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
2 #include "matrixsimulator.h"
4 int main(int argc, char *argv[])
6 MatrixSimulator simulator; //create instance of simulator
8 simulator.load_spectrograph_model(argv[1], 1); //read in ZEMAX simulated transformation matrices
9 simulator.set_wavelength(10000); // set wavelength steps per order
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
14 IdealEtalon cs = IdealEtalon(10., 1., 0., 0.9); // spectral source ideal etalon
15 simulator.add_source(&cs); //add source to simulator
17 simulator.simulate_spectrum(); //simulate echelle spectra
19 simulator.save_to_file("../image2.hdf", true, true, true); //save echelle spectrum to file
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.