SimSource.h
Classes
- SimSource -- a container for data destined for an MS SOURCE table record (full description)
- SimSourceList -- a container for data destined for an MS SOURCE table (full description)
Interface
- Public Members
- SimSource(const String& name, const MDirection& dir, const String& code="", Int spWinId=-1)
- SimSource(const SimSource& that)
- SimSource& operator=(const SimSource& that)
- Int getRow() const
- void setRow(Int id)
- Int getId() const
- void setId(Int id)
- const String &name() const
- const MDirection& direction() const
- const String& code() const
- void setTime(MEpoch t)
- const MEpoch& time() const
- const Double timeSec() const
- Double interval() const
- void setInterval(Quantity intv)
- void setIntervalSec(Double intv)
- Int spectralWindow() const
- Quantity distance() const
- Double distancekm() const
- void setDistance(const Quantity& dist)
- void setDistancekm(Double dist)
Prerequisite
Etymology
This is a container for describing sources to be observed in simulated
observations.
Synopsis
This container describes the sources that are to be observed in a set
of simulated observations. It provides a simpler (subset) representation
of a source than what is allowed in the MS SOURCE table.
This container is used to define simulated observations. Simulators would
not normally create these objects directly but rather implicitly via the
SimObservations class.
For far-field, non-moving objects, one sets the description at construction
time with an object name, direction, and, optionally, a code and associated
spectral window ID. This data cannot be changed later. One can later set
a time stamp and interval if the source is moving, and/or a distance if it
is in the near-field. It is intended that this latter extended data would
be set once and not changed (particularly after the data have been flushed
to disk).
Motivation
This container provides an simplified in-memory representation of
feeds that will ultimately be written to a SOURCE table.
The interface is oriented toward what is typical with current instruments
and thus is simpler than the interface provided by the MS SOURCE table.
To Do
- It would probably be helpful to have a common base classes for
all Sim* and Sim*List classes that are managed by SimTelescope
and SimObservations
Member Description
Create a record
name is the name of the source.
dir is the direction to the source
code is an optional classification of the source in terms
of the role it plays in data processing (see the MS2
spec's defintion of the SOURCE table for details).
spWinId is an associated spectral window ID. If set to -1, the
source is associated with all windows.
SimSource(const SimSource& that)
SimSource& operator=(const SimSource& that)
create a copy
Int getRow() const
void setRow(Int id)
get and set the row ID, the row in the SOURCE table containing this
record. An ID less than zero means that this record has not yet
been recorded.
Int getId() const
void setId(Int id)
get and set the SOURCE_ID.
An ID less than zero means that it will be set to the row ID when it
is recorded in the SOURCE table
return the source name
return the direction to the source
return the role code for this source
set the mid-point of the time interval for which this source
description is valid.
const MEpoch& time() const
const Double timeSec() const
return the mid-point of the time interval for which this source
description is valid. If interval() is < 0, then this time
represents the starting time. The default time is 0s. timesec()
returns the time in seconds and, thus, is more convenient for
determining if the time has been set from its default.
return the time interval for which this source description is valid.
If the interval is < 0, then this description is valid until the
starting time of the next record.
set the time interval for which this source description is valid.
If the interval is < 0, then this description is valid until the
starting time of the next record.
return the spectral window associated with this source. A value
less than 0 refers to all windows.
get and the distance to the source. If <= 0.0, the distance is taken
to be in the far-field (default). The units on the value returned by
distancekm() is kilometers.
Interface
- SimSourceList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), rec_p(initsz, 0)
- SimSourceList(const MSSource& srct, uInt stepz=4)
- SimSourceList(const SimSourceList& t)
- SimSourceList& operator=(const SimSourceList& t)
- ~SimSourceList()
- void clearIds()
- SimSource& operator[](Int i)
- const SimSource& operator[](Int i) const
- Int numSources() const
- SimSource& addSource(const String& name, const MDirection& dir, const String& code="", Int spWinId=-1)
- void initFrom(const MSSource& srct)
- void flush(MSSource& srct)
Private Members
- void deleteRecs()
- SimSource& get(Int i) const
- void throwOutOfRange(uInt legallength, Int index) const
- void add(SimSource *src)
Prerequisite
Etymology
This class holds a list of SimSource
objects.
Synopsis
This class holds a list of SimSource
instances which, as a group, describes a list of sources to observe.
When using this class, one does not create SimSource objects directly,
but rather implicitly via the addSource() 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 SimSource in its list to the MS,
it sets the row number of the source record via setRow();
this is used as a flag indicating that the SimSource as been flushed. This
allows one to later add additional setups to the list; when flush() is
called again, only the new SimSource data are written out. This, of
course, assumes that the same output MSSource is passed to the
flush() function each time. If you want to write all the data to a new
SOURCE table, you can call clearIds() to clear all the row
markers.
A list of polarization setups can be read in from a SOURCE table
as well using the initFrom() method or the
SimSourceList(const MSSource&, ...)
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
sources that will ultimately be written to a SOURCE table.
The interface is oriented toward what is typical with current instruments
and thus is simpler than the interface provided by the MS SOURCE
table.
To Do
- loading from an existing MS needs more testing.
- It would probably be helpful to have a common base classes for
all Sim* and Sim*List classes that are managed by SimTelescope
and SimObservations
Member Description
SimSourceList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), rec_p(initsz, 0)
create an empty list
create a list and fill it with the contents of a SOURCE table
SimSourceList(const SimSourceList& t)
SimSourceList& operator=(const SimSourceList& t)
create a copy
reset all the row markers used to flag the SimSource members that
have been recorded to a Measurement Set already. Thus, the next call
to flush() will record all SimPols to the SOURCE table.
This should be used when writing to a new SOURCE table,
different from one previously read from or written to.
access the i-th source description in this list.
return the number of sources in this list
Create a source description.
name is the name of the source.
dir is the direction to the source
code is an optional classification of the source in terms
of the role it plays in data processing (see the MS2
spec's defintion of the SOURCE table for details).
spWinId is an associated spectral window ID. If set to -1, the
source is associated with all windows.
add source descriptions from an MS SOURCE table
write out all sources that have yet to be written.
void throwOutOfRange(uInt legallength, Int index) const