[1778] | 1 | //
|
---|
| 2 | // C++ Interface: FillerBase
|
---|
| 3 | //
|
---|
| 4 | // Description:
|
---|
| 5 | //
|
---|
| 6 | //
|
---|
| 7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010
|
---|
| 8 | //
|
---|
| 9 | // Copyright: See COPYING file that comes with this distribution
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 |
|
---|
| 13 | #include "FillberBase.h"
|
---|
| 14 |
|
---|
| 15 | using namespace casa;
|
---|
| 16 |
|
---|
| 17 | namespace asap
|
---|
| 18 | {
|
---|
| 19 | FillerBase::FillerBase() :
|
---|
| 20 | table_(0),
|
---|
| 21 | {
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | void FillerBase::setSpectrum(const Vector<Float>& spectrum,
|
---|
| 25 | const Vector<uChar>& flags)
|
---|
| 26 | {
|
---|
| 27 | RecordFieldPtr< Array<Float> > specCol(row_.record(), "SPECTRA");
|
---|
| 28 | RecordFieldPtr< Array<uChar> > flagCol(row_.record(), "FLAGTRA");
|
---|
| 29 | *specCol = spectrum;
|
---|
| 30 | *flagCol = flags;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void FillerBase::setIndex(uInt scanno, uInt cycleno, uInt ifno, uInt polno,
|
---|
| 34 | uInt beamno)
|
---|
| 35 | {
|
---|
| 36 | RecordFieldPtr<uInt> beamCol(row_.record(), "BEAMNO");
|
---|
| 37 | RecordFieldPtr<uInt> ifCol(row_.record(), "IFNO");
|
---|
| 38 | RecordFieldPtr<uInt> polCol(row_.record(), "POLNO");
|
---|
| 39 | RecordFieldPtr<uInt> cycleCol(row_.record(), "CYCLENO");
|
---|
| 40 | RecordFieldPtr<uInt> scanColCol(row_.record(), "SCANNO");
|
---|
| 41 | *beamCol = beamno;
|
---|
| 42 | *cycleCol = cycleno;
|
---|
| 43 | *ifCol = ifno;
|
---|
| 44 | *polCol = polno;
|
---|
| 45 | *scanCol = scanno;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | void FillerBase::setFrequency(Double refpix, Double refval,
|
---|
| 49 | Double incr);
|
---|
| 50 | {
|
---|
| 51 | /// @todo this has to change when nchan isn't global anymore
|
---|
| 52 | uInt id= table_->frequencies().addEntry(refpix, refval, incr);
|
---|
| 53 | RecordFieldPtr<uInt> mfreqidCol(row_.record(), "FREQ_ID");
|
---|
| 54 | *mfreqidCol = id;
|
---|
| 55 |
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | void FillerBase::setMolecule(Double restfreq)
|
---|
| 60 | {
|
---|
| 61 | uInt id = table_->molecules().addEntry(restfreq);
|
---|
| 62 | RecordFieldPtr<uInt> molidCol(row_.record(), "MOLECULE_ID");
|
---|
| 63 | *molidCol = id;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | void FillerBase::setDirection(const Vector<Double>& dir.
|
---|
| 67 | Float az, Float el)
|
---|
| 68 | {
|
---|
| 69 | RecordFieldPtr<Array<Double> > dirCol(row_.record(), "DIRECTION");
|
---|
| 70 | *dirCol = dir;
|
---|
| 71 | RecordFieldPtr<Float> azCol(row_.record(), "AZIMUTH");
|
---|
| 72 | *azCol = az;
|
---|
| 73 | RecordFieldPtr<Float> elCol(row_.record(), "ELEVATION");
|
---|
| 74 | *elCol = el;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void FillerBase::setFocus(Float pa, Float faxis,
|
---|
| 78 | Float ftan, Float frot)
|
---|
| 79 | {
|
---|
| 80 | RecordFieldPtr<uInt> mfocusidCol(row_.record(), "FOCUS_ID");
|
---|
| 81 | uInt id = table_->focus().addEntry(pa, faxis, ftan, frot);
|
---|
| 82 | *mfocusidCol = id;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | void FillerBase::setTime(Double interval, Double mjd)
|
---|
| 86 | {
|
---|
| 87 | RecordFieldPtr<Double> mjdCol(row_.record(), "TIME");
|
---|
| 88 | *mjdCol = mjd;
|
---|
| 89 | RecordFieldPtr<Double> intCol(row_.record(), "INTERVAL");
|
---|
| 90 | *intCol = interval;
|
---|
| 91 |
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | void FillerBase::setWeather(Float temperature, Float pressure,
|
---|
| 95 | Float humidity,
|
---|
| 96 | Float windspeed, Float windaz)
|
---|
| 97 | {
|
---|
| 98 | uInt id = table_->weather().addEntry(temperature, pressure,
|
---|
| 99 | humidity, windspeed, windaz);
|
---|
| 100 | RecordFieldPtr<uInt> mweatheridCol(row_.record(), "WEATHER_ID");
|
---|
| 101 | *mweatheridCol = id;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | void FillerBase::setTcal(const String& tcaltime,
|
---|
| 105 | const Vector<Float>& tcal)
|
---|
| 106 | {
|
---|
| 107 | uInt id = table_->tcal().addEntry(tcaltime, tcal);
|
---|
| 108 | RecordFieldPtr<uInt> mcalidCol(row_.record(), "TCAL_ID");
|
---|
| 109 | *mcalidCol = id;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | void FillerBase::setScanRate(const Vector<Double>& srate)
|
---|
| 113 | {
|
---|
| 114 |
|
---|
| 115 | RecordFieldPtr<Array<Double> > srateCol(row_.record(), "SCANRATE");
|
---|
| 116 | *srateCol = srate;
|
---|
| 117 |
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | void FillerBase::setReferenceBeam(Int beamno)
|
---|
| 121 | {
|
---|
| 122 | RecordFieldPtr<Int> rbCol(row_.record(), "REFBEAMNO");
|
---|
| 123 | *rbCol = beamno;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | void FillerBase::setSource(const std::string& name, Int type,
|
---|
| 127 | const std::string& fieldname,
|
---|
| 128 | const Vector<Double>& dir,
|
---|
| 129 | const Vector<Double>& propermot,
|
---|
| 130 | Double velocity)
|
---|
| 131 | {
|
---|
| 132 | RecordFieldPtr<String> srcnCol(row_.record(), "SRCNAME");
|
---|
| 133 | *srnCol = name;
|
---|
| 134 | RecordFieldPtr<Int> srctCol(row_.record(), "SRCTYPE");
|
---|
| 135 | *srctCol = type;
|
---|
| 136 | RecordFieldPtr<String> fieldnCol(row_.record(), "FIELDNAME");
|
---|
| 137 | *fieldnCol = fieldname;
|
---|
| 138 | RecordFieldPtr<Array<Double> > spmCol(row_.record(), "SRCPROPERMOTION");
|
---|
| 139 | *spmCol = pksrec.srcPM;
|
---|
| 140 | RecordFieldPtr<Array<Double> > sdirCol(row_.record(), "SRCDIRECTION");
|
---|
| 141 | *sdirCol = pksrec.srcDir;
|
---|
| 142 | RecordFieldPtr<Double> svelCol(row_.record(), "SRCVELOCITY");
|
---|
| 143 | *svelCol = pksrec.srcVel;
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | void FillerBase::commitRow()
|
---|
| 147 | {
|
---|
| 148 | table_->table().addRow();
|
---|
| 149 | row_.put(table_->table().nrow()-1);
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | };
|
---|