source: branches/newfiller/src/FillerBase.cpp@ 1790

Last change on this file since 1790 was 1788, checked in by Malte Marquarding, 15 years ago

Added omitted elements OPACITY and TSYS

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