SimDataDesc.h

Classes

SimDataDesc -- a container for data destined for an MS DATA_DESCRIPTION table (full description)
SimDataDescList -- a container for data destined for an MS DATA_DESCRIPTION table (full description)

class SimDataDesc

Interface

Public Members
SimDataDesc(uInt polId, uInt spw, Bool upto=False)
SimDataDesc(uInt polId, const Vector<uInt>& spwids)
SimDataDesc(const SimDataDesc& s)
SimDataDesc& operator=(const SimDataDesc& s)
~SimDataDesc()
Int getRow() const
void setRow(Int id)
uInt polId() const
const Vector<uInt>& spectralWindowIds() const
uInt numWindows() const

Description

Prerequisite

Etymology

This is a container for describing a data description record for simulated observations.

Synopsis

This container describes a desired combination of polarization setup and set of spectral windows, known in MS parlance, as data descriptions (as it defines the shape of the visibility data arrays). This container is used to define simulated observations. Simulators would not normally create these objects directly but rather implicitly via the SimObservations class.

The combination is defined in terms of IDs into an MS's POLARIZATION and SPECTRAL_WINDOW tables (which are usually managed via a SimObservations object), similar to structure of a MeasurmentSet's DATA_DESCRIPTION record. The difference being that in a SimDataDesc, a single polarization setup can be with a set of windows as an aid to users simulating typical uses of correlation spectrometers. The IDs are set at construction time and cannot be changed later.

Since this class has no connections either a spectral window table nor a polarization setup table, no checks are done to ensure that the IDs exist anywhere or are otherwise valid. This must be done at a higher level.

Motivation

This container provides an simplified in-memory representation of feeds that will ultimately be written to a DATA_DESCRIPTION table. The interface is oriented toward what is typical with current instruments and thus is simpler than the interface provided by the MS DATA_DESCRIPTION table.

To Do

Member Description

SimDataDesc(uInt polId, uInt spw, Bool upto=False)

Create a record associating a polarization setup with a spectral window. polid is the POLARIZATION_ID, and spw is the SPECTRALWINDOW_ID when upto=False. If upto is True, the polarization set up will be associated with all spectral windows with IDs less than spw.

SimDataDesc(uInt polId, const Vector<uInt>& spwids)

Create a record associating a polarization setup with a set of spectral windows

SimDataDesc(const SimDataDesc& s)
SimDataDesc& operator=(const SimDataDesc& s)

create a copy

~SimDataDesc()

Int getRow() const
void setRow(Int id)

get and set the row ID, the first row in the DATA_DESCRIPTION table containing this record. An ID less than zero means that this record has not yet been recorded.

uInt polId() const

return the ID of the polarization setup

const Vector<uInt>& spectralWindowIds() const

return the list of window IDs polarization setup is associated with. An id < 0 indicates that the line is associated with all windows

uInt numWindows() const

return the number of spectral windows refered to in this description


class SimDataDescList

Interface

SimDataDescList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), nid_p(0), rec_p(initsz, 0), bydd_p()
SimDataDescList(const MSDataDescription& ddt, uInt stepz=4)
SimDataDescList(const SimDataDescList& t)
SimDataDescList& operator=(const SimDataDescList& t)
~SimDataDescList()
void clearIds()
SimDataDesc& operator[](Int i)
const SimDataDesc& operator[](Int i) const
SimDataDesc& dataDesc(uInt i)
const SimDataDesc& dataDesc(uInt i) const
uInt numDesc() const
uInt numIds() const
SimDataDesc& addDataDesc(uInt polId, uInt spw, Bool upto=False)
SimDataDesc& addDataDesc(uInt polId, const Vector<uInt>& spwids)
uInt loadSpWinMap(Vector<uInt>& out, Int npol=-1, Int nspw=-1)
void initFrom(const MSDataDescription& ddt)
void flush(MSDataDescription& ddt, uInt npol, uInt nspw)
Private Members
void deleteRecs()
SimDataDesc& get(Int i) const
void throwOutOfRange(uInt legallength, Int index) const
void add(SimDataDesc *dop)

Description

Prerequisite

Etymology

This class holds a list of SimDataDesc objects.

Synopsis

This class holds a list of SimDataDesc instances which, as a group, describes a spectrometer set-up (typical of correlation spectrometers). When using this class, one does not create SimDataDesc objects directly, but rather implicitly via the addDataDesc() function. The ultimate purpose of this container is to support simulated observations. Simulators would not normally create these objects directly but rather implicitly via the SimObservations class.

An important function handled by this class is the recording of the data descriptiosn to a Measurement Set. This is done with the flush() function. When it writes the data from a SimDataDesc in its list to the MS, it sets the row number of the window via setRow(); this is used as a flag indicating that the SimDataDesc has been flushed. This allows one to later add additional setups to the list; when flush() is called again, only the new SimDataDesc data are written out. This, of course, assumes that the same output MSDataDescription is passed to the flush() function each time. If you want to write all the data to a new DATA_DESCRIPTION table, you can call clearIds() to clear all the row markers.

A list of data descriptions can be read in from a DATA_DESCRIPTION table as well using the initFrom() method or the SimDataDescList(const MSDataDescription&, ...) constructor. These will implicitly set the row markers from the input table. This allows one to add new setups to the already recorded set.

Motivation

This container provides an simplified in-memory representation of data descriptions that will ultimately be written to a DATA_DESCRIPTION table. The interface is oriented toward what is typical with current instruments and thus is simpler than the interface provided by the MS DATA_DESCRIPTION table.

To Do

Member Description

SimDataDescList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), nid_p(0), rec_p(initsz, 0), bydd_p()

create an empty list

SimDataDescList(const MSDataDescription& ddt, uInt stepz=4)

create a list and fill it with the contents of a DATA_DESCRIPTION table

SimDataDescList(const SimDataDescList& t)
SimDataDescList& operator=(const SimDataDescList& t)

create a copy

~SimDataDescList()

void clearIds()

reset all the row markers used to flag the SimDataDesc members that have been recorded to a Measurement Set already. Thus, the next call to flush() will record all SimPols to the DATA_DESCRIPTION table. This should be used when writing to a new DATA_DESCRIPTION table, different from one previously read from or written to.

SimDataDesc& operator[](Int i)
const SimDataDesc& operator[](Int i) const

access the i-th SimDataDesc object in this list.

SimDataDesc& dataDesc(uInt i)
const SimDataDesc& dataDesc(uInt i) const

return the SimDataDesc for the data description with a given ID.

uInt numDesc() const

return the number of SimDataDesc objects in this list

uInt numIds() const

return the number of data description IDs in this list. That is, return the number of window-polarization setup cominations in this list.

SimDataDesc& addDataDesc(uInt polId, uInt spw, Bool upto=False)

Add a description associating a polarization setup with a spectral window. polid is the POLARIZATION_ID, and spw is the SPECTRALWINDOW_ID when upto=False. If upto is True, the polarization set up will be associated with all spectral windows with IDs less than spw.

SimDataDesc& addDataDesc(uInt polId, const Vector<uInt>& spwids)

Create a record associating a polarization setup with a set of spectral windows

uInt loadSpWinMap(Vector<uInt>& out, Int npol=-1, Int nspw=-1)

load a vector that provides a map of DataDescription IDs to spectral window. If npol is >= 0, then only those data description IDs that point to polarization IDs < npol will be included in the map. Similarly, if nspw >= 0, only those data description IDs that point to spectral window IDs < nspw will be included. To get a map that is consistent with what is actually written out to the DATA_DESCRIPTION table by flush(), npol and nspw must both be > 0. When npol and nspw are not provided, the map returned is one based on the assumption that all data description records are valid and will be written out.

void initFrom(const MSDataDescription& ddt)

add data descriptions lookups from an MS

void flush(MSDataDescription& ddt, uInt npol, uInt nspw)

write out all data descriptions that have yet to be written

void deleteRecs()

SimDataDesc& get(Int i) const

void throwOutOfRange(uInt legallength, Int index) const

void add(SimDataDesc *dop)