gavo.base.spectral module

Spectral-related functions.

gavo.base.spectral.getFilterMap() Tuple[Dict[str, Tuple[float, float, float]], Dict[str, str]][source]

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: str, toUnit: str) Callable[[float], float][source]

Returns a function converting spectral values in fromUnit to toUnit.

gavo.base.spectral.getSpecExpr(fromUnit: str, toUnit: str) str[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.

gavo.base.spectral.toStdSpecUnit(fromUnit: str) Tuple[str, float][source]

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

Unconvertable units raise a UfuncError.