SimField.h
Classes
- SimField -- a container for data destined for an MS FIELD table (full description)
- SimFieldList -- a container for data destined for an MS FIELD table (full description)
Interface
- Public Members
- SimField(uInt srcId, const MDirection& dir, Double longOffset=0.0, Double latOffset=0.0, const longOffset& name="", const longOffset& code="") : row_p(-1), src_p(srcId), rep_p(0), off_p(2,0.0), name_p(name), code_p(code), dir_p(dir)
- SimField(const SimField& s)
- SimField& operator=(const SimField& s)
- ~SimField()
- Int getRow() const
- void setRow(Int id)
- uInt sourceId() const
- const String& name() const
- const String& code() const
- const Vector<Double>& offset() const
- const MDirection& direction() const
- static Vector<Double> offset(const MDirection srcdir, const MDirection flddir)
- uInt repetition() const
- void setRepetition(uInt n)
Prerequisite
Etymology
This is a container for describing fields to be observed in simulated
observations.
Synopsis
This container describes a field to be observed in a set
of simulated observations. It provides a simplified data model for a field
that assumes that the field position is not moving in time and that its
delay, phase, and reference directions are all the same. Furthermore, it
provides an observer-oriented interface that allows one to specify the
field direction in terms of offsets from a source or reference direction.
This container is used to define simulated observations. Simulators would
not normally create these objects directly but rather implicitly via the
SimObservations class.
The field direction and the associated source ID are set at construction
time and cannot be changed. No check is done to ensure that the source
ID exists or is otherwise valid; this must be done at a higher level.
The only writable data in this class are a row marker (via setRow(), used by
SimFieldList) and an optional
repetition factor. The repetition factor (set with setRepetition())
indicates how many times this field should be observed consecutively before
observing slews to the next field. This value is not recorded in an MS
FIELD table. (The SimpleSimulator
uses this as a default repetition value if one is not set at a higher
level.)
Motivation
This container provides an simplified in-memory representation of
feeds that will ultimately be written to a FIELD table.
The interface is oriented toward what is typical with current instruments
and thus is simpler than the interface provided by the MS FIELD 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
SimField(uInt srcId, const MDirection& dir, Double longOffset=0.0, Double latOffset=0.0, const longOffset& name="", const longOffset& code="") : row_p(-1), src_p(srcId), rep_p(0), off_p(2,0.0), name_p(name), code_p(code), dir_p(dir)
Create a record.
srcId is the source ID that this field is associated with.
dir is normally the position of the source referenced by srcId
so that longOffset and latOffset gives the relative
position of the field center; however, dir will be the
absolute position of the field when
longOffset=latOffset=0.
longOffset is the true angular offset in radians in the direction
perpendicular to the celestial pole (i.e. along a great
circle) of the field center from the source position
given by dir.
latOffset is the angular offset in radians in the direction of the
celestial (north) pole of the field center from the
source position.
SimField(const SimField& s)
SimField& operator=(const SimField& s)
create a copy
Int getRow() const
void setRow(Int id)
get and set the row ID, the row in the FIELD table containing this
record. An ID less than zero means that this record has not yet
been recorded.
return the ID of the source observed in this field
return the name of the field
return the code of the field
return the offset from the source position for this field. The
first element is the longitude offset and the second is the
latitude offset. Both are in radians.
return the direction of the field center. (This will recorded
simulataneously as DELAY_DIR, PHASE_DIR, and REFERENCE_DIR.)
compute the shift between to positions. The returned vector is
the same as returned from offset(). The values are only approximate.
get and set the number of consecutive integrations to perform on
this field. A value of zero means a suitable default value should
be used.
Interface
- SimFieldList(uInt initsz=2, uInt stepsz=4) : n_p(0), chnk_p(stepsz), rec_p(initsz, 0)
- SimFieldList(const MSField& fldt, uInt stepz=4)
- SimFieldList(const SimFieldList& t)
- SimFieldList& operator=(const SimFieldList& t)
- ~SimFieldList()
- void clearIds()
- SimField& operator[](Int i)
- const SimField& operator[](Int i) const
- uInt numFields() const
- SimField& addField(uInt srcId, const MDirection& dir, Double longOffset=0.0, Double latOffset=0.0, const String& name="", const String& code="")
- void initFrom(const MSField& fldt)
- void flush(MSField& fldt, MSSource& srct)
Private Members
- void deleteRecs()
- SimField& get(Int i) const
- void throwOutOfRange(uInt legallength, Int index) const
- void add(SimField *fld)
- uInt loadSourceInfo(MSSource& srct, SimpleOrderedMap<Int, String> &snames, SimpleOrderedMap<Int, Double> ×)
Prerequisite
Etymology
This class holds a list of SimField
objects.
Synopsis
This class holds a list of SimField
instances which, as a group, describes a list of sources to observe.
When using this class, one does not create SimField 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
fields to a Measurement Set. This is done with the flush()
function. When it writes the data from a SimField 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 SimField has been flushed. This
allows one to later add additional setups to the list; when flush() is
called again, only the new SimField 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
FIELD table, you can call clearIds() to clear all the row
markers.
A list of fields can be read in from a FIELD table
as well using the initFrom() method or the SimFieldList(const MSField&, ...)
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 FIELD table.
The interface is oriented toward what is typical with current instruments
and thus is simpler than the interface provided by the MS FIELD
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
SimFieldList(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 FIELD table
SimFieldList(const SimFieldList& t)
SimFieldList& operator=(const SimFieldList& t)
create a copy
reset all the row markers used to flag the SimField members that
have been recorded to a Measurement Set already. Thus, the next call
to flush() will record all SimFields to the FIELD table.
This should be used when writing to a new FIELD table,
different from one previously read from or written to.
access the i-th field in this list.
return the number of fields in this list
SimField& addField(uInt srcId, const MDirection& dir, Double longOffset=0.0, Double latOffset=0.0, const String& name="", const String& code="")
Add a field.
srcId is the source ID that this field is associated with.
dir is normally the position of the source referenced by srcId
so that longOffset and latOffset gives the relative
position of the field center; however, dir will be the
absolute position of the field when
longOffset=latOffset=0.
longOffset is the true angular offset in radians in the direction
perpendicular to the celestial pole (i.e. along a great
circle) of the field center from the source position
given by dir.
latOffset is the angular offset in radians in the direction of the
celestial (north) pole of the field center from the
source position.
add field descriptions from an MS FIELD table
write out all fields that have yet to be written
void throwOutOfRange(uInt legallength, Int index) const