Telescope#

class Telescope(surface=None, optics=None, meta={})[source]#

Bases: object

Telescope: collecting area, mirror thermal emission and Airy PSF.

Parameters:
  • surface (float or None, optional) – Collecting area in m^2. If None, it is computed from the "diameter_ext" and "diameter_int" entries of meta. Default is None.

  • optics (ThermalOptics or None, optional) – Thermal properties of the telescope mirrors. Default is None.

  • meta (dict, optional) – Telescope specifications (e.g. "diameter_ext" and "diameter_int" in m). Default is an empty dict.

Variables:

mutable_parameters (list of str) – Parameters that can be changed after initialization with update.

Warns:

UserWarning – If surface is None and the diameters are not given in meta.

Methods

from_config

Build a telescope from a configuration dictionary.

get_airy_radius

Get the Airy disk radius.

get_encircled_energy

Get the fraction of the PSF energy encircled within given radii.

get_encircled_energy_radius

Get the radius encircling a given fraction of the PSF energy.

get_nea_airy

Get the Noise Equivalent Area (NEA) of the Airy disk.

get_psfprofile

Get the diffraction-limited PSF image.

get_thermal_signal

Get the mirror thermal signal received by a spaxel.

show_psfprofile

Show the PSF image (log scale, axes in arcsec).

update

Update mutable parameters.

Attributes

diameter_ext

External diameter (assumed circular) in m.

diameter_int

Internal diameter (assumed circular) in m.

emissivity

Mirror emissivity (one value per mirror).

meta

Metadata dictionary containing the telescope specifications.

mutable_parameters

nelements

Number of mirrors sharing each temperature and emissivity.

optics

ThermalOptics describing the mirrors' thermal emission.

surface

Collecting area in m^2.

temperature

Mirror temperature(s) in K.

classmethod from_config(config)[source]#

Build a telescope from a configuration dictionary.

Parameters:

config (dict) – Configuration dictionary (e.g. the [telescope] section of a configuration file). It may contain "surface" [m^2], otherwise "diameter_ext" and "diameter_int" [m] are used, and must contain the thermal parameters required by from_config (at least "temperature" and "emissivity"). It is stored as meta.

Returns:

Telescope – The telescope instance.

get_airy_radius(lbda, norm_scale=1)[source]#

Get the Airy disk radius.

The radius of the first minimum of the Airy disk is 1.22 * lbda / diameter_ext (in radian).

Parameters:
  • lbda (float or array_like) – Wavelength(s) in Angstrom.

  • norm_scale (float, optional) – Scale by which the radius is divided (e.g. a pixel size in arcsec to get the radius in pixels). Default is 1.

Returns:

numpy.ndarray – Radius of the first minimum in arcsec (divided by norm_scale), one value per wavelength.

get_encircled_energy(lbda, radius, profile='airy', normal_scatter=None, size=2, **kwargs)[source]#

Get the fraction of the PSF energy encircled within given radii.

Parameters:
  • lbda (float) – Wavelength in Angstrom.

  • radius (float or array_like) – Radius or radii in arcsec.

  • profile (str, optional) – PSF profile to use (see get_psfprofile). Default is "airy".

  • normal_scatter (float or None, optional) – Sigma of an additional Gaussian scatter convolved with the PSF, in arcsec. Default is None.

  • size (float, optional) – Minimum size of the PSF image in arcsec; it is enlarged to include the largest radius if needed. Default is 2.

  • **kwargs – Additional arguments passed to get_psfprofile.

Returns:

numpy.ndarray – Encircled energy fraction, one value per radius.

get_encircled_energy_radius(lbda, ee, profile='airy', normal_scatter=None, max_radius=2, nbins=1000, **kwargs)[source]#

Get the radius encircling a given fraction of the PSF energy.

The encircled energy is computed on a grid of nbins radii between 0 and max_radius and the closest grid radius is returned.

Parameters:
  • lbda (float) – Wavelength in Angstrom.

  • ee (float or array_like) – Encircled energy fraction(s), between 0 and 1.

  • profile (str, optional) – PSF profile to use (see get_psfprofile). Default is "airy".

  • normal_scatter (float or None, optional) – Sigma of an additional Gaussian scatter convolved with the PSF, in arcsec. Default is None.

  • max_radius (float, optional) – Maximum radius of the search grid in arcsec. Default is 2.

  • nbins (int, optional) – Number of radii in the search grid. Default is 1000.

  • **kwargs – Additional arguments passed to get_encircled_energy.

Returns:

numpy.ndarray – Radius in arcsec, one value per ee.

get_nea_airy(lbda, norm_scale=1, padding=5, position=(0, 0), **kwargs)[source]#

Get the Noise Equivalent Area (NEA) of the Airy disk.

Parameters:
  • lbda (float or array_like) – Wavelength(s) in Angstrom.

  • norm_scale (float, optional) – Scale by which the Airy radius is divided (see get_airy_radius). Default is 1.

  • padding (float, optional) – Half-width of the evaluation grid, in units of the (mean) Airy radius. Default is 5.

  • position (tuple of float, optional) – Position of the PSF centroid. Default is (0, 0).

  • **kwargs – Additional arguments passed to get_2dpsf_nea.

Returns:

float or numpy.ndarray – Noise Equivalent Area of the Airy disk, in the squared units of the radius (arcsec^2 divided by norm_scale**2).

get_psfprofile(lbda, profile='airy', shape=(10, 10), normal_scatter=None, oversampling=10, **kwargs)[source]#

Get the diffraction-limited PSF image.

Internally, the PSF is computed in units of the smallest Airy radius (a “pixel”), each pixel being divided into oversampling sub-pixels.

Parameters:
  • lbda (float or array_like) – Wavelength(s) in Angstrom used to compute the Airy radius.

  • profile (str, optional) – PSF profile: "airy", or "gaussian" (aliases "gauss", "norm", "normal") with a sigma matching the Airy radius (see airyradius_to_gaussiansigma). Default is "airy".

  • shape (tuple of float or None, optional) – Size (height, width) of the PSF image in arcsec. If None, ten times the largest Airy radius is used. Default is (10, 10).

  • normal_scatter (float or None, optional) – Sigma of an additional Gaussian scatter convolved with the PSF, in arcsec. Default is None.

  • oversampling (int, optional) – Number of sub-pixels per pixel. Default is 10.

  • **kwargs – Additional arguments passed to get_profilepsf (e.g. position, norm_pixels).

Returns:

  • psf (numpy.ndarray) – PSF image (one image per wavelength if lbda is an array).

  • pixelarea (float) – Area of a PSF image (sub-)pixel, in pixel^2 units.

  • arcsec_to_pixels (float) – Conversion factor from arcsec to PSF image (sub-)pixels.

  • radius (numpy.ndarray) – Airy radius in arcsec, one value per wavelength.

get_thermal_signal(lbda_bin, solid_angle, as_sum=True)[source]#

Get the mirror thermal signal received by a spaxel.

Parameters:
  • lbda_bin (array_like) – Wavelength bin(s) in Angstrom, either 1D [lbda_min, lbda_max] or 2D [[lbda_min, lbda_max], [lbda_min, lbda_max], ...].

  • solid_angle (float) – Spaxel solid angle in steradian.

  • as_sum (bool, optional) – If True, return the sum of the contributions of all mirrors. Otherwise, return one entry per mirror. Default is True.

Returns:

float or numpy.ndarray – Thermal signal in ph/s/spaxel, integrated over each wavelength bin.

show_psfprofile(lbda, ax=None, profile='airy', oversampling=10, show_radius=False, shape=None, normal_scatter=None, **kwargs)[source]#

Show the PSF image (log scale, axes in arcsec).

Parameters:
  • lbda (float) – Wavelength in Angstrom.

  • ax (matplotlib.axes.Axes or None, optional) – Axes to plot on. If None, a new figure and axes are created. Default is None.

  • profile (str, optional) – PSF profile to use (see get_psfprofile). Default is "airy".

  • oversampling (int, optional) – Number of sub-pixels per pixel. Default is 10.

  • show_radius (bool, optional) – If True, show the Airy radius as horizontal and vertical lines. Default is False.

  • shape (tuple of float or None, optional) – Size of the PSF image in arcsec. If None, ten times the Airy radius is used. Default is None.

  • normal_scatter (float or None, optional) – Sigma of an additional Gaussian scatter convolved with the PSF, in arcsec. Default is None.

  • **kwargs – Additional arguments passed to matplotlib.axes.Axes.imshow.

Returns:

matplotlib.figure.Figure – The figure containing the plot.

update(reset_others=False, **kwargs)[source]#

Update mutable parameters.

See mutable_parameters for the list of accepted names. Setting diameter_ext or diameter_int resets a previously given surface, which is then computed from the diameters.

Parameters:
  • reset_others (bool, optional) – If True, parameters not given in kwargs are reset to their initial values. Default is False.

  • **kwargs – Parameters to update.

Warns:

UserWarning – If a given parameter is not mutable (it is then ignored).

diameter_ext#

External diameter (assumed circular) in m.

diameter_int#

Internal diameter (assumed circular) in m.

emissivity#

Mirror emissivity (one value per mirror).

meta#

Metadata dictionary containing the telescope specifications.

mutable_parameters = ['temperature', 'emissivity', 'diameter_ext', 'diameter_int', 'surface']#
nelements#

Number of mirrors sharing each temperature and emissivity.

optics#

ThermalOptics describing the mirrors’ thermal emission.

surface#

Collecting area in m^2.

If not given explicitly, it is computed from diameter_ext and diameter_int.

temperature#

Mirror temperature(s) in K.