convert_flux

sofia_redux.visualization.utils.unit_conversion.convert_flux(in_flux, start_unit, end_unit, wavelength, wave_unit)[source]

Convert flux data to new units.

The wavelength array is required to convert from some flux units to others, via the astropy.units.spectral_density equivalency.

Parameters:
in_fluxarray-like

Input flux data to convert.

start_unitastropy.units.Unit or str

Starting unit for flux data, to convert from.

end_unitastropy.units.Unit or str

Desired unit for flux data, to convert to.

wavelengtharray-like

Wavelength data associated with the flux.

wave_unitastropy.units.Unit or str

Current wavelength unit.

Returns:
out_fluxarray-like

Converted flux array. The wavelength array is unchanged.

Raises:
ValueError

If the input and output units are incompatible.