drift.core.telescope
Functions
|
Check if array entries are within the given range. |
|
|
|
Get the maximum (l,m) that a baseline is sensitive to. |
|
Classes
|
A base for a polarised telescope. |
|
A base for a polarised telescope. |
|
A base for a polarised telescope. |
|
Base class for simulating any transit interferometer. |
|
A base for an unpolarised telescope. |
- class drift.core.telescope.PolarisedTelescope(latitude=45, longitude=0, **kwargs)
Bases:
TransitTelescope
A base for a polarised telescope.
Again, an abstract class, but the only things that require implementing are the feedpositions, _get_unique and the beam function, as well as the polarization property.
- skip_V
Omit calculation of Stokes V transfer function to a mild computational saving. As there is almost no Stokes V emission on the sky this is a reasonable trade off. The entries are left in the transfer matrices, but they will be filled with zeros.
- Type:
bool, optional
- skip_pol
Omit calculation of Stokes Q, U and V for a large computational saving. This means that the effect of the (large) polarized signal from the sky will not be correctly calculated. Only do this if you are really sure it’s what you want. The entries are left in the transfer matrices, but they will be filled with zeros.
- beam : methods
(abstract method) Routines giving the field pattern for the x and y feeds.
Initialise a telescope object.
- Parameters:
latitude (scalar) – Position on the Earths surface of the telescope (in degrees).
longitude (scalar) – Position on the Earths surface of the telescope (in degrees).
- property included_pol: ndarray
The included polarisation indices.
- Returns:
Polarisation indices.
- Return type:
pol_ind
- property polarisation
Polarisation map.
- Returns:
pol – One-dimensional array of strings describing the polarisation.
- Return type:
np.ndarray
- class drift.core.telescope.SimplePolarisedTelescope(latitude=45, longitude=0, **kwargs)
Bases:
PolarisedTelescope
A base for a polarised telescope.
Again, an abstract class, but the only things that require implementing are the feedpositions, _get_unique and the beam functions beamx and beamy.
- beamx, beamy : methods
(abstract methods) Routines giving the field pattern for the x and y feeds.
Initialise a telescope object.
- Parameters:
latitude (scalar) – Position on the Earths surface of the telescope (in degrees).
longitude (scalar) – Position on the Earths surface of the telescope (in degrees).
- property beamclass
Simple beam mode of dual polarisation feeds.
- abstract beamx(feed, freq)
Beam for the X polarisation feed.
- Parameters:
feed (integer) – Index for the feed.
freq (integer) – Index for the frequency.
- Returns:
beam – Healpix maps (of size [self._nside, 2]) of the field pattern in the theta and phi directions.
- Return type:
np.ndarray
- abstract beamy(feed, freq)
Beam for the Y polarisation feed.
- Parameters:
feed (integer) – Index for the feed.
freq (integer) – Index for the frequency.
- Returns:
beam – Healpix maps (of size [self._nside, 2]) of the field pattern in the theta and phi directions.
- Return type:
np.ndarray
- property feedpositions
An (nfeed,2) array of the feed positions relative to an arbitary point (in m)
- property polarisation
Polarisation map.
- Returns:
pol – One-dimensional array with the polarization for each feed (‘X’ or ‘Y’).
- Return type:
np.ndarray
- class drift.core.telescope.SimpleUnpolarisedTelescope(latitude=45, longitude=0, **kwargs)
Bases:
UnpolarisedTelescope
A base for a polarised telescope.
Again, an abstract class, but the only things that require implementing are the feedpositions, _get_unique and the beam functions beamx and beamy.
- beamx, beamy : methods
(abstract methods) Routines giving the field pattern for the x and y feeds.
Initialise a telescope object.
- Parameters:
latitude (scalar) – Position on the Earths surface of the telescope (in degrees).
longitude (scalar) – Position on the Earths surface of the telescope (in degrees).
- property beamclass
Simple beam mode of dual polarisation feeds.
- property feedpositions
An (nfeed,2) array of the feed positions relative to an arbitary point (in m)
- class drift.core.telescope.TransitTelescope(latitude=45, longitude=0, **kwargs)
Bases:
Reader
,Observer
Base class for simulating any transit interferometer.
This is an abstract class, and several methods must be implemented before it is usable. These are:
feedpositions - a property which contains the positions of all the feeds
_get_unique - calculates which baselines are identical
_transfer_single - calculate the beam transfer for a single baseline+freq
_make_matrix_array - makes an array of the right size to hold the transfer functions
_copy_transfer_into_single - copy a single transfer matrix into a collection.
The last two are required for supporting polarised beam functions.
- freq_lower, freq_higher
The center of the lowest and highest frequency bands. Deprecated, use freq_start, freq_end instead.
- Type:
scalar
- freq_start, freq_end
The start and end frequencies in MHz. Defaults: 800, 400.
- Type:
scalar
- num_freq
The number of frequency bands (only use for setting up the frequency binning). Generally using nfreq is preferred. Default: 1024.
- Type:
scalar
- freq_mode
Choose if freq_start and freq_end are the edges of the band (“edge”), or whether they are the central frequencies of the first and last channel, in this case the last (Nyquist) frequency can either be skipped (“centre”, default) or included (“centre_nyquist”). The behaviour of the “centre” mode matches the output of the CASPER PFB-FIR block.
- Type:
{“centre”, “edge”}
- channel_bin
Number of channels to bin together. This must exactly devide the total number. Binning is performed prior to selection of any subset. Default: 1.
- Type:
int, optional
- channel_list
List of channel indices to select. If set, this takes priority over channel_range. Currently this is not implemented.
- Type:
list, optional
- channel_range
Select subset of frequencies using a range of frequency channel indices, either [start, stop, step], [start, stop], or [stop] is acceptable. Default selects all channels.
- Type:
list, optional
- tsys_flat
The system temperature (in K). Override tsys for anything more sophisticated. Default: 50.
- Type:
scalar
- ndays
Number of days to assume when computing thermal noise. Default: 733.
- Type:
int
- accuracy_boost
When computing beam transfer function, increase nside of healpix maps by 2**accuracy_boost compared to default determination of nside. Default: 1.0.
- Type:
float
- l_boost
Increase lmax and mmax for telescope, and lmax/mmax values computed for individual baselines, by a factor of l_boost compared to default computations. Default: 1.0.
- Type:
float
- force_lmax, force_mmax
Use specific values for the telescope’s l_max and m_max, instead of computing these values based on the angular scales accessible to the longest baseline at the highest frequency. l_boost is ignored if these values are specified. This is useful if you intend to combine several sets of beam transfer matrices that are separately computed over different frequency ranges. Default: None.
- Type:
int
- minlength, maxlength
Minimum and maximum baseline lengths to include (in metres).
- Type:
scalar
- auto_correlations
Include elements for feed auto-correlations in computed beam transfer matrices. Default: False.
- Type:
bool
- local_origin
If set the observers location is the terrestrial origin, and so the rotation angle corresponds to the right ascension that is overhead (Local Stellar Angle in caput.time). If not the origin is Greenwich, so the rotation angle is what is overhead at Greenwich (Earth Rotation Angle). Default: True.
- Type:
bool
- skip_freq
Frequency indices (with the set of frequencies defined by the other parameters) to skip. Skipped frequencies are considered to be present, but their beam transfer matrices are implicitly zero and thus are skipped in the beam transfer matrix calculation. This is useful for RFI channels that we know will be masked.
- Type:
list
- skip_baselines
Baseline indices to skip. Like skipped frequencies, skipped baselines are considered to be present, but their beam transfer matrices are implicitly zero and thus are skipped in the beam transfer matrix calculation.
- Type:
list
- beam_cache_size
Size of the beam cache in MB. Setting this minimises the amount of recalculation of the primary beams while generating beam transfer matrices. Default is 200 MB.
- Type:
float
Initialise a telescope object.
- Parameters:
latitude (scalar) – Position on the Earths surface of the telescope (in degrees).
longitude (scalar) – Position on the Earths surface of the telescope (in degrees).
- property baselines
The unique baselines in the telescope.
- abstract property beamclass
An nfeed array of the class of each beam (identical labels are considered to have identical beams).
- calculate_feedpairs()
Calculate all the unique feedpairs and their redundancies, and set the internal state of the object.
- property feedconj
An (nfeed, nfeed) array giving the feed pairs which must be complex conjugated.
- property feedmap
An (nfeed, nfeed) array giving the mapping between feedpairs and the calculated baselines. Each entry is an index into the arrays of unique pairs.
- property feedmask
An (nfeed, nfeed) array giving the entries that have been calculated. This allows to mask out pairs we want to ignore.
- abstract property feedpositions
An (nfeed,2) array of the feed positions relative to an arbitary point (in m)
- property frequencies
The centre of each frequency band (in MHz).
- property included_baseline: ndarray
The baseline indices that are being calculated.
- Returns:
Indices of included baselines.
- Return type:
bl_ind
- property included_freq: ndarray
The frequency indices that are being calculated.
- Returns:
Indices of included frequencies.
- Return type:
freq_ind
- property included_pol: ndarray
The pol indices that are being calculated.
- Returns:
Indices of included polarisations.
- Return type:
pol_ind
- property index_map_prod
Generate a full triangle index_map/prod like object.
- Returns:
prodmap – A structured array of (input_a, input_b) pairs for the upper triangle.
- Return type:
np.ndarray
- property index_map_stack
Generate an index_map/stack like object.
- Returns:
stack – A structured array with (prod_ind, conj) pairs the same length as unique_pairs.
- Return type:
np.ndarray
- property input_index
Override to add custom labelling of the inputs, e.g. serial numbers.
This should give an identifier that uniquely labels a correlator input and so can be used to match inputs through subsetting and reordering.
There are two conventional fields used in the output, either a chan_id field for an integer label, or a correlator_input for a string labelling (useful for serial number strings). If both are present, correlator_input is used.
- property lmax
The maximum l the telescope is sensitive to.
- property mmax
The maximum m the telescope is sensitive to.
- property nbase
The number of unique baselines.
- property nfeed
The number of feeds.
- property nfreq
The number of frequency bins.
- noisepower(bl_indices, f_indices, ndays=None)
Calculate the instrumental noise power spectrum.
Assume we are still within the regime where the power spectrum is white in m modes.
- Parameters:
bl_indices (array_like) – Indices of baselines to calculate.
f_indices (array_like) – Indices of frequencies to calculate. Must be broadcastable against bl_indices.
ndays (integer) – The number of sidereal days observed.
- Returns:
noise_ps – The noise power spectrum.
- Return type:
np.ndarray
- property npairs
The number of unique feed pairs.
- property num_pol_sky
The number of polarisation combinations on the sky that we are considering. Should be either 1 (T=I only), 3 (T, Q, U) or 4 (T, Q, U and V).
- property prodstack
Generate the results of a prodstack.
This is similar to the output of uniquepairs, but has the same typing as used within draco.
- Returns:
prodstack – A structured array with (input_a, input_b) pairs.
- Return type:
np.ndarray
- property redundancy
The redundancy of each baseline (corresponds to entries in cyl.baselines).
- property reverse_map_stack
Generate a reverse_map/stack like object.
- Returns:
stack – A structured array of (stack_ind, conj) pairs the same length as prod.
- Return type:
np.ndarray
- transfer_for_baseline(baseline)
Fetch all transfer matrices for a given baseline.
- Parameters:
baseline (integer) – The baseline index.
- Returns:
transfer – The transfer matrices. Packed as in TransitTelescope.transfer_matrices.
- Return type:
np.ndarray
- transfer_for_frequency(freq)
Fetch all transfer matrices for a given frequency.
- Parameters:
freq (integer) – The frequency index.
- Returns:
transfer – The transfer matrices. Packed as in TransitTelescope.transfer_matrices.
- Return type:
np.ndarray
- transfer_matrices(bl_indices, f_indices, global_lmax=True)
Calculate the spherical harmonic transfer matrices for baseline and frequency combinations.
- Parameters:
bl_indices (array_like) – Indices of baselines to calculate.
f_indices (array_like) – Indices of frequencies to calculate. Must be broadcastable against bl_indices.
global_lmax (boolean, optional) – If set (default), the output size lside in (l,m) is big enough to hold the maximum for the entire telescope. If not set it is only big enough for the requested set.
- Returns:
transfer – An array containing the transfer functions. The shape is somewhat complicated, the first indices correspond to the broadcast size of bl_indices and f_indices, then there may be some polarisation indices, then finally the (l,m) indices, range (lside, 2*lside-1).
- Return type:
np.ndarray, dtype=np.complex128
- tsys(f_indices=None)
The system temperature.
Currenty has a flat T_sys across the whole bandwidth. Override for anything more complicated.
- Parameters:
f_indices (array_like) – Indices of frequencies to get T_sys at.
- Returns:
tsys – System temperature at requested frequencies.
- Return type:
array_like
- abstract property u_width
The approximate physical width (in the u-direction) of the dish/telescope etc, for calculating the maximum (l,m).
- property uniquepairs
An (npairs, 2) array of the feed pairs corresponding to each baseline.
- abstract property v_width
The approximate physical length (in the v-direction) of the dish/telescope etc, for calculating the maximum (l,m).
- property wavelengths
The central wavelength of each frequency band (in metres).
- property zenith
The zenith vector in spherical polars.
The position of the zenith spherical polars (in radians). Read only.
- Returns:
zenith
- Return type:
[theta, phi]
- class drift.core.telescope.UnpolarisedTelescope(latitude=45, longitude=0, **kwargs)
Bases:
TransitTelescope
A base for an unpolarised telescope.
Again, an abstract class, but the only things that require implementing are the feedpositions, _get_unique and the beam function.
Initialise a telescope object.
- Parameters:
latitude (scalar) – Position on the Earths surface of the telescope (in degrees).
longitude (scalar) – Position on the Earths surface of the telescope (in degrees).
- abstract beam(feed, freq)
Beam for a particular feed.
- Parameters:
feed (integer) – Index for the feed.
freq (integer) – Index for the frequency.
- Returns:
beam – A Healpix map (of size self._nside) of the beam. Potentially complex.
- Return type:
np.ndarray
- noisepower(bl_indices, f_indices, ndays=None)
Calculate the instrumental noise power spectrum.
Assume we are still within the regime where the power spectrum is white in m modes.
- Parameters:
bl_indices (array_like) – Indices of baselines to calculate.
f_indices (array_like) – Indices of frequencies to calculate. Must be broadcastable against bl_indices.
ndays (integer) – The number of sidereal days observed.
- Returns:
noise_ps – The noise power spectrum.
- Return type:
np.ndarray
- drift.core.telescope.in_range(arr, min, max)
Check if array entries are within the given range.
- Parameters:
arr (np.ndarray) – Array to check.
min (scalar or np.ndarray) – Minimum and maximum values to test against. Values can be in arrays broadcastable against arr.
max (scalar or np.ndarray) – Minimum and maximum values to test against. Values can be in arrays broadcastable against arr.
- Returns:
val – True if all entries are within range.
- Return type:
boolean
- drift.core.telescope.max_lm(baselines, wavelengths, uwidth, vwidth=0.0)
Get the maximum (l,m) that a baseline is sensitive to.
- Parameters:
baselines (np.ndarray) – An array of baselines.
wavelengths (np.ndarray) – An array of frequencies.
width (np.ndarray) – Width of the receiver in the u-direction.
- Returns:
lmax, mmax
- Return type:
array_like