Usage

Spectrograph Model

Please check PyEchelle's documentation on how to generate a spectrograph model from a ZEMAX file or simply browse the data folder and select one of the provided models.

## Example

1 #include <iostream>
2 #include "matrixsimulator.h"
3 
4 int main(int argc, char *argv[])
5 {
6 MatrixSimulator simulator; //create instance of simulator
7 
8 simulator.load_spectrograph_model(argv[1], 1); //read in ZEMAX simulated transformation matrices
9 simulator.set_wavelength(10000); // set wavelength steps per order
10 
11 GratingEfficiency ge = GratingEfficiency(0.8, 76., 76., 31.6); //Echelle Grating efficiency
12 simulator.add_efficiency(&ge); //add efficiency profile to simulator. More profiles can be added
13 
14 IdealEtalon cs = IdealEtalon(10., 1., 0., 0.9); // spectral source ideal etalon
15 simulator.add_source(&cs); //add source to simulator
16 
17 simulator.simulate_spectrum(); //simulate echelle spectra
18 
19 simulator.save_to_file("../image2.hdf", true, true, true); //save echelle spectrum to file
20 
21 return 0;
22 }

generates a 2D Fabry-Perot etalon spectrum.

On a mordern PC this should take <3s.

Let's go through the code and add some more explanation:

1 MatrixSimulator simulator();
2 simulator.load_spectrograph(argv[1],1]);

These lines create an instance of the simulator class and load the spectrograph model from a file - the filename here is passed via argv. The second argument (1) selects fiber number 1 from the file for selecting the first fiber of the spectrograph model. In the case of MaroonX, there are 5 fibers in the file, that we could choose from.

1 simulator.set_wavelength(10000);

This sets the number of wavelength steps per order that it used for the simulation.