source: trunk/src/Scantable.h@ 2666

Last change on this file since 2666 was 2666, checked in by Malte Marquarding, 12 years ago

Ticket #173: added setting of constraints on the fitter.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.5 KB
RevLine 
[824]1//
2// C++ Interface: Scantable
3//
4// Description:
5//
6//
7// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2005
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef ASAPSCANTABLE_H
13#define ASAPSCANTABLE_H
[2]14
15// STL
[2186]16#include <fstream>
17#include <iostream>
18#include <sstream>
[2]19#include <string>
20#include <vector>
21// AIPS++
[455]22#include <casa/aips.h>
[322]23#include <casa/Arrays/MaskedArray.h>
[2186]24#include <casa/Arrays/Vector.h>
[80]25#include <casa/BasicSL/String.h>
[2186]26#include <casa/Containers/Record.h>
27#include <casa/Exceptions/Error.h>
28#include <casa/Quanta/Quantum.h>
[824]29#include <casa/Utilities/CountedPtr.h>
30
[2186]31#include <coordinates/Coordinates/SpectralCoordinate.h>
[322]32
[824]33#include <measures/TableMeasures/ScalarMeasColumn.h>
34
[2186]35#include <scimath/Mathematics/FFTServer.h>
[1598]36
[2186]37#include <tables/Tables/ArrayColumn.h>
38#include <tables/Tables/ScalarColumn.h>
39#include <tables/Tables/Table.h>
[1819]40
[2658]41
[2186]42#include "MathUtils.h"
43#include "STFit.h"
44#include "STFitEntry.h"
[2666]45//#include "STFitter.h"
[2186]46#include "STFocus.h"
47#include "STFrequencies.h"
[901]48#include "STHeader.h"
[2186]49#include "STHistory.h"
[824]50#include "STMolecules.h"
[2186]51#include "STPol.h"
[824]52#include "STSelector.h"
[2186]53#include "STTcal.h"
54#include "STWeather.h"
[2]55
[824]56namespace asap {
[2]57
[2666]58class Fitter;
59
[824]60/**
61 * This class contains and wraps a casa::Table, which is used to store
62 * all the information. This can be either a MemoryTable or a
63 * disk based Table.
64 * It provides access functions to the underlying table
65 * It contains n subtables:
66 * @li weather
67 * @li frequencies
68 * @li molecules
69 * @li tcal
70 * @li focus
71 * @li fits
72 *
73 * @brief The main ASAP data container
74 * @author Malte Marquarding
75 * @date
76 * @version
77*/
[2658]78class Scantable
[824]79{
[902]80
81friend class STMath;
82
[2]83public:
[824]84 /**
85 * Default constructor
86 */
[1350]87 explicit Scantable(casa::Table::TableType ttype = casa::Table::Memory);
[19]88
[824]89 /**
[2321]90 * Create a Scantable object from an existing table on disk
[824]91 * @param[in] name the name of the existing Scantable
92 */
[2321]93 explicit Scantable(const std::string& name,
94 casa::Table::TableType ttype = casa::Table::Memory);
[2]95
[824]96 /// @fixme this is only sensible for MemoryTables....
97 Scantable(const Scantable& other, bool clear=true);
[161]98
[824]99 /**
100 * Destructor
101 */
102 virtual ~Scantable();
[745]103
[824]104 /**
105 * get a const reference to the underlying casa::Table
[1104]106 * @return const \ref casa::Table reference
[824]107 */
108 const casa::Table& table() const;
[19]109
[824]110 /**
111 * get a reference to the underlying casa::Table with the Selection
112 * object applied if set
113 * @return casa::Table reference
114 */
115 casa::Table& table();
[21]116
[845]117
118 /**
119 * Get a handle to the selection object
120 * @return constant STSelector reference
121 */
122 const STSelector& getSelection() const { return selector_; }
123
124 /**
125 * Set the data to be a subset as defined by the STSelector
126 * @param selection a STSelector object
127 */
[824]128 void setSelection(const STSelector& selection);
[845]129
130 /**
131 * unset the selection of the data
132 */
[824]133 void unsetSelection();
134 /**
135 * set the header
[1295]136 * @param[in] sth an STHeader object
[824]137 */
[901]138 void setHeader( const STHeader& sth );
[386]139
[824]140 /**
141 * get the header information
[901]142 * @return an STHeader object
[824]143 */
[901]144 STHeader getHeader( ) const;
[1068]145
[824]146 /**
147 * Checks if the "other" Scantable is conformant with this,
148 * i.e. if header values are the same.
149 * @param[in] other another Scantable
150 * @return true or false
151 */
152 bool conformant( const Scantable& other);
[430]153
[824]154 /**
[1068]155 *
156 * @param stype The type of the source, 0 = on, 1 = off
157 */
158 void setSourceType(int stype);
159
160
161 /**
[1104]162 * The number of scans in the table
[824]163 * @return number of scans in the table
164 */
[845]165 int nscan() const;
[490]166
[915]167 casa::MEpoch::Types getTimeReference() const;
[21]168
[1411]169
170 casa::MEpoch getEpoch(int whichrow) const;
171
[824]172 /**
173 * Get global antenna position
[845]174 * @return casa::MPosition
[824]175 */
176 casa::MPosition getAntennaPosition() const;
[490]177
[1441]178 /**
179 * the @ref casa::MDirection for a specific row
180 * @param[in] whichrow the row number
181 * return casa::MDirection
182 */
[987]183 casa::MDirection getDirection( int whichrow ) const;
[1598]184
[1441]185 /**
186 * get the direction type as a string, e.g. "J2000"
187 * @param[in] whichrow the row number
188 * return the direction string
189 */
[1068]190 std::string getDirectionString( int whichrow ) const;
191
[1441]192 /**
193 * set the direction type as a string, e.g. "J2000"
194 * @param[in] refstr the direction type
195 */
[987]196 void setDirectionRefString(const std::string& refstr="");
[1441]197
[1104]198 /**
199 * get the direction reference string
200 * @return a string describing the direction reference
201 */
[1598]202 std::string getDirectionRefString() const;
[987]203
[824]204 /**
[845]205 * Return the Flux unit of the data, e.g. "Jy" or "K"
206 * @return string
[824]207 */
208 std::string getFluxUnit() const;
[472]209
[824]210 /**
[845]211 * Set the Flux unit of the data
212 * @param unit a string representing the unit, e.g "Jy" or "K"
[824]213 */
214 void setFluxUnit( const std::string& unit );
[472]215
[824]216 /**
[1189]217 * Set the Stokes type of the data
[1295]218 * @param feedtype a string representing the type, e.g "circular" or "linear"
[1189]219 */
220 void setFeedType( const std::string& feedtype );
221
222 /**
[824]223 *
[845]224 * @param instrument a string representing an insturment. see xxx
[824]225 */
226 void setInstrument( const std::string& instrument );
[2]227
[845]228 /**
229 * (Re)calculate the azimuth and elevationnfor all rows
230 */
[824]231 void calculateAZEL();
[745]232
[824]233 /**
[845]234 * "hard" flag the data, this flags everything selected in setSelection()
[1104]235 * param[in] msk a boolean mask of length nchan describing the points to
236 * to be flagged
[824]237 */
[1430]238 //void flag( const std::vector<bool>& msk = std::vector<bool>());
[1994]239 //void flag( const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
[455]240
[1994]241 void flag( int whichrow = -1, const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
242
[852]243 /**
[1819]244 * Flag the data in a row-based manner. (CAS-1433 Wataru Kawasaki)
245 * param[in] rows list of row numbers to be flagged
246 */
247 void flagRow( const std::vector<casa::uInt>& rows = std::vector<casa::uInt>(), bool unflag=false);
248
249 /**
250 * Get flagRow info at the specified row. If true, the whole data
251 * at the row should be flagged.
252 */
253 bool getFlagRow(int whichrow) const
254 { return (flagrowCol_(whichrow) > 0); }
255
256 /**
257 * Flag the data outside a specified range (in a channel-based manner).
258 * (CAS-1807 Wataru Kawasaki)
259 */
260 void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
261
262 /**
263 * Return a list of booleans with the size of nchan for a specified row, to get info
264 * about which channel is clipped.
265 */
266 std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
267 void srchChannelsToClip(casa::uInt whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag,
268 casa::Vector<casa::uChar> flgs);
269
270 /**
[852]271 * Return a list of row numbers with respect to the original table.
[902]272 * @return a list of unsigned ints
[852]273 */
274 std::vector<unsigned int> rownumbers() const;
[845]275
[852]276
[845]277 /**
278 * Get the number of beams in the data or a specific scan
279 * @param scanno the scan number to get the number of beams for.
280 * If scanno<0 the number is retrieved from the header.
281 * @return an integer number
282 */
[824]283 int nbeam(int scanno=-1) const;
[845]284 /**
285 * Get the number of IFs in the data or a specific scan
286 * @param scanno the scan number to get the number of IFs for.
287 * If scanno<0 the number is retrieved from the header.
288 * @return an integer number
289 */
[824]290 int nif(int scanno=-1) const;
[845]291 /**
292 * Get the number of polarizations in the data or a specific scan
293 * @param scanno the scan number to get the number of polarizations for.
294 * If scanno<0 the number is retrieved from the header.
295 * @return an integer number
296 */
[824]297 int npol(int scanno=-1) const;
[794]298
[896]299 std::string getPolType() const;
300
[845]301
302 /**
303 * Get the number of integartion cycles
304 * @param scanno the scan number to get the number of rows for.
305 * If scanno<0 the number is retrieved from the header.
[1104]306 * @return the number of rows (for the specified scanno)
[845]307 */
[824]308 int nrow(int scanno=-1) const;
[794]309
[1111]310 int getBeam(int whichrow) const;
[1694]311 std::vector<uint> getBeamNos() const { return getNumbers(beamCol_); }
[50]312
[847]313 int getIF(int whichrow) const;
[1694]314 std::vector<uint> getIFNos() const { return getNumbers(ifCol_); }
[1111]315
[847]316 int getPol(int whichrow) const;
[1694]317 std::vector<uint> getPolNos() const { return getNumbers(polCol_); }
[1111]318
[1694]319 std::vector<uint> getScanNos() const { return getNumbers(scanCol_); }
[865]320 int getScan(int whichrow) const { return scanCol_(whichrow); }
[1111]321
[1819]322 //TT addition
323 std::vector<uint> getMolNos() {return getNumbers(mmolidCol_); }
324
[1111]325 /**
326 * Get the number of channels in the data or a specific IF. This currently
327 * varies only with IF number
328 * @param ifno the IF number to get the number of channels for.
329 * If ifno<0 the number is retrieved from the header.
330 * @return an integer number
331 */
332 int nchan(int ifno=-1) const;
[923]333 int getChannels(int whichrow) const;
[206]334
[1111]335 int ncycle(int scanno=-1) const;
336 int getCycle(int whichrow) const { return cycleCol_(whichrow); }
337
[847]338 double getInterval(int whichrow) const
339 { return integrCol_(whichrow); }
[845]340
[865]341 float getTsys(int whichrow) const
342 { return casa::Vector<casa::Float>(tsysCol_(whichrow))(0); }
[2161]343 std::vector<float> getTsysSpectrum(int whichrow) const ;
[847]344 float getElevation(int whichrow) const
345 { return elCol_(whichrow); }
346 float getAzimuth(int whichrow) const
347 { return azCol_(whichrow); }
[865]348 float getParAngle(int whichrow) const
[1819]349 { return focus().getParAngle(mfocusidCol_(whichrow)); }
350 int getTcalId(int whichrow) const
351 { return mtcalidCol_(whichrow); }
[386]352
[865]353 std::string getSourceName(int whichrow) const
354 { return srcnCol_(whichrow); }
355
[847]356 std::vector<bool> getMask(int whichrow) const;
[896]357 std::vector<float> getSpectrum(int whichrow,
[905]358 const std::string& poltype = "" ) const;
[847]359
[884]360 void setSpectrum(const std::vector<float>& spec, int whichrow);
361
[902]362 std::string getPolarizationLabel(int index, const std::string& ptype) const
363 { return STPol::getPolLabel(index, ptype ); }
[401]364
[845]365 /**
366 * Write the Scantable to disk
367 * @param filename the output file name
368 */
[824]369 void makePersistent(const std::string& filename);
[745]370
[860]371 std::vector<std::string> getHistory() const
372 { return historyTable_.getHistory(); };
[483]373
[860]374 void addHistory(const std::string& hist) { historyTable_.addEntry(hist); }
[488]375
[860]376 void appendToHistoryTable(const STHistory& otherhist)
377 { historyTable_.append(otherhist); }
378
[2163]379 std::string headerSummary();
[2290]380 void summary(const std::string& filename="");
381 std::string oldheaderSummary();
[2286]382 // std::string summary();
[2290]383 void oldsummary(const std::string& filename="");
384
[1947]385 //std::string getTime(int whichrow=-1, bool showdate=true) const;
386 std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const;
[1350]387 double getIntTime(int whichrow) const { return integrCol_(whichrow); }
[19]388
[847]389 // returns unit, conversion frame, doppler, base-frame
[18]390
[847]391 /**
392 * Get the frequency set up
393 * This is forwarded to the STFrequencies subtable
394 * @return unit, frame, doppler
395 */
396 std::vector<std::string> getCoordInfo() const
397 { return freqTable_.getInfo(); };
398
399 void setCoordInfo(std::vector<string> theinfo)
400 { return freqTable_.setInfo(theinfo); };
401
[865]402
403 std::vector<double> getAbcissa(int whichrow) const;
404
[1730]405 std::vector<float> getWeather(int whichrow) const;
406
[847]407 std::string getAbcissaLabel(int whichrow) const;
408 std::vector<double> getRestFrequencies() const
409 { return moleculeTable_.getRestFrequencies(); }
[1819]410 std::vector<double> getRestFrequency(int id) const
411 { return moleculeTable_.getRestFrequency(id); }
[847]412
[1819]413 /**
[1170]414 void setRestFrequencies(double rf, const std::string& name = "",
415 const std::string& = "Hz");
[1819]416 **/
417 // Modified by Takeshi Nakazato 05/09/2008
418 /***
419 void setRestFrequencies(vector<double> rf, const vector<std::string>& name = "",
420 const std::string& = "Hz");
421 ***/
422 void setRestFrequencies(vector<double> rf,
423 const vector<std::string>& name = vector<std::string>(1,""),
424 const std::string& = "Hz");
[847]425
[1819]426 //void setRestFrequencies(const std::string& name);
427 void setRestFrequencies(const vector<std::string>& name);
428
[1360]429 void shift(int npix);
430
[1598]431 casa::SpectralCoordinate getSpectralCoordinate(int whichrow) const;
432
[987]433 void convertDirection(const std::string& newframe);
434
[824]435 STFrequencies& frequencies() { return freqTable_; }
[1375]436 const STFrequencies& frequencies() const { return freqTable_; }
[824]437 STWeather& weather() { return weatherTable_; }
[1375]438 const STWeather& weather() const { return weatherTable_; }
[824]439 STFocus& focus() { return focusTable_; }
[1375]440 const STFocus& focus() const { return focusTable_; }
[824]441 STTcal& tcal() { return tcalTable_; }
[1375]442 const STTcal& tcal() const { return tcalTable_; }
[824]443 STMolecules& molecules() { return moleculeTable_; }
[1375]444 const STMolecules& molecules() const { return moleculeTable_; }
[860]445 STHistory& history() { return historyTable_; }
[1375]446 const STHistory& history() const { return historyTable_; }
[972]447 STFit& fit() { return fitTable_; }
[1375]448 const STFit& fit() const { return fitTable_; }
[2]449
[902]450 std::vector<std::string> columnNames() const;
[896]451
[972]452 void addFit(const STFitEntry& fit, int row);
453 STFitEntry getFit(int row) const
454 { STFitEntry fe; fitTable_.getEntry(fe, mfitidCol_(row)); return fe; }
455
[1391]456 //Added by TT
457 /**
458 * Get the antenna name
459 * @return antenna name string
460 */
[1819]461 casa::String getAntennaName() const;
[1391]462
463 /**
464 * For GBT MS data only. check a scan list
465 * against the information found in GBT_GO table for
466 * scan number orders to get correct pairs.
467 * @param[in] scan list
468 * @return status
469 */
470 int checkScanInfo(const std::vector<int>& scanlist) const;
471
472 /**
473 * Get the direction as a vector, for a specific row
474 * @param[in] whichrow the row numbyyer
475 * @return the direction in a vector
476 */
477 std::vector<double> getDirectionVector(int whichrow) const;
478
[1586]479 /**
480 * Set a flag indicating whether the data was parallactified
481 * @param[in] flag true or false
482 */
[1598]483 void parallactify(bool flag)
[2357]484 { focusTable_.setParallactify(flag); }
[1727]485
[1819]486 /**
487 * Reshape spectrum
488 * @param[in] nmin, nmax minimum and maximum channel
489 * @param[in] irow row number
490 *
491 * 30/07/2008 Takeshi Nakazato
492 **/
493 void reshapeSpectrum( int nmin, int nmax ) throw( casa::AipsError );
494 void reshapeSpectrum( int nmin, int nmax, int irow ) ;
495
496 /**
497 * Change channel number under fixed bandwidth
498 * @param[in] nchan, dnu new channel number and spectral resolution
499 * @param[in] irow row number
500 *
501 * 27/08/2008 Takeshi Nakazato
502 **/
503 void regridChannel( int nchan, double dnu ) ;
504 void regridChannel( int nchan, double dnu, int irow ) ;
[2595]505 void regridChannel( int nchan, double dnu, double fmin, int irow ) ;
[1819]506
[2435]507 void regridSpecChannel( double dnu, int nchan=-1 ) ;
508
[2047]509 bool getFlagtraFast(casa::uInt whichrow);
[1819]510
[2012]511 void polyBaseline(const std::vector<bool>& mask,
512 int order,
[2094]513 bool getResidual=true,
[2189]514 const std::string& progressInfo="true,1000",
515 const bool outLogger=false,
[2012]516 const std::string& blfile="");
517 void autoPolyBaseline(const std::vector<bool>& mask,
518 int order,
519 const std::vector<int>& edge,
520 float threshold=3.0,
521 int chanAvgLimit=1,
[2094]522 bool getResidual=true,
[2189]523 const std::string& progressInfo="true,1000",
524 const bool outLogger=false,
[2012]525 const std::string& blfile="");
[2645]526 void chebyshevBaseline(const std::vector<bool>& mask,
527 int order,
528 float thresClip,
529 int nIterClip,
530 bool getResidual=true,
531 const std::string& progressInfo="true,1000",
532 const bool outLogger=false,
533 const std::string& blfile="");
534 void autoChebyshevBaseline(const std::vector<bool>& mask,
535 int order,
536 float thresClip,
537 int nIterClip,
538 const std::vector<int>& edge,
539 float threshold=3.0,
540 int chanAvgLimit=1,
541 bool getResidual=true,
542 const std::string& progressInfo="true,1000",
543 const bool outLogger=false,
544 const std::string& blfile="");
[2012]545 void cubicSplineBaseline(const std::vector<bool>& mask,
546 int nPiece,
547 float thresClip,
548 int nIterClip,
[2094]549 bool getResidual=true,
[2189]550 const std::string& progressInfo="true,1000",
551 const bool outLogger=false,
[2012]552 const std::string& blfile="");
553 void autoCubicSplineBaseline(const std::vector<bool>& mask,
554 int nPiece,
555 float thresClip,
556 int nIterClip,
557 const std::vector<int>& edge,
558 float threshold=3.0,
559 int chanAvgLimit=1,
[2094]560 bool getResidual=true,
[2189]561 const std::string& progressInfo="true,1000",
562 const bool outLogger=false,
[2012]563 const std::string& blfile="");
[2047]564 void sinusoidBaseline(const std::vector<bool>& mask,
[2186]565 const bool applyFFT,
566 const std::string& fftMethod,
567 const std::string& fftThresh,
568 const std::vector<int>& addNWaves,
569 const std::vector<int>& rejectNWaves,
[2047]570 float thresClip,
571 int nIterClip,
[2081]572 bool getResidual=true,
[2189]573 const std::string& progressInfo="true,1000",
574 const bool outLogger=false,
[2047]575 const std::string& blfile="");
576 void autoSinusoidBaseline(const std::vector<bool>& mask,
[2186]577 const bool applyFFT,
578 const std::string& fftMethod,
579 const std::string& fftThresh,
580 const std::vector<int>& addNWaves,
581 const std::vector<int>& rejectNWaves,
[2047]582 float thresClip,
583 int nIterClip,
584 const std::vector<int>& edge,
585 float threshold=3.0,
586 int chanAvgLimit=1,
[2081]587 bool getResidual=true,
[2189]588 const std::string& progressInfo="true,1000",
589 const bool outLogger=false,
[2047]590 const std::string& blfile="");
[2186]591 std::vector<float> execFFT(const int whichrow,
592 const std::vector<bool>& inMask,
593 bool getRealImag=false,
594 bool getAmplitudeOnly=false);
[2012]595 float getRms(const std::vector<bool>& mask, int whichrow);
596 std::string formatBaselineParams(const std::vector<float>& params,
597 const std::vector<bool>& fixed,
598 float rms,
[2193]599 int nClipped,
[2012]600 const std::string& masklist,
601 int whichrow,
[2064]602 bool verbose=false,
[2641]603 bool csvformat=false,
[2064]604 int start=-1,
605 int count=-1,
606 bool resetparamid=false) const;
[2012]607 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges,
608 const std::vector<float>& params,
609 const std::vector<bool>& fixed,
610 float rms,
[2193]611 int nClipped,
[2012]612 const std::string& masklist,
613 int whichrow,
[2641]614 bool verbose=false,
615 bool csvformat=false) const;
[2591]616 std::vector<uint> getMoleculeIdColumnData() const;
617 void setMoleculeIdColumnData(const std::vector<uint>& molids);
[1907]618
[2012]619
[824]620private:
[896]621
622 casa::Matrix<casa::Float> getPolMatrix( casa::uInt whichrow ) const;
623
[824]624 /**
[2005]625 * Turns a time value into a formatted string
[824]626 * @param x
627 * @return
628 */
629 std::string formatSec(casa::Double x) const;
[18]630
[824]631 std::string formatTime(const casa::MEpoch& me, bool showdate)const;
[1947]632 std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
[22]633
[824]634 /**
635 * Turns a casa::MDirection into a nicely formatted string
636 * @param md an casa::MDirection
637 * @return
638 */
639 std::string formatDirection(const casa::MDirection& md) const;
[19]640
[824]641 /**
642 * Create a unique file name for the paged (temporary) table
643 * @return just the name
644 */
645 static casa::String generateName();
[286]646
[824]647 /**
648 * attach to cached columns
649 */
650 void attach();
[50]651
[824]652 /**
653 * Set up the main casa::Table
654 */
655 void setupMainTable();
[88]656
[859]657 void attachSubtables();
[865]658 void copySubtables(const Scantable& other);
659
[824]660 /**
661 * Convert an "old" asap1 style row index into a new index
662 * @param[in] therow
663 * @return and index into @table_
664 */
665 int rowToScanIndex(int therow);
[212]666
[1694]667 std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
[1111]668
[2321]669 static const casa::uInt version_ = 4;
[286]670
[824]671 STSelector selector_;
[236]672
[824]673 casa::Table::TableType type_;
[465]674
[824]675 // the actual data
676 casa::Table table_;
677 casa::Table originalTable_;
[745]678
[824]679 STTcal tcalTable_;
680 STFrequencies freqTable_;
681 STWeather weatherTable_;
682 STFocus focusTable_;
683 STMolecules moleculeTable_;
[860]684 STHistory historyTable_;
[960]685 STFit fitTable_;
[860]686
[824]687 // Cached Columns to avoid reconstructing them for each row get/put
[847]688 casa::ScalarColumn<casa::Double> integrCol_;
[824]689 casa::MDirection::ScalarColumn dirCol_;
[847]690 casa::MEpoch::ScalarColumn timeCol_;
[923]691 casa::ScalarColumn<casa::Float> azCol_;
692 casa::ScalarColumn<casa::Float> elCol_;
[824]693 casa::ScalarColumn<casa::String> srcnCol_, fldnCol_;
[1819]694 casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_, flagrowCol_;
[1068]695 casa::ScalarColumn<casa::Int> rbeamCol_, srctCol_;
[865]696 casa::ArrayColumn<casa::Float> specCol_, tsysCol_;
[824]697 casa::ArrayColumn<casa::uChar> flagsCol_;
[430]698
[824]699 // id in frequencies table
700 casa::ScalarColumn<casa::uInt> mfreqidCol_;
701 // id in tcal table
702 casa::ScalarColumn<casa::uInt> mtcalidCol_;
[430]703
[824]704 casa::ArrayColumn<casa::String> histitemCol_;
[972]705 casa::ScalarColumn<casa::Int> mfitidCol_;
[824]706 casa::ScalarColumn<casa::uInt> mweatheridCol_;
[322]707
[824]708 casa::ScalarColumn<casa::uInt> mfocusidCol_;
709
710 casa::ScalarColumn<casa::uInt> mmolidCol_;
711
[896]712 static std::map<std::string, STPol::STPolFactory *> factories_;
713 void initFactories();
714
[1819]715 /**
716 * Add an auxiliary column to the main table and attach it to a
717 * cached column. Use for adding new columns that the original asap2
718 * tables do not have.
719 * @param[in] col reference to the cached column to be attached
720 * @param[in] colName column name in asap table
721 * @param[in] defValue default value to fill in the column
722 *
723 * 25/10/2009 Wataru Kawasaki
724 */
725 template<class T, class T2> void attachAuxColumnDef(casa::ScalarColumn<T>&,
726 const casa::String&,
727 const T2&);
728 template<class T, class T2> void attachAuxColumnDef(casa::ArrayColumn<T>&,
729 const casa::String&,
730 const casa::Array<T2>&);
[1907]731
[2012]732 void fitBaseline(const std::vector<bool>& mask, int whichrow, Fitter& fitter);
[2645]733 double getChebyshevPolynomial(int n, double x);
734 std::vector<float> doChebyshevFitting(const std::vector<float>& data,
735 const std::vector<bool>& mask,
736 int order,
737 std::vector<float>& params,
738 int& nClipped,
739 float thresClip=3.0,
740 int nIterClip=1,
741 bool getResidual=true);
[2012]742 std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
743 const std::vector<bool>& mask,
[2081]744 int nPiece,
[2064]745 std::vector<int>& idxEdge,
[2012]746 std::vector<float>& params,
[2193]747 int& nClipped,
[2012]748 float thresClip=3.0,
[2058]749 int nIterClip=1,
[2094]750 bool getResidual=true);
[2047]751 std::vector<float> doSinusoidFitting(const std::vector<float>& data,
752 const std::vector<bool>& mask,
[2081]753 const std::vector<int>& waveNumbers,
[2047]754 std::vector<float>& params,
[2193]755 int& nClipped,
[2047]756 float thresClip=3.0,
[2058]757 int nIterClip=1,
[2094]758 bool getResidual=true);
[2186]759 void selectWaveNumbers(const int whichrow,
760 const std::vector<bool>& chanMask,
761 const bool applyFFT,
762 const std::string& fftMethod,
763 const std::string& fftThresh,
764 const std::vector<int>& addNWaves,
765 const std::vector<int>& rejectNWaves,
766 std::vector<int>& nWaves);
767 void parseThresholdExpression(const std::string& fftThresh,
768 std::string& fftThAttr,
769 float& fftThSigma,
770 int& fftThTop);
771 void doSelectWaveNumbers(const int whichrow,
772 const std::vector<bool>& chanMask,
773 const std::string& fftMethod,
774 const float fftThSigma,
775 const int fftThTop,
776 const std::string& fftThAttr,
777 std::vector<int>& nWaves);
[2411]778 void addAuxWaveNumbers(const int whichrow,
779 const std::vector<int>& addNWaves,
[2186]780 const std::vector<int>& rejectNWaves,
781 std::vector<int>& nWaves);
[2411]782 void setWaveNumberListUptoNyquistFreq(const int whichrow,
783 std::vector<int>& nWaves);
[2012]784 bool hasSameNchanOverIFs();
785 std::string getMaskRangeList(const std::vector<bool>& mask,
786 int whichrow,
787 const casa::String& coordInfo,
[2047]788 bool hasSameNchan,
789 bool verbose=false);
790 std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask);
[2641]791 std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose, bool csvformat) const;
792 std::string formatBaselineParamsFooter(float rms, int nClipped, bool verbose, bool csvformat) const;
[2012]793 std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask);
794 //std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask, const std::vector<int>& edge, const int minEdgeSize, STLineFinder& lineFinder);
[2641]795 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, Fitter& fitter);
796 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<int>& edge, const std::vector<float>& params, const int nClipped);
797 void outputFittingResult(bool outLogger, bool outTextFile, bool csvFormat, const std::vector<bool>& chanMask, int whichrow, const casa::String& coordInfo, bool hasSameNchan, std::ofstream& ofs, const casa::String& funcName, const std::vector<float>& params, const int nClipped);
[2189]798 void parseProgressInfo(const std::string& progressInfo, bool& showProgress, int& minNRow);
799 void showProgressOnTerminal(const int nProcessed, const int nTotal, const bool showProgress=true, const int nTotalThreshold=1000);
[1994]800
801 void applyChanFlag( casa::uInt whichrow, const std::vector<bool>& msk, casa::uChar flagval);
802
[2]803};
804
[824]805} // namespace
806
[2]807#endif
Note: See TracBrowser for help on using the repository browser.