Instrument¶
- class nsb2.core.instrument.Instrument[source]¶
Bases:
ABCBase 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.
Return the extent of the field of view.
pixel_coords(observation)Return the pixel centre positions.
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:
field (nsb2.core.dtypes.SourceField) – The queried source field.
pixel_refs (nsb2.core.dtypes.PixelRefs) – Assignment with
indicespopulated andweightsunset.observation (astropy.coordinates.BaseCoordinateFrame) – The telescope pointing frame.
- Returns:
A new assignment with
weightsfilled in. The input is not modified.- Return type:
- 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
nbyngrid. Default is 2, i.e. the corners of the field of view.
- Returns:
Grid positions, shape
(n, n).- Return type:
- 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:
- 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:
- 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:
- project_continuous(rates, eval_coords)[source]¶
Interpolate a rate field from the evaluation grid onto the pixels.
- Parameters:
rates (astropy.units.Quantity) – Rate field on the evaluation grid, shape
(M_lat, M_lon, N_sources, C_comp).eval_coords (astropy.coordinates.SkyCoord) – The evaluation grid, shape
(M_lat, M_lon). Only its shape is used; the positions are reconstructed fromfov_range()to matcheval_grid().
- Returns:
Per-pixel rates, shape
(N_pix, 3), scaled by each pixel’s solid angle since the field is a radiance.- Return type:
- project_discrete(rates, pixel_refs)[source]¶
Sum discrete source rates into the pixels they belong to.
- Parameters:
rates (astropy.units.Quantity) – Per-source rates, shape
(N_sources, C_comp), already weighted by source brightness.pixel_refs (nsb2.core.dtypes.PixelRefs) – Source-to-pixel assignment, with
weightsfilled in.
- Returns:
Per-pixel rates, shape
(N_pix, 3), holding the minimum, median and maximum over the spectral components.- Return type:
- Raises:
ValueError – If
pixel_refs.weightshas not been filled in.
- __init__()¶
- classmethod __new__(*args, **kwargs)¶