draco.analysis.sidereal

Take timestream data and regridding it into sidereal days which can be stacked.

Usage

Generally you would want to use these tasks together. Sending time stream data into SiderealGrouper, then feeding that into SiderealRegridder to grid onto each sidereal day, and then into SiderealStacker if you want to combine the different days.

Functions

get_slice_to_broadcast(weight_axis, dataset_axis)

Generate a slice that will broadcast the weights against some other dataset.

Classes

RebinGradientCorrection()

Apply a linear gradient correction to shift RA samples to bin centres.

SiderealGrouper()

Group individual timestreams together into whole Sidereal days.

SiderealRebinner()

Regrid a sidereal day of data using a binning method.

SiderealRegridder()

Take a sidereal days worth of data, and put onto a regular grid.

SiderealRegridderCubic()

Regrid onto the sidereal day using cubic Hermite spline interpolation.

SiderealRegridderLinear()

Regrid onto the sidereal day using linear interpolation.

SiderealRegridderNearest()

Regrid onto the sidereal day using nearest neighbor interpolation.

SiderealStacker()

Take in a set of sidereal days, and stack them up.

SiderealStackerMatch()

Take in a set of sidereal days, and stack them up.

class draco.analysis.sidereal.RebinGradientCorrection[source]

Bases: SingleTask

Apply a linear gradient correction to shift RA samples to bin centres.

Requires a sidereal day with full sidereal coverage to calculate a local gradient for each RA bin. The dataset value at the RA bin centre is interpolated based on the local gradient and difference between bin centre and effective bin centre.

If the rebinned dataset has full sidereal coverage, it can be used to create the gradient.

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(sstream: SiderealStream) SiderealStream[source]

Apply the gradient correction to the input dataset.

Parameters:

sstream – sidereal day to apply a correction to

Returns:

Input sidereal day with gradient correction applied, if needed

Return type:

sstream

setup(sstream_ref: SiderealStream) None[source]

Provide the dataset to use in the gradient calculation.

This dataset must have complete sidereal coverage.

Parameters:

sstream_ref – Reference SiderealStream

class draco.analysis.sidereal.SiderealGrouper[source]

Bases: SingleTask

Group individual timestreams together into whole Sidereal days.

padding

Extra amount of a sidereal day to pad each timestream by. Useful for getting rid of interpolation artifacts.

Type:

float

offset

Time in seconds to subtract before determining the LSD. Useful if the desired output is not a full sideral stream, but rather a narrow window around source transits on different sideral days. In that case, one should set this quantity to 240 * (source_ra - 180).

Type:

float

min_day_length

Require at least this fraction of a full sidereal day to process.

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(tstream)[source]

Load in each sidereal day.

Parameters:

tstream (containers.TimeStream) – Timestream to group together.

Returns:

ts – Returns the timestream of each sidereal day when we have received the last file, otherwise returns None.

Return type:

containers.TimeStream or None

process_finish()[source]

Return the final sidereal day.

Returns:

ts – Returns the timestream of the final sidereal day if it’s long enough, otherwise returns None.

Return type:

containers.TimeStream or None

setup(manager)[source]

Set the local observers position.

Parameters:

manager (Observer) – An Observer object holding the geographic location of the telescope. Note that TransitTelescope instances are also Observers.

class draco.analysis.sidereal.SiderealRebinner[source]

Bases: SiderealRegridder

Regrid a sidereal day of data using a binning method.

Assign a fraction of each time sample to the nearest RA bin based on the propotion of the time bin that overlaps the RA bin.

Tracks the weighted effective centre of RA bin so that a centring correction can be applied afterwards. A correction option is implemented in RebinGradientCorrection.

Parameters:

weight (str (default: "inverse_variance")) – The weighting to use in the stack. Either uniform or inverse_variance.

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]

Rebin the sidereal day.

Parameters:

data (containers.TimeStream) – Timestream data for the day (must have a LSD attribute).

Returns:

sdata – The regularly gridded sidereal timestream.

Return type:

containers.SiderealStream

class draco.analysis.sidereal.SiderealRegridder[source]

Bases: Regridder

Take a sidereal days worth of data, and put onto a regular grid.

Uses a maximum-likelihood inverse of a Lanczos interpolation to do the regridding. This gives a reasonably local regridding, that is pretty well behaved in m-space.

samples

Number of samples across the sidereal day.

Type:

int

lanczos_width

Width of the Lanczos interpolation kernel.

Type:

int

snr_cov

Ratio of signal covariance to noise covariance (used for Wiener filter).

Type:

float

down_mix

Down mix the visibility prior to interpolation using the fringe rate of a source at zenith. This is un-done after the interpolation.

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(data)[source]

Regrid the sidereal day.

Parameters:

data (containers.TimeStream) – Timestream data for the day (must have a LSD attribute).

Returns:

sdata – The regularly gridded sidereal timestream.

Return type:

containers.SiderealStream

setup(manager)[source]

Set the local observers position.

Parameters:

manager (Observer) – An Observer object holding the geographic location of the telescope. Note that TransitTelescope instances are also Observers.

class draco.analysis.sidereal.SiderealRegridderCubic[source]

Bases: SiderealRegridder

Regrid onto the sidereal day using cubic Hermite spline interpolation.

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.

class draco.analysis.sidereal.SiderealRegridderLinear[source]

Bases: SiderealRegridder

Regrid onto the sidereal day using linear interpolation.

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.

class draco.analysis.sidereal.SiderealRegridderNearest[source]

Bases: SiderealRegridder

Regrid onto the sidereal day using nearest neighbor interpolation.

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.

class draco.analysis.sidereal.SiderealStacker[source]

Bases: SingleTask

Take in a set of sidereal days, and stack them up.

Also computes the variance over sideral days using an algorithm that updates the sum of square differences from the current mean, which is less prone to numerical issues. See West, D.H.D. (1979). https://doi.org/10.1145/359146.359153.

tag

The tag to give the stack.

Type:

str (default: “stack”)

weight

The weighting to use in the stack. Either uniform or inverse_variance.

Type:

str (default: “inverse_variance”)

with_sample_variance

Add a dataset containing the sample variance of the visibilities over sidereal days to the sidereal stack.

Type:

bool (default: False)

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(sdata)[source]

Stack up sidereal days.

Parameters:

sdata (containers.SiderealStream) – Individual sidereal day to add to stack.

process_finish()[source]

Normalize the stack and return the result.

Returns:

stack – Stack of sidereal days.

Return type:

containers.SiderealStream

class draco.analysis.sidereal.SiderealStackerMatch[source]

Bases: SingleTask

Take in a set of sidereal days, and stack them up.

This treats the time average of each input sidereal stream as an extra source of noise and uses a Wiener filter approach to consistent stack the individual streams together while accounting for their distinct coverage in RA. In practice this is used for co-adding stacks with different sidereal coverage while marginalising out the effects of the different cross talk contributions that each input stream may have.

There is no uniquely correct solution for the sidereal average (or m=0 mode) of the output stream. This task fixes this unknown mode by setting the median of each 24 hour period to zero. Note this is not the same as setting the m=0 mode to be zero.

Parameters:

tag (str) – The tag to give the stack.

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(sdata)[source]

Stack up sidereal days.

Parameters:

sdata (containers.SiderealStream) – Individual sidereal day to stack up.

process_finish()[source]

Construct and emit sidereal stack.

Returns:

stack – Stack of sidereal days.

Return type:

containers.SiderealStream

draco.analysis.sidereal.get_slice_to_broadcast(weight_axis, dataset_axis)[source]

Generate a slice that will broadcast the weights against some other dataset.

Parameters:
  • weight_axis (list of str) – Names of the axes in the weights.

  • dataset_axis (list of str) – Names of the axes in the dataset.

Returns:

slc – Slice that when applied to the weights will make them broadcastable against the other dataset.

Return type:

list containing either slice(None) or None