The Simulation Class¶
simulation.py
This is Simulation class designed to create various simulations for the DESI project. This code can be found as an eups product in the eups product directory (/n/des/desi/software/products/Simulation-trunk).
-
class
simulation.
Simulation
(inputDict)¶ Defines the Simulation class, which provides one of four different areas of simulations for the DESI instrument control software: Donut, Star GalSim, Star Simple, Sly Simpleand Spectrograph. The class needs a dictionary of inputs and from those creates a simulation.
Allowed inputs:
sim_type: star_galsim, star_simple, sky_simple, donut, and spectrograph, type of simulation to create
image_size: tuple of ints, size of image to be created in pixels. Note: a lot of the images using spectrograph and donut types have fixed sizes and should not use this parameter.
nObj: number of objects to simulate (donuts, stars, spectra)
roi_list: list of positions for stars to be placed in the star_galsim and star_simple simulations. These are automatically made to be isolated from other star locations on the image so they don’t overlap.
zernCoeffs: array of coefficients for the donut simulations
psf_flux: flux of stars in the galsim simulations
psf_size: size (in arcsec) of stars in the galsim simulations
psf_flux_deviation: amount of deviation between flux values chosen. The simulation chooses flux values between (psf_flux - psf_flux_deviation) and psf_flux + psf_flux_deviation).
galsim_pixel_scale: pixel scale (arcsec / pixel) for galsim
galsim_sky_level: sky level of CCDNoise used for galsim
flavor: type of exposure (light, dark) for the simple star simulation. Should be set as ‘light’ to simulate stars
spectrograph_channel: channel (r, b, or z) of spectrograph to use in the spectra simulations
spectrum_fraction: fraction of spectra to plot (1 / x) in the spectra simulations to reduce computation time (amount of dots in line). So a spectrum fraction of 10 plots every tenth spectrum
fixed_positions: whether or not stars in star_galsim or star_simple simulations are in fixed positions, then to be moved only by a small random amount for each exposure
fixed_random_seed: seed for fixed positions of stars if variable fixed_positions is set to True
fixed_positions_deviation: parameters for how much fixed positions of stars should vary for the guiding exposure loop
-
defaults
= {'fixed_positions': False, 'fixed_positions_deviation': 4, 'fixed_random_seed': 6673476, 'flavor': 'light', 'galsim_pixel_scale': 0.127, 'galsim_sky_level': 25000.0, 'image_size': None, 'nObj': 20, 'offset_x': 0, 'offset_y': 0, 'psf_flux': 1000000.0, 'psf_flux_deviation': 500000.0, 'psf_size': 1, 'roi_list': [], 'sim_type': None, 'spectrograph_channel': 'r', 'spectrum_fraction': 1, 'zernCoeffs': [0.0, 0.0, 0.0, 10.0, 0.3, 0.4, 0.2, 0.1, -0.3, 0.05, 0.5]}¶ defaults for the input dictionary
-
update
(updateParams)¶ Update simulation parameters
Keyword Arguments: updateParams – values which overwrite the current parameters
-
revert_to_defaults
()¶ Returns simulation parameters to original defaults
-
get_current_params
()¶ Returns: current simulation parameter dictionary
-
get_available_simulations
()¶ Returns: available simulation type
-
create_simulation
(newParams={})¶ Creates a simulation based on the current parameters of the simulation object while also taking an optional argument of parameters to update just for the simulation. The new parameters are not updated permanently.
There are four different simulation types: donut, star_galsim, star_simple, sky_simple, and spectrograph. Each simulation can be modifed through a variety of parameters stored in the class.
Keyword Arguments: newParams – dictionary of parameters to input for this simulation only Returns: a simulation image depending on the parameters given Return type: numpy array
-
-
class
simulation.
Simulation
(inputDict) Defines the Simulation class, which provides one of four different areas of simulations for the DESI instrument control software: Donut, Star GalSim, Star Simple, Sly Simpleand Spectrograph. The class needs a dictionary of inputs and from those creates a simulation.
Allowed inputs:
sim_type: star_galsim, star_simple, sky_simple, donut, and spectrograph, type of simulation to create
image_size: tuple of ints, size of image to be created in pixels. Note: a lot of the images using spectrograph and donut types have fixed sizes and should not use this parameter.
nObj: number of objects to simulate (donuts, stars, spectra)
roi_list: list of positions for stars to be placed in the star_galsim and star_simple simulations. These are automatically made to be isolated from other star locations on the image so they don’t overlap.
zernCoeffs: array of coefficients for the donut simulations
psf_flux: flux of stars in the galsim simulations
psf_size: size (in arcsec) of stars in the galsim simulations
psf_flux_deviation: amount of deviation between flux values chosen. The simulation chooses flux values between (psf_flux - psf_flux_deviation) and psf_flux + psf_flux_deviation).
galsim_pixel_scale: pixel scale (arcsec / pixel) for galsim
galsim_sky_level: sky level of CCDNoise used for galsim
flavor: type of exposure (light, dark) for the simple star simulation. Should be set as ‘light’ to simulate stars
spectrograph_channel: channel (r, b, or z) of spectrograph to use in the spectra simulations
spectrum_fraction: fraction of spectra to plot (1 / x) in the spectra simulations to reduce computation time (amount of dots in line). So a spectrum fraction of 10 plots every tenth spectrum
fixed_positions: whether or not stars in star_galsim or star_simple simulations are in fixed positions, then to be moved only by a small random amount for each exposure
fixed_random_seed: seed for fixed positions of stars if variable fixed_positions is set to True
fixed_positions_deviation: parameters for how much fixed positions of stars should vary for the guiding exposure loop
-
defaults
= {'fixed_positions': False, 'fixed_positions_deviation': 4, 'fixed_random_seed': 6673476, 'flavor': 'light', 'galsim_pixel_scale': 0.127, 'galsim_sky_level': 25000.0, 'image_size': None, 'nObj': 20, 'offset_x': 0, 'offset_y': 0, 'psf_flux': 1000000.0, 'psf_flux_deviation': 500000.0, 'psf_size': 1, 'roi_list': [], 'sim_type': None, 'spectrograph_channel': 'r', 'spectrum_fraction': 1, 'zernCoeffs': [0.0, 0.0, 0.0, 10.0, 0.3, 0.4, 0.2, 0.1, -0.3, 0.05, 0.5]} defaults for the input dictionary
-
update
(updateParams) Update simulation parameters
Keyword Arguments: updateParams – values which overwrite the current parameters
-
revert_to_defaults
() Returns simulation parameters to original defaults
-
get_current_params
() Returns: current simulation parameter dictionary
-
get_available_simulations
() Returns: available simulation type
-
create_simulation
(newParams={}) Creates a simulation based on the current parameters of the simulation object while also taking an optional argument of parameters to update just for the simulation. The new parameters are not updated permanently.
There are four different simulation types: donut, star_galsim, star_simple, sky_simple, and spectrograph. Each simulation can be modifed through a variety of parameters stored in the class.
Keyword Arguments: newParams – dictionary of parameters to input for this simulation only Returns: a simulation image depending on the parameters given Return type: numpy array
-