gavo.base.spectral module

Spectral-related functions.


returns a pair for filter_def, aliases mapping.

This parses from the built-in data/filters.txt; filter_def maps filter names to tuples of lower, central, long wavelength in metres. (we may add further fields later, so it’s safer to [:3] these results).

Aliases just maps common filter names to our canontical names for these filters.

gavo.base.spectral.getSpecConverter(fromUnit, toUnit)[source]

Returns a function converting spectral values in fromUnit to toUnit.

gavo.base.spectral.getSpecExpr(fromUnit, toUnit)[source]

returns an expression that turns a value in fromUnit to one in toUnit.

The value in fromUnit is represented by a {} so you can just .format the expression it is in into the resulting string.


returns a pair of (standard unit, factor) to turn fromUnit into one of J, Hz, or m.

Unconvertable units raise a UfuncError.