SimSpWin.h

Classes

SimSpWin -- a container for data destined for an MS SPECTRAL_WINDOW record (full description)
SimSpWinList -- a container for data destined for an MS SPECTRAL_WINDOW record (full description)

class SimSpWin

Interface

Public Members
SimSpWin(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const String& name="", Bool usb=True)
SimSpWin(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const MFrequency refFreq, const String& name="", Bool usb=True)
SimSpWin(const MFrequency& start, const MVFrequency& width, const String& name="", Bool usb=True)
SimSpWin(const SimSpWin& other)
SimSpWin& operator=(const SimSpWin& other)
~SimSpWin()
uInt numChannels() const
Bool isUpperSideBand() const
const MFrequency& startFreq() const
const MFrequency& refFreq() const
const MVFrequency& chanWidth() const
const MVFrequency& chanStep() const
Int netSideband() const
Vector<Double>& chanFreq(Vector<Double> &freqs) const
Vector<Double>& chanWidth(Vector<Double>& widths) const
Double totalBandwidth() const
const String& getName() const
void setName(const String& name)
Int getId() const
void setId(Int id)
Bool isUniform() const
void setUniform(Bool flag)
Protected Members
SimSpWin()

Description

Prerequisite

Etymology

This is a container for describing a spectral window setup for a simulated telescope.

Synopsis

This class describes a single spectral window from a spectrometer of a telescope. It assumes a simple model in which a window is made up of one or more contiguous, uniform channels, typical of spectral correlator found on modern interferometers. This container is used to define simulated observations. Simulators would not normally create these objects directly but rather implicitly via the SimTelescope class.

The data describing the window is set at construction time and cannot be changed later. The data model assumes that the spectral channels that can be described by a starting frequency, a frequency increment, and a total number of channels. Furthermore, all channels are assumed to have the same channel bandwidth. The window can be given a name and a sideband designation. The only writable data of this class are a row marker (via setRow()), used by SimSpWinList to keep track of windows that have been written out to a SPECTRAL_WINDOW table in a Measurement Set, and a uniform flag (via setUniform()) which is used by SimSpWinList to indicate that a window read in from an MS does not really fit into the simple uniform data model. Neither of these writable items affect what is written out to a Measurement Set.

Motivation

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

To Do

Member Description

SimSpWin(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const String& name="", Bool usb=True)
SimSpWin(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const MFrequency refFreq, const String& name="", Bool usb=True)

initialize the container

SimSpWin(const MFrequency& start, const MVFrequency& width, const String& name="", Bool usb=True)

initialize the container to a single-channel continuum window

SimSpWin(const SimSpWin& other)
SimSpWin& operator=(const SimSpWin& other)

make a copy of the container

~SimSpWin()

uInt numChannels() const

Bool isUpperSideBand() const

const MFrequency& startFreq() const

const MFrequency& refFreq() const

const MVFrequency& chanWidth() const

const MVFrequency& chanStep() const

Int netSideband() const

return the net sideband code

Vector<Double>& chanFreq(Vector<Double> &freqs) const

load a Vector with the channel frequencies in Hertz

Vector<Double>& chanWidth(Vector<Double>& widths) const

load a Vector with the channel widths in Hertz

Double totalBandwidth() const

return the total bandwidth of the window in Hz. This is equal to the step size times the number of channels.

const String& getName() const
void setName(const String& name)

get and set the name of the window

Int getId() const
void setId(Int id)

get and set the ID. An ID less than zero means that this record has not yet been recorded.

Bool isUniform() const
void setUniform(Bool flag)

get and set the uniformity flag. This flag is False if the set up is not actually uniform enough to be described by this container. This will be the case if the set up originated from an atypical MS.

SimSpWin()

create an empty container

class SimSpWinList

Interface

Public Members
SimSpWinList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), rec_p(initsz, 0)
SimSpWinList(const MSSpectralWindow& spwt, uInt stepsz=4)
SimSpWinList(const SimSpWinList& other)
SimSpWinList& operator=(const SimSpWinList& other)
~SimSpWinList()
void clearIds()
SimSpWin& operator[](Int i)
const SimSpWin& operator[](Int i) const
Int numWindows() const
SimSpWin& addWindow(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const MFrequency &refFreq, const String& name="", Bool usb=True)
SimSpWin& addWindow(uInt nchan, const MFrequency& start, const MVFrequency& width, const MVFrequency& step, const String& name="", Bool usb=True)
SimSpWin& addWindow(const MFrequency& start, const MVFrequency& width, const String& name="", Bool usb=True)
void numChannels(Vector<Int> nchan) const
void initFrom(const MSSpectralWindow& spwt)
void flush(MSSpectralWindow& spwt)
Private Members
void deleteRecs()
SimSpWin& get(Int i) const
void throwOutOfRange(uInt legallength, Int index) const
void add(SimSpWin *win)

Description

Prerequisite

Etymology

This class holds a list of SimSpWin objects.

Synopsis

This class holds a list of SimSpWin instances which, as a group, describes a spectrometer set-up (typical of correlation spectrometers). When using this class, one does not create SimSpWin objects directly, but rather implicitly via the addWindow() function. (A special version is available for adding single-channel windows.) The ultimate purpose of this container is to support simulated observations. Simulators would not normally create these objects directly but rather implicitly via the SimTelescope class.

An important function handled by this class is the recording of the window descriptions to a Measurement Set. This is done with the flush() function. When it writes the data from a SimSpWin 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 SimSpWin as been flushed. This allows one to later add additional windows to the list; when flush() is called again, only the new SimSpWin data are written out. This, of course, assumes that the same output MSSpectralWindow is passed to the flush() function each time. If you want to write all the data to a new SPECTRAL_WINDOW table, you can call clearIds() to clear all the row markers.

A set of windows can be read in from a SPECTRAL_WINDOW table as well using the initFrom() method or the SimSpWinList(const MSSpectralWindow&, ...) constructor. These will implicitly set the row markers from the input table. This allows one to add new windows to the already recorded set.

Motivation

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

To Do

Member Description

SimSpWinList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), rec_p(initsz, 0)

create an empty buffer

SimSpWinList(const MSSpectralWindow& spwt, uInt stepsz=4)

create a buffer and fill it with the contents of a SPECTRAL_WINDOW table

SimSpWinList(const SimSpWinList& other)
SimSpWinList& operator=(const SimSpWinList& other)

create a copy

~SimSpWinList()

void clearIds()

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

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

access the i-th window in this list.

Int numWindows() const

return the number of windows described in this list

SimSpWin& addWindow(const MFrequency& start, const MVFrequency& width, const String& name="", Bool usb=True)

add a multi-channel spectral window

add a single channel continuum window

void numChannels(Vector<Int> nchan) const

add a multi-channel spectral window

load the number of channels in each window into given Vector. The input Vector, nchan, will be resized to the value returned by numWindows().

void initFrom(const MSSpectralWindow& spwt)

add a multi-channel spectral window

add window descriptions from an MS SPECTRAL_WINDOW table

void flush(MSSpectralWindow& spwt)

add a multi-channel spectral window

write out all windows that have yet to be written

void deleteRecs()
SimSpWin& get(Int i) const
void throwOutOfRange(uInt legallength, Int index) const
void add(SimSpWin *win)