mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Base spectrum class which provides manipulation and characterization functionality.
Definition at line 30 of file astroSpectrum.hpp.
#include <astro/astroSpectrum.hpp>
Public Member Functions | |
size_t | size () |
Get the current size of the spectrum. More... | |
realT & | operator[] (size_t i) |
Access a single point in the spectrum, specified by its vector index. More... | |
const realT | operator[] (size_t i) const |
Access a single point in the spectrum, specified by its vector index. More... | |
template<typename compSpectrumT > | |
baseSpectrum< realT > | operator* (const compSpectrumT &spec) |
Multiply two spectra together. More... | |
realT | mean () |
Calculate the mean value of the spectrum. More... | |
template<typename compSpectrumT > | |
realT | mean (const compSpectrumT &T) |
Calculate the mean value of the spectrum when mutiplied by another. More... | |
void | charTrans (realT &lambda0, realT &weff, realT &max, realT &fwhm, std::vector< realT > &lambda) |
Characterize the spectrum as a filter transmission curve. More... | |
template<class filterT > | |
void | charFlux (realT &flambda0, realT &fnu0, realT &fphot0, const realT &lambda_0, const std::vector< realT > &lambda, const filterT &trans) |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More... | |
void | charFlux (realT &flambda0, realT &fnu0, realT &fphot0, const realT &lambda_0, const std::vector< realT > &lambda, const std::vector< realT > &trans) |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More... | |
Public Attributes | |
std::vector< realT > | _spectrum |
Contains the spectrum after it is set. More... | |
|
inline |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve.
To obtain the flux (e.g. W/m^2) multiply these quantities by the effective width calculated using charTrans.
This implements Equations A11, A12, and A13 of Bessel 2012.
use unit conversions to make it work for everything.
check on integration method, should it be trap?
[out] | flambda0 | the flux of the star at \( \lambda_0 \) in W/m^3 |
[out] | fnu0 | the flux of the star at \( \lambda_0 \) in W/m^2/Hz |
[out] | fphot0 | the flux of the star at \( \lambda_0 \) in photons/sec/m^3 |
[in] | lambda_0 | the mean photon wavelength lambda_0 (from charTrans). |
[in] | lambda | the wavelength scale of this spectrum. |
[in] | trans | the filter transmission curve over which to characterize, on the same wavelength grid. |
Definition at line 197 of file astroSpectrum.hpp.
|
inline |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve.
To obtain the flux (e.g. W/m^2) multiply these quantities by the effective width calculated using charTrans.
This implements Equations A11, A12, and A13 of Bessel 2012.
use unit conversions to make it work for everything.
check on integration method, should it be trap?
[out] | flambda0 | the flux of the star at \( \lambda_0 \) in W/m^3 |
[out] | fnu0 | the flux of the star at \( \lambda_0 \) in W/m^2/Hz |
[out] | fphot0 | the flux of the star at \( \lambda_0 \) in photons/sec/m^3 |
[in] | lambda_0 | the mean photon wavelength lambda_0 (from charTrans). |
[in] | lambda | the wavelength scale of this spectrum. |
[in] | trans | the filter transmission curve over which to characterize, on the same wavelength grid. |
Definition at line 220 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum, mx::astro::constants::c(), and mx::astro::constants::h().
|
inline |
Characterize the spectrum as a filter transmission curve.
For a photonic transmission curve given by \( S(\lambda ) \) The mean photon wavelength is defined as
\[ \lambda_0 = \frac{1}{\Delta\lambda_{0}}\int \frac{S(\lambda )}{S_{max}} \lambda d\lambda \]
which Equation A14 of Bessel 2012.
where the effective width is defined by
\[ \Delta\lambda_{o} = \int \frac{S(\lambda )} { S_{max}} d\lambda \]
The full-width at half-maximum, FWHM, is the distance between the points at 50% of maximum \( S(\lambda) \).
[out] | lambda0 | the central wavelength of the filter |
[out] | weff | the effective width of the filter |
[out] | max | the maximum value of the transmission curve |
[out] | fwhm | the full-width at half-maximum of the filter profile |
[in] | lambda | the wavelength scale, should correspond to the spectrum. |
Definition at line 133 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Calculate the mean value of the spectrum.
Definition at line 83 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Calculate the mean value of the spectrum when mutiplied by another.
The result is normalized by the mean value of the input spectrum, equivalent to:
\[ \mu = \frac{\int T(\lambda)S(\lambda) d\lambda}{\int T(\lambda) d\lambda} \]
For instance, use this to get the mean value of a spectrum in a filter.
compSpectrumT | the vector-like type of the comparison spectrum. |
[in] | T | the spectrum to multiply by |
Definition at line 104 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Multiply two spectra together.
[in] | spec | the spectrum to multiply by |
Definition at line 66 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Access a single point in the spectrum, specified by its vector index.
[in] | i | the index of the spectral point |
Definition at line 47 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Access a single point in the spectrum, specified by its vector index.
[in] | i | the index of the spectral point |
Definition at line 56 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
|
inline |
Get the current size of the spectrum.
Definition at line 38 of file astroSpectrum.hpp.
References mx::astro::baseSpectrum< realT >::_spectrum.
std::vector<realT> mx::astro::baseSpectrum< realT >::_spectrum |
Contains the spectrum after it is set.
Definition at line 32 of file astroSpectrum.hpp.
Referenced by mx::astro::baseSpectrum< realT >::charFlux(), mx::astro::baseSpectrum< realT >::charTrans(), mx::astro::cahoyGrid< _units >::loadGrid(), mx::astro::baseSpectrum< realT >::mean(), mx::astro::baseSpectrum< realT >::operator*(), mx::astro::baseSpectrum< realT >::operator[](), and mx::astro::baseSpectrum< realT >::size().