  Aims: We generate theoretical ultraviolet and extreme-ultraviolet emission
line ratios for O IV and show their strong versatility as electron temperature
and density diagnostics for astrophysical plasmas. Methods: Recent fully
relativistic calculations of radiative rates and electron impact excitation
cross sections for O IV, supplemented with earlier data for A-values and proton
excitation rates, are used to derive theoretical O IV line intensity ratios for
a wide range of electron temperatures and densities. Results: Diagnostic line
ratios involving ultraviolet or extreme-ultraviolet transitions in O IV are
presented, that are applicable to a wide variety of astrophysical plasmas
ranging from low density gaseous nebulae to the densest solar and stellar
flares. Comparisons with observational data, where available, show good
agreement between theory and experiment, providing support for the accuracy of
the diagnostics. However, diagnostics are also presented involving lines that
are blended in existing astronomical spectra, in the hope this might encourage
further observational studies at higher spectral resolution.
