cphot 0.1
A C++ tool for computing photometry from spectra.
cphot::Filter Class Reference

Unit Aware Filter. input spectra and output values have units to avoid mis-interpretation. More...

#include <filter.hpp>

Public Member Functions

 Filter (const DMatrix &wavelength, const DMatrix &transmission, const QLength &wavelength_unit, const std::string dtype, const std::string name)
 Construct a new Filter:: Filter object. More...
 
void info ()
 Display some information on cout. More...
 
std::string get_name ()
 
double get_norm ()
 the norm of the passband More...
 
QLength get_leff ()
 Effective wavelength. More...
 
QLength get_lphot ()
 Photon distribution based effective wavelength. More...
 
QLength get_fwhm ()
 the difference between the two wavelengths for which filter transmission is half maximum. More...
 
QLength get_width ()
 Effective width. More...
 
QLength get_lmax ()
 the last λ value with a transmission at least 1% of maximum transmission More...
 
QLength get_lmin ()
 the first λ value with a transmission at least 1% of maximum transmission More...
 
QLength get_lpivot ()
 Pivot wavelength in nm. More...
 
QLength get_cl ()
 Central wavelength. More...
 
double get_AB_zero_mag ()
 AB magnitude zero point. More...
 
QSpectralFluxDensity get_AB_zero_flux ()
 AB flux zero point. More...
 
QSpectralFluxDensity get_AB_zero_Jy ()
 AB flux zero point in Jansky (Jy) More...
 
double get_ST_zero_mag ()
 ST magnitude zero point. More...
 
QSpectralFluxDensity get_ST_zero_flux ()
 ST flux zero point. More...
 
QSpectralFluxDensity get_ST_zero_Jy ()
 ST flux zero point in Jansky (Jy) More...
 
double get_Vega_zero_mag ()
 Vega magnitude zero point. More...
 
QSpectralFluxDensity get_Vega_zero_flux ()
 Vega flux zero point. More...
 
QSpectralFluxDensity get_Vega_zero_Jy ()
 Vega flux zero point in Jansky (Jy) More...
 
DMatrix get_wavelength ()
 Get the wavelength in nm. More...
 
DMatrix get_wavelength (const QLength &in)
 Get the wavelength in requested units. More...
 
DMatrix get_transmission ()
 Get the transmission. More...
 
bool is_photon_type ()
 Check the type of the detector. More...
 
QSpectralFluxDensity get_flux (const DMatrix &wavelength, const DMatrix &flux, const QLength &wavelength_unit, const QSpectralFluxDensity &flux_unit)
 Integrate the flux within the filter and return the integrated energy/flux. More...
 
Filter reinterp (const DMatrix &new_wavelength_nm)
 New filter interpolated to match a wavelegnth definition. More...
 
Filter reinterp (const DMatrix &new_wavelength, const QLength &new_wavelength_unit)
 New filter interpolated to match a wavelegnth definition. More...
 

Detailed Description

Unit Aware Filter. input spectra and output values have units to avoid mis-interpretation.

Define a filter by its name, wavelength and transmission The type of detector (energy or photon counter) can be specified for adapting calculations. (default: photon)

Definition at line 43 of file filter.hpp.

Constructor & Destructor Documentation

◆ Filter()

cphot::Filter::Filter ( const DMatrix wavelength,
const DMatrix transmission,
const QLength &  wavelength_unit,
const std::string  dtype,
const std::string  name 
)

Construct a new Filter:: Filter object.

Parameters
wavelengthwavelength definition
transmissiontransmission on the wavelength
wavelength_unitunits of the wavelength definition
dtype"photon" or "energy"
namename of the passband
Exceptions
std::runtime_errorif detector type is invalid

Definition at line 138 of file filter.hpp.

Member Function Documentation

◆ get_AB_zero_flux()

QSpectralFluxDensity cphot::Filter::get_AB_zero_flux ( )

AB flux zero point.

Calculated as

\[ flux_{AB} = 10^{-0.4 * (mag_{AB})} \]

Returns
AB flux zero point

Definition at line 281 of file filter.hpp.

◆ get_AB_zero_Jy()

QSpectralFluxDensity cphot::Filter::get_AB_zero_Jy ( )

AB flux zero point in Jansky (Jy)

Calculated as

\[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{AB} \]

where \(c\) is speed of light in m/s, and \(\lambda_{pivot}\) is the pivot wavelength in angstrom, and \(flux_{AB}\) is the AB flux in flam.

Returns
AB flux zero point in Jansky (Jy)

Definition at line 295 of file filter.hpp.

◆ get_AB_zero_mag()

double cphot::Filter::get_AB_zero_mag ( )

AB magnitude zero point.

\[ mag_{AB} = -2.5 * log10(f_nu) - 48.60 = -2.5 \log_{10}(f_\lambda) - 2.5 * \log_{10}(\lambda_{pivot}^2 / c) - 48.60 \]

Returns
AB magnitude zero point

Definition at line 266 of file filter.hpp.

◆ get_cl()

QLength cphot::Filter::get_cl ( )

Central wavelength.

\[ \lambda_{cl} = \frac{\int \lambda T(\lambda) d\lambda}{\int T(\lambda) d\lambda}\]

Returns
central wavelength in nm

Definition at line 504 of file filter.hpp.

◆ get_flux()

QSpectralFluxDensity cphot::Filter::get_flux ( const DMatrix wavelength,
const DMatrix flux,
const QLength &  wavelength_unit,
const QSpectralFluxDensity &  flux_unit 
)

Integrate the flux within the filter and return the integrated energy/flux.

The filter is first interpolated on the spectrum wavelength definition. The flux is then calculated as the integral of the flux within the filter depending on the detector type as:

  • for photon detectors:

    \[ f_\lambda = \frac{\int \lambda T(\lambda) f_\lambda d\lambda}{\int \lambda T(\lambda) d\lambda} \]

  • for energy detectors:

    \[ f_\lambda = \frac{\int T(\lambda) f_\lambda d\lambda}{\int T(\lambda) d\lambda} \]

Parameters
wavelengthwavelength array
fluxflux array
wavelength_unitwavelength unit
flux_unitflux unit
Returns
integrated flux through the filter

Definition at line 402 of file filter.hpp.

◆ get_fwhm()

QLength cphot::Filter::get_fwhm ( )

the difference between the two wavelengths for which filter transmission is half maximum.

..note:: This calculation is not exact but rounded to the nearest passband data points

Returns
fwhm in nm

Definition at line 561 of file filter.hpp.

◆ get_leff()

QLength cphot::Filter::get_leff ( )

Effective wavelength.

\[ \lambda_{eff} = \frac{\int \lambda T(\lambda) Vega(\lambda) d\lambda)}{\int T(\lambda) Vega(\lambda) d\lambda)} \]

Returns
Effective wavelenth

Definition at line 580 of file filter.hpp.

◆ get_lmax()

QLength cphot::Filter::get_lmax ( )

the last λ value with a transmission at least 1% of maximum transmission

Returns
max wavelength in nm

Definition at line 531 of file filter.hpp.

◆ get_lmin()

QLength cphot::Filter::get_lmin ( )

the first λ value with a transmission at least 1% of maximum transmission

Returns
min wavelength in nm

Definition at line 524 of file filter.hpp.

◆ get_lphot()

QLength cphot::Filter::get_lphot ( )

Photon distribution based effective wavelength.

Defined as

\[ \lambda_{phot} = \frac{\int\lambda^2 T(\lambda) Vega(\lambda) d\lambda }{\int\lambda T(\lambda) Vega(\lambda) d\lambda} \]

Returns
QLength

Definition at line 571 of file filter.hpp.

◆ get_lpivot()

QLength cphot::Filter::get_lpivot ( )

Pivot wavelength in nm.

if photon detector:

\[ \lambda_p^2 = \frac{\int \lambda T(\lambda) d\lambda}{\int T(\lambda) d\lambda / \lambda} \]

if energy:

\[ \lambda_p^2 = \frac{\int T(\lambda) d\lambda}{\int T(\lambda) d\lambda / \lambda^2} \]

Returns
pivot wavelength in nm

Definition at line 517 of file filter.hpp.

◆ get_name()

std::string cphot::Filter::get_name ( )
inline

Definition at line 89 of file filter.hpp.

◆ get_norm()

double cphot::Filter::get_norm ( )

the norm of the passband

\[ norm = \int T(\lambda) d\lambda \]

Returns
norm

Definition at line 540 of file filter.hpp.

◆ get_ST_zero_flux()

QSpectralFluxDensity cphot::Filter::get_ST_zero_flux ( )

ST flux zero point.

Calculated as

\[ flux_{ST} = 10^{-0.4 * (mag_{ST})} \]

Returns
ST flux in flam

Definition at line 320 of file filter.hpp.

◆ get_ST_zero_Jy()

QSpectralFluxDensity cphot::Filter::get_ST_zero_Jy ( )

ST flux zero point in Jansky (Jy)

Calculated as

\[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{ST} \]

where \(c\) is speed of light in m/s, and \(\lambda_{pivot}\) is the pivot wavelength in angstrom, and \(flux_{ST}\) is the ST flux in flam.

Returns
ST flux in Jy

Definition at line 334 of file filter.hpp.

◆ get_ST_zero_mag()

double cphot::Filter::get_ST_zero_mag ( )

ST magnitude zero point.

Set by definition to 21.1 mag

Returns
ST magnitude zero point

Definition at line 308 of file filter.hpp.

◆ get_transmission()

DMatrix cphot::Filter::get_transmission ( )

Get the transmission.

Returns
Transmission (unitless)

Definition at line 606 of file filter.hpp.

◆ get_Vega_zero_flux()

QSpectralFluxDensity cphot::Filter::get_Vega_zero_flux ( )

Vega flux zero point.

Returns
flux of Vega in flam (erg/s/cm^2/Angstrom)

Definition at line 354 of file filter.hpp.

◆ get_Vega_zero_Jy()

QSpectralFluxDensity cphot::Filter::get_Vega_zero_Jy ( )

Vega flux zero point in Jansky (Jy)

Calculated as

\[ flux_{Jy} = \frac{10^5}{10^{-8} c } \lambda_{pivot}^2 flux_{Vega} \]

where \(c\) is speed of light in m/s, and \(\lambda_{pivot}\) is the pivot wavelength in angstrom, and \(flux_{Vega}\) is the Vega flux in flam.

Returns
flux of Vega in Jy

Definition at line 373 of file filter.hpp.

◆ get_Vega_zero_mag()

double cphot::Filter::get_Vega_zero_mag ( )

Vega magnitude zero point.

Returns
Vega magnitude zero point

Definition at line 345 of file filter.hpp.

◆ get_wavelength() [1/2]

DMatrix cphot::Filter::get_wavelength ( )

Get the wavelength in nm.

Returns
wavelegnth in nm

Definition at line 587 of file filter.hpp.

◆ get_wavelength() [2/2]

DMatrix cphot::Filter::get_wavelength ( const QLength &  in)

Get the wavelength in requested units.

Parameters
inunits to convert to
Returns
wavelegnth in requested units

Definition at line 597 of file filter.hpp.

◆ get_width()

QLength cphot::Filter::get_width ( )

Effective width.

\[ width = \frac{\int T(\lambda) d\lambda}{\max(T(\lambda))} \]

Returns
width in nm

Definition at line 549 of file filter.hpp.

◆ info()

void cphot::Filter::info ( )

Display some information on cout.

Definition at line 467 of file filter.hpp.

◆ is_photon_type()

bool cphot::Filter::is_photon_type ( )

Check the type of the detector.

Returns
true photon
false energy

Definition at line 616 of file filter.hpp.

◆ reinterp() [1/2]

Filter cphot::Filter::reinterp ( const DMatrix new_wavelength,
const QLength &  new_wavelength_unit 
)

New filter interpolated to match a wavelegnth definition.

Parameters
new_wavelengthwavelength definition
new_wavelength_unitwavelength unit
Returns
new filter interpolated to match the new wavelength definition

Definition at line 456 of file filter.hpp.

◆ reinterp() [2/2]

Filter cphot::Filter::reinterp ( const DMatrix new_wavelength_nm)

New filter interpolated to match a wavelegnth definition.

Parameters
new_wavelength_nmwavelength definition in nm
Returns
new filter interpolated to match the new wavelength definition

Definition at line 442 of file filter.hpp.


The documentation for this class was generated from the following file: