scopesim.effects.metis_wcu.metis_wcu.WCUSource#

class scopesim.effects.metis_wcu.metis_wcu.WCUSource(**kwargs)#

Bases: TERCurve

Warm Calibration Unit Source.

This class returns a TERCurve that describes the output emission from the integrating sphere of the METIS WCU. The calculations include - black-body emission from the black-body source - coupling into the integrating sphere - integrating sphere magnification factor - thermal emission from the integrating sphere

Configuration file#

The default configuration file for the METIS WCU is provided in the irdb. To modify the configuration, copy the file <irdb>/METIS/metis_wcu_config.yaml to the working directory and edit it there. To use the file do e.g.

>>> cmds = sim.UserCommands(use_instrument="METIS", set_modes=["wcu_img_lm"])
>>> cmds["!WCU.config_file"] = "my_wcu_config.yaml"
>>> metis = sim.OpticalTrain(cmds)

Changing important parameters#

The temperatures of the black-body source, the integrating sphere as well as the ambient temperature of the WCU (which is the temperature of the focal-plane mask) can be set by calling

>>> metis["wcu_source"].set_temperature(bb_temp=1200*u.K, is_temp=320*u.K,
                                        wcu_temp=295*u.K)

The flux-controlling masks are currently implemented as a float (in [0, 1]) that gives the fraction of flux transmitted. It can be changed with

>>> metis["wcu_source"].set_bb_aperture(0.8)

The focal-plane mask and/or its orientation and position can be changed by calling

>>> metis["wcu_source"].set_fpmask("pinhole", angle=10, shift=(0.1, 0))

To use the lasers instead of the black-body source, do

>>> metis["wcu_source"].set_lamp("laser")

Which laser is seen depends on the wavelength of the observation. Note that the tunable laser currently cannot be tuned.

Added in version 0.9.2.

__init__(**kwargs)#

Methods

__init__(**kwargs)

apply_to(obj, **kwargs)

Apply the effect to the corresponding object.

bb_to_is_throughput()

Load throughput and return interpolation function.

compute_fp_emission()

Compute emission spectrum from opaque part of focal-plane mask.

compute_lamp_emission()

Compute the emission at the exit of the integrating sphere.

get_from_meta(item)

get_wavelength()

Try to set the appropriate wavelength vector for mode and filter.

info()

Print basic information on the effect, notably the description.

is_multiplication(wavelength[, nport])

Intensity multiplication factor for the integrating sphere.

plot([which, wavelength, axes])

Plot TER curves.

report([filename, output, rst_title_chars])

For Effect objects, generates a report based on the data and meta-data.

set_bb_aperture(value)

Change the flux-controlling aperture for the black-body source.

set_fpmask([maskname, angle, shift])

Change the focal-plane mask.

set_lamp([lamp])

Change the WCU lamp.

set_temperature([bb_temp, is_temp, wcu_temp])

Change the black-body temperature.

Attributes

background_source

Define a source field for the FP mask.

current_fpmask

Return name of the mask currently in use.

current_lamp

Return name of the lamp currently in use.

data

display_name

emission

include

lamps

Return list of available lamps.

mask_emission

meta_string

report_plot_include

report_table_include

required_keys

table

throughput

z_order

apply_to(obj, **kwargs)#

Apply the effect to the corresponding object.

property background_source#

Define a source field for the FP mask.

bb_to_is_throughput()#

Load throughput and return interpolation function.

This loads a lookup table for the transmission from the black-body source to the entrance port of the integrating sphere. It returns an interpolation function that can be evaluated on a reflectivity for the tube.

The model used is the general model, currently with no gaps.

compute_fp_emission()#

Compute emission spectrum from opaque part of focal-plane mask.

compute_lamp_emission()#

Compute the emission at the exit of the integrating sphere.

property current_fpmask#

Return name of the mask currently in use.

property current_lamp#

Return name of the lamp currently in use.

get_wavelength()#

Try to set the appropriate wavelength vector for mode and filter.

info() None#

Print basic information on the effect, notably the description.

is_multiplication(wavelength, nport=2)#

Intensity multiplication factor for the integrating sphere.

Parameters:
  • wavelength (nd.array, float) – Wavelengths [mm] on which to compute the factor.

  • nport (int) – Number of ports that contribute to “missing” reflective area on the inside of the integrating sphere. Typical values for the METIS WCU are 2 or 4, depending on whether the extra ports are counted. Value 0 can be used for testing purposes.

property lamps#

Return list of available lamps.

plot(which='x', wavelength=None, *, axes=None, **kwargs)#

Plot TER curves.

Parameters:
  • which ({"x", "t", "e", "r"}, optional) – “x” plots throughput. “t”,”e”,”r” plot trans/emission/refl. Can be a combination, e.g. “tr” or “tex” to plot each.

  • wavelength (array_like, optional) – Wavelength on x-axis, taken from currsys if None (default).

  • axes (matplotlib axes, optional) – If given, plot into existing axes. The default is None.

Returns:

fig – Figure containing plots.

Return type:

matplotlib figure

report(filename=None, output='rst', rst_title_chars='*+', **kwargs)#

For Effect objects, generates a report based on the data and meta-data.

This is to aid in the automation of the documentation process of the instrument packages in the IRDB.

Note

If the Effect can generate a plot, this will be saved to disc

Parameters:
  • filename (str, optional) – Where to save the RST file

  • output (str, optional) – [“rst”, “latex”] Output file format

  • rst_title_chars (2-str, optional) – Two unique characters used to denote rst subsection headings. Options: = - ` : ‘ “ ~ ^ _ * + # < >

  • parameters (Additional)

  • ---------------------

  • **kwargs (Either from the self.meta["report"] dictionary or via)

  • "report_table_include" (False)

  • "report_table_caption"

  • "report_plot_caption"

  • "report_plot_include" (False)

  • "report_plot_file_formats" (["png"]) – Multiple formats can be saved. The last entry is used for the RST.

  • "report_plot_filename" (None) – If None, uses self.meta[“name”] as the filename

  • "file_description" (str) – Taken from the header of a file, if available

  • "class_description" (str) – Taken from the docstring of the subclass

  • "changes_str" (list of str) – Take from the header of a file, if available

Returns:

rst_str – The full reStructureText string

Return type:

str

Notes

The format of the RST output is as follows:

<ClassType>: <effect name>
**************************
File Description: <description for file meta data>
Class Description: <description from class docstring>
Changes: <list of changes from file meta data>

Data
++++
.. figure:: <Figure_name>.png
    If the <Effect> object contains a ``.plot()`` function, add
    plot and write it to disc
Figure caption

Table caption
Table
    If the <Effect> object contains a ``.table()`` function, add
    a pprint version of the table

Meta-data
+++++++++
::
    A code block print out of the ``.meta`` dictionary
set_bb_aperture(value: float) None#

Change the flux-controlling aperture for the black-body source.

Currently, this accepts a float value between 0 and 1 that gives the fraction of black-body emission that exits the integrating sphere compared to the fully open case.

set_fpmask(maskname: str | None = None, angle: float | None = None, shift: tuple[float, float] | None = None) None#

Change the focal-plane mask.

If maskname is not given, the currently inserted mask is rotated to angle and shifted to shift. If maskname is given, angle and shift are reset to zero, unless explicitely specified.

See also FPMask.

Parameters:
  • maskname (str, Path) – Name of the mask, as a filepath or to be resolved in irdb

  • angle (float [deg]) – Angle by which mask is rotated

  • shift (tuple (float, float) [arcsec]) – Shift of mask in x and y direction

set_lamp(lamp='bb')#

Change the WCU lamp.

The list of available lamps can be obtained with

>>> metis["wcu_source"].lamps

The lamp currently in use is

>>> metis["wcu_source"].current_lamp

It is changed with, e.g.,

>>> metis["wcu_source"].set_lamp("laser")
set_temperature(bb_temp: float | Quantity | None = None, is_temp: float | Quantity | None = None, wcu_temp: float | Quantity | None = None) None#

Change the black-body temperature.

Parameters:
  • bb_temp (float, Quantity) – new temperatures for the BB source, the integrating sphere and the ambient WCU, arespectively. If float, the unit is assumed to be Kelvin.

  • wcu_temp (float, Quantity) – new temperatures for the BB source, the integrating sphere and the ambient WCU, arespectively. If float, the unit is assumed to be Kelvin.

  • is_temp (float, Quantity) – new temperatures for the BB source, the integrating sphere and the ambient WCU, arespectively. If float, the unit is assumed to be Kelvin.