astrocook.core.units module#

The units of the flux (phase 6-quater, PR 8-bis, agreed with Guido, 12 November 2026).

A loader gives the flux a physical unit only when it reads one (BUNIT, TUNIT or a known descriptor of the format); otherwise the flux is in ARBITRARY_FLUX, the unit arb_flux of Astrocook. It is a unit of its own, not dimensionless: a dimensionless flux is a normalized one, and an arbitrary flux cannot be converted to a physical unit (y_convert refuses it; set_properties declares the unit, calibrate_from_magnitudes calibrates the flux).

arb_flux is enabled in astropy when this module is imported (by core/structures.py), so astropy.units.Unit('arb_flux') gives it. It is not a unit of the FITS standard: the archives write it in TUNITn by hand (astropy would drop it with a warning) and read it back with known_unit(); other FITS readers show the string.

astrocook.core.units.ARBITRARY_FLUX = Unit("arb_flux")#

The unit of a flux whose physical unit is not known

astrocook.core.units.FLAM = Unit("erg / (Angstrom s cm2)")#

f_lambda in the unit that the calibration gives

astrocook.core.units.FLUX_AUX_COLUMNS = ('cont', 'model', 'cont_pl')#

the unit cannot tell them, since a flux without a unit and a quality flag are both dimensionless

Type:

The auxiliary columns in the unit of the flux, by name (F69, F130)

astrocook.core.units.is_arbitrary_flux(unit) → bool[source]#

Whether unit is the arbitrary flux of Astrocook.

astrocook.core.units.has_no_unit(unit) → bool[source]#

Whether unit is missing or dimensionless.

astrocook.core.units.known_unit(unit)[source]#

unit, with an unrecognized unit (as astropy reads arb_flux from a FITS header) replaced by the enabled unit of that name, if any.

astrocook.core.units.parse_flux_unit(text) → UnitBase | None[source]#

The unit of the flux written in a header (BUNIT, TUNITn), or None if there is none, it cannot be read, or it is dimensionless.

Read as a FITS unit first, then as an astropy one (arb_flux, erg/(s cm2 Angstrom)).

astrocook.core.units.is_flux_density_per_wavelength(unit) → bool[source]#

Whether unit is a flux density per unit wavelength (f_lambda).