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 <casa/Containers/RecordField.h>
|
---|
14 |
|
---|
15 | #include "FillerBase.h"
|
---|
16 |
|
---|
17 | using namespace casa;
|
---|
18 |
|
---|
19 | namespace asap {
|
---|
20 |
|
---|
21 | FillerBase::FillerBase(casa::CountedPtr<Scantable> stable) :
|
---|
22 | table_(stable)
|
---|
23 | {
|
---|
24 | }
|
---|
25 |
|
---|
26 | void FillerBase::setHeader(const STHeader& header)
|
---|
27 | {
|
---|
28 | table_->setHeader(header);
|
---|
29 | }
|
---|
30 |
|
---|
31 | void FillerBase::setSpectrum(const Vector<Float>& spectrum,
|
---|
32 | const Vector<uChar>& flags,
|
---|
33 | const Vector<Float>& tsys)
|
---|
34 | {
|
---|
35 | RecordFieldPtr< Array<Float> > specCol(row_.record(), "SPECTRA");
|
---|
36 | RecordFieldPtr< Array<uChar> > flagCol(row_.record(), "FLAGTRA");
|
---|
37 | RecordFieldPtr< Array<Float> > tsysCol(row_.record(), "TSYS");
|
---|
38 |
|
---|
39 | *specCol = spectrum;
|
---|
40 | *flagCol = flags;
|
---|
41 | *tsysCol = tsys;
|
---|
42 | }
|
---|
43 |
|
---|
44 |
|
---|
45 | void FillerBase::setOpacity(Float opacity)
|
---|
46 | {
|
---|
47 | RecordFieldPtr<Float> tauCol(row_.record(), "OPACITY") ;
|
---|
48 | *tauCol = opacity ;
|
---|
49 | }
|
---|
50 |
|
---|
51 | void FillerBase::setIndex(uInt scanno, uInt cycleno, uInt ifno, uInt polno,
|
---|
52 | uInt beamno)
|
---|
53 | {
|
---|
54 | RecordFieldPtr<uInt> beamCol(row_.record(), "BEAMNO");
|
---|
55 | RecordFieldPtr<uInt> ifCol(row_.record(), "IFNO");
|
---|
56 | RecordFieldPtr<uInt> polCol(row_.record(), "POLNO");
|
---|
57 | RecordFieldPtr<uInt> cycleCol(row_.record(), "CYCLENO");
|
---|
58 | RecordFieldPtr<uInt> scanCol(row_.record(), "SCANNO");
|
---|
59 | *beamCol = beamno;
|
---|
60 | *cycleCol = cycleno;
|
---|
61 | *ifCol = ifno;
|
---|
62 | *polCol = polno;
|
---|
63 | *scanCol = scanno;
|
---|
64 | }
|
---|
65 |
|
---|
66 | void FillerBase::setFrequency(Double refpix, Double refval,
|
---|
67 | Double incr)
|
---|
68 | {
|
---|
69 | /// @todo this has to change when nchan isn't global anymore
|
---|
70 | uInt id= table_->frequencies().addEntry(refpix, refval, incr);
|
---|
71 | RecordFieldPtr<uInt> mfreqidCol(row_.record(), "FREQ_ID");
|
---|
72 | *mfreqidCol = id;
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 | void FillerBase::setMolecule(const Vector<Double>& restfreq)
|
---|
78 | {
|
---|
79 | Vector<String> tmp;
|
---|
80 | uInt id = table_->molecules().addEntry(restfreq, tmp, tmp);
|
---|
81 | RecordFieldPtr<uInt> molidCol(row_.record(), "MOLECULE_ID");
|
---|
82 | *molidCol = id;
|
---|
83 | }
|
---|
84 |
|
---|
85 | void FillerBase::setDirection(const Vector<Double>& dir,
|
---|
86 | Float az, Float el)
|
---|
87 | {
|
---|
88 | RecordFieldPtr<Array<Double> > dirCol(row_.record(), "DIRECTION");
|
---|
89 | *dirCol = dir;
|
---|
90 | RecordFieldPtr<Float> azCol(row_.record(), "AZIMUTH");
|
---|
91 | *azCol = az;
|
---|
92 | RecordFieldPtr<Float> elCol(row_.record(), "ELEVATION");
|
---|
93 | *elCol = el;
|
---|
94 | }
|
---|
95 |
|
---|
96 | void FillerBase::setFocus(Float pa, Float faxis,
|
---|
97 | Float ftan, Float frot)
|
---|
98 | {
|
---|
99 | RecordFieldPtr<uInt> mfocusidCol(row_.record(), "FOCUS_ID");
|
---|
100 | uInt id = table_->focus().addEntry(pa, faxis, ftan, frot);
|
---|
101 | *mfocusidCol = id;
|
---|
102 | }
|
---|
103 |
|
---|
104 | void FillerBase::setTime(Double interval, Double mjd)
|
---|
105 | {
|
---|
106 | RecordFieldPtr<Double> mjdCol(row_.record(), "TIME");
|
---|
107 | *mjdCol = mjd;
|
---|
108 | RecordFieldPtr<Double> intCol(row_.record(), "INTERVAL");
|
---|
109 | *intCol = interval;
|
---|
110 |
|
---|
111 | }
|
---|
112 |
|
---|
113 | void FillerBase::setWeather(Float temperature, Float pressure,
|
---|
114 | Float humidity,
|
---|
115 | Float windspeed, Float windaz)
|
---|
116 | {
|
---|
117 | uInt id = table_->weather().addEntry(temperature, pressure,
|
---|
118 | humidity, windspeed, windaz);
|
---|
119 | RecordFieldPtr<uInt> mweatheridCol(row_.record(), "WEATHER_ID");
|
---|
120 | *mweatheridCol = id;
|
---|
121 | }
|
---|
122 |
|
---|
123 | void FillerBase::setTcal(const String& tcaltime,
|
---|
124 | const Vector<Float>& tcal)
|
---|
125 | {
|
---|
126 | uInt id = table_->tcal().addEntry(tcaltime, tcal);
|
---|
127 | RecordFieldPtr<uInt> mcalidCol(row_.record(), "TCAL_ID");
|
---|
128 | *mcalidCol = id;
|
---|
129 | }
|
---|
130 |
|
---|
131 | void FillerBase::setScanRate(const Vector<Double>& srate)
|
---|
132 | {
|
---|
133 | RecordFieldPtr<Array<Double> > srateCol(row_.record(), "SCANRATE");
|
---|
134 | *srateCol = srate;
|
---|
135 | }
|
---|
136 |
|
---|
137 | void FillerBase::setReferenceBeam(Int beamno)
|
---|
138 | {
|
---|
139 | RecordFieldPtr<Int> rbCol(row_.record(), "REFBEAMNO");
|
---|
140 | *rbCol = beamno;
|
---|
141 | }
|
---|
142 |
|
---|
143 | void FillerBase::setSource(const std::string& name, Int type,
|
---|
144 | const std::string& fieldname,
|
---|
145 | const Vector<Double>& dir,
|
---|
146 | const Vector<Double>& propermot,
|
---|
147 | Double velocity)
|
---|
148 | {
|
---|
149 | RecordFieldPtr<String> srcnCol(row_.record(), "SRCNAME");
|
---|
150 | *srcnCol = name;
|
---|
151 | RecordFieldPtr<Int> srctCol(row_.record(), "SRCTYPE");
|
---|
152 | *srctCol = type;
|
---|
153 | RecordFieldPtr<String> fieldnCol(row_.record(), "FIELDNAME");
|
---|
154 | *fieldnCol = fieldname;
|
---|
155 | RecordFieldPtr<Array<Double> > spmCol(row_.record(), "SRCPROPERMOTION");
|
---|
156 | *spmCol = propermot;
|
---|
157 | RecordFieldPtr<Array<Double> > sdirCol(row_.record(), "SRCDIRECTION");
|
---|
158 | *sdirCol = dir;
|
---|
159 | RecordFieldPtr<Double> svelCol(row_.record(), "SRCVELOCITY");
|
---|
160 | *svelCol = velocity;
|
---|
161 | }
|
---|
162 |
|
---|
163 | void FillerBase::commitRow()
|
---|
164 | {
|
---|
165 | table_->table().addRow();
|
---|
166 | row_.put(table_->table().nrow()-1);
|
---|
167 | }
|
---|
168 |
|
---|
169 | };
|
---|