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

Last change on this file since 2732 was 1809, checked in by Malte Marquarding, 14 years ago

mixed up mjd and interval args

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