mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::astro::cahoyGrid< _units > Struct Template Reference

template<typename _units>
struct mx::astro::cahoyGrid< _units >

A class to manage interpolation in separation and phase on the albedo spectrum grid from Cahoy et al (2010) [2].

Usage:

std::vector<double> lambda;
math::vectorScale(lambda, 100000, 4e-12, 600e-9); //Construct the wavelength scale
cahoyGrid<units::si<double>> grid;
grid.loadGrid(3, lambda); //Open the grid for 3x metallicity, pre-interpolating on the wavelength scale.
grid.setParameters({1.0, 0.1}); //Set the separation to 1.0 AU, and the phase angle to 0.1 radians.
grid.setSpectrum(lambda); //Perform the interpolation. Note that lambda is only used for a size check here.
void vectorScale(vectorT &vec, size_t N=0, typename vectorT::value_type scale=0, typename vectorT::value_type offset=0)
Fill in a vector with a regularly spaced scale.
Definition: vectorUtils.hpp:62

After the above steps you now have the Ag spectrum at 1.0 AU and 0.1 radians phase on the lambda scale.

Definition at line 121 of file cahoyAlbedos.hpp.

#include <astro/cahoyAlbedos.hpp>

+ Inheritance diagram for mx::astro::cahoyGrid< _units >:

Public Member Functions

int loadGrid (int metal, std::vector< realT > &lambda)
 Load the grid into memory for one of the metallicities and pre-interpolate onto the wavelength scale. More...
 
int setParameters (const paramsT &params)
 Set the separatio and phase of the spectrum. More...
 
int setSpectrum (std::vector< realT > &lambda)
 Get an interpolated spectrum at arbitrary non-grid point using bilinear interpolation. More...
 
- Public Member Functions inherited from mx::astro::baseSpectrum< _units::realT >
size_t size ()
 Get the current size of the spectrum. More...
 
_units::realT & operator[] (size_t i)
 Access a single point in the spectrum, specified by its vector index. More...
 
const _units::realT operator[] (size_t i) const
 Access a single point in the spectrum, specified by its vector index. More...
 
baseSpectrum< _units::realT > operator* (const compSpectrumT &spec)
 Multiply two spectra together. More...
 
_units::realT mean ()
 Calculate the mean value of the spectrum. More...
 
_units::realT mean (const compSpectrumT &T)
 Calculate the mean value of the spectrum when mutiplied by another. More...
 
void charTrans (_units::realT &lambda0, _units::realT &weff, _units::realT &max, _units::realT &fwhm, std::vector< _units::realT > &lambda)
 Characterize the spectrum as a filter transmission curve. More...
 
void charFlux (_units::realT &flambda0, _units::realT &fnu0, _units::realT &fphot0, const _units::realT &lambda_0, const std::vector< _units::realT > &lambda, const filterT &trans)
 Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More...
 
void charFlux (_units::realT &flambda0, _units::realT &fnu0, _units::realT &fphot0, const _units::realT &lambda_0, const std::vector< _units::realT > &lambda, const std::vector< _units::realT > &trans)
 Characterize the flux densities of the spectrum w.r.t. a filter transmission curve. More...
 

Additional Inherited Members

- Public Attributes inherited from mx::astro::baseSpectrum< _units::realT >
std::vector< _units::realT > _spectrum
 Contains the spectrum after it is set. More...
 

Member Function Documentation

◆ loadGrid()

template<typename _units >
int mx::astro::cahoyGrid< _units >::loadGrid ( int  metal,
std::vector< realT > &  lambda 
)
inline

Load the grid into memory for one of the metallicities and pre-interpolate onto the wavelength scale.

Parameters
[in]metalthe metalicity, can be 1, 3, 10 or 30.
[in]lambdathe wavelength scale.

Definition at line 141 of file cahoyAlbedos.hpp.

References mx::astro::baseSpectrum< _units::realT >::_spectrum, mx::astro::baseSpectrum< realT >::_spectrum, mx::astro::astroSpectrum< _spectrumT, freq >::setParameters(), and mx::astro::astroSpectrum< _spectrumT, freq >::setSpectrum().

◆ setParameters()

template<typename _units >
int mx::astro::cahoyGrid< _units >::setParameters ( const paramsT &  params)
inline

Set the separatio and phase of the spectrum.

Parameters
[in]paramsStruct containting the separation and phase of the spectrum

Definition at line 176 of file cahoyAlbedos.hpp.

◆ setSpectrum()

template<typename _units >
int mx::astro::cahoyGrid< _units >::setSpectrum ( std::vector< realT > &  lambda)
inline

Get an interpolated spectrum at arbitrary non-grid point using bilinear interpolation.

If outside the endpoints of the grid, the grid is simply extended (i.e. constant albedo).

Parameters
[in]lambdathe wavelength grid. Must be the same as used for construction and/or openGrid

Definition at line 186 of file cahoyAlbedos.hpp.

References mx::astro::baseSpectrum< _units::realT >::_spectrum.


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