Class Source

Inheritance Relationships

Derived Types

Class Documentation

class Source

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.

Subclassed by CalibrationSource, StellarSource

Public Functions

Source()
virtual ~Source()
virtual std::vector<double> get_interpolated_spectral_density(std::vector<double> wavelength)

Returns spectrum at given wavelength

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

Parameters

wavelength – wavelength vector

Returns

spectrum at given wavelength

void set_doppler_shift(double shift)

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

Parameters

shift – doppler shift in [m/s]

void set_integration_steps(int n)

Sets the number of sub steps of the integrator.

Parameters

n – number of sub-intervals

virtual std::vector<double> get_photon_flux(std::vector<double> wavelength)
inline virtual std::vector<double> get_wavelength()
inline bool is_list_like()
inline bool is_stellar_source()
inline std::string get_source_name()

Protected Functions

inline virtual double get_spectral_density(double wavelength)

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

See

Source::get_spectrum() will use this function to integrate over it to retrieve a spectrum for a given wavelength vector.

Parameters

wavelength – wavelength

Returns

spectral density

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

number of steps for the integrator

Integrates the

This is a simple integrator, which integrates the

Todo:

This integrator should be replaced with a more accurate one. For highly unresolved spectra this integrator might not be very precise.

See

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

See

{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
  • n – number of sub-intervals

  • a – lower limit for integration [micron]

  • b – upper limit for integration [micron]

Returns

integrated spectrum within [a, b]

Protected Attributes

bool list_like

whether the source is list-like or not

bool stellar_source

stellar source or not?

std::string name

name of the source

double shift

current doppler shift

double s_val = 1.0

Scaling factor used in Source::scale_spectral_density() for normalization of source spectral_density against Source::v_zp.

int integration_steps