|
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 298 of file astroSpectrum.hpp.
#include <astro/astroSpectrum.hpp>
Public Member Functions | |
| astroSpectrum () | |
| Default c'tor. | |
| astroSpectrum (const paramsT ¶ms) | |
| Constructor specifying name, the enivronment will be queried for data directory. | |
| astroSpectrum (const paramsT ¶ms, const std::string &dataDir) | |
| Constructor specifying name and data directory. | |
| int | setParameters (const paramsT ¶ms) |
| Set the parameters of the spectrum, using the underlying spectrums parameter type. | |
| int | setParameters (const paramsT ¶ms, const std::string &dataDir) |
| Set the parameters of the spectrum, using the underlying spectrum's parameter type. | |
| template<typename gridT> | |
| error_t | setSpectrum (gridT &lambda) |
| Load the spectrum and interpolate it onto a wavelength scale. | |
| Public Member Functions inherited from mx::astro::baseSpectrum< _spectrumT::units::realT > | |
| size_t | size () |
| Get the current size of the spectrum. | |
| realT & | operator[] (size_t i) |
| Access a single point in the spectrum, specified by its vector index. | |
| baseSpectrum< realT > | operator* (const compSpectrumT &spec) |
| Multiply two spectra together. | |
| realT | mean () |
| Calculate the mean value of the spectrum. | |
| void | charTrans (realT &lambda0, realT &weff, realT &max, realT &fwhm, std::vector< realT > &lambda) |
| Characterize the spectrum as a filter transmission curve. | |
| 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. | |
Public Attributes | |
| std::string | _dataDir |
| The directory containing the spectrum. | |
| paramsT | _params |
| Public Attributes inherited from mx::astro::baseSpectrum< _spectrumT::units::realT > | |
| std::vector< realT > | _spectrum |
| Contains the spectrum after it is set. | |
|
inline |
Default c'tor.
Definition at line 311 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 316 of file astroSpectrum.hpp.
References 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 322 of file astroSpectrum.hpp.
References setParameters().
|
inline |
Set the parameters of the spectrum, using the underlying spectrums parameter type.
| [in] | params | The name of the spectrum |
Definition at line 330 of file astroSpectrum.hpp.
References _dataDir, _params, and mx::sys::getEnv().
Referenced by astroSpectrum(), 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 347 of file astroSpectrum.hpp.
|
inline |
Load the spectrum and interpolate it onto a wavelength scale.
| [in] | lambda | the wavelength scale on which to interpolate. Same units as in source file. |
Definition at line 359 of file astroSpectrum.hpp.
References _dataDir, _params, mx::astro::baseSpectrum< _spectrumT::units::realT >::_spectrum, mx::math::gsl_interpolate(), mx::internal::mxlib_error_report(), mx::noerror, and mx::paramnotset.
Referenced by mx::astro::cahoyGrid< _units >::loadGrid().
| std::string mx::astro::astroSpectrum< _spectrumT, freq, verboseT >::_dataDir |
The directory containing the spectrum.
Definition at line 305 of file astroSpectrum.hpp.
Referenced by setParameters(), setParameters(), and setSpectrum().
| paramsT mx::astro::astroSpectrum< _spectrumT, freq, verboseT >::_params |
The parameters of the spectrum, e.g. its name or the numerical parameters needed to generate the name.
Definition at line 307 of file astroSpectrum.hpp.
Referenced by setParameters(), setParameters(), and setSpectrum().