Data Writers

Time-Series FITS

Modules to take TBW/TBN time series data and write it to a FITS file composed of binary tables. The format of TSFITS files is:

PRIMARY HDU
Keywords:
  • OBJECT - object being observed in this data set, e.g., ‘zenith’

  • TELESCOP - telescope used for the observations, e.g., ‘LWA-1’

  • OBSMODE - observation mode used for the data. Options are:
    1. TBW
    2. TBN
  • NSTANDS - number of stands found in the file

  • TBWBITS optional - how many bits are used by the TBW data (4 or 12)

  • FILTER optional - TBN filter code used to acquire the data

  • GAIN optional - TBN gain setting used to acquire the data

  • FREQ optional - central frequency in Hz for the TBN observations

TIME SERIES HDU

Binary table that stores the actual observations. There is one TIME SERIES extionsion per stand in the data. Keywords:

  • EXTNAME - extension name of ‘TIME SERIES’
  • EXTVER - extension version equal to the order in which the data was added to the FITS file
  • STAND - stand number associated with this data
  • DATE-OBS - date of observation for the first sample of the first data row
Data:
  • DATA - column storing the observations. For TBW data this consists of 400 (12-bit) or 1200 (4-bit) elements per row stored as 16-bit integers. For TBN data this consits of 512 elements per row stored as 32-bit complex numbers.
  • POL - column storing the polarization associated with the DATA column. ‘x’ polarization is stored as 0 and ‘y’ polarization is stored as 1. The values is stored as a 16-bit integer.
  • TIME - number of samples at f_S (196 MSamples/s) since DATE-OBS for the first sample in the row. This is stored as a 64-bit integer.
class lsl.writer.tsfits.UTC

tzinfo object for UTC time.

fromutc
datetime in UTC -> datetime in local time.
class lsl.writer.tsfits.TSFITS(filename, mode, Overwrite=False, UseQueue=True, verbose=False)

Class that holds TSFITS data until it is ready to be writen to disk.

addStandData(frame)
Add a frame object to the TSFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits, TBN filter code, etc.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.
class lsl.writer.tsfits.TBW(filename, Overwrite=False, UseQueue=True, verbose=False)

Sub-class of TSFITS for dealing with TBW data in particular.

addStandData(frame)
Add a frame object to the TSFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits, TBN filter code, etc.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.
class lsl.writer.tsfits.TBN(filename, Overwrite=False, UseQueue=True, verbose=False)

Sub-class of TSFITS for dealing with TBN data in particular.

addStandData(frame)
Add a frame object to the TSFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits, TBN filter code, etc.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.

Single-Dish FITS

SDFITS Standard

Modules to take DRX/TBW/TBN data and write it to a SDFITS file.

class lsl.writer.sdfits.SDFITS(filename, mode, LFFT=128, Overwrite=False, UseQueue=True, verbose=False)

Class that holds TSFITS data until it is ready to be writen to disk.

addStandData(frame)
Add a frame object to the SDFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setCentralFrequency(centralFreq)
Set the central frequency in Hz of the data for TBN and DRX observations.
setSampleRate(sampleRate)
Set the sample rate in Hz of the data for TBN and DRX observations.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.
class lsl.writer.sdfits.TBW(filename, LFFT=128, Overwrite=False, UseQueue=True, verbose=False)

Sub-class of SDFITS for dealing with TBW data in particular.

addStandData(frame)
Add a frame object to the SDFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setCentralFrequency(centralFreq)
Set the central frequency in Hz of the data for TBN and DRX observations.
setSampleRate(sampleRate)
Set the sample rate in Hz of the data for TBN and DRX observations.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.
class lsl.writer.sdfits.TBN(filename, LFFT=128, Overwrite=False, UseQueue=True, verbose=False)

Sub-class of SDFITS for dealing with TBN data in particular.

addStandData(frame)
Add a frame object to the SDFITS file. This function takes care of figuring out which extension the data goes to and how it should be formated. This function also updates the primary HDU with information about the data, i.e., TBW data bits.
close()
Empty the data queue (if it exists) and write all changes to disk using flush.
flush()
Short-cut to the pyfits.flush() function on an opened FITS file.
getStandData(stand)

Retrieve a dictionary of all data stored for a particular stand. The dictionary keys are:

  • data - numpy array of data
  • pol - numpy array of polarizations
  • time - numpy array of times in samples at f_S since DATE-OBS
info()
Short-cut to the pyfits.info() function on an opened FITS file.
setCentralFrequency(centralFreq)
Set the central frequency in Hz of the data for TBN and DRX observations.
setSampleRate(sampleRate)
Set the sample rate in Hz of the data for TBN and DRX observations.
setSite(site)
Set the TELESCOP keyword in the primary HDU using an lsl.common.stations object.

FITS IDI

FITS IDI Standard

Module for writting correlator output to a FITS IDI file. The classes and functions defined in this module are based heavily off the lwda_fits library.

class lsl.writer.fitsidi.IDI(filename, refTime=0.0, verbose=False)

Class for storing visibility data and writing the data, along with array geometry, frequency setup, etc., to a FITS IDI file that can be read into AIPS via the FITLD task.

addDataSet(obsTime, intTime, baselines, visibilities)
Create a UVData object to store a collection of visibilites.
close()
Close out the file.
parseRefTime(refTime)
Given a time as either a integer, float, string, or datetime object, convert it to a string in the formation ‘YYYY-MM-DDTHH:MM:SS’.
readArrayGeometry()
Return a tuple with the array geodetic position and the local positions for all antennas defined in the ARRAY_GEOMETRY table.
readArrayMapper()
Return a tuple with the array NOSTA mapper and inverse mapper (both dictionaries. If the stand IDs have not been mapped, return None for both.
refTime2AstroDate()
Convert a reference time string to an lsl.astro.date object.
setFrequency(freq)
Given a numpy array of frequencies, set the relevant common observation parameters and add an entry to the self.freq list.
setGeometry(site, stands, bits=8)
Given a station and an array of stands, set the relevant common observation parameters and add entries to the self.array list.
setStokes(polList)
Given a list of Stokes parameters, update the object’s parameters
write()
Fill in the FITS-IDI file will all of the tables in the correct order.

VDIF

VDIF Standard (PDF)

Module to write VDIF frames. The implementation of this module is similar to that of lsl.sim.tbw in that the primary element defined in this module is a Frame object which as attribute functions that can create a numpy representation of the raw frame and write that raw frame to an open file- handle.

See also

lsl.sim.tbw

class lsl.writer.vdif.Frame(stand=0, time=0, bits=16, data=None, sampleRate=196000000.0)

Object to create and write a VDIF (VLBI Data Interchange Format) frame (version 1, June 26, 2009).

createRawFrame()
Using the data and information stored in the object, create a numpy array on unsigned 1-byte integers that represents the frame.
writeRawFrame(fh)
Create a numpy representation of the VDIF frame and then write it to the specified file handle.

Table Of Contents

Previous topic

Data Readers

Next topic

Computing Spectra

This Page