lightcurvelynx.astro_utils.unit_utils

Functions

bulk_convert_matrix(mat, in_units, out_units)

Bulk convert a numpy matrix from one set of units to another.

flam_to_fnu(flux_flam, wavelengths, *, wave_unit, ...)

Covert flux from f_lambda unit to f_nu unit.

fnu_to_flam(flux_fnu, wavelengths, *, wave_unit, ...)

Covert flux from f_nu unit to f_lambda unit

Module Contents

bulk_convert_matrix(mat, in_units, out_units)[source]

Bulk convert a numpy matrix from one set of units to another.

Parameters:
  • mat (numpy.ndarray) – The numpy matrix of values to convert.

  • in_units (astropy.units) – The current (input) units of the matrix.

  • out_units (astropy.units) – The desired (output) units of the matrix.

Returns:

output – The converted numpy matrix of values.

Return type:

numpy.ndarray

flam_to_fnu(flux_flam, wavelengths, *, wave_unit, flam_unit, fnu_unit)[source]

Covert flux from f_lambda unit to f_nu unit.

Parameters:
  • flux_flam (list or numpy.ndarray) – The flux values in flam units. This can be a single N-length array or an M x N matrix.

  • wavelengths (list or numpy.ndarray) – The wavelength values associated with the input flux values. This can be a single N-length array or an M x N matrix. If it is an N-length array, the same wavelength values are used for each flux_flam.

  • wave_unit (astropy.units.Unit) – The unit for the wavelength values.

  • flam_unit (astropy.units.Unit) – The unit for the input flux_flam values.

  • fnu_unit (astropy.units.Unit) – The unit for the output flux_fnu values.

Returns:

flux_fnu – The flux values in fnu units.

Return type:

list or np.array

fnu_to_flam(flux_fnu, wavelengths, *, wave_unit, flam_unit, fnu_unit)[source]

Covert flux from f_nu unit to f_lambda unit

Parameters:
  • flux_fnu (list or numpy.ndarray) – The flux values in fnu units. This can be a single N-length array or an M x N matrix.

  • wavelengths (list or numpy.ndarray) – The wavelength values associated with the input flux values. This can be a single N-length array or an M x N matrix. If it is an N-length array, the same wavelength values are used for each flux_fnu.

  • wave_unit (astropy.units.Unit) – The unit for the wavelength values.

  • flam_unit (astropy.units.Unit) – The unit for the output flux_flam values.

  • fnu_unit (astropy.units.Unit) – The unit for the input flux_fnu values.

Returns:

flux_flam – The flux values in flam units.

Return type:

list or np.array