The instrument Module

Tools For Modeling Instruments

Basic instrument modeling, such as convolving a spectral cube with an instrument PSF, can be achieved using utilities in SimIM’s map module. For more sophisticated instrument modeling, the instrument module and simim.instrument.Instrument class exist.

The Instrument class defines an instrument with one or more detectors, which can then be paired with a field or fields for simulated observations. The detectors of an instrument are defined in terms of the spatial response (PSF) and spectral response. Detector noise and pointing offsets between detectors can also be included.

Once detectors and fields are added to an Instrument instance, the class has methods to produce maps of the field as seen by each detector, as well as to sample the field (and instrument noise) into a timestram at a specified set of positions

class simim.instrument.Instrument(spatial_unit: str = None, spectral_unit: str = None, flux_unit: str = None, best_spatial_res: float = None, best_spectral_res: float = None, default_spatial_response: Callable = None, default_spatial_kwargs: dict = None, default_spectral_response: Callable = None, default_spectral_kwargs: dict = None, default_noise_function: Callable = None, default_noise_kwargs: dict = None, pointing_offset_frame: str = None)

Stores and evaluates instrument response to a simulated sky

An Instrument object represents an telescope+instrument capable of observing a simulated sky. Instruments are built by adding one or more Detectors, which describe a single detector of the instrument (or a collection of identical detectors).

Each detector is defined in terms of its spatial and spectral response and an optional noise function. Spatial and spectral response are assumed to be independent, although spatial response is evaluated as functions of all three map dimensions (so a spectrally varrying PSF is possible). When extracting detector response to a map, the map will be convolved with the spatial response and then averaged along the spectral response dimension, weighted by the spectral response.

A few default responses are predefined and can be specified by giving a string rather than a function when attaching new detectors.

Methods

add_detector([name, nominal_frequency, ...])

Add a new detector to the instrument

add_field(grid[, name, field_property_idx, ...])

Add a field for the instrument to observe

del_detectors(*detector_names)

Remove one or more detectors from the instrument's detector listing

del_fields(*field_names)

Remove one or more fields from the instrument's field listing

map_fields(*field_names[, ...])

Generate maps of the specified fields based on instruemnt response settings

plot_detector_response(*detector_names[, ...])

Plot the spatial and spectral response functions for one or more detectors

plot_spectral_response([fmin, fmax, figsize])

Plot the spectral response of every detector

sample_fields(positions, *field_names[, ...])

Sample observed field at a specified set of points

set_noise_functions(*detector_names, ...[, ...])

Set a new noise function for a detector, set of detectors, or the instrument default

set_spatial_respones(*detector_names, ...[, ...])

Set a new spatial response function for a detector, set of detectors, or the instrument default

set_spectral_respones(*detector_names, ...)

Set a new spectral response function for a detector, set of detectors, or the instrument default

Parameters:
spatial_unit{‘rad’,’deg’,’arcmin’,’arcsec’}, default=’rad’

The units in which the spatial response function is defined

spectral_unit{‘Hz’,’GHz’,’m’,’mm’,’um’}, default=’Hz’

The units in which the spectral response function is defined

flux_unit{‘Jy’,’mJy’}, default=’Jy’

The units in which the the noise_function provides noise for the detector and in which the signal in any attached fields is defined

best_spatial_resfloat (optional)

The best angular resolution of any detector to be attached to the instrument. This is used for checking that resolution of attached spectral cubes is adequate. If no value is given, no checks are performed. Should be specified in units matching spatial_unit

best_spectral_resfloat (optional)

The best spectral resolution of any detector to be attached to the instrument. This is used for checking that resolution of attached spectral cubes is adequate. If no value is given, no checks are performed. Should be specified in units matching spectral_unit

default_spatial_responsefunction, or one of ‘gauss’, ‘spec-gauss’
(optional)

The default spatial response function to be used when adding detectors. Used when no spatial response is specified in the add_detector method; if none is given then a spatial response must be specified each time a detector is added. If ‘gauss’ a two dimensional gaussian will be used. The center (default zero) and width can be controlled by specifying the ‘cx’, ‘cy’, ‘fwhmx’, ‘fwhmy’ in spatial_kwargs. If ‘spec-gauss’ a two dimensional gaussian that varries as a function of frequency will be used. The center (default zero) can be controlled by specifying the ‘cx’ and ‘cy’ in spatial_kwargs. The width at a specific frequency are set by specifying ‘freq0’, ‘fwhmx’, and ‘fwhmy’. The scaling of the size with frequency is set using the ‘freq_exp’ factor (default -1). The size at a given frequency will then be fwhmx_f = fwhmx * (freq0/freq)**freq_exp.

default_spatial_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_spatial_response function. If not given, then any spatial_kwargs must be provided each time a detector is added.

default_spectral_responsefunction, or one of ‘gauss’, ‘boxcar’
(optional)

The default spectral response function to be used when adding detectors. Used when no spectral response is specified in the add_detector method; if none is given then a spectral response must be specified each time a detector is added. If ‘gauss’ a gaussian response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs. If ‘boxcar’ a boxcar response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs.

default_spectral_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_spectral_response function. If not given, then any spectral_kwargs must be provided each time a detector is added.

default_noise_functionfunction or ‘white’ or ‘none’ (optional)

The default noise function to be used when adding detectors. Used when no noise is specified in the add_detector method; if none is given then a noise function must be specified each time a detector is added. See set_noise_functions method for details.

default_noise_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_noise_function. If not given, then any spectral_kwargs must be provided each time a detector is added. If ‘white’ a default white noise function will be used. The rms for a 1 second sample and a DC offset can be specified using the ‘rms’ and ‘bias’ parameters in noise_kwargs.

pointing_offset_frame‘radec’, ‘azel’

Frame in which to apply offsets, default is ‘radec’.

Methods

add_detector([name, nominal_frequency, ...])

Add a new detector to the instrument

add_field(grid[, name, field_property_idx, ...])

Add a field for the instrument to observe

del_detectors(*detector_names)

Remove one or more detectors from the instrument's detector listing

del_fields(*field_names)

Remove one or more fields from the instrument's field listing

map_fields(*field_names[, ...])

Generate maps of the specified fields based on instruemnt response settings

plot_detector_response(*detector_names[, ...])

Plot the spatial and spectral response functions for one or more detectors

plot_spectral_response([fmin, fmax, figsize])

Plot the spectral response of every detector

sample_fields(positions, *field_names[, ...])

Sample observed field at a specified set of points

set_noise_functions(*detector_names, ...[, ...])

Set a new noise function for a detector, set of detectors, or the instrument default

set_spatial_respones(*detector_names, ...[, ...])

Set a new spatial response function for a detector, set of detectors, or the instrument default

set_spectral_respones(*detector_names, ...)

Set a new spectral response function for a detector, set of detectors, or the instrument default

set_spatial_respones(*detector_names: str, spatial_response: Callable, spatial_kwargs: dict = None) None

Set a new spatial response function for a detector, set of detectors, or the instrument default

When no detector_names are specified, spatial response of all detectors will be updated. To instead change the instrument’s default spatial response, pass the string ‘instrument’ with the list of detector_names. Note that updating the instrument default will not automatically change the spatial response of existing detectors that were created using this default.

Parameters:
*detector_namesstr

One or more strings naming the detectors to modify. If ‘instrument’ is passed as one of these strings it will also change the instrument’s default_spatial_response attribute.

spatial_responsefunction, or one of ‘gauss’, ‘spec-gauss’

function that takes vectors of x offset, y offset (in spatial_unit), and frequency (in spectral_unit) and returns the spatial response of the detector. Additional function arguments can be as a dictionary of keyword arguments using spatial_kwargs. If ‘gauss’ a two dimensional gaussian will be used. The center (default zero) and width can be controlled by specifying the ‘cx’, ‘cy’, ‘fwhmx’, ‘fwhmy’ in spatial_kwargs. If ‘spec-gauss’ a two dimensional gaussian that varries as a function of frequency will be used. The center (default zero) can be controlled by specifying the ‘cx’ and ‘cy’ in spatial_kwargs. The width at a specific frequency are set by specifying ‘freq0’, ‘fwhmx’, and ‘fwhmy’. The scaling of the size with frequency is set using the ‘freq_exp’ factor (default -1). The size at a given frequency will then be fwhmx_f = fwhmx * (freq0/freq)**freq_exp.

spatial_kwargsdict, optional

A dictionary of kwargs that will be passed to the spatial_response function

set_spectral_respones(*detector_names: str, spectral_response: Callable, spectral_kwargs: dict = None) None

Set a new spectral response function for a detector, set of detectors, or the instrument default

When no detector_names are specified, spectral response of all detectors will be updated. To instead change the instrument’s default spectral response, pass the string ‘instrument’ with the list of detector_names. Note that updating the instrument default will not automatically change the spectral response of existing detectors that were created using this default.

Parameters:
*detector_namesstr

One or more strings naming the detectors to modify. If ‘instrument’ is passed as one of these strings it will also change the instrument’s default_spectral_response attribute.

spectral_responsefunction, or one of ‘gauss’, ‘boxcar’

function that takes vectors of frequency (in spectral_unit) and returns the spectral response of the detector. Additional function arguments can be passed as a dictionary of keyword arguments using spectral_kwargs. If ‘gauss’ a gaussian response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs. If ‘boxcar’ a boxcar response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs.

spectral_kwargsdict, optional

A dictionary of kwargs that will be passed to the spectral_response function

set_noise_functions(*detector_names: str, noise_function: Callable, noise_kwargs: dict = None) None

Set a new noise function for a detector, set of detectors, or the instrument default

When no detector_names are specified, noise functions of all detectors will be updated. To change the instrument’s default noise function, pass the string ‘instrument’ with the list of detector_names. Note that updating the instrument default will not automatically change the noise function of existing detectors that were created using this default.

Parameters:
*detector_namesstr

One or more strings naming the detectors to modify. If ‘instrument’ is passed as one of these strings it will also change the instrument’s default_noise_function attribute.

noise_functionfunction, ‘white’, or ‘none’

function that takes an integer number of samples and a timestep, and returns a time series of noise - this can be used to add noise to a timestream. Additional function arguments can be passed as adictionary of keyword arguments using noise_kwargs. If ‘white’ a default white noise function will be used. The rms for a 1 second sample and a DC offset can be specified using the ‘rms’ and ‘bias’ parameters in noise_kwargs.

noise_kwargsdict, optional

A dictionary of kwargs that will be passed to the noise_response function

add_detector(name: str = None, nominal_frequency: float = None, spatial_response: Callable = None, spatial_kwargs: dict = None, spectral_response: Callable = None, spectral_kwargs: dict = None, noise_function: Callable = None, noise_kwargs: dict = None, pointing_offsets=None)

Add a new detector to the instrument

No arguments are required, if none are given, the detector will have the default spatial response, spectral response, and noise functions set when initializing the Instrument. If a default for one of these parameters wasn’t set, then it must be specified here.

If a default spatial response is set for the Instrument, then providing a value for spatial_response in the method call will overwrite this. Providing no value for spatial_response, but providing a spatial_kwargs dictionary will result in the default Instrument spectral response function being evaluated, but with different parameters from the defaults.

The same is also true for spectral_response/spectral_kwargs, and noise_function/noise_kwargs.

Parameters:
namestr (optional)

A name for the detector. If none is given this will be set to a number (starting with 0 for the first detector added and counting up).

nominal_frequencyfloat (optional)

Optionally specify a nominal frequency of the detector. If no value is given it will be guessed by evaulauting the spatial response function. This is not used for any importatn computations, just providing back information about the detector and deciding how to generate quicklook plots.

spatial_responsefunction, or one of ‘gauss’, ‘spec-gauss’ (optional)

function that takes vectors of x offset, y offset (in spatial_unit), and frequency (in spectral_unit) and returns the spatial response of the detector. Additional function arguments can be as a dictionary of keyword arguments using spatial_kwargs. If ‘gauss’ a two dimensional gaussian will be used. The center (default zero) and width can be controlled by specifying the ‘cx’, ‘cy’, ‘fwhmx’, ‘fwhmy’ in spatial_kwargs. If ‘spec-gauss’ a two dimensional gaussian that varries as a function of frequency will be used. The center (default zero) can be controlled by specifying the ‘cx’ and ‘cy’ in spatial_kwargs. The width at a specific frequency are set by specifying ‘freq0’, ‘fwhmx’, and ‘fwhmy’. The scaling of the size with frequency is set using the ‘freq_exp’ factor (default -1). The size at a given frequency will then be fwhmx_f = fwhmx * (freq0/freq)**freq_exp.

spatial_kwargsdict, optional (optional)

A dictionary of kwargs that will be passed to the spatial_response function

spectral_responsefunction, or one of ‘gauss’, ‘boxcar’ (optional)

function that takes vectors of frequency (in spectral_unit) and returns the spectral response of the detector. Additional function arguments can be passed as a dictionary of keyword arguments using spectral_kwargs. If ‘gauss’ a gaussian response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs. If ‘boxcar’ a boxcar response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs.

spectral_kwargsdict, optional (optional)

A dictionary of kwargs that will be passed to the spectral_response function

noise_functionfunction, ‘white’, or ‘none’ (optional)

function that takes an integer number of samples and a timestep, and returns a time series of noise - this can be used to add noise to a timestream. Additional function arguments can be passed as adictionary of keyword arguments using noise_kwargs. If ‘white’ a default white noise function will be used. The rms for a 1 second sample and a DC offset can be specified using the ‘rms’ and ‘bias’ parameters in noise_kwargs.

noise_kwargsdict, optional (optional)

A dictionary of kwargs that will be passed to the noise_function function

pointing_offsetstuple (optional)

A tuple specifying the offset between the telescope pointing axis and the detector pointing axis. Defaults to (0,0). If given it will be used when sampling and detectors samples will be taken from positions shifted by adding this tuple

del_detectors(*detector_names: str) None

Remove one or more detectors from the instrument’s detector listing

Parameters:
*detector_namesstr

One or more strings naming the detectors to remove

add_field(grid: Grid, name: str = None, field_property_idx: int = None, in_place: bool = True, _check: bool = True) None

Add a field for the instrument to observe

Provide a simim.map.Grid instance representing the field to be observed by the instrument. The Grid instance should generally be free from pre-applied observational effects (these are handled by the Instrument object itself), and should be pixelized at a higher resolution than the best resolution of the instrument elements

Multiple calls to this method will add multiple fields that can be accessed based on their assigned name. For methods which apply to a specific field the default behavior is to use the most recently added field.

Parameters:
gridsimim.map.Grid

A 3d simim.map.Grid grid that contains spatial dimensions in its first two axes and the spectral dimension in its third.

namestr (optional)

Name for the field, if none is given this will match the numerical index of the field.

field_property_idxint (optional)

The property index of the grid property to map. Defaults to 0, and never needs to be set for grids containing only one property

in_placebool (optional)

When True (default) a reference to the grid will be stored with the Instrument instance. When False a copy of the grid is stored. Note that Instrument methods don’t transform the grid, so storing a copy is only necessary if the grid will be changed by external code in a way that shouldn’t be reflected in the instrument modeling.

_checkbool

Flag for checking unit compatibility between grid and self.

del_fields(*field_names: str) None

Remove one or more fields from the instrument’s field listing

Parameters:
*field_namesstr

One or more strings naming the fields to remove

map_fields(*field_names: str, spatial_response_norm: str = 'peak', kernel_size: int = None, beam: Grid = None, pad: int = None)

Generate maps of the specified fields based on instruemnt response settings

Parameters:
*field_namesstr

One or more strings naming the fields to map, if no names are specified all fields will be mapped

spatial_response_norm‘peak’, ‘area’, or ‘none’

How to normalize the beam peak will make the peak pixel equal to 1, area will make the total volume under the PSF equal to 1, none will apply no normalization (assumes this has been handled by the spatial_response function itself)

kernel_sizeint

The number of pixels (per side) to use when generating images of the PSF. Pixel size will match the pixel size of the field. This should be large enough to ensure the PSF is represented down to well below the peak. Only kernel_size or beam should be specified. Default will be 10 * the best resolution of the instrument

beamsimim.map.Grid

A 3d grid describing the PSF in spatial pixels matched in size to those of the field(s) and a number of spectral pixels matched to the field(s). Only kernel_size or beam should be specified.

padint (optional)

Specify a number of cells to zero pad onto the each side of the field during convolution with the beam.

sample_fields(positions: ndarray, *field_names: str, sample_signal: bool = True, sample_noise: bool = True, dt: float = None)

Sample observed field at a specified set of points

This code requires that the map_fields method has been run for the fields to be sampled.

Parameters:
positionsarray

An array containg the positions at which to sample the field. It should have a shape of (n_samples, 2). Repeats of the same position are allowed.

*field_namesstr

One or more strings naming the fields to sample, if no names are specified all fields will be used

sample_signalbool (optional)

Determines whether to sample signal (from the field maps). Default is True, set to False to draw noise samples

sample_noisebool (optional)

Determines whether to sample noise (from detector noise_functions). Default is True, set to False to draw signal-only samples

dtfloat (optional)

The timestep for each sample, passed to noise_function when drawing noise samples.

Returns:
samplesarray or dict

If one field is requested, this will be an array of shape (n_samples, n_detectors) containing the samples for each detector. If multiple fields are requested, it will be a dict containing an array of samples for each field. Dictionary keys will match field names.

plot_detector_response(*detector_names: str, xmin: float = None, xmax: float = None, ymin: float = None, ymax: float = None, fmin: float = None, fmax: float = None, fspatial: float = None, figsize: tuple = (10, 5))

Plot the spatial and spectral response functions for one or more detectors

Parameters:
*detector_namesstr

One or more detector names to plot. If no names are given, all detectors will be plotted.

fmin, fmaxfloat (optional)

The minimum and maximum frequency to plot the spectrum over, if None given it +/-10% of the detector representative frequency will be used

fspatialfloat (optional)

The frequency at which to evaluate the detector spatial response. If None given the detector representative frequency will be used

xmin, xmax, ymin, ymaxfloat

The minimum and maximum spatial coordinates defining the region over which to plot the detector spatial response. If None given the 5 times the instrument best_spatial_resolution will be used.

figsizetuple

Size of the resulting plots

plot_spectral_response(fmin: float = None, fmax: float = None, figsize: tuple = (5, 5)) None

Plot the spectral response of every detector

Parameters:
fmin, fmaxfloat (optional)

The minimum and maximum frequency to plot the spectrum over.

figsizetuple (optional)

Size of the resulting plots

class simim.instrument.Detector(spatial_unit: str = None, spectral_unit: str = None, flux_unit: str = None, spatial_response: Callable = None, spatial_kwargs: dict = None, spectral_response: Callable = None, spectral_kwargs: dict = None, noise_function: Callable = None, noise_kwargs: dict = None, pointing_offsets: tuple = None, pointing_offset_frame: str = None, nominal_frequency: float = None, spatial_res: float = None, spectral_res: float = None)

Modified version of instrument class for working with single detectors

Methods

add_detector([name, nominal_frequency, ...])

Add a new detector to the instrument

add_field(grid[, name, field_property_idx, ...])

Add a field for the instrument to observe

del_detectors(*detector_names)

Remove one or more detectors from the instrument's detector listing

del_fields(*field_names)

Remove one or more fields from the instrument's field listing

map_fields(*field_names[, ...])

Generate maps of the specified fields based on instruemnt response settings

plot_detector_response(*detector_names[, ...])

Plot the spatial and spectral response functions for one or more detectors

plot_spectral_response([fmin, fmax, figsize])

Plot the spectral response of every detector

sample_fields(positions, *field_names[, ...])

Sample observed field at a specified set of points

set_noise_functions(*detector_names, ...[, ...])

Set a new noise function for a detector, set of detectors, or the instrument default

set_spatial_respones(*detector_names, ...[, ...])

Set a new spatial response function for a detector, set of detectors, or the instrument default

set_spectral_respones(*detector_names, ...)

Set a new spectral response function for a detector, set of detectors, or the instrument default

Parameters:
spatial_unit{‘rad’,’deg’,’arcmin’,’arcsec’}, default=’rad’

The units in which the spatial response function is defined

spectral_unit{‘Hz’,’GHz’,’m’,’mm’,’um’}, default=’Hz’

The units in which the spectral response function is defined

flux_unit{‘Jy’,’mJy’}, default=’Jy’

The units in which the the noise_function provides noise for the detector and in which the signal in any attached fields is defined

best_spatial_resfloat (optional)

The best angular resolution of any detector to be attached to the instrument. This is used for checking that resolution of attached spectral cubes is adequate. If no value is given, no checks are performed. Should be specified in units matching spatial_unit

best_spectral_resfloat (optional)

The best spectral resolution of any detector to be attached to the instrument. This is used for checking that resolution of attached spectral cubes is adequate. If no value is given, no checks are performed. Should be specified in units matching spectral_unit

default_spatial_responsefunction, or one of ‘gauss’, ‘spec-gauss’
(optional)

The default spatial response function to be used when adding detectors. Used when no spatial response is specified in the add_detector method; if none is given then a spatial response must be specified each time a detector is added. If ‘gauss’ a two dimensional gaussian will be used. The center (default zero) and width can be controlled by specifying the ‘cx’, ‘cy’, ‘fwhmx’, ‘fwhmy’ in spatial_kwargs. If ‘spec-gauss’ a two dimensional gaussian that varries as a function of frequency will be used. The center (default zero) can be controlled by specifying the ‘cx’ and ‘cy’ in spatial_kwargs. The width at a specific frequency are set by specifying ‘freq0’, ‘fwhmx’, and ‘fwhmy’. The scaling of the size with frequency is set using the ‘freq_exp’ factor (default -1). The size at a given frequency will then be fwhmx_f = fwhmx * (freq0/freq)**freq_exp.

default_spatial_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_spatial_response function. If not given, then any spatial_kwargs must be provided each time a detector is added.

default_spectral_responsefunction, or one of ‘gauss’, ‘boxcar’
(optional)

The default spectral response function to be used when adding detectors. Used when no spectral response is specified in the add_detector method; if none is given then a spectral response must be specified each time a detector is added. If ‘gauss’ a gaussian response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs. If ‘boxcar’ a boxcar response will be used. The center frequency, width and amplitude can be controlled by specifying the ‘freq0’, ‘fwhm’, and ‘A’ in spectral_kwargs.

default_spectral_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_spectral_response function. If not given, then any spectral_kwargs must be provided each time a detector is added.

default_noise_functionfunction or ‘white’ or ‘none’ (optional)

The default noise function to be used when adding detectors. Used when no noise is specified in the add_detector method; if none is given then a noise function must be specified each time a detector is added. See set_noise_functions method for details.

default_noise_kwargsdict (optional)

A dictionary of kwargs that will be passed to the default_noise_function. If not given, then any spectral_kwargs must be provided each time a detector is added. If ‘white’ a default white noise function will be used. The rms for a 1 second sample and a DC offset can be specified using the ‘rms’ and ‘bias’ parameters in noise_kwargs.

pointing_offset_frame‘radec’, ‘azel’

Frame in which to apply offsets, default is ‘radec’.

Methods

add_detector([name, nominal_frequency, ...])

Add a new detector to the instrument

add_field(grid[, name, field_property_idx, ...])

Add a field for the instrument to observe

del_detectors(*detector_names)

Remove one or more detectors from the instrument's detector listing

del_fields(*field_names)

Remove one or more fields from the instrument's field listing

map_fields(*field_names[, ...])

Generate maps of the specified fields based on instruemnt response settings

plot_detector_response(*detector_names[, ...])

Plot the spatial and spectral response functions for one or more detectors

plot_spectral_response([fmin, fmax, figsize])

Plot the spectral response of every detector

sample_fields(positions, *field_names[, ...])

Sample observed field at a specified set of points

set_noise_functions(*detector_names, ...[, ...])

Set a new noise function for a detector, set of detectors, or the instrument default

set_spatial_respones(*detector_names, ...[, ...])

Set a new spatial response function for a detector, set of detectors, or the instrument default

set_spectral_respones(*detector_names, ...)

Set a new spectral response function for a detector, set of detectors, or the instrument default

Spatial Response Functions

There are built in functions for creating a Gaussian beam or a Gaussian beam that varies in size along the frequency axis. Other beams can be specified by the user by passing an appropriately defined function.

A valid spatial response function will take as its arguments three 1D arrays - specifying grids of 1) angular offsets in the RA direction, 2) angular offset in the dec direction, and 3) frequency/wavelength, and will return a 3D grid containing the beam evaluated at every 3D grid point from the three axes. Spatial response functions may have additional parameters, which can then be specified in the spatial_kwargs parameter when adding a detector to the Instrument instance.

Spectral Response Functions

There are built in functions for creating Gaussian and boxcar shaped spectral responses. Other beams can be specified by the user by passing an appropriately defined function.

A valid spectral response function will take as it argument a 1D array of frequency/wavelength coordinates, and return a 1D array containing the spectral response at each coordinate. Spectral response functions may have additional parameters, which can then be specified in the spectral_kwargs parameter when adding a detector to the Instrument instance.

Noise Functions

Noise functions can be used to define the instrument noise of a detector which will be added to the output timestream when generating timestreams. These functions should take as arguments 1) a number of samples to draw and 2) a timestep for each sample, and will return specified number of samples drawn from a noise distribution appropriate for the timestep.

There are builtin functions for white noise or zero noise. Others can be defined by the user.