Template Function phot::PhotConvert(double, double)

Function Documentation

template<PhotSystem From, PhotSystem To>
constexpr auto phot::PhotConvert(double photIn, double wl) -> double

Convert a flux, specific luminosity, or magnitude from one photometric system to another.

Only declared here, not defined: only specific (from, to) pairs are given a definition, via explicit specialization, below. Neither From nor To may be PhotSystem::Vega for this overload – see the three-argument PhotConvert(photIn, wl, fluxVega) overload below for any (from, to) pair involving Vega, since Vega’s zero point is filter-dependent (a given filter’s own fluxVega(), see Filter::fluxVega()) rather than a fixed constant like flux0AB/flux0ST.

Every specialization converting to or from one of the magnitude systems (ST, AB) treats its Flambda/Fnu-side value as a specific luminosity, not a flux already observed at some real distance: it first divides by fourPiTenPcSq to convert to the flux that would be seen at the standard distance of 10 pc, before applying the magnitude system’s own zero point – see fourPiTenPcSq’s own comment. The direct Flambda <-> Fnu conversion, by contrast, is purely a change of independent variable (wavelength to frequency) and never touches fourPiTenPcSq at all, so it applies identically whether photIn is a genuine flux or a specific luminosity.

Declared constexpr here, but not every specialization below actually is: only the Flambda <-> Fnu pair, which needs nothing but arithmetic, can be. Every specialization touching a magnitude system needs std::log10 or std::pow, neither of which is a constexpr function until C++26 – see PhotConvert<Fnu, AB>’s own comment.

Template Parameters:
  • From – The PhotSystem photIn is expressed in

  • To – The PhotSystem to convert photIn to

Parameters:
  • photIn – The input value – named generically, rather than fluxIn, because it need not be a flux at all: in erg/s/cm^2/Angstrom (if From is Flambda) or erg/s/cm^2/Hz (if From is Fnu) if it genuinely is a flux, but just as often a specific luminosity in erg/s/Angstrom or erg/s/Hz respectively (e.g. FilterCollection::phot()’s own results, which carry no particular distance), or a magnitude (if From is ST or AB)

  • wl – The wavelength at which photIn is evaluated, in Angstrom; unused (present only for a uniform signature across every specialization) by any specialization whose from/to pair doesn’t itself depend on wavelength

Returns:

photIn converted to To, in erg/s/[cm^2/]Hz (if To is Fnu), erg/s/[cm^2/]Angstrom (if To is Flambda), or a magnitude (if To is ST or AB)