class handels spectrum simulation
More...
#include <matrixsimulator.h>
|
| MatrixSimulator () |
|
void | read_transformations (std::string path) |
|
cv::Mat | get_transformation_matrix (int order, double wavelength) |
|
void | set_wavelength (int N) |
|
void | set_wavelength (std::vector< double > wavelength) |
|
void | calc_sim_matrices () |
|
cv::Mat | transform_slit (cv::Mat &slit_image, cv::Mat &transformation_matrix, double weight) |
|
int | simulate_order (int order, cv::Mat &slit_image, cv::Mat &output_image, bool aberrations) |
|
void | simulate_spectrum () |
|
void | set_efficiencies (std::vector< Efficiency * > &efficiencies) |
|
void | add_efficiency (Efficiency *eff) |
|
void | add_source (Source *src) |
|
void | load_spectrograph_model (std::string path, int fiber_number) |
|
void | set_order_range (int min_order, int max_order) |
|
void | set_ccd (CCD *ccd) |
|
void | set_slit (Slit *slit) |
|
void | set_psfs (PSF *psfs) |
|
void | prepare_sources (std::vector< Source * > sources) |
|
void | save_to_file (std::string filename, bool downsample=true, bool bleed=true, bool overwrite=false) |
|
void | transformation_to_file (std::string filename) |
|
double | get_blaze () |
|
double | get_gpmm () |
|
|
cv::Mat | img |
|
std::map< int, std::vector< raw_transformation > > | raw_transformations |
|
std::vector< Efficiency * > | efficiencies |
|
std::vector< Source * > | sources |
|
std::map< int, std::vector< double > > | sim_wavelength |
|
std::map< int, std::vector< cv::Mat > > | sim_matrices |
|
std::map< int, std::vector< double > > | sim_efficiencies |
|
std::map< int, std::vector< double > > | sim_spectra |
|
std::map< int, tk::spline > | tr_p |
|
std::map< int, tk::spline > | tr_r |
|
std::map< int, tk::spline > | tr_q |
|
std::map< int, tk::spline > | tr_phi |
|
std::map< int, tk::spline > | tr_tx |
|
std::map< int, tk::spline > | tr_ty |
|
PSF * | psfs |
|
Slit * | slit |
|
std::vector< int > | orders |
|
spectrograph_information | spec_info |
|
class handels spectrum simulation
This class is the main class of Echelle++, it handels the transformation matrix generation and spectrum simulation.
MatrixSimulator::MatrixSimulator |
( |
| ) |
|
void MatrixSimulator::add_efficiency |
( |
Efficiency * |
eff | ) |
|
Adds an efficiency profile. This is used to add efficiency curves for various components of the spectrograph. You can add several profiles - they will all be multiplied for the final spectrum simulation, in order to account for the total efficiency of the spectreograph.
- Parameters
-
void MatrixSimulator::add_source |
( |
Source * |
src | ) |
|
Sets the 1D input spectrum source that shall be simulated. See class::Source for more details.
- Parameters
-
void MatrixSimulator::calc_sim_matrices |
( |
| ) |
|
Calculate transformation matrices for all wavelength that are used for the spectrum simulation.
void MatrixSimulator::calc_splines |
( |
| ) |
|
|
private |
Calculates spline interpolation across each order for each transformation parameters.
double MatrixSimulator::get_blaze |
( |
| ) |
|
double MatrixSimulator::get_gpmm |
( |
| ) |
|
cv::Mat MatrixSimulator::get_transformation_matrix |
( |
int |
order, |
|
|
double |
wavelength |
|
) |
| |
Returns 2x3 transformation matrix for given order and wavelength; For affine transformation the lower row of the transformation matrix is always 0,0,1. OpenCv requires therefore only a 2x3 transformation matrix for the affine warping. ToDo: raise error when order, wavelength combination is not in the model
- Parameters
-
order | echelle diffraction order |
wavelength | wavelength [micrometer] |
- Returns
- 2x3 transformation matrix
void MatrixSimulator::load_spectrograph_model |
( |
std::string |
path, |
|
|
int |
fiber_number |
|
) |
| |
Load spectrograph model from HDF file
- Parameters
-
path | path to HDF file containing spectrograph model |
fiber_number | fiber to select |
void MatrixSimulator::prepare_sources |
( |
std::vector< Source * > |
sources | ) |
|
void MatrixSimulator::read_transformations |
( |
std::string |
path | ) |
|
reads in spectrograph model from HDF file. Please check documentation of PyEchelle to get more information about the proper file format.
- Parameters
-
void MatrixSimulator::save_to_file |
( |
std::string |
filename, |
|
|
bool |
downsample = true , |
|
|
bool |
bleed = true , |
|
|
bool |
overwrite = false |
|
) |
| |
void MatrixSimulator::set_ccd |
( |
CCD * |
ccd | ) |
|
Sets the CCD that shall be used for the simulation. See CD for more details
- Parameters
-
ccd | CCD used for simulation |
void MatrixSimulator::set_efficiencies |
( |
std::vector< Efficiency * > & |
efficiencies | ) |
|
void MatrixSimulator::set_order_range |
( |
int |
min_order, |
|
|
int |
max_order |
|
) |
| |
sets order range for the simulation in case only subset of the order shall be simulated.
- Parameters
-
min_order | minimum echelle order |
max_order | maximum echelle order |
void MatrixSimulator::set_psfs |
( |
PSF * |
psfs | ) |
|
Sets Point spread function that shall be used for simulation. See PSF for more details
- Parameters
-
psfs | PSFs used for simulation. |
void MatrixSimulator::set_slit |
( |
Slit * |
slit | ) |
|
Sets the input slit that shall be used for the simulation. See slit for more details
- Parameters
-
slit | Input slit used for simulation |
void MatrixSimulator::set_wavelength |
( |
int |
N | ) |
|
Set wavelength steps per order
This sets the wavelength steps per order that are used for simulation. Usually the input spectrum will be integrated between the borders of each wavelength step. Make sure this number is sufficiently high. As a rule of thumb, take the number of pixels in dispersion direction, divide it by the average pixel sampling and multiply it by 5.
- Parameters
-
N | number of wavelength steps per order. |
void MatrixSimulator::set_wavelength |
( |
std::vector< double > |
wavelength | ) |
|
Set wavelength for simulation directly.
This sets the wavelength at which the spectrum is simulated directly. This can be useful when simulating emission lines from a emission lamp or for high finesse etalon or laser frequency comb spectra. In these cases - when the linewidths of the simulated spectrum is completely unresolved by the spectrograph - it is not necessary to integrate the input spectrum in fixed wavelength bins.
- Parameters
-
wavelength | wavelength array [micrometers] |
int MatrixSimulator::simulate_order |
( |
int |
order, |
|
|
cv::Mat & |
slit_image, |
|
|
cv::Mat & |
output_image, |
|
|
bool |
aberrations |
|
) |
| |
Simulates a single order.
- Parameters
-
order | echelle order |
slit_image | input illumination distribution |
output_image | destination image |
aberrations | true if PSF convolution shall be done |
- Returns
void MatrixSimulator::simulate_spectrum |
( |
| ) |
|
Simulate the entire spectrum.
cv::Mat MatrixSimulator::transform_slit |
( |
cv::Mat & |
slit_image, |
|
|
cv::Mat & |
transformation_matrix, |
|
|
double |
weight |
|
) |
| |
Transforms an input image with a certain transformation matrix and a global weight. The global weight will usually be the intensity of the input spectrum at this wavelength, multiplied by the efficiency of the spectrograph at that wavelength.
- Parameters
-
slit_image | input illumination distribution |
transformation_matrix | 2x3 affine transformation matrix |
weight | global weight |
- Returns
void MatrixSimulator::transformation_to_file |
( |
std::string |
filename | ) |
|
CCD* MatrixSimulator::ccd |
std::vector<Efficiency*> MatrixSimulator::efficiencies |
|
private |
cv::Mat MatrixSimulator::img |
|
private |
std::vector<int> MatrixSimulator::orders |
|
private |
PSF* MatrixSimulator::psfs |
|
private |
int MatrixSimulator::raw_n |
std::map<int, std::vector<double> > MatrixSimulator::sim_efficiencies |
|
private |
std::map<int, std::vector<cv::Mat> > MatrixSimulator::sim_matrices |
|
private |
std::map<int, std::vector<double> > MatrixSimulator::sim_spectra |
|
private |
std::map<int, std::vector<double> > MatrixSimulator::sim_wavelength |
|
private |
Slit* MatrixSimulator::slit |
|
private |
std::vector<Source*> MatrixSimulator::sources |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_p |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_phi |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_q |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_r |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_tx |
|
private |
std::map<int, tk::spline > MatrixSimulator::tr_ty |
|
private |
The documentation for this class was generated from the following files: