Data Writers

Time-Series FITS

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, UseQueue=True, verbose=False, memmap=None, clobber=False)

Class that holds TSFITS data until it is ready to be written 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, UseQueue=True, verbose=False, memmap=None, clobber=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, UseQueue=True, verbose=False, memmap=None, clobber=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

class lsl.writer.sdfits.SD(filename, refTime=0.0, verbose=False, memmap=None, clobber=False)

Class for storing spectrometer data and writing the data, along with array frequency setup, etc., to a SDFITS file that can be read into CASA via the sd.scantable() function.

addComment(comment)

Add a comment to data.

New in version 1.2.4.

addDataSet(obsTime, intTime, beam, data, pol='XX')

Create a SpectrometerData object to store a collection of spectra.

addHistory(history)

Add a history entry to the data.

New in version 1.2.4.

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’.

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.

setObserver(observer, project='UNKNOWN', mode='UNKNOWN')

Set the observer name, project, and observation mode (if given) to the self.observer, self.project, and self.mode attributes, respectively.

setSite(site)

Set the TELESCOP keyword in the primary HDU using an lsl.common.stations.LWAStation object.

setStokes(polList)

Given a list of Stokes parameters, update the object’s parameters.

write()

Fill in the SDFITS file will all of the tables in the correct order.

FITS IDI

FITS IDI Standard

class lsl.writer.fitsidi.IDI(filename, refTime=0.0, verbose=False, memmap=None, clobber=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.

addComment(comment)

Add a comment to data.

New in version 1.2.4.

addDataSet(obsTime, intTime, baselines, visibilities, pol='XX', source='z')

Create a UVData object to store a collection of visibilities.

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 as part of the baselines.

Changed in version 1.1.0: Added a new ‘source’ keyword to set the phase center for the data. This can either by ‘z’ for zenith or a ephem.Body instances for a point on the sky.

addHistory(history)

Add a history entry to the data.

New in version 1.2.4.

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, antennas, bits=8)

Given a station and an array of stands, set the relevant common observation parameters and add entries to the self.array list.

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.

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.

class lsl.writer.fitsidi.AIPS(filename, refTime=0.0, verbose=False, memmap=None, clobber=False)

Sub-class of the FITS IDI writer for making files that should work with AIPS nicely. AIPS imposes a limit on antenna number of two digits (1-99). This sub-class overwrite the setGeometry() function with one that enforces the two digit limit and maps accordingly. It also sets the FITS LWATYPE keyword in the primary HDU to a value of IDI-AIPS-ZA to distinguish files written by this writer from the standard IDI writer.

class lsl.writer.fitsidi.ExtendedIDI(filename, refTime=0.0, verbose=False, memmap=None, clobber=False)

Sub-class of the FITS IDI writer for making files that support up to 65,535 antennas. This is done by changing the packing of baselines stored in the UVDATA table. The new packing for baseline (i,j) is: (i << 16) & (j) It also sets the FITS LWATYPE keyword in the primary HDU to a value of IDI-EXTENDED-ZA to distinguish files written by this writer from the standard IDI writer.

UVFITS

class lsl.writer.uvfits.UV(filename, refTime=0.0, verbose=False, memmap=None, clobber=False)

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

addComment(comment)

Add a comment to data.

New in version 1.2.4.

addDataSet(obsTime, intTime, baselines, visibilities, pol='XX', source='z')

Create a UVData object to store a collection of visibilities.

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 as part of the baselines.

addHistory(history)

Add a history entry to the data.

New in version 1.2.4.

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(dummy=False)

Return a tuple with the array geodetic position and the local positions for all antennas defined in the AIPS AN table.

readArrayMapper(dummy=False)

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, antennas, bits=8)

Given a station and an array of stands, set the relevant common observation parameters and add entries to the self.array list.

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.

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.

Measurement Set

class lsl.writer.measurementset.MS(filename, refTime=0.0, verbose=False, memmap=None, clobber=False)

Class for storing visibility data and writing the data, along with array geometry, frequency setup, etc., to a CASA measurement set.

addDataSet(obsTime, intTime, baselines, visibilities, pol='XX', source='z')

Create a UVData object to store a collection of visibilities.

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 as part of the baselines.

Changed in version 1.1.0: Added a new ‘source’ keyword to set the phase center for the data. This can either by ‘z’ for zenith or a ephem.Body instances for a point on the sky.

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’.

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, antennas, bits=8)

Given a station and an array of stands, set the relevant common observation parameters and add entries to the self.array list.

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.

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)

class lsl.writer.vdif.Frame(stand=0, time=0, bits=8, 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