draco.core.containers

Distributed containers for holding various types of analysis data.

Containers

Container Base Classes

Helper Routines

These routines are designed to be replaced by other packages trying to insert their own custom container types.

Functions

copy_datasets_filter(source, dest[, axis, ...])

Copy datasets while filtering a given axis.

empty_like(obj, **kwargs)

Create an empty container like obj.

empty_timestream(**kwargs)

Create a new timestream container.

Classes

BaselineMask(*args, **kwargs)

A container for holding a baseline-dependent mask for a timestream.

CommonModeGainData(*args, **kwargs)

Parallel container for holding gain data common to all inputs.

CommonModeSiderealGainData([ra])

Parallel container for holding sidereal gain data common to all inputs.

ContainerBase(*args, **kwargs)

A base class for pipeline containers.

CosmologyContainer([cosmology])

A baseclass for a container that is referenced to a background Cosmology.

DataWeightContainer(*args, **kwargs)

A base class for containers with generic data/weight datasets.

DelayContainer(*args, **kwargs)

A container with a delay axis.

DelayCrossSpectrum(*args[, weight_boost, sample])

Container for a delay cross power spectra.

DelayCutoff(*args, **kwargs)

Container for a delay cutoff.

DelaySpectrum(*args[, weight_boost, sample])

Container for a delay power spectrum.

DelayTransform([weight_boost])

Container for a delay spectrum.

FitFormedBeam(*args, **kwargs)

Container for formed beams fit to a primary beam model versus hour angle.

FitFormedBeamEW(*args, **kwargs)

Container for formed beams fit to a primary beam model versus hour angle.

FormedBeam(*args, **kwargs)

Container for formed beams.

FormedBeamHA(*args, **kwargs)

Container for formed beams.

FormedBeamHAEW(*args, **kwargs)

Container for formed beams constructed from a HybridVisStream.

FormedBeamHAMask(*args, **kwargs)

Mask bad formed beams as a function of hour angle.

FormedBeamMask(*args, **kwargs)

Mask bad formed beams.

Fourier3DContainer([cosmology])

A base container with Fourier axes, (pol,delay,u,v).

FreqContainer(*args, **kwargs)

A pipeline container for data with a frequency axis.

FrequencyStack(*args, **kwargs)

Container for a frequency stack.

FrequencyStackByPol(*args, **kwargs)

Container for a frequency stack split by polarisation.

GainData(*args, **kwargs)

Parallel container for holding gain data.

GainDataBase(*args, **kwargs)

A container interface for gain-like data.

GridBeam([coords])

Generic container for representing a 2D beam on a rectangular grid.

HEALPixBeam([coords, ordering])

Container for representing the spherical 2-d beam in a HEALPix grid.

HealpixContainer([nside])

Base class container for holding Healpix map data.

HybridVisMModes([mmax, oddra])

Visibilities beamformed in the NS direction and m-mode transformed in RA.

HybridVisStream(*args, **kwargs)

Visibilities beamformed only in the NS direction.

KLModes([mmax, oddra])

Parallel container for holding KL filtered m-mode data.

LocalizedRFIMask(*args, **kwargs)

Container for an RFI mask for each freq, el, and time sample.

LocalizedSiderealRFIMask([ra])

Container for an RFI mask for each freq, ra, and el sample.

MContainer([mmax, oddra])

Container for holding m-mode type data.

MModes(*args, **kwargs)

Parallel container for holding m-mode data.

Map([polarisation])

Container for holding multi-frequency sky maps.

MockFrequencyStack(*args, **kwargs)

Container for holding a frequency stack for multiple mock catalogs.

MockFrequencyStackByPol(*args, **kwargs)

Container for holding a frequency stack split by pol for multiple mock catalogs.

PowerSpectrum1D([cosmology])

Container for a 1D power spectrum.

PowerSpectrum2D([cosmology])

Container for a 2D cylindrically averaged power spectrum.

PowerSpectrum3D([cosmology])

Container for a 3D power spectrum.

Powerspectrum2D([kperp_edges, kpar_edges])

Container for a 2D cartesian power spectrum.

RFIMask(*args, **kwargs)

A container for holding an RFI mask for a timestream.

RFIMaskByPol(*args, **kwargs)

A container for holding a polarisation-dependent RFI mask as a function of time.

RingMap([ra])

Container for holding multifrequency ring maps.

RingMapMask([ra])

Mask bad ringmap pixels.

SVDModes([mmax, oddra])

Parallel container for holding SVD m-mode data.

SVDSpectrum(*args, **kwargs)

Container for an m-mode SVD spectrum.

SampleVarianceContainer(*args, **kwargs)

Base container for holding the sample variance over observations.

SiderealBaselineMask([ra])

A container for holding a baseline-dependent mask for a sidereal stream.

SiderealContainer([ra])

A pipeline container for data with an RA axis.

SiderealGainData([ra])

Parallel container for holding sidereal gain data.

SiderealRFIMask([ra])

A container for holding an RFI mask for a sidereal stream.

SiderealRFIMaskByPol([ra])

A container for holding a polarisation-dependent RFI mask as a function of RA.

SiderealStream(*args, **kwargs)

A container for holding a visibility dataset in sidereal time.

SourceCatalog(*args, **kwargs)

A basic container for holding astronomical source catalogs.

SpatialDelayCube([cosmology])

Container for a data in (pol,delays,u,v) domain.

SpectroscopicCatalog(*args, **kwargs)

A container for spectroscopic catalogs.

Stack3D(*args, **kwargs)

Container for a 3D frequency stack.

StaticGainData(*args, **kwargs)

Parallel container for holding static gain data (i.e. non time varying).

SystemSensitivity(*args, **kwargs)

A container for holding the total system sensitivity.

TODContainer(*args, **kwargs)

A pipeline container for time ordered data.

TableBase(*args, **kwargs)

A base class for containers holding tables of data.

TimeStream(*args, **kwargs)

A container for holding a visibility dataset in time.

TrackBeam([theta, phi, coords, track_type])

Container for a sequence of beam samples at arbitrary locations on the sphere.

VisBandpassCompensate(*args, **kwargs)

Container for window-compensated bandpass gains.

VisBandpassCompensateBaseline(*args, **kwargs)

Container for window-compensated bandpass gains.

VisBandpassCompensateBaselineRA([ra])

Container for window-compensated bandpass gains.

VisBandpassWindow(*args, **kwargs)

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

VisBandpassWindowBaseline(*args, **kwargs)

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

VisBandpassWindowBaselineRA([ra])

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

VisBase(*args, **kwargs)

A very basic class for visibility data.

VisContainer(*args, **kwargs)

A base container for holding a visibility dataset.

VisGridStream([ra])

Visibilities gridded into a 2D array.

WaveletSpectrum(*args, **kwargs)

Container for a wavelet power spectrum.

class draco.core.containers.BaselineMask(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer

A container for holding a baseline-dependent mask for a timestream.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

Unlike RFIMask, this is distributed by default.

property mask

Get the mask dataset.

property stack

The stack definition as an index (and conjugation) of a member product.

class draco.core.containers.CommonModeGainData(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer, GainDataBase

Parallel container for holding gain data common to all inputs.

class draco.core.containers.CommonModeSiderealGainData(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer, GainDataBase

Parallel container for holding sidereal gain data common to all inputs.

class draco.core.containers.ContainerBase(*args, **kwargs)[source]

Bases: BasicCont

A base class for pipeline containers.

This class is designed to do much of the work of setting up pipeline containers. It should be derived from, and two variables set _axes and _dataset_spec. See the Notes section for details.

Parameters:
  • data_group (memh5.MemDiskGroup) – A container to pass through for making a shallow copy. This is used by routine like caput.tod.concatenate and generally shouldn’t be used directly. Either a keyword argument, or the first positional argument.

  • axes_from (memh5.BasicCont, optional) – Another container to copy axis definitions from. Must be supplied as keyword argument.

  • attrs_from (memh5.BasicCont, optional) – Another container to copy attributes from. Must be supplied as keyword argument. This applies to attributes in default datasets too.

  • dsets_from (memh5.BasicCont, optional) – A container to copy datasets from. Any dataset which an axis whose definition has been explicitly set (i.e. does not come from axes_from) will not be copied.

  • copy_from (memh5.BasicCont, optional) – Set axes_from, attrs_from and dsets_from to this instance if they are not set explicitly.

  • skip_datasets (bool, optional) – Skip creating datasets. They must all be added manually with .add_dataset regardless of the entry in .dataset_spec. Default is False.

  • distributed (bool, optional) – Should this be a distributed container. Defaults to True.

  • comm (mpi4py.MPI.Comm, optional) – The MPI communicator to distribute over. Use COMM_WORLD if not set.

  • allow_chunked (bool, optional) – Allow the datasets to be chunked. Default is True.

  • kwargs (dict) – Should contain entries for all other axes.

Notes

Inheritance from other ContainerBase subclasses should work as expected, with datasets defined in super classes appearing as expected, and being overridden where they are redefined in the derived class.

The variable _axes should be a tuple containing the names of axes that datasets in this container will use.

The variable _dataset_spec should define the datasets. It’s a dictionary with the name of the dataset as key. Each entry should be another dictionary, the entry ‘axes’ is mandatory and should be a list of the axes the dataset has (these should correspond to entries in _axes), as is dtype which should be a datatype understood by numpy. Other possible entries are:

  • initialise : if set to True the dataset will be created as the container is initialised.

  • distributed : the dataset will be distributed if the entry is True, if False it won’t be, and if not set it will be distributed if the container is set to be.

  • distributed_axis : the axis to distribute over. Should be a name given in the axes entry.

add_dataset(name)[source]

Create an empty dataset.

The dataset must be defined in the specification for the container.

Parameters:

name (string) – Name of the dataset to create.

Returns:

dset

Return type:

memh5.MemDataset

property axes

The set of axes for this container including any defined on the instance.

property dataset_spec

Return a copy of the fully resolved dataset specifiction as a dictionary.

property datasets

Return the datasets in this container.

Do not try to add a new dataset by assigning to an item of this property. Use create_dataset instead.

Returns:

datasets – Entries are caput.memh5 datasets.

Return type:

read only dictionary

class draco.core.containers.CosmologyContainer(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: ContainerBase

A baseclass for a container that is referenced to a background Cosmology.

Parameters:

cosmology – An explicit cosmology instance or dict representation. If not set, the cosmology must get set via attrs_from.

property cosmology

The background cosmology.

class draco.core.containers.DataWeightContainer(*args, **kwargs)[source]

Bases: ContainerBase

A base class for containers with generic data/weight datasets.

This is meant such that tasks can operate generically over containers with this common structure. The data and weight datasets are expected to have the same size, though this isn’t checked. Subclasses must define _data_dset_name and _weight_dset_name.

property data: MemDataset

The main dataset.

property weight: MemDataset

The weights for each data point.

class draco.core.containers.DelayContainer(*args, **kwargs)[source]

Bases: ContainerBase

A container with a delay axis.

property delay: ndarray

The delay axis in microseconds.

class draco.core.containers.DelayCrossSpectrum(*args, weight_boost=1.0, sample=1, **kwargs)[source]

Bases: DelaySpectrum

Container for a delay cross power spectra.

property spectrum

Get the spectrum dataset.

class draco.core.containers.DelayCutoff(*args, **kwargs)[source]

Bases: ContainerBase

Container for a delay cutoff.

property cutoff

Get the cutoff dataset.

property el

Get the el axis.

property pol

Get the pol axis.

class draco.core.containers.DelaySpectrum(*args, weight_boost=1.0, sample=1, **kwargs)[source]

Bases: DelayContainer

Container for a delay power spectrum.

Notes

A note about definitions: for a dataset with a frequency axis, the corresponding delay spectrum is the result of Fourier transforming in frequency, while the delay power spectrum is obtained by taking the squared magnitude of each element of the delay spectrum, and then usually averaging over some other axis. Our unfortunate convention is to store a delay power spectrum in a DelaySpectrum container, and store a delay spectrum in a DelayTransform container.

property freq

Get the frequency axis of the input data.

property spectrum

Get the spectrum dataset.

property weight_boost

Get the weight boost factor.

If set, this factor was used to set the assumed noise when computing the spectrum.

class draco.core.containers.DelayTransform(weight_boost=1.0, *args, **kwargs)[source]

Bases: DelayContainer

Container for a delay spectrum.

Notes

See the docstring for DelaySpectrum for a description of the difference between DelayTransform and DelaySpectrum.

property freq

Get the frequency axis of the input data.

property spectrum

Get the spectrum dataset.

property weight_boost

Get the weight boost factor.

If set, this factor was used to set the assumed noise when computing the spectrum.

class draco.core.containers.FitFormedBeam(*args, **kwargs)[source]

Bases: FormedBeam

Container for formed beams fit to a primary beam model versus hour angle.

property background

Get the background dataset.

property corr_background_beam

Get the corr_background_beam dataset.

property weight_background

Get the weight_background dataset.

class draco.core.containers.FitFormedBeamEW(*args, **kwargs)[source]

Bases: FitFormedBeam

Container for formed beams fit to a primary beam model versus hour angle.

These have not been collapsed along the east west baseline (ew) axis.

property ew

Get the ew index map.

class draco.core.containers.FormedBeam(*args, **kwargs)[source]

Bases: FreqContainer, DataWeightContainer

Container for formed beams.

property beam

Get the beam dataset.

property frequency

Get the frequency axis.

property id

Get the object id axis.

property pol

Get the pol axis.

property position

Get the position dataset.

property redshift

Get the redshift dataset.

class draco.core.containers.FormedBeamHA(*args, **kwargs)[source]

Bases: FormedBeam

Container for formed beams.

These have not been collapsed in the hour angle (HA) axis.

property ha

Get the hour angle dataset.

class draco.core.containers.FormedBeamHAEW(*args, **kwargs)[source]

Bases: FormedBeamHA

Container for formed beams constructed from a HybridVisStream.

These have not been collapsed along the hour angle (ha) or east west baseline (ew) axis.

property ew

Get the ew index map.

class draco.core.containers.FormedBeamHAMask(*args, **kwargs)[source]

Bases: FormedBeamMask

Mask bad formed beams as a function of hour angle.

class draco.core.containers.FormedBeamMask(*args, **kwargs)[source]

Bases: FreqContainer

Mask bad formed beams.

property mask

Get the mask dataset.

class draco.core.containers.Fourier3DContainer(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: CosmologyContainer, DelayContainer

A base container with Fourier axes, (pol,delay,u,v).

property freq_center

Get the central frequency attrs.

property kpara

Get the k_parallel axis.

property kx

Get the kx axis.

property ky

Get the ky axis.

property redshift

Get the redshift attrs.

property uv_mask

Get the uv-domain mask.

class draco.core.containers.FreqContainer(*args, **kwargs)[source]

Bases: ContainerBase

A pipeline container for data with a frequency axis.

This works like a normal ContainerBase container, but already has a freq axis defined, and specific properties for dealing with frequencies.

property freq

The physical frequency associated with each entry of the time axis.

By convention this property should return the frequency in MHz at the centre of each of frequency channel.

class draco.core.containers.FrequencyStack(*args, **kwargs)[source]

Bases: FreqContainer, DataWeightContainer

Container for a frequency stack.

In general used to hold the product of draco.analysis.SourceStack The stacked signal of frequency slices of the data in the direction of sources of interest.

property stack

Get the stack dataset.

class draco.core.containers.FrequencyStackByPol(*args, **kwargs)[source]

Bases: FrequencyStack

Container for a frequency stack split by polarisation.

property pol

Get the pol axis.

class draco.core.containers.GainData(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer, GainDataBase

Parallel container for holding gain data.

property input

Get the input axis.

property update_id

Get the update id dataset if it exists.

class draco.core.containers.GainDataBase(*args, **kwargs)[source]

Bases: DataWeightContainer

A container interface for gain-like data.

To support the previous behaviour of gain type data the weight dataset is optional, and returns None if it is not present.

property gain: MemDataset

Get the gain dataset.

property weight: MemDataset | None

The weights for each data point.

Returns None is no weight dataset exists.

class draco.core.containers.GridBeam(coords='celestial', *args, **kwargs)[source]

Bases: FreqContainer, DataWeightContainer

Generic container for representing a 2D beam on a rectangular grid.

property beam

Get the beam dataset.

property coords

Get the coordinates attribute.

property gain

Get the gain dataset.

property input

Get the input axis.

property phi

Get the phi axis.

property pol

Get the pol axis.

property quality

Get the quality dataset.

property theta

Get the theta axis.

class draco.core.containers.HEALPixBeam(coords='unknown', ordering='unknown', *args, **kwargs)[source]

Bases: FreqContainer, HealpixContainer, DataWeightContainer

Container for representing the spherical 2-d beam in a HEALPix grid.

Parameters:
  • ordering ({"nested", "ring"}) – The HEALPix ordering scheme used for the beam map.

  • coords ({"celestial", "galactic", "telescope"}) – The coordinate system that the beam map is defined on.

property beam

Get the beam dataset.

property coords

Get the coordinate attribute.

property input

Get the input axis.

property nside

Get the nsides of the map.

property ordering

Get the ordering attribute.

property pol

Get the pol axis.

class draco.core.containers.HealpixContainer(nside=None, *args, **kwargs)[source]

Bases: ContainerBase

Base class container for holding Healpix map data.

Parameters:

nside (int) – The nside of the Healpix maps.

property nside

Get the nside of the map.

class draco.core.containers.HybridVisMModes(mmax: int | None = None, oddra: bool | None = None, *args, **kwargs)[source]

Bases: FreqContainer, MContainer, VisBase

Visibilities beamformed in the NS direction and m-mode transformed in RA.

This container has visibilities beam formed only in the NS direction to give a grid in elevation.

class draco.core.containers.HybridVisStream(*args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer, VisBase

Visibilities beamformed only in the NS direction.

This container has visibilities beam formed only in the NS direction to give a grid in elevation.

add_dataset(name)[source]

Override base class to first check that multiple filters are not created.

property dirty_beam

Not useful at this stage, but it’s needed to propagate onward.

property effective_ra

Get the effective_ra dataset if it exists, None otherwise.

property ew

Get the east-west baseline index map.

property filter

Return the filter dataset, if available.

property nsample

Get the nsample dataset if it exists, None otherwise.

property pol

Get the polarisation index map.

class draco.core.containers.KLModes(mmax: int | None = None, oddra: bool | None = None, *args, **kwargs)[source]

Bases: SVDModes

Parallel container for holding KL filtered m-mode data.

Parameters:

mmax (integer, optional) – Largest m to be held.

class draco.core.containers.LocalizedRFIMask(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer

Container for an RFI mask for each freq, el, and time sample.

The data frac_rfi stores information about the proportion of subdata that detected RFI, which is used to generate the mask.

property el

Get the el axis.

property frac_rfi

Get the frac_rfi dataset.

property mask

Get the mask dataset.

class draco.core.containers.LocalizedSiderealRFIMask(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer

Container for an RFI mask for each freq, ra, and el sample.

The data frac_rfi stores information about the proportion of subdata that detected RFI, which is used to generate the mask.

property el

Get the el axis.

property frac_rfi

Get the frac_rfi dataset.

property mask

Get the mask dataset.

class draco.core.containers.MContainer(mmax: int | None = None, oddra: bool | None = None, *args, **kwargs)[source]

Bases: ContainerBase

Container for holding m-mode type data.

Note this container will have an msign axis even though not all m-mode based data needs one. As always this is not an issue, datasets that don’t need it are not required to list it in their axes list.

Parameters:
  • mmax (integer, optional) – Largest m to be held.

  • oddra (bool, optional) – Does this MContainer come from an underlying odd number of RA points. This determines if the largest negative m is filled or not (it is for odd=True, not for odd=False). Default is odd=False.

property mmax: int

The maximum m stored.

property oddra: bool

Whether this represents an odd or even number of RA points.

class draco.core.containers.MModes(*args, **kwargs)[source]

Bases: FreqContainer, VisContainer, MContainer

Parallel container for holding m-mode data.

vis

Visibility array.

Type:

mpidataset.MPIArray

weight

Array of weights for each point.

Type:

mpidataset.MPIArray

class draco.core.containers.Map(polarisation=True, *args, **kwargs)[source]

Bases: FreqContainer, HealpixContainer

Container for holding multi-frequency sky maps.

The maps are packed in format [freq, pol, pixel] where the polarisations are Stokes I, Q, U and V, and the pixel dimension stores a Healpix map.

Parameters:
  • nside (int) – The nside of the Healpix maps.

  • polarisation (bool, optional) – If True all Stokes parameters are stored, if False only Stokes I is stored.

property map

Get the map dataset.

class draco.core.containers.MockFrequencyStack(*args, **kwargs)[source]

Bases: FrequencyStack

Container for holding a frequency stack for multiple mock catalogs.

Adds a mock axis as the first dimension of each dataset.

class draco.core.containers.MockFrequencyStackByPol(*args, **kwargs)[source]

Bases: FrequencyStackByPol

Container for holding a frequency stack split by pol for multiple mock catalogs.

Adds a mock axis as the first dimension of each dataset.

class draco.core.containers.PowerSpectrum1D(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: CosmologyContainer

Container for a 1D power spectrum.

property k1D

Get the k1D dataset.

property neff

Get the 1D power spectrum var dataset.

property samp_var

Get the 1D power spectrum error dataset.

property spectrum

Get the 1D power spectrum dataset.

property var

Get the 1D power spectrum var dataset.

class draco.core.containers.PowerSpectrum2D(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: CosmologyContainer

Container for a 2D cylindrically averaged power spectrum.

property delay_cut

Get the delay cutoff value.

property kpara

Get the k_parallel axis.

property kperp

Get the kprep axis.

property mask

Get the 2D signal window dataset.

property neff

Get the effective number of modes dataset.

property spectrum

Get the 2D power spectrum dataset.

property weight

Get the 2D weight dataset.

class draco.core.containers.PowerSpectrum3D(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: Fourier3DContainer

Container for a 3D power spectrum.

property ps_norm

Get the power spectrum normalizaiton attrs.

property spectrum

Get the 3D power spectrum.

class draco.core.containers.Powerspectrum2D(kperp_edges=None, kpar_edges=None, *args, **kwargs)[source]

Bases: ContainerBase

Container for a 2D cartesian power spectrum.

Generally you should set the standard attributes z_start and z_end with the redshift range included in the power spectrum estimate, and the type attribute with a description of the estimator type. Suggested valued for type are:

unwindowed

The standard unbiased quadratic estimator.

minimum_variance

The minimum variance, but highly correlated, estimator. Just a rescaled version of the q-estimator.

uncorrelated

The uncorrelated estimator using the root of the Fisher matrix.

Parameters:
  • kpar_edges (np.ndarray) – Array of the power spectrum bin boundaries.

  • kperp_edges (np.ndarray) – Array of the power spectrum bin boundaries.

property C_inv

Get the C inverse dataset.

property powerspectrum

Get the powerspectrum dataset.

class draco.core.containers.RFIMask(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer

A container for holding an RFI mask for a timestream.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

property mask

Get the mask dataset.

class draco.core.containers.RFIMaskByPol(*args, **kwargs)[source]

Bases: RFIMask

A container for holding a polarisation-dependent RFI mask as a function of time.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

property pol

Get the pol index map.

class draco.core.containers.RingMap(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer, DataWeightContainer

Container for holding multifrequency ring maps.

The maps are packed in format [freq, pol, ra, EW beam, el] where the polarisations are Stokes I, Q, U and V.

Parameters:
  • nside (int) – The nside of the Healpix maps.

  • polarisation (bool, optional) – If True all Stokes parameters are stored, if False only Stokes I is stored.

property dirty_beam

Get the dirty beam dataset.

property el

Get the el axis.

property map

Get the map dataset.

property pol

Get the pol axis.

property rms

Get the rms dataset.

class draco.core.containers.RingMapMask(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer

Mask bad ringmap pixels.

property mask

Get the mask dataset.

class draco.core.containers.SVDModes(mmax: int | None = None, oddra: bool | None = None, *args, **kwargs)[source]

Bases: MContainer, VisBase

Parallel container for holding SVD m-mode data.

Parameters:

mmax (integer, optional) – Largest m to be held.

property nmode

Get the nmode dataset.

class draco.core.containers.SVDSpectrum(*args, **kwargs)[source]

Bases: ContainerBase

Container for an m-mode SVD spectrum.

property spectrum

Get the spectrum dataset.

class draco.core.containers.SampleVarianceContainer(*args, **kwargs)[source]

Bases: ContainerBase

Base container for holding the sample variance over observations.

This works like ContainerBase but provides additional capabilities for containers that may be used to hold the sample mean and variance over complex-valued observations. These capabilities include automatic definition of the component axis, properties for accessing standard datasets, properties that rotate the sample variance into common bases, and a sample_weight property that provides an equivalent to the weight dataset that is determined from the sample variance over observations.

Subclasses must include a sample_variance and nsample dataset in there _dataset_spec dictionary. They must also specify a _mean property that returns the dataset containing the mean over observations.

property component

Get the component axis.

property nsample

Get the nsample dataset if it exists.

property sample_variance

Convenience access to the sample variance dataset.

Returns:

C – The variance over the dimension that was stacked (e.g., sidereal days, holographic observations) in the default real-imaginary basis. The array is packed into upper-triangle format such that the component axis contains [(‘real’, ‘real’), (‘real’, ‘imag’), (‘imag’, ‘imag’)].

Return type:

np.ndarray[ncomponent, …]

property sample_variance_amp_phase

Calculate the amplitude/phase covariance.

This interpretation is only valid if the fractional variations in the amplitude and phase are small.

Returns:

C – The observed amplitude/phase covariance matrix, packed into upper triangle format such that the component axis contains [(‘amp’, ‘amp’), (‘amp’, ‘phase’), (‘phase’, ‘phase’)].

Return type:

np.ndarray[ncomponent, …]

property sample_variance_iq

Rotate the sample variance to the in-phase/quadrature basis.

Returns:

C – The sample_variance dataset in the in-phase/quadrature basis, packed into upper triangle format such that the component axis contains [(‘I’, ‘I’), (‘I’, ‘Q’), (‘Q’, ‘Q’)].

Return type:

np.ndarray[ncomponent, …]

property sample_weight

Calculate a weight from the sample variance.

Returns:

weight – The trace of the sample_variance dataset is used as an estimate of the total variance and divided by the nsample dataset to yield the uncertainty on the mean. The inverse of this quantity is returned, and can be compared directly to the weight dataset.

Return type:

np.ndarray[…]

class draco.core.containers.SiderealBaselineMask(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer

A container for holding a baseline-dependent mask for a sidereal stream.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

Unlike SiderealRFIMask, this is distributed by default.

property mask

Get the mask dataset.

property stack

The stack definition as an index (and conjugation) of a member product.

class draco.core.containers.SiderealContainer(ra=None, *args, **kwargs)[source]

Bases: ContainerBase

A pipeline container for data with an RA axis.

This works like a normal ContainerBase container, but already has an RA axis defined, and specific properties for dealing with this axis.

Note that Right Ascension is a fairly ambiguous term. What is typically meant here is the Local Stellar Angle, which is the transiting RA in CIRS coordinates. This is similar to J2000/ICRS with the minimal amount of coordinate rotation to account for the polar axis precession.

Parameters:

ra (array or int, optional) – Either the explicit locations of samples of the RA axis, or if passed an integer interpret this as a number of samples dividing the full sidereal day and create an axis accordingly.

property ra

The RA in degrees associated with each sample of the RA axis.

class draco.core.containers.SiderealGainData(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer, GainDataBase

Parallel container for holding sidereal gain data.

property input

Get the input axis.

class draco.core.containers.SiderealRFIMask(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer

A container for holding an RFI mask for a sidereal stream.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

property mask

Get the mask dataset.

class draco.core.containers.SiderealRFIMaskByPol(ra=None, *args, **kwargs)[source]

Bases: SiderealRFIMask

A container for holding a polarisation-dependent RFI mask as a function of RA.

The mask is True for contaminated samples that should be excluded, and False for clean samples.

property pol

Get the pol index map.

class draco.core.containers.SiderealStream(*args, **kwargs)[source]

Bases: FreqContainer, VisContainer, SiderealContainer, SampleVarianceContainer

A container for holding a visibility dataset in sidereal time.

Parameters:

ra (int) – The number of points to divide the RA axis up into.

property effective_ra

Get the effective_ra dataset if it exists, None otherwise.

property gain

Get the gain dataset.

property input_flags

Get the input_flags dataset.

class draco.core.containers.SourceCatalog(*args, **kwargs)[source]

Bases: TableBase

A basic container for holding astronomical source catalogs.

Notes

The ra and dec coordinates should be ICRS.

class draco.core.containers.SpatialDelayCube(cosmology: Cosmology | dict | None = None, *args, **kwargs)[source]

Bases: Fourier3DContainer

Container for a data in (pol,delays,u,v) domain.

property vis

Get the spatial data cube.

class draco.core.containers.SpectroscopicCatalog(*args, **kwargs)[source]

Bases: SourceCatalog

A container for spectroscopic catalogs.

class draco.core.containers.Stack3D(*args, **kwargs)[source]

Bases: FreqContainer, DataWeightContainer

Container for a 3D frequency stack.

property stack

Get the stack dataset.

class draco.core.containers.StaticGainData(*args, **kwargs)[source]

Bases: FreqContainer, GainDataBase

Parallel container for holding static gain data (i.e. non time varying).

property input

Get the input axis.

class draco.core.containers.SystemSensitivity(*args, **kwargs)[source]

Bases: FreqContainer, TODContainer

A container for holding the total system sensitivity.

This should be averaged/collapsed in the stack/prod axis to provide an overall summary of the system sensitivity. Two datasets are available: the measured noise from the visibility weights and the radiometric estimate of the noise from the autocorrelations.

property frac_lost

Get the frac_lost dataset.

property measured

Get the measured noise dataset.

property pol

Get the pol axis.

property radiometer

Get the radiometer estimate dataset.

property weight

Get the weight dataset.

class draco.core.containers.TODContainer(*args, **kwargs)[source]

Bases: ContainerBase, TOData

A pipeline container for time ordered data.

This works like a normal ContainerBase container, with the added ability to be concatenated, and treated like a a tod.TOData instance.

class draco.core.containers.TableBase(*args, **kwargs)[source]

Bases: ContainerBase

A base class for containers holding tables of data.

Similar to the ContainerBase class, the container is defined through a dictionary given as a _table_spec class attribute. The container may also hold generic datasets by specifying _dataset_spec as with ContainerBase. See Notes for details.

Parameters:
  • axes_from (memh5.BasicCont, optional) – Another container to copy axis definitions from. Must be supplied as keyword argument.

  • attrs_from (memh5.BasicCont, optional) – Another container to copy attributes from. Must be supplied as keyword argument. This applies to attributes in default datasets too.

  • kwargs (dict) – Should contain definitions for all other table axes.

Notes

A _table_spec consists of a dictionary mapping table names into a description of the table. That description is another dictionary containing several entries.

  • columns : the set of columns in the table. Given as a list of (name, dtype) pairs.

  • axis : an optional name for the rows of the table. This is automatically generated as ‘<tablename>_index’ if not explicitly set. This corresponds to an index_map entry on the container.

  • initialise : whether to create the table by default.

  • distributed : whether the table is distributed, or common across all MPI ranks.

An example _table_spec entry is:

_table_spec = {
    'quasars': {
        'columns': [
            ['ra': np.float64],
            ['dec': np.float64],
            ['z': np.float64]
        ],
        'distributed': False,
        'axis': 'quasar_id'
    }
    'quasar_mask': {
        'columns': [
            ['mask', bool]
        ],
        'axis': 'quasar_id'
    }
}
property table_spec

Return a copy of the fully resolved table specifiction as a dictionary.

class draco.core.containers.TimeStream(*args, **kwargs)[source]

Bases: FreqContainer, VisContainer, TODContainer

A container for holding a visibility dataset in time.

This should look similar enough to the CHIME CorrData container that they can be used interchangably in most cases.

property gain

Get the gain dataset.

property input_flags

Get the input_flags dataset.

class draco.core.containers.TrackBeam(theta=None, phi=None, coords='celestial', track_type='drift', *args, **kwargs)[source]

Bases: FreqContainer, SampleVarianceContainer, DataWeightContainer

Container for a sequence of beam samples at arbitrary locations on the sphere.

The axis of the beam samples is ‘pix’, defined by the numpy.dtype [(‘theta’, np.float32), (‘phi’, np.float32)].

property beam

Get the beam dataset.

property coords

Get the coordinates attribute.

property gain

Get the gain dataset.

property input

Get the input axis.

property pix

Get the pix axis.

property pol

Get the pol axis.

property track_type

Get the track type attribute.

class draco.core.containers.VisBandpassCompensate(*args, **kwargs)[source]

Bases: FreqContainer

Container for window-compensated bandpass gains.

property comp_bandpass

Get the comp_bandpass dataset.

property sval

Get the sval dataset.

class draco.core.containers.VisBandpassCompensateBaseline(*args, **kwargs)[source]

Bases: VisBandpassCompensate

Container for window-compensated bandpass gains.

property comp_bandpass

Get the comp_bandpass dataset.

property sval

Get the sval dataset.

class draco.core.containers.VisBandpassCompensateBaselineRA(ra=None, *args, **kwargs)[source]

Bases: SiderealContainer, VisBandpassCompensateBaseline

Container for window-compensated bandpass gains.

property comp_bandpass

Get the comp_bandpass dataset.

property rank

Get the sval dataset.

class draco.core.containers.VisBandpassWindow(*args, **kwargs)[source]

Bases: FreqContainer

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

property bandpass

Get the bandpass dataset.

property window

Get the window dataset.

class draco.core.containers.VisBandpassWindowBaseline(*args, **kwargs)[source]

Bases: VisBandpassWindow

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

property bandpass

Get the bandpass dataset.

property window

Get the window dataset.

class draco.core.containers.VisBandpassWindowBaselineRA(ra=None, *args, **kwargs)[source]

Bases: SiderealContainer, VisBandpassWindowBaseline

Container for bandpass gains and their window estimated by running bandpass HyFoReS on hybrid beam-formed visibilities.

property bandpass

Get the bandpass dataset.

property window

Get the window dataset.

class draco.core.containers.VisBase(*args, **kwargs)[source]

Bases: DataWeightContainer

A very basic class for visibility data.

For better support for input/prod/stack structured data use VisContainer.

property vis

The visibility like dataset.

class draco.core.containers.VisContainer(*args, **kwargs)[source]

Bases: VisBase

A base container for holding a visibility dataset.

This works like a ContainerBase container, with the ability to create visibility specific axes, if they are not passed as a kwargs parameter.

Additionally this container has visibility specific defined properties such as ‘vis’, ‘weight’, ‘freq’, ‘input’, ‘prod’, ‘stack’, ‘prodstack’, ‘conjugate’.

Parameters:
  • axes_from (memh5.BasicCont, optional) – Another container to copy axis definitions from. Must be supplied as keyword argument.

  • attrs_from (memh5.BasicCont, optional) – Another container to copy attributes from. Must be supplied as keyword argument. This applies to attributes in default datasets too.

  • kwargs (dict) – Should contain entries for all other axes.

property input

The correlated inputs.

property is_stacked

Test if the data has been stacked or not.

property prod

All the pairwise products that are represented in the data.

property prodstack

A pair of input indices representative of those in the stack.

Note, these are correctly conjugated on return, and so calculations of the baseline and polarisation can be done without additionally looking up the stack conjugation.

property stack

The stacks definition as an index (and conjugation) of a member product.

class draco.core.containers.VisGridStream(ra=None, *args, **kwargs)[source]

Bases: FreqContainer, SiderealContainer, VisBase

Visibilities gridded into a 2D array.

Only makes sense for an array which is a cartesian grid.

property redundancy

Get the redundancy dataset.

class draco.core.containers.WaveletSpectrum(*args, **kwargs)[source]

Bases: FreqContainer, DelayContainer, DataWeightContainer

Container for a wavelet power spectrum.

property spectrum

The wavelet spectrum.

draco.core.containers.copy_datasets_filter(source: ContainerBase, dest: ContainerBase, axis: str | list | tuple = [], selection: ndarray | list | slice | dict = {}, exclude_axes: list[str] | None = None, copy_without_selection: bool = False)[source]

Copy datasets while filtering a given axis.

Only datasets containing the axis to be filtered will be copied.

Parameters:
  • source – Source container

  • dest – Destination container. The axes in this container should reflect the selections being made to the source.

  • axis – Name of the axes to filter. These must match the axes in selection, unless selection is a single item. This is partially here for legacy reasons, as the selections can be fully specified by selection

  • selection – A filtering selection to be applied to each axis.

  • exclude_axes – An optional set of axes that if a dataset contains one means it will not be copied.

  • copy_without_selection – If set to True, then datasets that do not have an axis appearing in selection will still be copied over in full. Default is False.

draco.core.containers.empty_like(obj, **kwargs)[source]

Create an empty container like obj.

Parameters:
  • obj (ContainerBase) – Container to base this one off.

  • kwargs (optional) – Optional definitions of specific axes we want to override. Works in the same way as the ContainerBase constructor, though axes_from=obj and attrs_from=obj are implied.

Returns:

newobj – New data container.

Return type:

container.ContainerBase

draco.core.containers.empty_timestream(**kwargs)[source]

Create a new timestream container.

This indirect call exists so it can be replaced to return custom timestream types.

Parameters:

kwargs (optional) – Arguments to pass to the timestream constructor.

Returns:

ts

Return type:

TimeStream