draco.analysis.beamform

Beamform visibilities to the location of known sources.

Functions

icrs_to_cirs(ra, dec, epoch[, apparent])

Convert a set of positions from ICRS to CIRS at a given data.

Classes

BeamForm()

BeamForm for a single source catalog and multiple visibility datasets.

BeamFormBase()

Base class for beam forming tasks.

BeamFormCat()

BeamForm for multiple source catalogs and a single visibility dataset.

BeamFormExternal()

Beamform a single catalog and multiple datasets using an external beam model.

BeamFormExternalCat()

Beamform multiple catalogs and a single dataset using an external beam model.

BeamFormExternalMixin()

Base class for tasks that beamform using an external model of the primary beam.

FitBeamFormed()

Fit beamformed visibilities as a function of hour angle to a primary beam model.

HealpixBeamForm()

Beamform by extracting the pixel containing each source form a Healpix map.

HybridVisBeamForm()

Beamform on a catalog of sources using the HybridVisStream data product.

RingMapBeamForm()

Beamform by extracting the pixel containing each source form a RingMap.

RingMapStack2D()

Stack RingMap's on sources directly.

class draco.analysis.beamform.BeamForm[source]

Bases: BeamFormBase

BeamForm for a single source catalog and multiple visibility datasets.

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(data)[source]

Parse the visibility data and beamforms all sources.

Parameters:

data (containers.SiderealStream or containers.TimeStream) – Data to beamform on.

Returns:

formed_beam – Formed beams at each source.

Return type:

containers.FormedBeam or containers.FormedBeamHA

setup(manager, source_cat)[source]

Parse the source catalog and performs the generic setup.

Parameters:
  • manager (either ProductManager, BeamTransfer or TransitTelescope) – Contains a TransitTelescope object describing the telescope.

  • source_cat (containers.SourceCatalog) – Catalog of points to beamform at.

class draco.analysis.beamform.BeamFormBase[source]

Bases: SingleTask

Base class for beam forming tasks.

Defines a few useful methods. Not to be used directly but as parent class for BeamForm and BeamFormCat.

collapse_ha

Sum over hour-angle/time to complete the beamforming. Default is True.

Type:

bool

polarization
Determines the polarizations that will be output:
  • ‘I’ : Stokes I only.

  • ‘full’ : ‘XX’, ‘XY’, ‘YX’ and ‘YY’ in this order. (default)

  • ‘copol’ : ‘XX’ and ‘YY’ only.

  • ‘stokes’ : ‘I’, ‘Q’, ‘U’ and ‘V’ in this order. Not implemented.

Type:

string

weight
How to weight the redundant baselines when adding:
  • ‘natural’ : each baseline weighted by its redundancy (default)

  • ‘uniform’ : each baseline given equal weight

  • ‘inverse_variance’ : each baseline weighted by the weight attribute

Type:

string

no_beam_model

Do not include a primary beam factor in the beamforming weights, i.e., use uniform weighting as a function of hour angle and declination.

Type:

string

timetrack

How long (in seconds) to track sources at each side of transit. Default is 900 seconds. Total transit time will be 2 * timetrack.

Type:

float

variable_timetrack

Scale the total time to track each source by the secant of the source declination, so that all sources are tracked through the same angle on the sky. Default is False.

Type:

bool

freqside

Number of frequencies to process at each side of the source. Default (None) processes all frequencies.

Type:

int

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process()[source]

Generic process method.

Performs all the beamforming, but not the data parsing. To be complemented by specific process methods in daughter tasks.

Returns:

formed_beam – Formed beams at each source. Shape depends on parameter collapse_ha.

Return type:

containers.FormedBeam or containers.FormedBeamHA

process_finish()[source]

Clear lists holding copies of data.

These lists will persist beyond this task being done, so the data stored there will continue to use memory.

setup(manager)[source]

Generic setup method.

To be complemented by specific setup methods in daughter tasks.

Parameters:

manager (either ProductManager, BeamTransfer or TransitTelescope) – Contains a TransitTelescope object describing the telescope.

class draco.analysis.beamform.BeamFormCat[source]

Bases: BeamFormBase

BeamForm for multiple source catalogs and a single visibility dataset.

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(source_cat)[source]

Parse the source catalog and beamforms all sources.

Parameters:

source_cat (containers.SourceCatalog) – Catalog of points to beamform at.

Returns:

formed_beam – Formed beams at each source.

Return type:

containers.FormedBeam or containers.FormedBeamHA

setup(manager, data)[source]

Parse the visibility data and performs the generic setup.

Parameters:
  • manager (either ProductManager, BeamTransfer or TransitTelescope) – Contains a TransitTelescope object describing the telescope.

  • data (containers.SiderealStream or containers.TimeStream) – Data to beamform on.

class draco.analysis.beamform.BeamFormExternal[source]

Bases: BeamFormExternalMixin, BeamForm

Beamform a single catalog and multiple datasets using an external beam model.

The setup method requires [beam, manager, source_cat] as arguments.

class draco.analysis.beamform.BeamFormExternalCat[source]

Bases: BeamFormExternalMixin, BeamFormCat

Beamform multiple catalogs and a single dataset using an external beam model.

The setup method requires [beam, manager, data] as arguments.

class draco.analysis.beamform.BeamFormExternalMixin[source]

Bases: object

Base class for tasks that beamform using an external model of the primary beam.

The primary beam is provided to the task during setup. Do not use this class directly, instead use BeamFormExternal and BeamFormExternalCat.

setup(beam, *args)[source]

Initialize the beam.

Parameters:
  • beam (GridBeam) – Model for the primary beam.

  • args (optional) – Additional argument to pass to the super class

class draco.analysis.beamform.FitBeamFormed[source]

Bases: BeamFormExternalMixin, SingleTask

Fit beamformed visibilities as a function of hour angle to a primary beam model.

Must provide a GridBeam object in celestial coordinates as argument to setup.

weight

How to weight different hour angles during the fit.

Type:

“uniform” or “inverse_variance”

max_ha

Only consider hour angles less than this value in degrees. If not provided, then will include all hour angles in the input container.

Type:

float

epsilon

Regularisation used during the fit.

Type:

float

get_template(pol, dec, ha)[source]

Get the template as a function of hour angle to fit to transit.

Parameters:
  • pol (str) – String specifying the polarisation, either ‘XX’, ‘XY’, ‘YX’, or ‘YY’.

  • dec (float) – The declination of the source in radians.

  • ha (np.ndarray[nha,]) – The hour angle of the source in radians.

Returns:

t – Template for the source transit as a function of hour angle. First column is entirely 1 and corresponds to an overall additive offset. Second column is the primary beam model versus hour angle.

Return type:

np.ndarray[nha, 2]

process(data)[source]

Fit a model to the beamformed visibilites along the hour angle axis.

Parameters:

data (FormedBeamHA or FormedBeamHAEW) – Visibilities beamformed to the location of sources in a catalog.

Returns:

out – Best-fit parameters describing the hour-angle dependence.

Return type:

FitFormedBeam or FitFormedBeamEW

class draco.analysis.beamform.HealpixBeamForm[source]

Bases: SingleTask

Beamform by extracting the pixel containing each source form a Healpix map.

Unless it has an explicit epoch attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed to the CIRS coordinates in the epoch of the map.

fwhm

Smooth the map with a Gaussian with the specified FWHM in degrees. If None (default), leave at native map resolution. This will modify the input map in place.

Type:

float

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(catalog: SourceCatalog) FormedBeam[source]

Extract sources from a ringmap.

Parameters:

catalog – The catalog to extract sources from.

Returns:

The source spectra.

Return type:

formed_beam

setup(hpmap: Map)[source]

Set the map to extract beams from at each catalog location.

Parameters:

hpmap – The Healpix map to extract the sources from.

class draco.analysis.beamform.HybridVisBeamForm[source]

Bases: SingleTask

Beamform on a catalog of sources using the HybridVisStream data product.

window

Window size in degrees. For each source, right ascensions corresponding to abs(ra - source_ra) <= window are extracted from the hybrid beamformed visibility at the declination closest to the sources location. Default is 5 degrees.

Type:

float

ignore_rot

Ignore the telescope rotation_angle when calculating the baseline distances used to beamform in the east-west direction. Defaults to False.

Type:

bool

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(hvis)[source]

Finish beamforming in the east-west direction.

Parameters:

hvis (draco.core.containers.HybridVisStream) – Visibilities beamformed in the north-south direction to a grid of declinations along the meridian.

Returns:

out – Visibilities beamformed to the location of sources in a catalog.

Return type:

draco.core.containers.HybridFormedBeamHA

setup(manager, catalog)[source]

Define the observer and the catalog of sources.

Parameters:
  • manager (draco.core.io.TelescopeConvertible) – Observer object holding the geographic location of the telescope. Note that if ignore_rot is False and this object has a non-zero rotation_angle, then the beamforming will account for the phase due to the north-south component of the rotation.

  • catalog (draco.core.containers.SourceCatalog) – Beamform on sources in this catalog.

class draco.analysis.beamform.RingMapBeamForm[source]

Bases: SingleTask

Beamform by extracting the pixel containing each source form a RingMap.

This is significantly faster than Beamform or BeamformCat with the caveat that they can beamform exactly on a source whereas this task is at the mercy of what was done to produce the RingMap (use DeconvolveHybridM for best results).

Unless it has an explicit lsd attribute, the ring map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed to the CIRS coordinates in the epoch of the map.

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(catalog: SourceCatalog) FormedBeam[source]

Extract sources from a ringmap.

Parameters:

catalog – The catalog to extract sources from.

Returns:

The source spectra.

Return type:

sources

setup(telescope: ProductManager | BeamTransfer | TransitTelescope, ringmap: RingMap)[source]

Set the telescope object.

Parameters:
  • telescope – The telescope object to use.

  • ringmap – The ringmap to extract the sources from. See the class documentation for how the epoch is determined.

class draco.analysis.beamform.RingMapStack2D[source]

Bases: RingMapBeamForm

Stack RingMap’s on sources directly.

Parameters:
  • num_ra (int) – The number of RA and DEC pixels to stack either side of the source.

  • num_dec (int) – The number of RA and DEC pixels to stack either side of the source.

  • num_freq (int) – Number of final frequency channels either side of the source redshift to stack.

  • freq_width (float) – Length of frequency interval either side of source to use in MHz.

  • weight ({"patch", "dec", "enum"}) – How to weight the data. If “input” the data is weighted on a pixel by pixel basis according to the input data. If “patch” then the inverse of the variance of the extracted patch is used. If “dec” then the inverse variance of each declination strip is used.

Initialize pipeline task.

May be overridden with no arguments. Will be called after any config.Property attributes are set and after ‘input’ and ‘requires’ keys are set up.

process(catalog: SourceCatalog) FormedBeam[source]

Extract sources from a ringmap.

Parameters:

catalog – The catalog to extract sources from.

Returns:

The source spectra.

Return type:

sources

draco.analysis.beamform.icrs_to_cirs(ra, dec, epoch, apparent=True)[source]

Convert a set of positions from ICRS to CIRS at a given data.

Parameters:
  • ra (float or np.ndarray) – Positions of source in ICRS coordinates including an optional redshift position.

  • dec (float or np.ndarray) – Positions of source in ICRS coordinates including an optional redshift position.

  • epoch (time_like) – Time to convert the positions to. Can be any type convertible to a time using caput.time.ensure_unix.

  • apparent (bool) – Calculate the apparent position (includes abberation and deflection).

Returns:

ra_cirs, dec_cirs – Arrays of the positions in CIRS coordiantes.

Return type:

float or np.ndarray