Class MatrixSimulator

Class Documentation

class MatrixSimulator

class for simulating spectra

Public Functions

MatrixSimulator(const std::string path, int fiber_number, bool keep_ccd)

Load spectrograph model from HDF file

Parameters
  • path – path to HDF file containing spectrograph model

  • fiber_number – fiber to select

  • keep_ccd – if true it assumes that a CCD has already been added to the spectrograph model. It keeps it and adds the new simulations to it. This can be used to simplify the simulation of multiple fibers.

void set_wavelength(int N)

Set wavelength grid on which the input spectrum will be interpolated.

Parameters

N – number of wavelength per order

void set_wavelength(std::vector<double> wavelength)

Set wavelength grid on which the input spectrum will be evaluated on

Parameters

wavelength – wavelength vector. Values given in microns.

void add_efficiency(Efficiency *eff)

Adds an efficiency profile to the simulator.

Parameters

eff

void set_telescope(Telescope *telescope)

Sets telescope of the spectrograph.

Parameters

telescope

void set_source(Source *src)

Sets the spectral source of the current simulation.

Parameters

src

void save_to_hdf(const std::string filename, bool bleed = true, bool overwrite = false)

Save simulated spectrum to an HDF file.

Parameters
  • filename – filename

  • bleed – bleed overexposed pixel TODO: not implemented yet

  • overwrite – True to overwrite existing file TODO: not working yet

void save_to_fits(const std::string filename, bool bleed = true, bool overwrite = false)

Save simulated spectrum to a FITS file

Parameters
  • filename – filename

  • bleed – bleed overexposed pixel TODO: not implemented yet

  • overwrite – set true to overwrite existing file

void save_1d_to_fits(const std::string filename)

Save 1d spectra in fits file. This function saves the 1 dimensional spectrum which was used for the simulation in the fits file. It is therefore a perfectly reduced spectrum.

Parameters

filename – path to the fits file

double get_alpha()

Returns blaze angle in degrees

Returns

blaze angle

double get_gpmm()

Returns grove lines per mm

Returns

grove lines per mm

int get_fiber_number()

Returns fiber number of current simulation.

Returns

current fiber number

void simulate(double t, unsigned long seed)

Simulate spectrum.

Parameters
  • t – integration time

  • seed – random seed. If 0, will be generated by std::random_device

Returns

double get_minimum_wavelength()

Returns the minimum wavelength supported by the spectrograph [microns]

Returns

minimum wavelength [microns]

double get_maximum_wavelength()

Returns the maximum wavelength supported by the spectrograph [microns]

Returns

maximum wavelength [microns]

void add_background(double bias, double noise, unsigned long seed)

Adds readout noise and bias to the frame. Make sure, you only call this function once, when the keep_ccd flag is set.

Parameters
  • bias – bias level count

  • noise – standard deviation for noise

  • seed – optional: random seed