Data Writers

Single-Dish FITS

SDFITS Standard

Module for writing spectrometer output to a SDFITS file. The SDFITS created by this modulefiles closely follow the Parkes variant of the SDFITS convention (see [http://fits.gsfc.nasa.gov/registry/sdfits.html]). The main differences between the two is that the LWA SDFITS do not contain calbration or weather information. This, however, should not stop the files from being loaded into CASA with the ATNF Spectral Analysis Package (ASAP).

Changed in version 0.5.0: The classes and functions defined in this module are based heavily off the lsl.writer.fitsidi writer.

class lsl.writer.sdfits.Sd(filename, ref_time=0.0, verbose=False, memmap=None, overwrite=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.

add_comment(comment)

Add a comment to data.

New in version 1.2.4.

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

Create a SpectrometerData object to store a collection of spectra.

add_header_keyword(name, value, comment=None)

Add an additional entry to the header of the primary HDU.

New in version 2.0.0.

add_history(history)

Add a history entry to the data.

New in version 1.2.4.

property astro_ref_time

Convert a reference time string to an lsl.astro.date object.

close()

Close out the file.

parse_time(ref_time)

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

set_frequency(freq)

Given a numpy array of frequencies, set the relevant common observation parameters and add an entry to the self.freq list.

set_geometry(*args, **kwds)

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

set_observer(observer, project='UNKNOWN', mode='ZA')

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

New in version 2.0.0.

set_site(site)

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

set_stokes(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

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

Note

Some software that deal with FITS IDI files, e.g. AIPS, does not support FITS IDI files with more than 99 antennas. See the lsl.writer.fitsidi.aips class for a FITS IDI writer that respects this limit.

Changed in version 1.1.4: Fixed a conjugation problem in the visibilities saved to a FITS-IDI file Added support for writing user-specified weights to a FITS-IDI file

Changed in version 1.2.2: Added support for writing multiple IFs to the same FITS-IDI file

class lsl.writer.fitsidi.Aips(filename, ref_time=0.0, verbose=False, memmap=None, overwrite=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 set_geometry() 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, ref_time=0.0, verbose=False, memmap=None, overwrite=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.

class lsl.writer.fitsidi.Idi(filename, ref_time=0.0, verbose=False, memmap=None, overwrite=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.

add_comment(comment)

Add a comment to data.

New in version 1.2.4.

add_history(history)

Add a history entry to the data.

New in version 1.2.4.

close()

Close out the file.

read_array_geometry()

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

read_array_mapper()

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.

set_geometry(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.

write()

Fill in the FITS-IDI file will all of the tables in the correct order.

UVFITS

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

Note

For arrays with between 256 and 2048 antennas, the baseline packing follows the MIRIAD convention.

class lsl.writer.uvfits.Uv(filename, ref_time=0.0, verbose=False, memmap=None, overwrite=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.

add_comment(comment)

Add a comment to data.

New in version 1.2.4.

add_history(history)

Add a history entry to the data.

New in version 1.2.4.

close()

Close out the file.

read_array_geometry(dummy=False)

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

read_array_mapper(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.

set_geometry(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.

write()

Fill in the FITS-IDI file will all of the tables in the correct order.

Measurement Set

Module for writing correlator output to a CASA measurement set.

New in version 1.2.1.

class lsl.writer.measurementset.Ms(filename, ref_time=0.0, verbose=False, memmap=None, overwrite=False)

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

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=8, data=None, sample_rate=196000000.0)

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

create_raw_frame()

Using the data and information stored in the object, create a numpy array on unsigned 1-byte integers that represents the frame.

write_raw_frame(fh)

Create a numpy representation of the VDIF frame and then write it to the specified file handle.