source: trunk/src/Scantable.h@ 2750

Last change on this file since 2750 was 2737, checked in by WataruKawasaki, 12 years ago

New Development: No

JIRA Issue: Yes CAS-4794

Ready for Test: No

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): sd

Description:


  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.2 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
[2667]322 std::vector<uint> getCycleNos() const { return getNumbers(cycleCol_); }
323 int getCycle(int whichrow) const { return cycleCol_(whichrow); }
324
[1819]325 //TT addition
326 std::vector<uint> getMolNos() {return getNumbers(mmolidCol_); }
327
[1111]328 /**
329 * Get the number of channels in the data or a specific IF. This currently
330 * varies only with IF number
331 * @param ifno the IF number to get the number of channels for.
332 * If ifno<0 the number is retrieved from the header.
333 * @return an integer number
334 */
335 int nchan(int ifno=-1) const;
[923]336 int getChannels(int whichrow) const;
[206]337
[1111]338 int ncycle(int scanno=-1) const;
339
[2667]340
[847]341 double getInterval(int whichrow) const
342 { return integrCol_(whichrow); }
[845]343
[865]344 float getTsys(int whichrow) const
345 { return casa::Vector<casa::Float>(tsysCol_(whichrow))(0); }
[2161]346 std::vector<float> getTsysSpectrum(int whichrow) const ;
[847]347 float getElevation(int whichrow) const
348 { return elCol_(whichrow); }
349 float getAzimuth(int whichrow) const
350 { return azCol_(whichrow); }
[865]351 float getParAngle(int whichrow) const
[1819]352 { return focus().getParAngle(mfocusidCol_(whichrow)); }
353 int getTcalId(int whichrow) const
354 { return mtcalidCol_(whichrow); }
[386]355
[865]356 std::string getSourceName(int whichrow) const
357 { return srcnCol_(whichrow); }
358
[847]359 std::vector<bool> getMask(int whichrow) const;
[896]360 std::vector<float> getSpectrum(int whichrow,
[905]361 const std::string& poltype = "" ) const;
[847]362
[884]363 void setSpectrum(const std::vector<float>& spec, int whichrow);
364
[902]365 std::string getPolarizationLabel(int index, const std::string& ptype) const
366 { return STPol::getPolLabel(index, ptype ); }
[401]367
[845]368 /**
369 * Write the Scantable to disk
370 * @param filename the output file name
371 */
[824]372 void makePersistent(const std::string& filename);
[745]373
[860]374 std::vector<std::string> getHistory() const
375 { return historyTable_.getHistory(); };
[483]376
[860]377 void addHistory(const std::string& hist) { historyTable_.addEntry(hist); }
[488]378
[860]379 void appendToHistoryTable(const STHistory& otherhist)
380 { historyTable_.append(otherhist); }
381
[2163]382 std::string headerSummary();
[2290]383 void summary(const std::string& filename="");
384 std::string oldheaderSummary();
[2286]385 // std::string summary();
[2290]386 void oldsummary(const std::string& filename="");
387
[1947]388 //std::string getTime(int whichrow=-1, bool showdate=true) const;
389 std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const;
[1350]390 double getIntTime(int whichrow) const { return integrCol_(whichrow); }
[19]391
[847]392 // returns unit, conversion frame, doppler, base-frame
[18]393
[847]394 /**
395 * Get the frequency set up
396 * This is forwarded to the STFrequencies subtable
397 * @return unit, frame, doppler
398 */
399 std::vector<std::string> getCoordInfo() const
400 { return freqTable_.getInfo(); };
401
402 void setCoordInfo(std::vector<string> theinfo)
403 { return freqTable_.setInfo(theinfo); };
404
[865]405
406 std::vector<double> getAbcissa(int whichrow) const;
407
[1730]408 std::vector<float> getWeather(int whichrow) const;
409
[847]410 std::string getAbcissaLabel(int whichrow) const;
411 std::vector<double> getRestFrequencies() const
412 { return moleculeTable_.getRestFrequencies(); }
[1819]413 std::vector<double> getRestFrequency(int id) const
414 { return moleculeTable_.getRestFrequency(id); }
[847]415
[1819]416 /**
[1170]417 void setRestFrequencies(double rf, const std::string& name = "",
418 const std::string& = "Hz");
[1819]419 **/
420 // Modified by Takeshi Nakazato 05/09/2008
421 /***
422 void setRestFrequencies(vector<double> rf, const vector<std::string>& name = "",
423 const std::string& = "Hz");
424 ***/
425 void setRestFrequencies(vector<double> rf,
426 const vector<std::string>& name = vector<std::string>(1,""),
427 const std::string& = "Hz");
[847]428
[1819]429 //void setRestFrequencies(const std::string& name);
430 void setRestFrequencies(const vector<std::string>& name);
431
[1360]432 void shift(int npix);
433
[1598]434 casa::SpectralCoordinate getSpectralCoordinate(int whichrow) const;
435
[987]436 void convertDirection(const std::string& newframe);
437
[824]438 STFrequencies& frequencies() { return freqTable_; }
[1375]439 const STFrequencies& frequencies() const { return freqTable_; }
[824]440 STWeather& weather() { return weatherTable_; }
[1375]441 const STWeather& weather() const { return weatherTable_; }
[824]442 STFocus& focus() { return focusTable_; }
[1375]443 const STFocus& focus() const { return focusTable_; }
[824]444 STTcal& tcal() { return tcalTable_; }
[1375]445 const STTcal& tcal() const { return tcalTable_; }
[824]446 STMolecules& molecules() { return moleculeTable_; }
[1375]447 const STMolecules& molecules() const { return moleculeTable_; }
[860]448 STHistory& history() { return historyTable_; }
[1375]449 const STHistory& history() const { return historyTable_; }
[972]450 STFit& fit() { return fitTable_; }
[1375]451 const STFit& fit() const { return fitTable_; }
[2]452
[902]453 std::vector<std::string> columnNames() const;
[896]454
[972]455 void addFit(const STFitEntry& fit, int row);
456 STFitEntry getFit(int row) const
457 { STFitEntry fe; fitTable_.getEntry(fe, mfitidCol_(row)); return fe; }
458
[1391]459 //Added by TT
460 /**
461 * Get the antenna name
462 * @return antenna name string
463 */
[1819]464 casa::String getAntennaName() const;
[1391]465
466 /**
467 * For GBT MS data only. check a scan list
468 * against the information found in GBT_GO table for
469 * scan number orders to get correct pairs.
470 * @param[in] scan list
471 * @return status
472 */
473 int checkScanInfo(const std::vector<int>& scanlist) const;
474
475 /**
476 * Get the direction as a vector, for a specific row
477 * @param[in] whichrow the row numbyyer
478 * @return the direction in a vector
479 */
480 std::vector<double> getDirectionVector(int whichrow) const;
481
[1586]482 /**
483 * Set a flag indicating whether the data was parallactified
484 * @param[in] flag true or false
485 */
[1598]486 void parallactify(bool flag)
[2357]487 { focusTable_.setParallactify(flag); }
[1727]488
[1819]489 /**
490 * Reshape spectrum
491 * @param[in] nmin, nmax minimum and maximum channel
492 * @param[in] irow row number
493 *
494 * 30/07/2008 Takeshi Nakazato
495 **/
496 void reshapeSpectrum( int nmin, int nmax ) throw( casa::AipsError );
497 void reshapeSpectrum( int nmin, int nmax, int irow ) ;
498
499 /**
500 * Change channel number under fixed bandwidth
501 * @param[in] nchan, dnu new channel number and spectral resolution
502 * @param[in] irow row number
503 *
504 * 27/08/2008 Takeshi Nakazato
505 **/
506 void regridChannel( int nchan, double dnu ) ;
507 void regridChannel( int nchan, double dnu, int irow ) ;
[2595]508 void regridChannel( int nchan, double dnu, double fmin, int irow ) ;
[1819]509
[2435]510 void regridSpecChannel( double dnu, int nchan=-1 ) ;
511
[2047]512 bool getFlagtraFast(casa::uInt whichrow);
[1819]513
[2012]514 void polyBaseline(const std::vector<bool>& mask,
515 int order,
[2094]516 bool getResidual=true,
[2189]517 const std::string& progressInfo="true,1000",
518 const bool outLogger=false,
[2012]519 const std::string& blfile="");
520 void autoPolyBaseline(const std::vector<bool>& mask,
521 int order,
522 const std::vector<int>& edge,
523 float threshold=3.0,
524 int chanAvgLimit=1,
[2094]525 bool getResidual=true,
[2189]526 const std::string& progressInfo="true,1000",
527 const bool outLogger=false,
[2012]528 const std::string& blfile="");
[2645]529 void chebyshevBaseline(const std::vector<bool>& mask,
530 int order,
531 float thresClip,
532 int nIterClip,
533 bool getResidual=true,
534 const std::string& progressInfo="true,1000",
535 const bool outLogger=false,
536 const std::string& blfile="");
537 void autoChebyshevBaseline(const std::vector<bool>& mask,
538 int order,
539 float thresClip,
540 int nIterClip,
541 const std::vector<int>& edge,
542 float threshold=3.0,
543 int chanAvgLimit=1,
544 bool getResidual=true,
545 const std::string& progressInfo="true,1000",
546 const bool outLogger=false,
547 const std::string& blfile="");
[2012]548 void cubicSplineBaseline(const std::vector<bool>& mask,
549 int nPiece,
550 float thresClip,
551 int nIterClip,
[2094]552 bool getResidual=true,
[2189]553 const std::string& progressInfo="true,1000",
554 const bool outLogger=false,
[2012]555 const std::string& blfile="");
556 void autoCubicSplineBaseline(const std::vector<bool>& mask,
557 int nPiece,
558 float thresClip,
559 int nIterClip,
560 const std::vector<int>& edge,
561 float threshold=3.0,
562 int chanAvgLimit=1,
[2094]563 bool getResidual=true,
[2189]564 const std::string& progressInfo="true,1000",
565 const bool outLogger=false,
[2012]566 const std::string& blfile="");
[2047]567 void sinusoidBaseline(const std::vector<bool>& mask,
[2186]568 const bool applyFFT,
569 const std::string& fftMethod,
570 const std::string& fftThresh,
571 const std::vector<int>& addNWaves,
572 const std::vector<int>& rejectNWaves,
[2047]573 float thresClip,
574 int nIterClip,
[2081]575 bool getResidual=true,
[2189]576 const std::string& progressInfo="true,1000",
577 const bool outLogger=false,
[2047]578 const std::string& blfile="");
579 void autoSinusoidBaseline(const std::vector<bool>& mask,
[2186]580 const bool applyFFT,
581 const std::string& fftMethod,
582 const std::string& fftThresh,
583 const std::vector<int>& addNWaves,
584 const std::vector<int>& rejectNWaves,
[2047]585 float thresClip,
586 int nIterClip,
587 const std::vector<int>& edge,
588 float threshold=3.0,
589 int chanAvgLimit=1,
[2081]590 bool getResidual=true,
[2189]591 const std::string& progressInfo="true,1000",
592 const bool outLogger=false,
[2047]593 const std::string& blfile="");
[2186]594 std::vector<float> execFFT(const int whichrow,
595 const std::vector<bool>& inMask,
596 bool getRealImag=false,
597 bool getAmplitudeOnly=false);
[2012]598 float getRms(const std::vector<bool>& mask, int whichrow);
599 std::string formatBaselineParams(const std::vector<float>& params,
600 const std::vector<bool>& fixed,
601 float rms,
[2193]602 int nClipped,
[2012]603 const std::string& masklist,
604 int whichrow,
[2064]605 bool verbose=false,
[2641]606 bool csvformat=false,
[2064]607 int start=-1,
608 int count=-1,
609 bool resetparamid=false) const;
[2012]610 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges,
611 const std::vector<float>& params,
612 const std::vector<bool>& fixed,
613 float rms,
[2193]614 int nClipped,
[2012]615 const std::string& masklist,
616 int whichrow,
[2641]617 bool verbose=false,
618 bool csvformat=false) const;
[2591]619 std::vector<uint> getMoleculeIdColumnData() const;
620 void setMoleculeIdColumnData(const std::vector<uint>& molids);
[2713]621 double calculateModelSelectionCriteria(const std::string& valname,
622 const std::string& blfunc,
623 int order,
624 const std::vector<bool>& inMask,
625 int whichrow,
626 bool useLineFinder,
627 const std::vector<int>& edge,
628 float threshold,
629 int chanAvgLimit);
[1907]630
[2012]631
[824]632private:
[896]633
634 casa::Matrix<casa::Float> getPolMatrix( casa::uInt whichrow ) const;
635
[824]636 /**
[2005]637 * Turns a time value into a formatted string
[824]638 * @param x
639 * @return
640 */
641 std::string formatSec(casa::Double x) const;
[18]642
[824]643 std::string formatTime(const casa::MEpoch& me, bool showdate)const;
[1947]644 std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
[22]645
[824]646 /**
647 * Turns a casa::MDirection into a nicely formatted string
648 * @param md an casa::MDirection
649 * @return
650 */
651 std::string formatDirection(const casa::MDirection& md) const;
[19]652
[824]653 /**
654 * Create a unique file name for the paged (temporary) table
655 * @return just the name
656 */
657 static casa::String generateName();
[286]658
[824]659 /**
660 * attach to cached columns
661 */
662 void attach();
[50]663
[824]664 /**
665 * Set up the main casa::Table
666 */
667 void setupMainTable();
[88]668
[859]669 void attachSubtables();
[865]670 void copySubtables(const Scantable& other);
671
[824]672 /**
673 * Convert an "old" asap1 style row index into a new index
674 * @param[in] therow
675 * @return and index into @table_
676 */
677 int rowToScanIndex(int therow);
[212]678
[1694]679 std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
[1111]680
[2321]681 static const casa::uInt version_ = 4;
[286]682
[824]683 STSelector selector_;
[236]684
[824]685 casa::Table::TableType type_;
[465]686
[824]687 // the actual data
688 casa::Table table_;
689 casa::Table originalTable_;
[745]690
[824]691 STTcal tcalTable_;
692 STFrequencies freqTable_;
693 STWeather weatherTable_;
694 STFocus focusTable_;
695 STMolecules moleculeTable_;
[860]696 STHistory historyTable_;
[960]697 STFit fitTable_;
[860]698
[824]699 // Cached Columns to avoid reconstructing them for each row get/put
[847]700 casa::ScalarColumn<casa::Double> integrCol_;
[824]701 casa::MDirection::ScalarColumn dirCol_;
[847]702 casa::MEpoch::ScalarColumn timeCol_;
[923]703 casa::ScalarColumn<casa::Float> azCol_;
704 casa::ScalarColumn<casa::Float> elCol_;
[824]705 casa::ScalarColumn<casa::String> srcnCol_, fldnCol_;
[1819]706 casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_, flagrowCol_;
[1068]707 casa::ScalarColumn<casa::Int> rbeamCol_, srctCol_;
[865]708 casa::ArrayColumn<casa::Float> specCol_, tsysCol_;
[824]709 casa::ArrayColumn<casa::uChar> flagsCol_;
[430]710
[824]711 // id in frequencies table
712 casa::ScalarColumn<casa::uInt> mfreqidCol_;
713 // id in tcal table
714 casa::ScalarColumn<casa::uInt> mtcalidCol_;
[430]715
[824]716 casa::ArrayColumn<casa::String> histitemCol_;
[972]717 casa::ScalarColumn<casa::Int> mfitidCol_;
[824]718 casa::ScalarColumn<casa::uInt> mweatheridCol_;
[322]719
[824]720 casa::ScalarColumn<casa::uInt> mfocusidCol_;
721
722 casa::ScalarColumn<casa::uInt> mmolidCol_;
723
[896]724 static std::map<std::string, STPol::STPolFactory *> factories_;
725 void initFactories();
726
[1819]727 /**
728 * Add an auxiliary column to the main table and attach it to a
729 * cached column. Use for adding new columns that the original asap2
730 * tables do not have.
731 * @param[in] col reference to the cached column to be attached
732 * @param[in] colName column name in asap table
733 * @param[in] defValue default value to fill in the column
734 *
735 * 25/10/2009 Wataru Kawasaki
736 */
737 template<class T, class T2> void attachAuxColumnDef(casa::ScalarColumn<T>&,
738 const casa::String&,
739 const T2&);
740 template<class T, class T2> void attachAuxColumnDef(casa::ArrayColumn<T>&,
741 const casa::String&,
742 const casa::Array<T2>&);
[1907]743
[2012]744 void fitBaseline(const std::vector<bool>& mask, int whichrow, Fitter& fitter);
[2645]745 double getChebyshevPolynomial(int n, double x);
746 std::vector<float> doChebyshevFitting(const std::vector<float>& data,
747 const std::vector<bool>& mask,
748 int order,
749 std::vector<float>& params,
[2737]750 std::vector<bool>& finalMask,
751 float& rms,
[2645]752 int& nClipped,
753 float thresClip=3.0,
754 int nIterClip=1,
755 bool getResidual=true);
[2012]756 std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
757 const std::vector<bool>& mask,
[2081]758 int nPiece,
[2064]759 std::vector<int>& idxEdge,
[2012]760 std::vector<float>& params,
[2193]761 int& nClipped,
[2012]762 float thresClip=3.0,
[2058]763 int nIterClip=1,
[2094]764 bool getResidual=true);
[2047]765 std::vector<float> doSinusoidFitting(const std::vector<float>& data,
766 const std::vector<bool>& mask,
[2081]767 const std::vector<int>& waveNumbers,
[2047]768 std::vector<float>& params,
[2193]769 int& nClipped,
[2047]770 float thresClip=3.0,
[2058]771 int nIterClip=1,
[2094]772 bool getResidual=true);
[2186]773 void selectWaveNumbers(const int whichrow,
774 const std::vector<bool>& chanMask,
775 const bool applyFFT,
776 const std::string& fftMethod,
777 const std::string& fftThresh,
778 const std::vector<int>& addNWaves,
779 const std::vector<int>& rejectNWaves,
780 std::vector<int>& nWaves);
781 void parseThresholdExpression(const std::string& fftThresh,
782 std::string& fftThAttr,
783 float& fftThSigma,
784 int& fftThTop);
785 void doSelectWaveNumbers(const int whichrow,
786 const std::vector<bool>& chanMask,
787 const std::string& fftMethod,
788 const float fftThSigma,
789 const int fftThTop,
790 const std::string& fftThAttr,
791 std::vector<int>& nWaves);
[2411]792 void addAuxWaveNumbers(const int whichrow,
793 const std::vector<int>& addNWaves,
[2186]794 const std::vector<int>& rejectNWaves,
795 std::vector<int>& nWaves);
[2411]796 void setWaveNumberListUptoNyquistFreq(const int whichrow,
797 std::vector<int>& nWaves);
[2012]798 bool hasSameNchanOverIFs();
799 std::string getMaskRangeList(const std::vector<bool>& mask,
800 int whichrow,
801 const casa::String& coordInfo,
[2047]802 bool hasSameNchan,
803 bool verbose=false);
804 std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask);
[2641]805 std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose, bool csvformat) const;
806 std::string formatBaselineParamsFooter(float rms, int nClipped, bool verbose, bool csvformat) const;
[2012]807 std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask);
808 //std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask, const std::vector<int>& edge, const int minEdgeSize, STLineFinder& lineFinder);
[2641]809 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);
810 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);
811 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]812 void parseProgressInfo(const std::string& progressInfo, bool& showProgress, int& minNRow);
813 void showProgressOnTerminal(const int nProcessed, const int nTotal, const bool showProgress=true, const int nTotalThreshold=1000);
[1994]814
815 void applyChanFlag( casa::uInt whichrow, const std::vector<bool>& msk, casa::uChar flagval);
816
[2713]817 double doCalculateModelSelectionCriteria(const std::string& valname,
818 const std::vector<float>& spec,
819 const std::vector<bool>& mask,
820 const std::string& blfunc,
821 int order);
[2737]822 double doGetRms(const std::vector<bool>& mask, const casa::Vector<casa::Float>& spec);
[2713]823
[2]824};
825
[824]826} // namespace
827
[2]828#endif
Note: See TracBrowser for help on using the repository browser.