UserCommands¶
-
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
dictionaryMethods Summary
keys
(self)Return the keys in the UserCommands.cmds dictionary
update
(self, new_dict)Update multiple entries of a
UserCommands
dictionaryvalues
(self)Return the values in the UserCommands.cmds dictionary
writeto
(self[, filename])Write all the key-value commands to an ASCII file on disk
Methods Documentation
-
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)