Correlation

Python module to handle the channelization and cross-correlation of TBW and TBN data. The main python functions in this module are:

  • calcSpectra - calculate power spectra for a collection of signals

  • FXCorrelator - calculate cross power spectra for a collection of signals

  • FXStokes - calculate Stokes cross power spectra for a collection of signals

    both of which have been deprecated in favor of the new C extension based routines listed below.

The main python/C extension functions in this module are:
  • SpecMaster - similar to calcSpectra but uses the _spec module for all

    computations and does not support automatic sub-integration

  • StokesMaster - similar to SpecMaster but computes all four Stokes parameters

  • FXMaster - calculate cross power spectra for a collection of signals

Each function is set up to process the signals in parallel using the multiprocessing module and accepts a variety of options controlling the processing of the data, including various window functions and time averaging.

Changed in version 1.0.1: Removed SpecMasterP.

Changed in version 1.0.0: All of the functions here now return all ‘LFFT’ channels.

Baseline Utilities

lsl.correlator.uvutils.get_baselines(antennas, antennas2=None, include_auto=False, indicies=False)

Generate a list of two-element tuples that describe which antennae compose each of the output uvw triplets from compute_uvw/compute_uv_track. If the indicies keyword is set to True, the two-element tuples contain the indicies of the stands array used, rather than the actual stand numbers.

lsl.correlator.uvutils.baseline_to_antennas(baseline, antennas, antennas2=None, baseline_list=None, include_auto=False, indicies=False)

Given a baseline number, a list of stands, and options of how the base- line listed was generated, convert the baseline number to antenna numbers. Alternatively, use a list of baselines instead of generating a new list. This utility is useful for figuring out what antennae comprise a baseline.

lsl.correlator.uvutils.antennas_to_baseline(ant1, ant2, antennas, antennas2=None, baseline_list=None, include_auto=False, indicies=False)

Given two antenna numbers, a list of stands, and options to how the base- line listed was generated, convert the antenna pair to a baseline number. This utility is useful for picking out a particular pair from a list of baselines.

Computing uvw Coordinates

lsl.correlator.uvutils.compute_uvw(antennas, HA=0.0, dec=34.07, freq=49000000.0, site=<LWAStation id='VL', name='LWA1', lat=34:04:08.0, long=-107:37:42.1, elev=2133.6, pressure=0.0, horizon=0:00:00.0, antennas=[...], interface=<LSLInterface backend='lsl.common.dp', mcs='lsl.common.mcs', sdf='lsl.common.sdf', metabundle='lsl.common.metabundle', sdm='lsl.common.sdm'>>, include_auto=False)

Compute the uvw converate of a baselines formed by a collection of stands. The coverage is computed at a given HA (in hours) and declination (in degrees) for a given site. The frequency provided (in Hz) can either as a scalar or as a numpy array. If more than one frequency is given, the output is a three dimensional with dimensions of baselines, uvw, and frequencies.

Changed in version 0.4.0: Switched over to passing in Antenna instances generated by the lsl.common.station module instead of a list of stand ID numbers.

Changed in version 1.0.0: Added a keyword (site) to specify the station used for the observation.

Changed in version 1.1.2: Updated to work with lists in a transparent manner.

Changed in version 2.0.1: Added support for ephem.Angle and astropy.coordinates.Angle instances for HA and dec. Added support for astropy.coordinates.EarthLocation instances for site.

lsl.correlator.uvutils.compute_uv_track(antennas, dec=34.07, freq=49000000.0, site=<LWAStation id='VL', name='LWA1', lat=34:04:08.0, long=-107:37:42.1, elev=2133.6, pressure=0.0, horizon=0:00:00.0, antennas=[...], interface=<LSLInterface backend='lsl.common.dp', mcs='lsl.common.mcs', sdf='lsl.common.sdf', metabundle='lsl.common.metabundle', sdm='lsl.common.sdm'>>)

Whereas compute_uvw provides the uvw coverage at a particular time, compute_uv_track provides the complete uv plane track for a long integration. The output is a three dimensional numpy array with dimensions baselines, uv, and 512 points along the track ellipses. Unlike compute_uvw, however, only a single frequency (in Hz) can be specified.

Changed in version 0.4.0: Switched over to passing in Antenna instances generated by the lsl.common.station module instead of a list of stand ID numbers.

Changed in version 1.0.0: Added a keyword (site) to specify the station used for the observation.

Changed in version 2.0.1: Added support for ephem.Angle and astropy.coordinates.Angle instances for dec. Added support for astropy.coordinates.EarthLocation instances for site.

Polyphase Filter Bank

This module implements a uniform DFT filter bank for use in calculating spectra as an alternative to a simple FFT. The implementation here is based on: http://www.scribd.com/doc/20561850/6/Polyphase-Filter-Coef%EF%AC%81cients

lsl.correlator.filterbank.fft(signal, N, P=1, window=<function null_window>)

FFT-based poly-phase filter bank for creating N channels with P taps. Optionally, a window function can be specified using the ‘window’ keyword. See lsl.correlator.fx.calcSpectra for details on using window functions.

lsl.correlator.filterbank.fft16(signal, N, window=<function null_window>)

Sub-type of lsl.correlator.filterbank.fft that uses 16 taps.

lsl.correlator.filterbank.fft2(signal, N, window=<function null_window>)

Sub-type of lsl.correlator.filterbank.fft that uses two taps.

lsl.correlator.filterbank.fft32(signal, N, window=<function null_window>)

Sub-type of lsl.correlator.filterbank.fft that uses 32 taps.

lsl.correlator.filterbank.fft4(signal, N, window=<function null_window>)

Sub-type of lsl.correlator.filterbank.fft that uses four taps.

lsl.correlator.filterbank.fft8(signal, N, window=<function null_window>)

Sub-type of lsl.correlator.filterbank.fft that uses eight taps.

FX Correlator

lsl.correlator.fx.null_window(L)

Default “empty” windowing function for use with the various routines. This function returned a numpy array of ‘1’s of the specified length.

lsl.correlator.fx.FXMaster(signals, antennas, LFFT=64, overlap=1, include_auto=False, verbose=False, window=<function null_window>, pfb=False, sample_rate=None, central_freq=0.0, Pol='XX', gain_correct=False, return_baselines=False, clip_level=0, phase_center='z')

A more advanced version of FXCorrelator for TBW and TBN data. Given an 2-D array of signals (stands, time-series) and an array of stands, compute the cross-correlation of the data for all baselines. Return the frequencies and visibilities as a two-elements tuple.

Changed in version 0.4.0: Switched over to passing in Antenna instances generated by the lsl.common.stations module instead of a list of stand ID numbers.

Changed in version 1.0.0: Added a phase-center keyword that accept a two-element tuple of azimuth and elelvation (in degrees) to change where the correlations are phased to

Changed in version 1.1.0: Made the ‘phase_center’ keyword more flexible. It can now be either: * ‘z’ to denote the zenith, * a ephem.Body instances which has been computed for the observer, or * a two-element tuple of azimuth, elevation in degrees.

Changed in version 1.2.5: Added the ‘pfb’ keyword.

Changed in version 2.0.1: Added support for phase_center to be an astropy.coordinates.AltAz instance

lsl.correlator.fx.FXStokes(signals, antennas, LFFT=64, overlap=1, include_auto=False, verbose=False, window=<function null_window>, pfb=False, sample_rate=None, central_freq=0.0, gain_correct=False, return_baselines=False, clip_level=0, phase_center='z')

A more advanced version of FXCorrelator for TBW and TBN data. Given an 2-D array of signals (stands, time-series) and an array of stands, compute the cross-correlation of the data for all baselines. Return the frequencies and visibilities as a two-elements tuple.

Changed in version 2.0.1: Added support for phase_center to be an astropy.coordinates.AltAz instance

Changed in version 1.0.0: Added a phase_center keyword that accept a two-element tuple of azimuth and elelvation (in degrees) to change where the correlations are phased to

Changed in version 1.1.0: Made the ‘phase_center’ keyword more flexible. It can now be either: * ‘z’ to denote the zenith, * a ephem.Body instances which has been computed for the observer, or * a two-element tuple of azimuth, elevation in degrees.

Changed in version 1.2.5: Added the ‘pfb’ keyword.