mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Class to manage an astronomical spectrum.
Details of the spectra, including units, file-location, and how they are read from disk, are specified by template parameter _spectrumT: see the available spectrum definitions. Spectra are loaded and immediately interpolated onto a wavelength grid. This is to facilitate manipulation of spectra, i.e. for multiplying by filters, etc.
Inherits functions and operators to manipulate and characterize spectra from baseSpectrum.
_spectrumT | is the underlying spectrum type, which provides (through static interfaces) the specifications of how to read or calculate the spectrum. |
freq | specify whether this spectrum uses frequency instead of wavelength. Default is false. |
Definition at line 279 of file astroSpectrum.hpp.
#include <astro/astroSpectrum.hpp>
Public Member Functions | |
astroSpectrum () | |
Default c'tor. More... | |
astroSpectrum (const paramsT ¶ms) | |
Constructor specifying name, the enivronment will be queried for data directory. More... | |
astroSpectrum (const paramsT ¶ms, const std::string &dataDir) | |
Constructor specifying name and data directory. More... | |
int | setParameters (const paramsT ¶ms) |
Set the parameters of the spectrum, using the underlying spectrums parameter type. More... | |
int | setParameters (const paramsT ¶ms, const std::string &dataDir) |
Set the parameters of the spectrum, using the underlying spectrum's parameter type. More... | |
template<typename gridT > | |
int | setSpectrum (gridT &lambda) |
Load the spectrum and interpolate it onto a wavelength scale. More... | |
Public Member Functions inherited from mx::astro::baseSpectrum< _spectrumT::units::realT > | |
size_t | size () |
Get the current size of the spectrum. More... | |
_spectrumT::units::realT & | operator[] (size_t i) |
Access a single point in the spectrum, specified by its vector index. More... | |
const _spectrumT::units::realT | operator[] (size_t i) const |
Access a single point in the spectrum, specified by its vector index. More... | |
baseSpectrum< _spectrumT::units::realT > | operator* (const compSpectrumT &spec) |
Multiply two spectra together. More... | |
_spectrumT::units::realT | mean () |
Calculate the mean value of the spectrum. More... | |
_spectrumT::units::realT | mean (const compSpectrumT &T) |
Calculate the mean value of the spectrum when mutiplied by another. More... | |
void | charTrans (_spectrumT::units::realT &lambda0, _spectrumT::units::realT &weff, _spectrumT::units::realT &max, _spectrumT::units::realT &fwhm, std::vector< _spectrumT::units::realT > &lambda) |
Characterize the spectrum as a filter transmission curve. More... | |
void | charFlux (_spectrumT::units::realT &flambda0, _spectrumT::units::realT &fnu0, _spectrumT::units::realT &fphot0, const _spectrumT::units::realT &lambda_0, const std::vector< _spectrumT::units::realT > &lambda, const filterT &trans) |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More... | |
void | charFlux (_spectrumT::units::realT &flambda0, _spectrumT::units::realT &fnu0, _spectrumT::units::realT &fphot0, const _spectrumT::units::realT &lambda_0, const std::vector< _spectrumT::units::realT > &lambda, const std::vector< _spectrumT::units::realT > &trans) |
Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More... | |
Public Attributes | |
std::string | _dataDir |
The directory containing the spectrum. More... | |
paramsT | _params |
The parameters of the spectrum, e.g. its name or the numerical parameters needed to generate the name. More... | |
Public Attributes inherited from mx::astro::baseSpectrum< _spectrumT::units::realT > | |
std::vector< _spectrumT::units::realT > | _spectrum |
Contains the spectrum after it is set. More... | |
|
inline |
Default c'tor.
Definition at line 291 of file astroSpectrum.hpp.
|
inlineexplicit |
Constructor specifying name, the enivronment will be queried for data directory.
[in] | params | The name of the spectrum |
Definition at line 294 of file astroSpectrum.hpp.
References mx::astro::astroSpectrum< _spectrumT, freq >::setParameters().
|
inline |
Constructor specifying name and data directory.
[in] | params | The name of the spectrum |
[in] | dataDir | The directory containing the spectrum |
Definition at line 300 of file astroSpectrum.hpp.
References mx::astro::astroSpectrum< _spectrumT, freq >::setParameters().
|
inline |
Set the parameters of the spectrum, using the underlying spectrums parameter type.
[in] | params | The name of the spectrum |
Definition at line 308 of file astroSpectrum.hpp.
References mx::astro::astroSpectrum< _spectrumT, freq >::_dataDir, mx::astro::astroSpectrum< _spectrumT, freq >::_params, and mx::sys::getEnv().
Referenced by mx::astro::astroSpectrum< _spectrumT, freq >::astroSpectrum(), and mx::astro::cahoyGrid< _units >::loadGrid().
|
inline |
Set the parameters of the spectrum, using the underlying spectrum's parameter type.
This version also sets the data directory, instead of using the enivronment variable.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[in] | params | The name of the spectrum |
[in] | dataDir | The directory containing the spectrum |
Definition at line 325 of file astroSpectrum.hpp.
References mx::astro::astroSpectrum< _spectrumT, freq >::_dataDir, and mx::astro::astroSpectrum< _spectrumT, freq >::_params.
|
inline |
Load the spectrum and interpolate it onto a wavelength scale.
Definition at line 337 of file astroSpectrum.hpp.
References mx::astro::astroSpectrum< _spectrumT, freq >::_dataDir, mx::astro::astroSpectrum< _spectrumT, freq >::_params, mx::astro::baseSpectrum< _spectrumT::units::realT >::_spectrum, and mx::math::gsl_interpolate().
Referenced by mx::astro::cahoyGrid< _units >::loadGrid().
std::string mx::astro::astroSpectrum< _spectrumT, freq >::_dataDir |
The directory containing the spectrum.
Definition at line 286 of file astroSpectrum.hpp.
Referenced by mx::astro::astroSpectrum< _spectrumT, freq >::setParameters(), and mx::astro::astroSpectrum< _spectrumT, freq >::setSpectrum().
paramsT mx::astro::astroSpectrum< _spectrumT, freq >::_params |
The parameters of the spectrum, e.g. its name or the numerical parameters needed to generate the name.
Definition at line 288 of file astroSpectrum.hpp.
Referenced by mx::astro::astroSpectrum< _spectrumT, freq >::setParameters(), and mx::astro::astroSpectrum< _spectrumT, freq >::setSpectrum().