Class Filter

Inheritance Relationships

Derived Types

Class Documentation

class Filter

Abstract base class representing a photometric filter.

This class defines the interface for a photometric filter – something that, given a spectrum, computes the photometric response of that spectrum in the filter. Derived classes must implement phot() according to however the filter’s own response is represented (e.g. tabulated, analytic).

Subclassed by phot::FilterIdeal, phot::FilterTabulated

Public Functions

inline explicit Filter(std::string name, bool photCount = false)

Construct a Filter.

Parameters:
  • name – Name of this filter, for output purposes

  • photCount – If true, this filter returns photon counts rather than F_lambda values; see phot() for details

Filter(const Filter&) = default
auto operator=(const Filter&) -> Filter& = default
Filter(Filter&&) = default
auto operator=(Filter&&) -> Filter& = default
virtual ~Filter() = default
inline auto name() const -> const std::string&

Get the name of this filter.

Returns:

The name of this filter

inline auto photCount() const -> bool

Get whether this filter returns photon counts.

Returns:

True if this filter returns photon counts rather than F_lambda values, false otherwise

virtual auto wlPivot() const -> double = 0

Get this filter’s pivot wavelength.

Used, e.g., to convert an F_lambda value returned by phot() into F_nu or a wavelength-dependent magnitude system via PhotConvert, since phot() itself collapses a filter’s response to a single number with no wavelength of its own.

Returns:

A single characteristic wavelength for this filter, in Angstrom

virtual auto wlSupport() const -> std::pair<double, double> = 0

Get the wavelength range over which this filter’s response is nonzero.

Used by FilterCollection::phot() to recognize a filter whose passband extends past the edge of a truncated wavelength grid (e.g. one chopped to an extinction curve’s own coverage), where the spectrum is unknown rather than zero.

Returns:

{minimum, maximum} wavelength, in Angstrom, outside of which this filter’s response is exactly zero; the minimum may be 0 and the maximum infinite, for a filter whose passband has no finite lower or upper end (e.g. a Q(*) ionization-threshold filter)

virtual auto phot(const std::vector<double> &wl, const std::vector<double> &spec) const -> double = 0

Compute the photometric response in this filter to a given spectrum.

Parameters:
  • wl – The wavelength grid, in Angstrom, on which spec is computed

  • spec – The spectrum to which to compute the photometric response

Returns:

The photometric response, in erg/s/cm^2/Angstrom if photCount() is false, or photons/s if photCount() is true

inline auto fluxVega() const -> double

Get this filter’s mean Vega flux.

Returns:

The filter-mean flux of Vega in this filter, in erg/s/cm^2/Angstrom, computing and caching it (via setFluxVega()) against the global Vega reference spectrum (see vegaSpectrum()) the first time it is needed; always 0 if photCount() is true, since a photon-count filter’s phot() value has no Flambda meaning, so the Vega spectrum is meaningless for it

Protected Functions

inline void setFluxVega() const

Set this filter’s mean Vega flux from the global Vega reference spectrum.

Computes fluxVega_ by evaluating this filter’s own phot() on the global Vega reference spectrum (see vegaSpectrum()), and stores the result – i.e. fluxVega_ becomes this filter’s own idea of “the flux of Vega,” on whatever basis (tabulated response, top-hat passband, etc.) phot() itself uses. Called automatically, at most once, by fluxVega() the first time it is needed; not normally called directly.

Protected Attributes

bool photCount_

True if this filter returns photon counts rather than F_lambda values

Protected Static Functions

static inline auto lnGrid(const std::vector<double> &wl) -> std::vector<double>

Element-wise natural logarithm of a wavelength grid.

Shared by every derived class that integrates its photometric response in ln(wavelength) rather than wavelength itself (FilterTabulated and FilterIdeal, as of this writing), so it lives here instead of being duplicated in each of them.

Parameters:

wl – Wavelength grid, in Angstrom

Returns:

ln(wl), element-wise