SDRecord.h

Classes

SDRecord -- This class enforces the structure of SDRecord expected by SDRecord consumers. (full description)

class SDRecord : public Record

Interface

Public Members
friend ostream& operator<< (ostream& os, const SDRecord& rec)
SDRecord(DataType dataType = TpFloat)
SDRecord(const SDRecord& other)
SDRecord(const Record& other)
~SDRecord()
SDRecord& operator=(const SDRecord& other)
const Record &data() const
Record &data()
const Record &desc() const
Record &desc()
const Record &header() const
Record &header()
const Array<String> &hist() const
Array<String> &hist()
const Record &other() const
Record &other()
Bool resize(const IPosition &newShape)
const IPosition& shape() const
Bool isValid() const
Bool isConsistent(String &errmsg) const
DataType arrType() const
const RORecordFieldPtr<Array<Float> > &rotsys() const
const RORecordFieldPtr<Double> &roduration() const
const RORecordFieldPtr<Double> &roexposure() const
const RORecordFieldPtr<Double> &rorestfrequency() const
const RORecordFieldPtr<String> &roveldef() const
const RORecordFieldPtr<String> &rorefframe() const
const RORecordFieldPtr<Record> &rochan_freq() const
const RORecordFieldPtr<Double> &roreffrequency() const
const RORecordFieldPtr<Array<Bool> > &roflag() const
const RORecordFieldPtr<Array<Float> > &roweight() const
const RORecordFieldPtr<Array<Float> > &rosigma() const
RecordFieldPtr<Array<Float> > &tsys()
RecordFieldPtr<Double> &duration()
RecordFieldPtr<Double> &exposure()
RecordFieldPtr<Double> &restfrequency()
RecordFieldPtr<String> &veldef()
RecordFieldPtr<String> &refframe()
RecordFieldPtr<Record> &chan_freq()
RecordFieldPtr<Double> &reffrequency()
RecordFieldPtr<Array<Bool> > &flag()
RecordFieldPtr<Array<Float> > &weight()
RecordFieldPtr<Array<Float> > &sigma()
const RORecordFieldPtr<Array<Float> > &rofarr() const
RecordFieldPtr<Array<Float> > &farr()
const RORecordFieldPtr<Array<Complex> > &rocarr() const
RecordFieldPtr<Array<Complex> > &carr()
static Bool isValid(const Record& rec)
static RecordDesc requiredDesc(DataType dataType)
ostream & show(ostream &os) const
static ostream & showRecord(ostream &os, const Record &rec)
Private Members
static void initStatics()
void initPointers()
void defaultValues()
void defaultMatValues()
void defaultVecValues()
void cacheShape()
void clear()

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

An SDRecord has a Record with a structure particularly suited for single dish data.

Synopsis

An SDRecord is a fixed format Record with the following structure: data TpRecord (fixed) desc TpRecord - things which describe the data chan_freq - Quantum > - chan_freq cell values refframe - String - frequency reference frame reffrequency - Double - frequence at value of reference pixel, same units as chan_freq chan_width - Double - channel width at reffrequency, for use in selection, same units as chan_freq restfrequency - Douuble - Hz corr_type - Vector - Stokes values converted to string representation units - String - units of the arr array (the data units) arr (TpArrayFloat || TpArrayComplex)(nchan, nstokes) flag TpArrayBool (nchan, nstokes) when flag(i,j) == True arr(i,j) is bad and should not be used weight TpArrayFloat (nchan, nstokes) sigma TpArrayFloat (nchan, nstokes) header TpRecord (fixed) time - MEpoch as a MeasureHolder scan_number - TpInt source_name - TpString direction - MDirection as a MeasureHolder refdirection - MDirection as a MeasureHolder veldef - TpString - velocity definition (RADIO, OPTICAL, ...) transition - TpString exposure - Double - seconds duration - DOuble - seconds observer - TpString project - TpString resolution - Double - channel resulution at reffrequency - Hz bandwidth - Double - total bandwidth - Hz tcal - TpArrayFloat(nstokes) - K trx - TpArrayFloat(nstokes) - K tsys - TpArrayFloat(nstokes) - K telescope - TpString telescope_position - MPosition as MeasureHolder pressure - hPa dewpoint - K tambient - K wind_dir - rad wind_speed - m/s azel - MDirection as MeasureHolder hist TpArrayString - the history of this SDRecord other - TpRecord - the contents of this depend on the data source if the source is a MeaurementSet, this record contains sub-records having the same names as the subtables found in the MeasurementSet. The contents of these records will be the appropriate single row from that subtable. Each record has an interp_method attribut which is a String that indicates how that row was filled from the Measurements. "direct" means that the row was directly indexed and no interpolation was necessary. "nearest" means that the nearest row in time and falling within the appropriate interval, as appropriate, was used. Other interpolation schemes are planned. In addition to the sub-table records, there will also be a "keys" record to hold the keys from the Main table. Non-standard subtables will be included here IF they have a TIME column and optionally an INTERVAL column or if they have an NS_KEYS keyword which indicates integer key columns. if the source is a table from an SDFITS binary table, any column/keyword not used should be added to an sdfits subrecord in the other record. if the source is an Image, any information not used in data and header should be added to an image subrecord in the other record

Anything with the above structure is a valid SDRecord It is intended to hold data originally from a MeasurementSet, a table constructed from an SDFITS table, or from an image cube and still be independent from these original data sources. As such, the data and header and intended to contain the most comonly used standard information about single dish data. Some data sources, most notably the MeasurementSet, will also typically duplicate some of the information found in the data and header records in the other records.

This class also provides convenient access to the required fields.

Example

Motivation

DISH works on individual rows of a MS and this structure helps that.

Thrown Exceptions

To Do

Member Description

friend ostream& operator<< (ostream& os, const SDRecord& rec)

This is mostly useful during debugging

SDRecord(DataType dataType = TpFloat)

The default SDRecord has the basic structure but indicates an empty data array, a default CoordinateSystem, empty header values and indexes. Primarily useful for assignments except within SDIterator which starts from this and constructs the full record. The type of an SDRecord can be either TpFloat or TpComplex. This determines the data type of the arr field and it must be set when the SDRecord is first constructed.

SDRecord(const SDRecord& other)

SDRecords are generally constructed within an SDIterator Sets this to an empty SDRecord and raises the error flag if other is not valid. The data type of this SDRecord will be the same as that of other

SDRecord(const Record& other)

~SDRecord()

SDRecord& operator=(const SDRecord& other)

const Record &data() const

the data sub-record

Record &data()

const Record &desc() const

the desc sub-record

Record &desc()

const Record &header() const

the header record

Record &header()

const Array<String> &hist() const

the history vector

Array<String> &hist()

const Record &other() const

the other record

Record &other()

Bool resize(const IPosition &newShape)

resize all standard array fields to be consistent with the new data shape

const IPosition& shape() const

return the current data shape

Bool isValid() const

verify that this SDRecord is still valid

Bool isConsistent(String &errmsg) const

verify that this SDRecord is consistent, a message describing the first failed inconsistency is return in errmsg when the return value is False.

DataType arrType() const

what type of a data array is this

const RORecordFieldPtr<Array<Float> > &rotsys() const
const RORecordFieldPtr<Double> &roduration() const
const RORecordFieldPtr<Double> &roexposure() const
const RORecordFieldPtr<Double> &rorestfrequency() const
const RORecordFieldPtr<String> &roveldef() const
const RORecordFieldPtr<String> &rorefframe() const
const RORecordFieldPtr<Record> &rochan_freq() const
const RORecordFieldPtr<Double> &roreffrequency() const
const RORecordFieldPtr<Array<Bool> > &roflag() const
const RORecordFieldPtr<Array<Float> > &roweight() const
const RORecordFieldPtr<Array<Float> > &rosigma() const
RecordFieldPtr<Array<Float> > &tsys()
RecordFieldPtr<Double> &duration()
RecordFieldPtr<Double> &exposure()
RecordFieldPtr<Double> &restfrequency()
RecordFieldPtr<String> &veldef()
RecordFieldPtr<String> &refframe()
RecordFieldPtr<Record> &chan_freq()
RecordFieldPtr<Double> &reffrequency()
RecordFieldPtr<Array<Bool> > &flag()
RecordFieldPtr<Array<Float> > &weight()
RecordFieldPtr<Array<Float> > &sigma()

These methods provide quick access to some fields.

const RORecordFieldPtr<Array<Complex> > &rocarr() const

Quick access to the data array. One of farr and carr will be empty, depending on the type of record.

arr field when this contains Complex data

const RORecordFieldPtr<Array<Float> > &rofarr() const
RecordFieldPtr<Array<Float> > &farr()
RecordFieldPtr<Array<Complex> > &carr()

Quick access to the data array. One of farr and carr will be empty, depending on the type of record.

static Bool isValid(const Record& rec)

verify that a record is a valid SDRecord

static RecordDesc requiredDesc(DataType dataType)

return the minimum required description

ostream & show(ostream &os) const

used by ostream << operator

static ostream & showRecord(ostream &os, const Record &rec)

this actually does the work, hierachically on each subrecord

static void initStatics()

function to initialize itsBasicDesc and itsBasicComplexDesc

void initPointers()

initialize the pointers

void defaultValues()

set the default values

void defaultMatValues()

set the default values for variable shaped matrices

void defaultVecValues()

set the default values for variable shaped vectors

void cacheShape()

get shape from the arr field

void clear()

function to set all fields to their default values by type