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.readDRSpec()
Function to read in a DR spectrometer header structure and data and retrun
a drspec.Frame instance.
-
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
Linear Polarization
Extension to take timeseries data and convert it to the frequency domain.
- The functions defined in this module are:
- FPSDR2 - FFT and integrate function for computing a series of overlapped
Fourier transforms for a real-valued (TBW) signal from a collection of
stands all at once.
- FPSDR3 - Similar to FPSDR2, but allows for a window function to be applied
to the data.
- FPSDC2 - FFT and integrate function for computing a series of overlapped
Fourier transforms for a complex-valued (TBN and DRX) signal from a
collection of stands/beams all at once.
- FPSDC3 - Similar to FPSDC2, but allows for a window function to be applied
to the data.
- PPSDR2 - Polyphase filterband (PFB) and integration function for computing
a series of overlapped PFB transforms for a real-valued (TBW) signal from
a collection of stands all at once.
- PPSDR3 - Similar to PPSDR2, but allows for a window function to be applied
to the data.
- PPSDC2 - PFB and integrate function for computing a series of overlapped
PFB transforms for a complex-valued (TBN and DRX) signal from a collection
of stands/beams all at once.
- PPSDC3 - Similar to PPSDC2, but allows for a window function to be applied
to the data.
See the inidividual functions for more details.
-
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
Stokes Parameters
Extension to take X and Y timeseries data and create the four Stokes
parameters.
- The functions defined in this module are:
- FPSDR2 - FFT and integrate function for computing a series of overlapped
Fourier transforms for a real-valued (TBW) signal from a collection of
stands all at once.
- FPSDR3 - Similar to FPSDR2, but allows for a window function to be applied
to the data.
- FPSDC2 - FFT and integrate function for computing a series of overlapped
Fourier transforms for a complex-valued (TBN and DRX) signal from a
collection of stands/beams all at once.
- FPSDC3 - Similar to FPSDC2, but allows for a window function to be applied
to the data.
Also included is an X-Engine for use with the lsl.correlator._core module to
perform cross-correlations for the stokes parameters.
See the inidividual functions for more details.
-
lsl.correlator._stokes.FPSDR2()
Perform a series of Fourier transforms on real-valued data to get the PSD
for the four Stokes parameters: I, Q, U, and V.
- 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: 3-D numpy.double (Stokes parameter (I,Q,U,V) by stands by channels) of PSD data
-
lsl.correlator._stokes.FPSDR3()
Perform a series of Fourier transforms with windows on real-valued data to
get the PSD for the four Stokes parameters: I, Q, U, and V.
- 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: 3-D numpy.double (Stokes parameter (I,Q,U,V) by stands by channels) of PSD data
-
lsl.correlator._stokes.FPSDC2()
Perform a series of Fourier transforms on complex-valued data to get the
PSD for the four Stokes parameters: I, Q, U, and V.
- 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: 3-D numpy.double (Stokes parameter (I,Q,U,V) by stands by channels) of PSD data
-
lsl.correlator._stokes.FPSDC3()
Perform a series of Fourier transforms with windows on complex-valued data
to get the PSD for the four Stokes parameters: I, Q, U, and V.
- 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: 3-D numpy.double (Stokes parameter (I,Q,U,V) by 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.
- 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.
- XEngine2 - Similar to XEngine, but works with a collection of stands all at
once.
See the inidividual functions for more details.
-
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.complex64 (stands by channels by FFT_set) of FFTd
data
- valid: 2-D numpy.uint8 (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.complex64 (stands by channels by FFT_set) of FFTd
data
- valid: 2-D numpy.uint8 (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.complex64 (stands by channels by FFT_set) of FFTd
data
- valid: 2-D numpy.uint8 (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.complex64 (stands by channels by FFT_set) of FFTd
data
- valid: 2-D numpy.uint8 (stands by FFT_set) of whether or not the FFT
set is valid (1) or not (0)
-
lsl.correlator._core.XEngine2()
Perform all XMACs for a data stream out of the F engine using OpenMP.
Changed in version 0.5: The second signal is not longer input as a conjugated array. Rather
the conjucation is performed as part of the cross-correlation.
- Input arguments are:
- fsignals1: 3-D numpy.complex64 (stand by channels by FFT_set) array of FFTd
data from an F engine.
- fsignals2: 3-D numpy.complex64 (stand by channels by FFT_set) array of
FFTd data from an F engine.
- sigValid1: 1-D numpy.uint8 (FFT_set) array of whether or not the FFT_set is
valid (1) or not (0) for the first signal.
- sigValid2: 1-D numpy.uint8 (FFT_set) array of whether or not the FFT_set is
valid (1) or not (0) for the second signal.
- Ouputs:
- visibility: 2-D numpy.complex64 (baseline by channel) array of cross-
correlated and averaged visibility data.
-
lsl.correlator._stokes.XEngine2()
Perform all XMACs for a data stream out of the F engine using OpenMP that
creates the four Stokes parameters: I, Q, U, and V.
- 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 FFTd
data from an F engine.
- sigValid1: 1-D numpy.uint8 (FFT_set) array of whether or not the FFT_set is
valid (1) or not (0) for the first signal.
- sigValid2: 1-D numpy.uint8 (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 (Stokes parameter (I,Q,U,V by baseline by
channel) array of cross-correlated and averaged visibility data.