Instrument

class nsb2.core.instrument.Instrument[source]

Bases: ABC

Base class for telescope and camera models.

Variables:

bandpass (nsb2.core.spectral.Bandpass) – Wavelength response of the full optical chain.

Methods Summary

compute_pixel_weights(field, pixel_refs, ...)

Fill in the instrument response weight of every source-pixel pair.

eval_grid(observation[, n])

Build the grid on which scattered light is evaluated.

fov_range()

Return the extent of the field of view.

pixel_coords(observation)

Return the pixel centre positions.

pixel_radii()

Return the per-pixel search radius for spatial source queries.

project_continuous(rates, eval_coords)

Interpolate a rate field from the evaluation grid onto the pixels.

project_discrete(rates, pixel_refs)

Sum discrete source rates into the pixels they belong to.

Methods Documentation

abstractmethod compute_pixel_weights(field, pixel_refs, observation)[source]

Fill in the instrument response weight of every source-pixel pair.

Parameters:
Returns:

A new assignment with weights filled in. The input is not modified.

Return type:

nsb2.core.dtypes.PixelRefs

eval_grid(observation, n=2)[source]

Build the grid on which scattered light is evaluated.

Scattered light varies slowly across a field of view a few degrees wide, so it is evaluated on a coarse grid and interpolated onto the pixels rather than computed per pixel.

Parameters:
  • observation (astropy.coordinates.BaseCoordinateFrame) – The telescope pointing frame.

  • n (int, optional) – Number of grid points per axis, giving an n by n grid. Default is 2, i.e. the corners of the field of view.

Returns:

Grid positions, shape (n, n).

Return type:

astropy.coordinates.SkyCoord

abstractmethod fov_range()[source]

Return the extent of the field of view.

Returns:

((lon_min, lon_max), (lat_min, lat_max)) in radians, relative to the pointing direction.

Return type:

tuple

abstractmethod pixel_coords(observation)[source]

Return the pixel centre positions.

Parameters:

observation (astropy.coordinates.BaseCoordinateFrame) – The telescope pointing frame.

Returns:

Pixel centres in the observation frame, shape (N_pix,).

Return type:

astropy.coordinates.SkyCoord

abstractmethod pixel_radii()[source]

Return the per-pixel search radius for spatial source queries.

Returns:

Radii in radians, shape (N_pix,). Large enough to cover the pixel’s full acceptance, so that no contributing source is missed.

Return type:

numpy.ndarray

project_continuous(rates, eval_coords)[source]

Interpolate a rate field from the evaluation grid onto the pixels.

Parameters:
Returns:

Per-pixel rates, shape (N_pix, 3), scaled by each pixel’s solid angle since the field is a radiance.

Return type:

astropy.units.Quantity

project_discrete(rates, pixel_refs)[source]

Sum discrete source rates into the pixels they belong to.

Parameters:
Returns:

Per-pixel rates, shape (N_pix, 3), holding the minimum, median and maximum over the spectral components.

Return type:

astropy.units.Quantity

Raises:

ValueError – If pixel_refs.weights has not been filled in.

__init__()
classmethod __new__(*args, **kwargs)