scopesim.optics.optical_element.OpticalElement#
- class scopesim.optics.optical_element.OpticalElement(yaml_dict=None, cmds=None, **kwargs)#
Bases:
objectContains all information to describe a section of an optical system.
There are 5 major section:
location,telescope,relay opticsinstrument,detector.An OpticalElement describes how a certain section of the optical train changes the incoming photon distribution by specifying a list of
Effectsalong with a set of local properties e.g. temperature, etc which are common to more than one Effect- Parameters:
yaml_dict (dict) – Description of optical section properties, effects, and meta-data
kwargs (dict) – Optical Element specific information which has no connection to the effects that are passed. Any global values, e.g. airmass (i.e. bang strings) are passed on to the individual effect which can extract the relevant bang_string from the UserCommands object held in self.cmds
- properties#
Contains any properties that is “global” to the optical element, e.g. instrument temperature, atmospheric pressure. Any OBS_DICT keywords are cleaned with from the
metadict during initialisation- Type:
- effects#
Contains the a list of dict descriptions of the effects that the optical element generates. Any OBS_DICT keywords are cleaned with from the
metadict during initialisation.- Type:
list of dicts
- __init__(yaml_dict=None, cmds=None, **kwargs)#
Methods
__init__([yaml_dict, cmds])add_effect(effect)Add effect to self if it's a valid
Effect.get_all(effect_class)Return a list of all effects in self that match effect_class.
get_from_meta(item)Return Effects of Effect meta properties.
get_z_order_effects(z_level[, z_max])Yield all effects in the given 100-range of z_level.
list_effects()Return formatted string representation as str.
report([filename, output, rst_title_chars])write_string(stream[, list_effects])Write formatted string representation to I/O stream.
Attributes
Return name or filename or placeholder.
masks_listproperties_strsurfaces_list- get_all(effect_class)#
Return a list of all effects in self that match effect_class.
- get_from_meta(item)#
Return Effects of Effect meta properties.
- Parameters:
item (str, int, Effect-Class) – Either the name, list index, or Class of an effect. It is possible to get meta entries from a named effect by using:
#<effect_name>.<meta-key>- Returns:
obj –
str, float : if #-string is used to get Effect.meta entries
Effect : if a unique Effect name is given
list : if an Effect-Class is given
- Return type:
Examples
- ::
from scopesim.effect import TERCurve opt_el = opt_elem.OpticalElement(detector_yaml_dict)
effect_list = opt_el[TERCurve] effect = opt_el[0] effect = opt_el[“detector_qe_curve”] meta_value = opt_el[“#detector_qe_curve.filename”]
- get_z_order_effects(z_level: int, z_max: int = None)#
Yield all effects in the given 100-range of z_level.
E.g.,
z_level=200will yield all effect with a z_order between 200 and 299. Optionally, the upper limit can be set manually with the optional argument z_max.- Parameters:
- Raises:
TypeError – Raised if either z_level or z_max is not of int type.
ValueError – Raised if z_max (if given) is less than z_level.
- Yields:
eff (Iterator of effects) – Iterator containing all effect objects in the given z_order range.