C Extensions

Warning

The modules documented before are compiled C extensions and are subject to change. It is recommended that users use the standard modules detailed in the previous sections over directly using these modules.

Go-Fast! Readers

Go Fast! (TM) - TBW, TBN, and DRX readers written in C

lsl.reader._gofast.readDRX()

Function to read in a single DRX frame (header+data) and store the contents as a Frame object. This function serves as a replacement for the pure python reader lsl.reader.drx.readFrame.

In order to use this reader in place of lsl.reader.drx.readFrame change:

>>> import lsl.reader.tbn as drx
>>> fh = open('some-drx-file.dat', 'rb')
>>> frame = drx.readFrame(fh)

to:

>>> import lsl.reader.drx as drx
>>> from lsl.reader._gofast import ReadDRX, syncError, eofError
>>> fh = open('some-drx-file.dat', 'rb')
>>> frame = readDRX(fh, tbn.Frame())

In addition, the exceptions checked for in the try...except blocks wrapping the frame reader need to be changed to ‘IOError’ since syncError and eofError are are sub-classes of IOError.

Changed in version 0.4.0: The Go Fast! readers are the default readers used by the lsl.reader.drx module.

lsl.reader._gofast.readTBN()

Function to read in a single TBN frame (header+data) and store the contents as a Frame object. This function serves as a replacement for the pure python reader lsl.reader.tbn.readFrame.

In order to use this reader in place of lsl.reader.tbn.readFrame change:

>>> import lsl.reader.tbn as tbn
>>> fh = open('some-tbn-file.dat', 'rb')
>>> frame = tbn.readFrame(fh)

to:

>>> import lsl.reader.tbn as tbn
>>> from lsl.reader._gofast import ReadTBN, syncError, eofError
>>> fh = open('some-tbn-file.dat', 'rb')
>> frame = readTBN(fh, tbn.Frame())

In addition, the exceptions checked for in the try...except blocks wrapping the frame reader need to be changed to ‘IOError’ since syncError and eofError are are sub-classes of IOError.

Changed in version 0.4.0: The Go Fast! readers are the default readers used by the lsl.reader.tbn module.

lsl.reader._gofast.readTBW()

Function to read in a single TBW frame (header+data) and store the contents as a Frame object. This function serves as a replacement for the pure python reader lsl.reader.tbw.readFrame.

In order to use this reader in place of lsl.reader.tbw.readFrame change:

>>> import lsl.reader.tbw as tbw
>>> fh = open('some-tbw-file.dat', 'rb')
>>> frame = tbw.readFrame(fh)

to:

>>> import lsl.reader.tbw as tbw
>>> from lsl.reader._gofast import ReadTBW, syncError, eofError
>>> fh = open('some-tbw-file.dat', 'rb')
>>> frame = readTBW(fh, tbw.Frame())

In addition, the exceptions checked for in the try...except blocks wrapping the frame reader need to be changed to ‘IOError’ since syncError and eofError are are sub-classes of IOError.

Changed in version 0.4.0: The Go Fast! readers are the default readers used by the lsl.reader.tbw module.

exception lsl.reader._gofast.eofError
Exception raised when a reader encounters the end-of-file while reading.
exception lsl.reader._gofast.syncError
Exception raised when a reader encounters an error with one or more of the four sync. words.

DRSU Direct Access Module

Module to provide the information necessary for direct access to files stored on a data recorder storage unit (DRSU).

Warning

This module is currently in an experimental phase.

lsl.reader._drsu.getDeviceChunkSize()
Function to return a long integer of the chunk size used on the specified DRSU device.
lsl.reader._drsu.getFileSize()
Function to return a long integer of the file size for a particular file on the specified DRSU device. An IOError is raised if the file cannot be found on the device.
lsl.reader._drsu.getFileStart()
Function to return a long integer of the file start position in bytes (corrected for the file start pattern) for a particular file on the specified DRSU device. An IOError is raised if the file cannot be found on the device.
lsl.reader._drsu.getFileTime()
Function to return a long integer of the file modification time for a particular file on the specified DRSU device. An IOError is raised if the file cannot be found on the device.
lsl.reader._drsu.getFileType()
Function to return a string of the file meta-data type (DEFAULT_DRX, etc.) for a particular file on the specified DRSU device. An IOError is raised if the file cannot be found on the device.
lsl.reader._drsu.listDevice()
Function to return a list of all files on a DRSU specified by device and return them as a list of filenames.
lsl.reader._drsu.listFiles()

Function to list all of the files on a DRSU specified by device and return them as a list of ‘File’ instances. These instances can then be used to provide direct access to the files stored on the DRSU.

The use of this function is preferred over listDevice/getFileSize/etc. because it stores all of the information returned in the other function in the File structure along with additional information. It also makes it ‘easier’ to open the specified file for reading.

Power Spectral Density Calculation

Test extension to replace lsl.correlator.fx.calcSpectra

lsl.correlator._spec.FPSDC2()

Perform a series of Fourier transforms on complex-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.FPSDC3()

Perform a series of Fourier transforms with windows on complex-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.FPSDR2()

Perform a series of Fourier transforms on real-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.FPSDR3()

Perform a series of Fourier transforms with windows on real-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.PPSDC2()

Perform a series of filter bank transforms on complex-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.PPSDC3()

Perform a series of filter bank transforms with windows on complex-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.PPSDR2()

Perform a series of filter bank transforms on real-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data
lsl.correlator._spec.PPSDR3()

Perform a series of filter bank transforms with windows on real-valued data to get the PSD.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • psd: 2-D numpy.double (stands by channels) of PSD data

FX Correlator Core

C-based F and X engines for the LWA software FX correlator. These function are meant to provide an alternative to the lsl.correlator.fx.correlate function and provide a much-needed speed boost to cross-correlation.

The function defined in this module are:
  • FEngineR2 -F-engine for computing a series of overlapped Fourier transforms with delay corrections for a real-valued (TBW) signal from a collection of stands all at once
  • FEngineR3 - Similar to FEngineR2, but allows for a window function to be applied to the data. The window function needs to be evaluated for the correct FFT length before being passed to FEngineR3
  • FEngineC2 - F-engine for computing a series of overlapped Fourier transforms with delay corrections for a complex-valued (TBN) signal from a collection of stands all at once
  • FEngineC3 - Similar to FEngineC2, but allows for a window function to be applied to the data. The window function needs to be evaluated for the correct FFT length before being passed to FEngineC3
  • XEngine - Cross-multipy and accumulate cross-power spectra using the inputs for two stands
  • XEngine2 - Similar to XEngine, but works with a collection of stands all at once
  • PEngineR2 - F-engined based on a 4-tap uniform DFT filter bank for computing a series of overlapped transforms with delay corrections for a real-valued (TBW) signals from a collection of stands
  • PEngineR3 - Similar to PEngineR2, but allows for a window function to be applied to the data. The window function needs to be evaluated to the correct FFT length and number of taps before being passed to PEngineR3
  • PEngineC2 - F-engined based on a 4-tap uniform DFT filter bank for computing a series of overlapped transforms with delay corrections for a complex-valued (TBN) signals from a collection of stands
  • PEngineC3 - Similar to PEngineC3, but allows for a window function to be applied to the data. The window function needs to be evaluated to the correct FFT length and number of taps before being passed to PEngineC3

See the inidividual functions for more details.

Note

The ‘P’ engines do not preserve phase and do not yield valid results for use in cross-correlation. Currently only the ‘F’ engines are know to be useful.

lsl.correlator._core.FEngineC2()

Perform a series of overlapped Fourier transforms on complex-valued data using OpenMP.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
  • frequency: 1-D numpy.double array of frequency values in Hz for the FFT channels
  • delays: 1-D numpy.double array of delays to apply to each stand
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • SampleRate: sample rate of the data (default=100e3)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • fsignals: 3-D numpy.cdouble (stands by channels by FFT_set) of FFTd data
  • valid: 2-D numpy.int16 (stands by FFT_set) of whether or not the FFT set is valid (1) or not (0)
lsl.correlator._core.FEngineC3()

Perform a series of overlapped Fourier transforms on complex-valued data using OpenMP and allow for windowing of the data.

Input arguments are:
  • signals: 2-D numpy.complex64 (stands by samples) array of data to FFT
  • frequency: 1-D numpy.double array of frequency values in Hz for the FFT channels
  • delays: 1-D numpy.double array of delays to apply to each stand
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • SampleRate: sample rate of the data (default=100e3)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • fsignals: 3-D numpy.cdouble (stands by channels by FFT_set) of FFTd data
  • valid: 2-D numpy.int16 (stands by FFT_set) of whether or not the FFT set is valid (1) or not (0)
lsl.correlator._core.FEngineR2()

Perform a series of overlapped Fourier transforms on real-valued data using OpenMP.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
  • frequency: 1-D numpy.double array of frequency values in Hz for the FFT channels
  • delays: 1-D numpy.double array of delays to apply to each stand
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • SampleRate: sample rate of the data (default=196e6)
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • fsignals: 3-D numpy.cdouble (stands by channels by FFT_set) of FFTd data
  • valid: 2-D numpy.int16 (stands by FFT_set) of whether or not the FFT set is valid (1) or not (0)
lsl.correlator._core.FEngineR3()

Perform a series of overlapped Fourier transforms on real-valued data using OpenMP and windows.

Input arguments are:
  • signals: 2-D numpy.int16 (stands by samples) array of data to FFT
  • frequency: 1-D numpy.double array of frequency values in Hz for the FFT channels
  • delays: 1-D numpy.double array of delays to apply to each stand
Input keywords are:
  • LFFT: number of FFT channels to make (default=64)
  • Overlap: number of overlapped FFTs to use (default=1)
  • SampleRate: sample rate of the data (default=196e6)
  • window: Callable Python function for generating the window
  • ClipLevel: count value of ‘bad’ data. FFT windows with instantaneous powers greater than or equal to this value greater are zeroed. Setting the ClipLevel to zero disables time-domain blanking
Outputs:
  • fsignals: 3-D numpy.cdouble (stands by channels by FFT_set) of FFTd data
  • valid: 2-D numpy.int16 (stands by FFT_set) of whether or not the FFT set is valid (1) or not (0)
lsl.correlator._core.PEngineC2()
Perform a series of overlapped filter bank transforms on complex-valued data using OpenMP.
lsl.correlator._core.PEngineC3()
Perform a series of overlapped filter bank transforms on complex-valued data using OpenMP and a window.
lsl.correlator._core.PEngineR2()
Perform a series of overlapped filter bank transforms on real-valued data using OpenMP.
lsl.correlator._core.PEngineR3()
Perform a series of overlapped filter bank transforms on real-valued data using OpenMP and windows.
lsl.correlator._core.XEngine()

Perform XMAC on two data streams out of the F engine.

Input arguments are:
  • fsignals1: 2-D numpy.cdouble (stand by channels by FFT_set) array of FFTd data from an F engine.
  • fsignals2: 2-D numpy.cdouble (stand by channels by FFT_set) array of conjudated FFTd data from an F engine.
  • sigValid1: 1-D numpy.int16 (FFT_set) array of whether or not the FFT_set is valid (1) or not (0) for the first signal.
  • sigValid2: 1-D numpy.int16 (FFT_set) array of whether or not the FFT_set is valid (1) or not (0) for the second signal.
Ouputs:
  • visibility: 1-D numpy.cdouble (channel) array of cross-correlated and

averaged visibility data.

Note

This function is slower than a pure numpy version of the same function.

lsl.correlator._core.XEngine2()

Perform all XMACs for a data stream out of the F engine using OpenMP.

Input arguments are:
  • fsignals1: 3-D numpy.cdouble (stand by channels by FFT_set) array of FFTd data from an F engine.
  • fsignals2: 3-D numpy.cdouble (stand by channels by FFT_set) array of conjudated FFTd data from an F engine.
  • sigValid1: 1-D numpy.int16 (FFT_set) array of whether or not the FFT_set is valid (1) or not (0) for the first signal.
  • sigValid2: 1-D numpy.int16 (FFT_set) array of whether or not the FFT_set is valid (1) or not (0) for the second signal.
Ouputs:
  • visibility: 3-D numpy.cdouble (baseline by channel) array of cross- correlated and averaged visibility data.

Table Of Contents

Previous topic

DRX - How do I...

This Page