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
Line 
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
14
15// STL
16#include <fstream>
17#include <iostream>
18#include <sstream>
19#include <string>
20#include <vector>
21// AIPS++
22#include <casa/aips.h>
23#include <casa/Arrays/MaskedArray.h>
24#include <casa/Arrays/Vector.h>
25#include <casa/BasicSL/String.h>
26#include <casa/Containers/Record.h>
27#include <casa/Exceptions/Error.h>
28#include <casa/Quanta/Quantum.h>
29#include <casa/Utilities/CountedPtr.h>
30
31#include <coordinates/Coordinates/SpectralCoordinate.h>
32
33#include <measures/TableMeasures/ScalarMeasColumn.h>
34
35#include <scimath/Mathematics/FFTServer.h>
36
37#include <tables/Tables/ArrayColumn.h>
38#include <tables/Tables/ScalarColumn.h>
39#include <tables/Tables/Table.h>
40
41
42#include "MathUtils.h"
43#include "STFit.h"
44#include "STFitEntry.h"
45//#include "STFitter.h"
46#include "STFocus.h"
47#include "STFrequencies.h"
48#include "STHeader.h"
49#include "STHistory.h"
50#include "STMolecules.h"
51#include "STPol.h"
52#include "STSelector.h"
53#include "STTcal.h"
54#include "STWeather.h"
55
56namespace asap {
57
58class Fitter;
59
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*/
78class Scantable
79{
80
81friend class STMath;
82
83public:
84 /**
85 * Default constructor
86 */
87 explicit Scantable(casa::Table::TableType ttype = casa::Table::Memory);
88
89 /**
90 * Create a Scantable object from an existing table on disk
91 * @param[in] name the name of the existing Scantable
92 */
93 explicit Scantable(const std::string& name,
94 casa::Table::TableType ttype = casa::Table::Memory);
95
96 /// @fixme this is only sensible for MemoryTables....
97 Scantable(const Scantable& other, bool clear=true);
98
99 /**
100 * Destructor
101 */
102 virtual ~Scantable();
103
104 /**
105 * get a const reference to the underlying casa::Table
106 * @return const \ref casa::Table reference
107 */
108 const casa::Table& table() const;
109
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();
116
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 */
128 void setSelection(const STSelector& selection);
129
130 /**
131 * unset the selection of the data
132 */
133 void unsetSelection();
134 /**
135 * set the header
136 * @param[in] sth an STHeader object
137 */
138 void setHeader( const STHeader& sth );
139
140 /**
141 * get the header information
142 * @return an STHeader object
143 */
144 STHeader getHeader( ) const;
145
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);
153
154 /**
155 *
156 * @param stype The type of the source, 0 = on, 1 = off
157 */
158 void setSourceType(int stype);
159
160
161 /**
162 * The number of scans in the table
163 * @return number of scans in the table
164 */
165 int nscan() const;
166
167 casa::MEpoch::Types getTimeReference() const;
168
169
170 casa::MEpoch getEpoch(int whichrow) const;
171
172 /**
173 * Get global antenna position
174 * @return casa::MPosition
175 */
176 casa::MPosition getAntennaPosition() const;
177
178 /**
179 * the @ref casa::MDirection for a specific row
180 * @param[in] whichrow the row number
181 * return casa::MDirection
182 */
183 casa::MDirection getDirection( int whichrow ) const;
184
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 */
190 std::string getDirectionString( int whichrow ) const;
191
192 /**
193 * set the direction type as a string, e.g. "J2000"
194 * @param[in] refstr the direction type
195 */
196 void setDirectionRefString(const std::string& refstr="");
197
198 /**
199 * get the direction reference string
200 * @return a string describing the direction reference
201 */
202 std::string getDirectionRefString() const;
203
204 /**
205 * Return the Flux unit of the data, e.g. "Jy" or "K"
206 * @return string
207 */
208 std::string getFluxUnit() const;
209
210 /**
211 * Set the Flux unit of the data
212 * @param unit a string representing the unit, e.g "Jy" or "K"
213 */
214 void setFluxUnit( const std::string& unit );
215
216 /**
217 * Set the Stokes type of the data
218 * @param feedtype a string representing the type, e.g "circular" or "linear"
219 */
220 void setFeedType( const std::string& feedtype );
221
222 /**
223 *
224 * @param instrument a string representing an insturment. see xxx
225 */
226 void setInstrument( const std::string& instrument );
227
228 /**
229 * (Re)calculate the azimuth and elevationnfor all rows
230 */
231 void calculateAZEL();
232
233 /**
234 * "hard" flag the data, this flags everything selected in setSelection()
235 * param[in] msk a boolean mask of length nchan describing the points to
236 * to be flagged
237 */
238 //void flag( const std::vector<bool>& msk = std::vector<bool>());
239 //void flag( const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
240
241 void flag( int whichrow = -1, const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
242
243 /**
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 /**
271 * Return a list of row numbers with respect to the original table.
272 * @return a list of unsigned ints
273 */
274 std::vector<unsigned int> rownumbers() const;
275
276
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 */
283 int nbeam(int scanno=-1) const;
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 */
290 int nif(int scanno=-1) const;
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 */
297 int npol(int scanno=-1) const;
298
299 std::string getPolType() const;
300
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.
306 * @return the number of rows (for the specified scanno)
307 */
308 int nrow(int scanno=-1) const;
309
310 int getBeam(int whichrow) const;
311 std::vector<uint> getBeamNos() const { return getNumbers(beamCol_); }
312
313 int getIF(int whichrow) const;
314 std::vector<uint> getIFNos() const { return getNumbers(ifCol_); }
315
316 int getPol(int whichrow) const;
317 std::vector<uint> getPolNos() const { return getNumbers(polCol_); }
318
319 std::vector<uint> getScanNos() const { return getNumbers(scanCol_); }
320 int getScan(int whichrow) const { return scanCol_(whichrow); }
321
322 //TT addition
323 std::vector<uint> getMolNos() {return getNumbers(mmolidCol_); }
324
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;
333 int getChannels(int whichrow) const;
334
335 int ncycle(int scanno=-1) const;
336 int getCycle(int whichrow) const { return cycleCol_(whichrow); }
337
338 double getInterval(int whichrow) const
339 { return integrCol_(whichrow); }
340
341 float getTsys(int whichrow) const
342 { return casa::Vector<casa::Float>(tsysCol_(whichrow))(0); }
343 std::vector<float> getTsysSpectrum(int whichrow) const ;
344 float getElevation(int whichrow) const
345 { return elCol_(whichrow); }
346 float getAzimuth(int whichrow) const
347 { return azCol_(whichrow); }
348 float getParAngle(int whichrow) const
349 { return focus().getParAngle(mfocusidCol_(whichrow)); }
350 int getTcalId(int whichrow) const
351 { return mtcalidCol_(whichrow); }
352
353 std::string getSourceName(int whichrow) const
354 { return srcnCol_(whichrow); }
355
356 std::vector<bool> getMask(int whichrow) const;
357 std::vector<float> getSpectrum(int whichrow,
358 const std::string& poltype = "" ) const;
359
360 void setSpectrum(const std::vector<float>& spec, int whichrow);
361
362 std::string getPolarizationLabel(int index, const std::string& ptype) const
363 { return STPol::getPolLabel(index, ptype ); }
364
365 /**
366 * Write the Scantable to disk
367 * @param filename the output file name
368 */
369 void makePersistent(const std::string& filename);
370
371 std::vector<std::string> getHistory() const
372 { return historyTable_.getHistory(); };
373
374 void addHistory(const std::string& hist) { historyTable_.addEntry(hist); }
375
376 void appendToHistoryTable(const STHistory& otherhist)
377 { historyTable_.append(otherhist); }
378
379 std::string headerSummary();
380 void summary(const std::string& filename="");
381 std::string oldheaderSummary();
382 // std::string summary();
383 void oldsummary(const std::string& filename="");
384
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;
387 double getIntTime(int whichrow) const { return integrCol_(whichrow); }
388
389 // returns unit, conversion frame, doppler, base-frame
390
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
402
403 std::vector<double> getAbcissa(int whichrow) const;
404
405 std::vector<float> getWeather(int whichrow) const;
406
407 std::string getAbcissaLabel(int whichrow) const;
408 std::vector<double> getRestFrequencies() const
409 { return moleculeTable_.getRestFrequencies(); }
410 std::vector<double> getRestFrequency(int id) const
411 { return moleculeTable_.getRestFrequency(id); }
412
413 /**
414 void setRestFrequencies(double rf, const std::string& name = "",
415 const std::string& = "Hz");
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");
425
426 //void setRestFrequencies(const std::string& name);
427 void setRestFrequencies(const vector<std::string>& name);
428
429 void shift(int npix);
430
431 casa::SpectralCoordinate getSpectralCoordinate(int whichrow) const;
432
433 void convertDirection(const std::string& newframe);
434
435 STFrequencies& frequencies() { return freqTable_; }
436 const STFrequencies& frequencies() const { return freqTable_; }
437 STWeather& weather() { return weatherTable_; }
438 const STWeather& weather() const { return weatherTable_; }
439 STFocus& focus() { return focusTable_; }
440 const STFocus& focus() const { return focusTable_; }
441 STTcal& tcal() { return tcalTable_; }
442 const STTcal& tcal() const { return tcalTable_; }
443 STMolecules& molecules() { return moleculeTable_; }
444 const STMolecules& molecules() const { return moleculeTable_; }
445 STHistory& history() { return historyTable_; }
446 const STHistory& history() const { return historyTable_; }
447 STFit& fit() { return fitTable_; }
448 const STFit& fit() const { return fitTable_; }
449
450 std::vector<std::string> columnNames() const;
451
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
456 //Added by TT
457 /**
458 * Get the antenna name
459 * @return antenna name string
460 */
461 casa::String getAntennaName() const;
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
479 /**
480 * Set a flag indicating whether the data was parallactified
481 * @param[in] flag true or false
482 */
483 void parallactify(bool flag)
484 { focusTable_.setParallactify(flag); }
485
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 ) ;
505 void regridChannel( int nchan, double dnu, double fmin, int irow ) ;
506
507 void regridSpecChannel( double dnu, int nchan=-1 ) ;
508
509 bool getFlagtraFast(casa::uInt whichrow);
510
511 void polyBaseline(const std::vector<bool>& mask,
512 int order,
513 bool getResidual=true,
514 const std::string& progressInfo="true,1000",
515 const bool outLogger=false,
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,
522 bool getResidual=true,
523 const std::string& progressInfo="true,1000",
524 const bool outLogger=false,
525 const std::string& blfile="");
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="");
545 void cubicSplineBaseline(const std::vector<bool>& mask,
546 int nPiece,
547 float thresClip,
548 int nIterClip,
549 bool getResidual=true,
550 const std::string& progressInfo="true,1000",
551 const bool outLogger=false,
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,
560 bool getResidual=true,
561 const std::string& progressInfo="true,1000",
562 const bool outLogger=false,
563 const std::string& blfile="");
564 void sinusoidBaseline(const std::vector<bool>& mask,
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,
570 float thresClip,
571 int nIterClip,
572 bool getResidual=true,
573 const std::string& progressInfo="true,1000",
574 const bool outLogger=false,
575 const std::string& blfile="");
576 void autoSinusoidBaseline(const std::vector<bool>& mask,
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,
582 float thresClip,
583 int nIterClip,
584 const std::vector<int>& edge,
585 float threshold=3.0,
586 int chanAvgLimit=1,
587 bool getResidual=true,
588 const std::string& progressInfo="true,1000",
589 const bool outLogger=false,
590 const std::string& blfile="");
591 std::vector<float> execFFT(const int whichrow,
592 const std::vector<bool>& inMask,
593 bool getRealImag=false,
594 bool getAmplitudeOnly=false);
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,
599 int nClipped,
600 const std::string& masklist,
601 int whichrow,
602 bool verbose=false,
603 bool csvformat=false,
604 int start=-1,
605 int count=-1,
606 bool resetparamid=false) const;
607 std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges,
608 const std::vector<float>& params,
609 const std::vector<bool>& fixed,
610 float rms,
611 int nClipped,
612 const std::string& masklist,
613 int whichrow,
614 bool verbose=false,
615 bool csvformat=false) const;
616 std::vector<uint> getMoleculeIdColumnData() const;
617 void setMoleculeIdColumnData(const std::vector<uint>& molids);
618
619
620private:
621
622 casa::Matrix<casa::Float> getPolMatrix( casa::uInt whichrow ) const;
623
624 /**
625 * Turns a time value into a formatted string
626 * @param x
627 * @return
628 */
629 std::string formatSec(casa::Double x) const;
630
631 std::string formatTime(const casa::MEpoch& me, bool showdate)const;
632 std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
633
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;
640
641 /**
642 * Create a unique file name for the paged (temporary) table
643 * @return just the name
644 */
645 static casa::String generateName();
646
647 /**
648 * attach to cached columns
649 */
650 void attach();
651
652 /**
653 * Set up the main casa::Table
654 */
655 void setupMainTable();
656
657 void attachSubtables();
658 void copySubtables(const Scantable& other);
659
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);
666
667 std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
668
669 static const casa::uInt version_ = 4;
670
671 STSelector selector_;
672
673 casa::Table::TableType type_;
674
675 // the actual data
676 casa::Table table_;
677 casa::Table originalTable_;
678
679 STTcal tcalTable_;
680 STFrequencies freqTable_;
681 STWeather weatherTable_;
682 STFocus focusTable_;
683 STMolecules moleculeTable_;
684 STHistory historyTable_;
685 STFit fitTable_;
686
687 // Cached Columns to avoid reconstructing them for each row get/put
688 casa::ScalarColumn<casa::Double> integrCol_;
689 casa::MDirection::ScalarColumn dirCol_;
690 casa::MEpoch::ScalarColumn timeCol_;
691 casa::ScalarColumn<casa::Float> azCol_;
692 casa::ScalarColumn<casa::Float> elCol_;
693 casa::ScalarColumn<casa::String> srcnCol_, fldnCol_;
694 casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_, flagrowCol_;
695 casa::ScalarColumn<casa::Int> rbeamCol_, srctCol_;
696 casa::ArrayColumn<casa::Float> specCol_, tsysCol_;
697 casa::ArrayColumn<casa::uChar> flagsCol_;
698
699 // id in frequencies table
700 casa::ScalarColumn<casa::uInt> mfreqidCol_;
701 // id in tcal table
702 casa::ScalarColumn<casa::uInt> mtcalidCol_;
703
704 casa::ArrayColumn<casa::String> histitemCol_;
705 casa::ScalarColumn<casa::Int> mfitidCol_;
706 casa::ScalarColumn<casa::uInt> mweatheridCol_;
707
708 casa::ScalarColumn<casa::uInt> mfocusidCol_;
709
710 casa::ScalarColumn<casa::uInt> mmolidCol_;
711
712 static std::map<std::string, STPol::STPolFactory *> factories_;
713 void initFactories();
714
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>&);
731
732 void fitBaseline(const std::vector<bool>& mask, int whichrow, Fitter& fitter);
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);
742 std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
743 const std::vector<bool>& mask,
744 int nPiece,
745 std::vector<int>& idxEdge,
746 std::vector<float>& params,
747 int& nClipped,
748 float thresClip=3.0,
749 int nIterClip=1,
750 bool getResidual=true);
751 std::vector<float> doSinusoidFitting(const std::vector<float>& data,
752 const std::vector<bool>& mask,
753 const std::vector<int>& waveNumbers,
754 std::vector<float>& params,
755 int& nClipped,
756 float thresClip=3.0,
757 int nIterClip=1,
758 bool getResidual=true);
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);
778 void addAuxWaveNumbers(const int whichrow,
779 const std::vector<int>& addNWaves,
780 const std::vector<int>& rejectNWaves,
781 std::vector<int>& nWaves);
782 void setWaveNumberListUptoNyquistFreq(const int whichrow,
783 std::vector<int>& nWaves);
784 bool hasSameNchanOverIFs();
785 std::string getMaskRangeList(const std::vector<bool>& mask,
786 int whichrow,
787 const casa::String& coordInfo,
788 bool hasSameNchan,
789 bool verbose=false);
790 std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask);
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;
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);
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);
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);
800
801 void applyChanFlag( casa::uInt whichrow, const std::vector<bool>& msk, casa::uChar flagval);
802
803};
804
805} // namespace
806
807#endif
Note: See TracBrowser for help on using the repository browser.