Base class of all spectral sources. More...

#include <source.h>

Inheritance diagram for Source:
Blackbody Constant IdealEtalon LineList PhoenixSpectrum

Public Member Functions

 Source ()
 
virtual ~Source ()
 
virtual std::vector< double > get_spectral_density (std::vector< double > wavelength)
 
virtual double get_spectral_density (double wavelength)
 
virtual std::vector< double > get_spectrum (std::vector< double > wavelength)
 
void set_doppler_shift (double shift)
 
void set_integration_steps (int n)
 

Private Member Functions

double integral_s (double a, double b, int n)
 

Private Attributes

double shift
 current doppler shift More...
 
int integration_steps
 number of steps for the integrator More...
 

Detailed Description

Base class of all spectral sources.

This class is the base class of all spectral sources. Its purpose is to provide a common interface for all sources. For implementing a new spectral source, inherit from this class and implement the Source::get_spectral_density function.

Constructor & Destructor Documentation

Source::Source ( )
Source::~Source ( )
virtual

Member Function Documentation

std::vector< double > Source::get_spectral_density ( std::vector< double >  wavelength)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns the spectral density of the Source at the given wavelength vector.

Parameters
wavelengthwavelength vector
Returns
spectral density at given wavelength
double Source::get_spectral_density ( double  wavelength)
virtual

This function returns the spectral density at a given wavelength. It is the essential function for all subclasses.

See also
Source::get_spectrum() will use this function to integrate over it to retreive a spectrum for a given wavelength vector.
Parameters
wavelengthwavelength
Returns
spectral density

Reimplemented in LineList, PhoenixSpectrum, Blackbody, IdealEtalon, and Constant.

std::vector< double > Source::get_spectrum ( std::vector< double >  wavelength)
virtual

Returns spectrum at given wavelength

This function returns the integrated spectral density for a given wavelength vector.

Parameters
wavelengthwavelength vector
Returns
spectrum at given wavelength

Reimplemented in LineList.

double Source::integral_s ( double  a,
double  b,
int  n 
)
private

Integrates the

See also
{Source::spectral_density()} function between limits a and b.

This is a simple integrator, which integrates the

See also
{Source::spectral_density} function between a and b. It uses a simple aproximation by deviding the interval [a,b] in n parts and sum

\[ I = \int_{a}^{b}(s(\lambda) d\lambda \approx \sum_{i=0}^{n} s(a + (i+0.5)frac{b-a}{n}) * \frac{(b-a)}{n} \]

Parameters
alower wavelength limit
bupper wavelength limit
nnumber of subintervalls
Returns
integrated spectrum within [a, b]
Todo:
This integrator should be replaved with a more accurate one. For highly unresolved spectra this integrator might not be very precise.
void Source::set_doppler_shift ( double  shift)

Applies a spectral shift on the spectrum to simulate radial velocity shifts.

Parameters
shiftdoppler shift in [m/s]
void Source::set_integration_steps ( int  n)

Sets the number of sub steps of the integrator.

Parameters
nnumber of subintervalls

Member Data Documentation

int Source::integration_steps
private

number of steps for the integrator

double Source::shift
private

current doppler shift


The documentation for this class was generated from the following files:
  • /home/stuermer/Repos/cpp/EchelleSimulator/include/source.h
  • /home/stuermer/Repos/cpp/EchelleSimulator/src/source.cpp