scopesim.optics.optical_element.OpticalElement#

class scopesim.optics.optical_element.OpticalElement(yaml_dict=None, cmds=None, **kwargs)#

Bases: object

Contains all information to describe a section of an optical system.

There are 5 major section: location, telescope, relay optics instrument, detector.

An OpticalElement describes how a certain section of the optical train changes the incoming photon distribution by specifying a list of Effects along 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

meta#

Contains meta data from the yaml, and is updated with the OBS_DICT key-value pairs

Type:

dict

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 meta dict during initialisation

Type:

dict

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 meta dict 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()

pretty_str()

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

display_name

Return name or filename or placeholder.

masks_list

properties_str

surfaces_list

add_effect(effect: Effect) None#

Add effect to self if it’s a valid Effect.

property display_name: str#

Return name or filename or placeholder.

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:

str, float, Effect, list

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=200 will 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:
  • z_level (int) – 100-range of z_orders.

  • z_max (int, optional) – Optional upper bound. This is currently not used anywhere in ScopeSim, but the functionality is tested. If None (default), this will be set to z_level + 99.

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.

pretty_str() str#

Return formatted string representation as str.

write_string(stream: TextIO, list_effects: bool = True) None#

Write formatted string representation to I/O stream.