simcado.commands module¶
-
class
simcado.commands.
UserCommands
(filename=None, sim_data_dir=None)[source]¶ Bases:
object
An extended dictionary with the parameters needed for running a simulation
A
UserCommands
object contains a dictionary which holds all the keywords from thedefault.config
file. It also has attributes which represent the frequently used variables, i.e.pix_res
,lam_bin_edges
,exptime
, etc<UserCommands>.cmds
is a dictionary that holds all the variables the user may wish to change. It also has some set variables like<UserCommands>.pix_res
that can be accessed directly, instead of from the dictionary.UserCommands
is imported directly into the simcado package and is accessable from the main package -simcado.UserCommands
If UserCommands is called without any arguments, the default values for MICADO and the E-ELT are used.
- Parameters
- filenamestr, optional
path to the user’s .config file
Examples
By default
UserCommands
contains the parameters needed to generate the MICADO optical train:>>> import simcado >>> my_cmds = simcado.UserCommands()
To list the keywords that are available:
>>> my_cmds.keys() ...
The
UserCommands
object also contains smaller dictionaries for each category of keywords - e.g. for the keywords describing the instrument:>>> my_cmds.inst ...
- Attributes
- Internal dictionaries
- cmdsdict (collections.OrderedDict)
the dictionary which holds all the keyword-value pairs needed for running a simualtion
- obsdict (collections.OrderedDict)
parameters about the observation
- simdict (collections.OrderedDict)
parameters about the simualtion
- atmodict (collections.OrderedDict)
parameters about the atmosphere
- scopedict (collections.OrderedDict)
parameters about the telescope
- instdict (collections.OrderedDict)
parameters about the instrument
- fpadict (collections.OrderedDict)
parameters about the detector array (FPA - Focal Plane Array)
- hxrgdict (collections.OrderedDict)
parameters about the chip noise (HxRG - HAWAII 4RG chip series)
- Attributes pertaining to the purely spectral data sets (e.g. transmission
- curves, stellar spectra, etc)
- lamnp.ndarray
a vector containing the centres of the wavelength bins used when resampling the spectra or transmission curves
- lam_resfloat
[um] the resolution of the
lam
- Attributes pertaining to the binning in spectral space for which different
- PSFs need to be used
- lam_psf_resfloat
[um] the spectal “distance” between layers - i.e. width of the bins
- lam_bin_edgesarray-like
[um] the edge of the spectral bin for each layer
- lam_bin_centersarray-like
[um] the centres of the spectral bin for each layer
- Attributes pertaining to the binning in the spatial plane
- pix_resfloat
[arcsec] the internal (oversampled) spatial resolution of the simulation
- fpa_resfloat
[arcsec] the field of view of the individual pixels on the detector
- General attributes
- verbosebool
Flag for printing intermediate results to the screen (default=True)
- exptimefloat
[s] exposure time of a single DIT
- diameterfloat
[m] outer diamter of the primary aperture (i.e. M1)
- areafloat
[m^2] effective area of the primary aperture (i.e. M1)
- filterstr
[BVRIzYJHKKs,user] filter used for the observation
Methods
update(new_dict)
updates the current
UserCommands
object from another dict-like objectkeys()
returns the keys in the
UserCommands.cmds
dictionaryvalues()
returns the values in the
UserCommands.cmds
dictionary-
update
(self, new_dict)[source]¶ Update multiple entries of a
UserCommands
dictionaryupdate(new_dict)
takes either a normal pythondict
object or aUserCommands
object. Only keywords that match those in theUserCommands
object will be updated. Misspelled keywords raise an error.To update single items in the dictionary, it is recommended to simply call the key and update the value - i.e
<UserCommands>[key] = value
.- Parameters
- new_dictdict,
UserCommands
- new_dictdict,
- Raises
- KeyError
If a parameter is not found in
self.cmds
.
See also
Examples
View the default commands
>>> import simcado >>> my_cmds = simcado.UserCommands() >>> print(my_cmds.cmds)
Change a single command
>>> my_cmds["OBS_DIT"] = 60
Change a series of commands at once
>>> new_cmds = {"OBS_DIT" : 60 , "OBS_NDIT" : 10} >>> my_cmds.update(new_cmds)
-
simcado.commands.
dump_defaults
(filename=None, selection='freq')[source]¶ Dump the frequent.config file to a path specified by the user
- Parameters
- filenamestr, optional
path or filename where the .config file is to be saved
- selectionstr, optional
[“freq”, “all”] amount of keywords to save. “freq” only prints the most frequently used keywords. “all” prints all of them
-
simcado.commands.
dump_chip_layout
(path=None)[source]¶ Dump the FPA_chip_layout.dat file to a path specified by the user
- Parameters
- pathstr, optional
path where the chip layout file is to be saved
-
simcado.commands.
dump_mirror_config
(path=None, what='scope')[source]¶ Dump the EC_mirrors_scope.tbl or the EC_mirrors_ao.tbl to disk
- Parameters
- pathstr, optional
path where the mirror configuration file is to be saved
- whatstr, optional
[“scope”, “ao”] dump the mirror configuration for either the telescope or the AO module
-
simcado.commands.
read_config
(config_file)[source]¶ Read in a SimCADO configuration file
- The configuration file is in SExtractor format:
‘PARAMETER Value # Comment’
- Parameters
- config_filestr
the filename of the .config file
- Returns
- config_dictdict (collections.OrderedDict)
A dictionary with keys ‘PARAMETER’ and values ‘Value’.
Notes
The values of the dictionary are strings and will have to be converted to the appropriate data type as they are needed.
-
simcado.commands.
update_config
(config_file, config_dict)[source]¶ Update a SimCADO configuration dictionary
A configuration file in the SExtractor format:
'PARAMETER Value # Comment'
an existing configuration dictionary.
- Parameters
- config_filestr
the filename of the .config file
- Returns
- config_dictdict
A dictionary with keys ‘PARAMETER’ and values ‘Value’.
Notes
the values of the dictionary are strings and will have to be converted to the appropriate data type as they are needed.