[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>
|
---|
[2186] | 30 | #include <coordinates/Coordinates/SpectralCoordinate.h>
|
---|
[824] | 31 | #include <measures/TableMeasures/ScalarMeasColumn.h>
|
---|
[2186] | 32 | #include <scimath/Mathematics/FFTServer.h>
|
---|
| 33 | #include <tables/Tables/ArrayColumn.h>
|
---|
| 34 | #include <tables/Tables/ScalarColumn.h>
|
---|
| 35 | #include <tables/Tables/Table.h>
|
---|
[1819] | 36 |
|
---|
[2186] | 37 | #include "MathUtils.h"
|
---|
[2767] | 38 | #include "STBaselineEnum.h"
|
---|
[2186] | 39 | #include "STFit.h"
|
---|
| 40 | #include "STFitEntry.h"
|
---|
| 41 | #include "STFocus.h"
|
---|
| 42 | #include "STFrequencies.h"
|
---|
[901] | 43 | #include "STHeader.h"
|
---|
[2186] | 44 | #include "STHistory.h"
|
---|
[824] | 45 | #include "STMolecules.h"
|
---|
[2186] | 46 | #include "STPol.h"
|
---|
[824] | 47 | #include "STSelector.h"
|
---|
[2186] | 48 | #include "STTcal.h"
|
---|
| 49 | #include "STWeather.h"
|
---|
[2] | 50 |
|
---|
[824] | 51 | namespace asap {
|
---|
[2] | 52 |
|
---|
[2666] | 53 | class Fitter;
|
---|
[2773] | 54 | class STLineFinder;
|
---|
| 55 | class STBaselineTable;
|
---|
[2666] | 56 |
|
---|
[824] | 57 | /**
|
---|
| 58 | * This class contains and wraps a casa::Table, which is used to store
|
---|
| 59 | * all the information. This can be either a MemoryTable or a
|
---|
| 60 | * disk based Table.
|
---|
| 61 | * It provides access functions to the underlying table
|
---|
| 62 | * It contains n subtables:
|
---|
| 63 | * @li weather
|
---|
| 64 | * @li frequencies
|
---|
| 65 | * @li molecules
|
---|
| 66 | * @li tcal
|
---|
| 67 | * @li focus
|
---|
| 68 | * @li fits
|
---|
| 69 | *
|
---|
| 70 | * @brief The main ASAP data container
|
---|
| 71 | * @author Malte Marquarding
|
---|
| 72 | * @date
|
---|
| 73 | * @version
|
---|
| 74 | */
|
---|
[2658] | 75 | class Scantable
|
---|
[824] | 76 | {
|
---|
[902] | 77 |
|
---|
| 78 | friend class STMath;
|
---|
| 79 |
|
---|
[2] | 80 | public:
|
---|
[824] | 81 | /**
|
---|
| 82 | * Default constructor
|
---|
| 83 | */
|
---|
[1350] | 84 | explicit Scantable(casa::Table::TableType ttype = casa::Table::Memory);
|
---|
[19] | 85 |
|
---|
[824] | 86 | /**
|
---|
[2321] | 87 | * Create a Scantable object from an existing table on disk
|
---|
[824] | 88 | * @param[in] name the name of the existing Scantable
|
---|
| 89 | */
|
---|
[2321] | 90 | explicit Scantable(const std::string& name,
|
---|
| 91 | casa::Table::TableType ttype = casa::Table::Memory);
|
---|
[2] | 92 |
|
---|
[824] | 93 | /// @fixme this is only sensible for MemoryTables....
|
---|
| 94 | Scantable(const Scantable& other, bool clear=true);
|
---|
[161] | 95 |
|
---|
[824] | 96 | /**
|
---|
| 97 | * Destructor
|
---|
| 98 | */
|
---|
| 99 | virtual ~Scantable();
|
---|
[745] | 100 |
|
---|
[824] | 101 | /**
|
---|
| 102 | * get a const reference to the underlying casa::Table
|
---|
[1104] | 103 | * @return const \ref casa::Table reference
|
---|
[824] | 104 | */
|
---|
| 105 | const casa::Table& table() const;
|
---|
[19] | 106 |
|
---|
[824] | 107 | /**
|
---|
| 108 | * get a reference to the underlying casa::Table with the Selection
|
---|
| 109 | * object applied if set
|
---|
| 110 | * @return casa::Table reference
|
---|
| 111 | */
|
---|
| 112 | casa::Table& table();
|
---|
[21] | 113 |
|
---|
[845] | 114 |
|
---|
| 115 | /**
|
---|
| 116 | * Get a handle to the selection object
|
---|
| 117 | * @return constant STSelector reference
|
---|
| 118 | */
|
---|
| 119 | const STSelector& getSelection() const { return selector_; }
|
---|
| 120 |
|
---|
| 121 | /**
|
---|
| 122 | * Set the data to be a subset as defined by the STSelector
|
---|
| 123 | * @param selection a STSelector object
|
---|
| 124 | */
|
---|
[824] | 125 | void setSelection(const STSelector& selection);
|
---|
[845] | 126 |
|
---|
| 127 | /**
|
---|
| 128 | * unset the selection of the data
|
---|
| 129 | */
|
---|
[824] | 130 | void unsetSelection();
|
---|
| 131 | /**
|
---|
| 132 | * set the header
|
---|
[1295] | 133 | * @param[in] sth an STHeader object
|
---|
[824] | 134 | */
|
---|
[901] | 135 | void setHeader( const STHeader& sth );
|
---|
[386] | 136 |
|
---|
[824] | 137 | /**
|
---|
| 138 | * get the header information
|
---|
[901] | 139 | * @return an STHeader object
|
---|
[824] | 140 | */
|
---|
[901] | 141 | STHeader getHeader( ) const;
|
---|
[1068] | 142 |
|
---|
[824] | 143 | /**
|
---|
| 144 | * Checks if the "other" Scantable is conformant with this,
|
---|
| 145 | * i.e. if header values are the same.
|
---|
| 146 | * @param[in] other another Scantable
|
---|
| 147 | * @return true or false
|
---|
| 148 | */
|
---|
| 149 | bool conformant( const Scantable& other);
|
---|
[430] | 150 |
|
---|
[824] | 151 | /**
|
---|
[1068] | 152 | *
|
---|
| 153 | * @param stype The type of the source, 0 = on, 1 = off
|
---|
| 154 | */
|
---|
| 155 | void setSourceType(int stype);
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | /**
|
---|
[1104] | 159 | * The number of scans in the table
|
---|
[824] | 160 | * @return number of scans in the table
|
---|
| 161 | */
|
---|
[845] | 162 | int nscan() const;
|
---|
[490] | 163 |
|
---|
[915] | 164 | casa::MEpoch::Types getTimeReference() const;
|
---|
[21] | 165 |
|
---|
[1411] | 166 |
|
---|
| 167 | casa::MEpoch getEpoch(int whichrow) const;
|
---|
| 168 |
|
---|
[824] | 169 | /**
|
---|
| 170 | * Get global antenna position
|
---|
[845] | 171 | * @return casa::MPosition
|
---|
[824] | 172 | */
|
---|
| 173 | casa::MPosition getAntennaPosition() const;
|
---|
[490] | 174 |
|
---|
[1441] | 175 | /**
|
---|
| 176 | * the @ref casa::MDirection for a specific row
|
---|
| 177 | * @param[in] whichrow the row number
|
---|
| 178 | * return casa::MDirection
|
---|
| 179 | */
|
---|
[987] | 180 | casa::MDirection getDirection( int whichrow ) const;
|
---|
[1598] | 181 |
|
---|
[1441] | 182 | /**
|
---|
| 183 | * get the direction type as a string, e.g. "J2000"
|
---|
| 184 | * @param[in] whichrow the row number
|
---|
| 185 | * return the direction string
|
---|
| 186 | */
|
---|
[1068] | 187 | std::string getDirectionString( int whichrow ) const;
|
---|
| 188 |
|
---|
[1441] | 189 | /**
|
---|
| 190 | * set the direction type as a string, e.g. "J2000"
|
---|
| 191 | * @param[in] refstr the direction type
|
---|
| 192 | */
|
---|
[987] | 193 | void setDirectionRefString(const std::string& refstr="");
|
---|
[1441] | 194 |
|
---|
[1104] | 195 | /**
|
---|
| 196 | * get the direction reference string
|
---|
| 197 | * @return a string describing the direction reference
|
---|
| 198 | */
|
---|
[1598] | 199 | std::string getDirectionRefString() const;
|
---|
[987] | 200 |
|
---|
[824] | 201 | /**
|
---|
[845] | 202 | * Return the Flux unit of the data, e.g. "Jy" or "K"
|
---|
| 203 | * @return string
|
---|
[824] | 204 | */
|
---|
| 205 | std::string getFluxUnit() const;
|
---|
[472] | 206 |
|
---|
[824] | 207 | /**
|
---|
[845] | 208 | * Set the Flux unit of the data
|
---|
| 209 | * @param unit a string representing the unit, e.g "Jy" or "K"
|
---|
[824] | 210 | */
|
---|
| 211 | void setFluxUnit( const std::string& unit );
|
---|
[472] | 212 |
|
---|
[824] | 213 | /**
|
---|
[1189] | 214 | * Set the Stokes type of the data
|
---|
[1295] | 215 | * @param feedtype a string representing the type, e.g "circular" or "linear"
|
---|
[1189] | 216 | */
|
---|
| 217 | void setFeedType( const std::string& feedtype );
|
---|
| 218 |
|
---|
| 219 | /**
|
---|
[824] | 220 | *
|
---|
[845] | 221 | * @param instrument a string representing an insturment. see xxx
|
---|
[824] | 222 | */
|
---|
| 223 | void setInstrument( const std::string& instrument );
|
---|
[2] | 224 |
|
---|
[845] | 225 | /**
|
---|
| 226 | * (Re)calculate the azimuth and elevationnfor all rows
|
---|
| 227 | */
|
---|
[824] | 228 | void calculateAZEL();
|
---|
[745] | 229 |
|
---|
[824] | 230 | /**
|
---|
[845] | 231 | * "hard" flag the data, this flags everything selected in setSelection()
|
---|
[1104] | 232 | * param[in] msk a boolean mask of length nchan describing the points to
|
---|
| 233 | * to be flagged
|
---|
[824] | 234 | */
|
---|
[1430] | 235 | //void flag( const std::vector<bool>& msk = std::vector<bool>());
|
---|
[1994] | 236 | //void flag( const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
|
---|
[455] | 237 |
|
---|
[1994] | 238 | void flag( int whichrow = -1, const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
|
---|
| 239 |
|
---|
[852] | 240 | /**
|
---|
[1819] | 241 | * Flag the data in a row-based manner. (CAS-1433 Wataru Kawasaki)
|
---|
| 242 | * param[in] rows list of row numbers to be flagged
|
---|
| 243 | */
|
---|
| 244 | void flagRow( const std::vector<casa::uInt>& rows = std::vector<casa::uInt>(), bool unflag=false);
|
---|
| 245 |
|
---|
| 246 | /**
|
---|
| 247 | * Get flagRow info at the specified row. If true, the whole data
|
---|
| 248 | * at the row should be flagged.
|
---|
| 249 | */
|
---|
| 250 | bool getFlagRow(int whichrow) const
|
---|
| 251 | { return (flagrowCol_(whichrow) > 0); }
|
---|
| 252 |
|
---|
| 253 | /**
|
---|
| 254 | * Flag the data outside a specified range (in a channel-based manner).
|
---|
| 255 | * (CAS-1807 Wataru Kawasaki)
|
---|
| 256 | */
|
---|
| 257 | void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
|
---|
| 258 |
|
---|
| 259 | /**
|
---|
| 260 | * Return a list of booleans with the size of nchan for a specified row, to get info
|
---|
| 261 | * about which channel is clipped.
|
---|
| 262 | */
|
---|
| 263 | std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
|
---|
| 264 | void srchChannelsToClip(casa::uInt whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag,
|
---|
| 265 | casa::Vector<casa::uChar> flgs);
|
---|
| 266 |
|
---|
| 267 | /**
|
---|
[852] | 268 | * Return a list of row numbers with respect to the original table.
|
---|
[902] | 269 | * @return a list of unsigned ints
|
---|
[852] | 270 | */
|
---|
| 271 | std::vector<unsigned int> rownumbers() const;
|
---|
[845] | 272 |
|
---|
[852] | 273 |
|
---|
[845] | 274 | /**
|
---|
| 275 | * Get the number of beams in the data or a specific scan
|
---|
| 276 | * @param scanno the scan number to get the number of beams for.
|
---|
| 277 | * If scanno<0 the number is retrieved from the header.
|
---|
| 278 | * @return an integer number
|
---|
| 279 | */
|
---|
[824] | 280 | int nbeam(int scanno=-1) const;
|
---|
[845] | 281 | /**
|
---|
| 282 | * Get the number of IFs in the data or a specific scan
|
---|
| 283 | * @param scanno the scan number to get the number of IFs for.
|
---|
| 284 | * If scanno<0 the number is retrieved from the header.
|
---|
| 285 | * @return an integer number
|
---|
| 286 | */
|
---|
[824] | 287 | int nif(int scanno=-1) const;
|
---|
[845] | 288 | /**
|
---|
| 289 | * Get the number of polarizations in the data or a specific scan
|
---|
| 290 | * @param scanno the scan number to get the number of polarizations for.
|
---|
| 291 | * If scanno<0 the number is retrieved from the header.
|
---|
| 292 | * @return an integer number
|
---|
| 293 | */
|
---|
[824] | 294 | int npol(int scanno=-1) const;
|
---|
[794] | 295 |
|
---|
[896] | 296 | std::string getPolType() const;
|
---|
| 297 |
|
---|
[845] | 298 |
|
---|
| 299 | /**
|
---|
| 300 | * Get the number of integartion cycles
|
---|
| 301 | * @param scanno the scan number to get the number of rows for.
|
---|
| 302 | * If scanno<0 the number is retrieved from the header.
|
---|
[1104] | 303 | * @return the number of rows (for the specified scanno)
|
---|
[845] | 304 | */
|
---|
[824] | 305 | int nrow(int scanno=-1) const;
|
---|
[794] | 306 |
|
---|
[1111] | 307 | int getBeam(int whichrow) const;
|
---|
[1694] | 308 | std::vector<uint> getBeamNos() const { return getNumbers(beamCol_); }
|
---|
[50] | 309 |
|
---|
[847] | 310 | int getIF(int whichrow) const;
|
---|
[1694] | 311 | std::vector<uint> getIFNos() const { return getNumbers(ifCol_); }
|
---|
[1111] | 312 |
|
---|
[847] | 313 | int getPol(int whichrow) const;
|
---|
[1694] | 314 | std::vector<uint> getPolNos() const { return getNumbers(polCol_); }
|
---|
[1111] | 315 |
|
---|
[1694] | 316 | std::vector<uint> getScanNos() const { return getNumbers(scanCol_); }
|
---|
[865] | 317 | int getScan(int whichrow) const { return scanCol_(whichrow); }
|
---|
[1111] | 318 |
|
---|
[2667] | 319 | std::vector<uint> getCycleNos() const { return getNumbers(cycleCol_); }
|
---|
| 320 | int getCycle(int whichrow) const { return cycleCol_(whichrow); }
|
---|
| 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 |
|
---|
[2667] | 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 ;
|
---|
[2791] | 344 |
|
---|
| 345 | void setTsys(const std::vector<float>& newvals, int whichrow);
|
---|
| 346 |
|
---|
[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 ) ;
|
---|
[2435] | 509 | void regridSpecChannel( double dnu, int nchan=-1 ) ;
|
---|
| 510 |
|
---|
[2047] | 511 | bool getFlagtraFast(casa::uInt whichrow);
|
---|
[1819] | 512 |
|
---|
[2767] | 513 | std::vector<std::string> applyBaselineTable(const std::string& bltable, const std::string& outbltable, const bool outbltableexists, const bool overwrite);
|
---|
| 514 | std::vector<std::string> subBaseline(const std::vector<std::string>& blInfoList, const std::string& outbltable, const bool outbltableexists, const bool overwrite);
|
---|
| 515 | void polyBaseline(const std::vector<bool>& mask,
|
---|
| 516 | int order,
|
---|
| 517 | float thresClip,
|
---|
| 518 | int nIterClip,
|
---|
[2094] | 519 | bool getResidual=true,
|
---|
[2189] | 520 | const std::string& progressInfo="true,1000",
|
---|
[2767] | 521 | const bool outLogger=false,
|
---|
| 522 | const std::string& blfile="",
|
---|
| 523 | const std::string& bltable="");
|
---|
[2012] | 524 | void autoPolyBaseline(const std::vector<bool>& mask,
|
---|
[2767] | 525 | int order,
|
---|
| 526 | float thresClip,
|
---|
| 527 | int nIterClip,
|
---|
| 528 | const std::vector<int>& edge,
|
---|
| 529 | float threshold=3.0,
|
---|
| 530 | int chanAvgLimit=1,
|
---|
| 531 | bool getResidual=true,
|
---|
| 532 | const std::string& progressInfo="true,1000",
|
---|
| 533 | const bool outLogger=false,
|
---|
| 534 | const std::string& blfile="",
|
---|
| 535 | const std::string& bltable="");
|
---|
[2645] | 536 | void chebyshevBaseline(const std::vector<bool>& mask,
|
---|
| 537 | int order,
|
---|
| 538 | float thresClip,
|
---|
| 539 | int nIterClip,
|
---|
| 540 | bool getResidual=true,
|
---|
| 541 | const std::string& progressInfo="true,1000",
|
---|
| 542 | const bool outLogger=false,
|
---|
[2767] | 543 | const std::string& blfile="",
|
---|
| 544 | const std::string& bltable="");
|
---|
[2645] | 545 | void autoChebyshevBaseline(const std::vector<bool>& mask,
|
---|
| 546 | int order,
|
---|
| 547 | float thresClip,
|
---|
| 548 | int nIterClip,
|
---|
| 549 | const std::vector<int>& edge,
|
---|
| 550 | float threshold=3.0,
|
---|
| 551 | int chanAvgLimit=1,
|
---|
| 552 | bool getResidual=true,
|
---|
| 553 | const std::string& progressInfo="true,1000",
|
---|
| 554 | const bool outLogger=false,
|
---|
[2767] | 555 | const std::string& blfile="",
|
---|
| 556 | const std::string& bltable="");
|
---|
[2012] | 557 | void cubicSplineBaseline(const std::vector<bool>& mask,
|
---|
| 558 | int nPiece,
|
---|
| 559 | float thresClip,
|
---|
| 560 | int nIterClip,
|
---|
[2094] | 561 | bool getResidual=true,
|
---|
[2189] | 562 | const std::string& progressInfo="true,1000",
|
---|
| 563 | const bool outLogger=false,
|
---|
[2767] | 564 | const std::string& blfile="",
|
---|
| 565 | const std::string& bltable="");
|
---|
[2012] | 566 | void autoCubicSplineBaseline(const std::vector<bool>& mask,
|
---|
| 567 | int nPiece,
|
---|
| 568 | float thresClip,
|
---|
| 569 | int nIterClip,
|
---|
| 570 | const std::vector<int>& edge,
|
---|
| 571 | float threshold=3.0,
|
---|
| 572 | int chanAvgLimit=1,
|
---|
[2094] | 573 | bool getResidual=true,
|
---|
[2189] | 574 | const std::string& progressInfo="true,1000",
|
---|
| 575 | const bool outLogger=false,
|
---|
[2767] | 576 | const std::string& blfile="",
|
---|
| 577 | const std::string& bltable="");
|
---|
[2047] | 578 | void sinusoidBaseline(const std::vector<bool>& mask,
|
---|
[2767] | 579 | const std::string& fftInfo,
|
---|
[2186] | 580 | const std::vector<int>& addNWaves,
|
---|
| 581 | const std::vector<int>& rejectNWaves,
|
---|
[2047] | 582 | float thresClip,
|
---|
| 583 | int nIterClip,
|
---|
[2081] | 584 | bool getResidual=true,
|
---|
[2189] | 585 | const std::string& progressInfo="true,1000",
|
---|
| 586 | const bool outLogger=false,
|
---|
[2767] | 587 | const std::string& blfile="",
|
---|
| 588 | const std::string& bltable="");
|
---|
[2047] | 589 | void autoSinusoidBaseline(const std::vector<bool>& mask,
|
---|
[2767] | 590 | const std::string& fftInfo,
|
---|
[2186] | 591 | const std::vector<int>& addNWaves,
|
---|
| 592 | const std::vector<int>& rejectNWaves,
|
---|
[2047] | 593 | float thresClip,
|
---|
| 594 | int nIterClip,
|
---|
| 595 | const std::vector<int>& edge,
|
---|
| 596 | float threshold=3.0,
|
---|
| 597 | int chanAvgLimit=1,
|
---|
[2081] | 598 | bool getResidual=true,
|
---|
[2189] | 599 | const std::string& progressInfo="true,1000",
|
---|
| 600 | const bool outLogger=false,
|
---|
[2767] | 601 | const std::string& blfile="",
|
---|
| 602 | const std::string& bltable="");
|
---|
[2186] | 603 | std::vector<float> execFFT(const int whichrow,
|
---|
| 604 | const std::vector<bool>& inMask,
|
---|
| 605 | bool getRealImag=false,
|
---|
| 606 | bool getAmplitudeOnly=false);
|
---|
[2012] | 607 | float getRms(const std::vector<bool>& mask, int whichrow);
|
---|
| 608 | std::string formatBaselineParams(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,
|
---|
[2064] | 614 | bool verbose=false,
|
---|
[2641] | 615 | bool csvformat=false,
|
---|
[2064] | 616 | int start=-1,
|
---|
| 617 | int count=-1,
|
---|
| 618 | bool resetparamid=false) const;
|
---|
[2012] | 619 | std::string formatPiecewiseBaselineParams(const std::vector<int>& ranges,
|
---|
| 620 | const std::vector<float>& params,
|
---|
| 621 | const std::vector<bool>& fixed,
|
---|
| 622 | float rms,
|
---|
[2193] | 623 | int nClipped,
|
---|
[2012] | 624 | const std::string& masklist,
|
---|
| 625 | int whichrow,
|
---|
[2641] | 626 | bool verbose=false,
|
---|
| 627 | bool csvformat=false) const;
|
---|
[2591] | 628 | std::vector<uint> getMoleculeIdColumnData() const;
|
---|
| 629 | void setMoleculeIdColumnData(const std::vector<uint>& molids);
|
---|
[2713] | 630 | double calculateModelSelectionCriteria(const std::string& valname,
|
---|
| 631 | const std::string& blfunc,
|
---|
| 632 | int order,
|
---|
| 633 | const std::vector<bool>& inMask,
|
---|
| 634 | int whichrow,
|
---|
| 635 | bool useLineFinder,
|
---|
| 636 | const std::vector<int>& edge,
|
---|
| 637 | float threshold,
|
---|
| 638 | int chanAvgLimit);
|
---|
[2767] | 639 | static std::vector<bool> getMaskFromMaskList(const int nchan,
|
---|
[2789] | 640 | const std::vector<int>& masklist);
|
---|
| 641 | static casa::Vector<casa::uInt> getMaskListFromMask(
|
---|
| 642 | const std::vector<bool>& mask);
|
---|
| 643 | static std::vector<int> splitToIntList(const std::string& str,
|
---|
| 644 | const char delim);
|
---|
| 645 | static std::vector<string> splitToStringList(const std::string& str,
|
---|
| 646 | const char delim);
|
---|
[1907] | 647 |
|
---|
[2789] | 648 | void dropXPol();
|
---|
[2012] | 649 |
|
---|
[824] | 650 | private:
|
---|
[896] | 651 |
|
---|
| 652 | casa::Matrix<casa::Float> getPolMatrix( casa::uInt whichrow ) const;
|
---|
| 653 |
|
---|
[824] | 654 | /**
|
---|
[2005] | 655 | * Turns a time value into a formatted string
|
---|
[824] | 656 | * @param x
|
---|
| 657 | * @return
|
---|
| 658 | */
|
---|
| 659 | std::string formatSec(casa::Double x) const;
|
---|
[18] | 660 |
|
---|
[824] | 661 | std::string formatTime(const casa::MEpoch& me, bool showdate)const;
|
---|
[1947] | 662 | std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
|
---|
[22] | 663 |
|
---|
[824] | 664 | /**
|
---|
| 665 | * Turns a casa::MDirection into a nicely formatted string
|
---|
| 666 | * @param md an casa::MDirection
|
---|
| 667 | * @return
|
---|
| 668 | */
|
---|
| 669 | std::string formatDirection(const casa::MDirection& md) const;
|
---|
[19] | 670 |
|
---|
[824] | 671 | /**
|
---|
| 672 | * Create a unique file name for the paged (temporary) table
|
---|
| 673 | * @return just the name
|
---|
| 674 | */
|
---|
| 675 | static casa::String generateName();
|
---|
[286] | 676 |
|
---|
[824] | 677 | /**
|
---|
| 678 | * attach to cached columns
|
---|
| 679 | */
|
---|
| 680 | void attach();
|
---|
[50] | 681 |
|
---|
[824] | 682 | /**
|
---|
| 683 | * Set up the main casa::Table
|
---|
| 684 | */
|
---|
| 685 | void setupMainTable();
|
---|
[88] | 686 |
|
---|
[859] | 687 | void attachSubtables();
|
---|
[865] | 688 | void copySubtables(const Scantable& other);
|
---|
| 689 |
|
---|
[824] | 690 | /**
|
---|
| 691 | * Convert an "old" asap1 style row index into a new index
|
---|
| 692 | * @param[in] therow
|
---|
| 693 | * @return and index into @table_
|
---|
| 694 | */
|
---|
| 695 | int rowToScanIndex(int therow);
|
---|
[212] | 696 |
|
---|
[1694] | 697 | std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
|
---|
[1111] | 698 |
|
---|
[2321] | 699 | static const casa::uInt version_ = 4;
|
---|
[286] | 700 |
|
---|
[824] | 701 | STSelector selector_;
|
---|
[236] | 702 |
|
---|
[824] | 703 | casa::Table::TableType type_;
|
---|
[465] | 704 |
|
---|
[824] | 705 | // the actual data
|
---|
| 706 | casa::Table table_;
|
---|
| 707 | casa::Table originalTable_;
|
---|
[745] | 708 |
|
---|
[824] | 709 | STTcal tcalTable_;
|
---|
| 710 | STFrequencies freqTable_;
|
---|
| 711 | STWeather weatherTable_;
|
---|
| 712 | STFocus focusTable_;
|
---|
| 713 | STMolecules moleculeTable_;
|
---|
[860] | 714 | STHistory historyTable_;
|
---|
[960] | 715 | STFit fitTable_;
|
---|
[860] | 716 |
|
---|
[824] | 717 | // Cached Columns to avoid reconstructing them for each row get/put
|
---|
[847] | 718 | casa::ScalarColumn<casa::Double> integrCol_;
|
---|
[824] | 719 | casa::MDirection::ScalarColumn dirCol_;
|
---|
[847] | 720 | casa::MEpoch::ScalarColumn timeCol_;
|
---|
[923] | 721 | casa::ScalarColumn<casa::Float> azCol_;
|
---|
| 722 | casa::ScalarColumn<casa::Float> elCol_;
|
---|
[824] | 723 | casa::ScalarColumn<casa::String> srcnCol_, fldnCol_;
|
---|
[1819] | 724 | casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_, flagrowCol_;
|
---|
[1068] | 725 | casa::ScalarColumn<casa::Int> rbeamCol_, srctCol_;
|
---|
[865] | 726 | casa::ArrayColumn<casa::Float> specCol_, tsysCol_;
|
---|
[824] | 727 | casa::ArrayColumn<casa::uChar> flagsCol_;
|
---|
[430] | 728 |
|
---|
[824] | 729 | // id in frequencies table
|
---|
| 730 | casa::ScalarColumn<casa::uInt> mfreqidCol_;
|
---|
| 731 | // id in tcal table
|
---|
| 732 | casa::ScalarColumn<casa::uInt> mtcalidCol_;
|
---|
[430] | 733 |
|
---|
[824] | 734 | casa::ArrayColumn<casa::String> histitemCol_;
|
---|
[972] | 735 | casa::ScalarColumn<casa::Int> mfitidCol_;
|
---|
[824] | 736 | casa::ScalarColumn<casa::uInt> mweatheridCol_;
|
---|
[322] | 737 |
|
---|
[824] | 738 | casa::ScalarColumn<casa::uInt> mfocusidCol_;
|
---|
| 739 |
|
---|
| 740 | casa::ScalarColumn<casa::uInt> mmolidCol_;
|
---|
| 741 |
|
---|
[896] | 742 | static std::map<std::string, STPol::STPolFactory *> factories_;
|
---|
| 743 | void initFactories();
|
---|
| 744 |
|
---|
[1819] | 745 | /**
|
---|
| 746 | * Add an auxiliary column to the main table and attach it to a
|
---|
| 747 | * cached column. Use for adding new columns that the original asap2
|
---|
| 748 | * tables do not have.
|
---|
| 749 | * @param[in] col reference to the cached column to be attached
|
---|
| 750 | * @param[in] colName column name in asap table
|
---|
| 751 | * @param[in] defValue default value to fill in the column
|
---|
| 752 | *
|
---|
| 753 | * 25/10/2009 Wataru Kawasaki
|
---|
| 754 | */
|
---|
| 755 | template<class T, class T2> void attachAuxColumnDef(casa::ScalarColumn<T>&,
|
---|
| 756 | const casa::String&,
|
---|
| 757 | const T2&);
|
---|
| 758 | template<class T, class T2> void attachAuxColumnDef(casa::ArrayColumn<T>&,
|
---|
| 759 | const casa::String&,
|
---|
| 760 | const casa::Array<T2>&);
|
---|
[1907] | 761 |
|
---|
[2767] | 762 | double getNormalPolynomial(int n, double x);
|
---|
[2645] | 763 | double getChebyshevPolynomial(int n, double x);
|
---|
[2773] | 764 | std::vector<std::vector<double> > getPolynomialModel(int order,
|
---|
| 765 | int nchan,
|
---|
| 766 | double (Scantable::*pfunc)(int, double));
|
---|
| 767 | std::vector<std::vector<std::vector<double> > > getPolynomialModelReservoir(int order,
|
---|
| 768 | double (Scantable::*pfunc)(int, double),
|
---|
| 769 | std::vector<int>& nChanNos);
|
---|
[2767] | 770 | std::vector<float> doPolynomialFitting(const std::vector<float>& data,
|
---|
| 771 | const std::vector<bool>& mask,
|
---|
| 772 | int order,
|
---|
| 773 | std::vector<float>& params,
|
---|
| 774 | float& rms,
|
---|
| 775 | std::vector<bool>& finalMask,
|
---|
| 776 | float clipth,
|
---|
| 777 | int clipn);
|
---|
| 778 | std::vector<float> doPolynomialFitting(const std::vector<float>& data,
|
---|
| 779 | const std::vector<bool>& mask,
|
---|
| 780 | int order,
|
---|
| 781 | std::vector<float>& params,
|
---|
| 782 | float& rms,
|
---|
| 783 | std::vector<bool>& finalMask,
|
---|
| 784 | int& nClipped,
|
---|
| 785 | float thresClip=3.0,
|
---|
| 786 | int nIterClip=0,
|
---|
| 787 | bool getResidual=true);
|
---|
[2645] | 788 | std::vector<float> doChebyshevFitting(const std::vector<float>& data,
|
---|
[2767] | 789 | const std::vector<bool>& mask,
|
---|
| 790 | int order,
|
---|
| 791 | std::vector<float>& params,
|
---|
| 792 | float& rms,
|
---|
| 793 | std::vector<bool>& finalMask,
|
---|
| 794 | float clipth,
|
---|
| 795 | int clipn);
|
---|
| 796 | std::vector<float> doChebyshevFitting(const std::vector<float>& data,
|
---|
| 797 | const std::vector<bool>& mask,
|
---|
| 798 | int order,
|
---|
| 799 | std::vector<float>& params,
|
---|
| 800 | float& rms,
|
---|
| 801 | std::vector<bool>& finalMask,
|
---|
| 802 | int& nClipped,
|
---|
| 803 | float thresClip=3.0,
|
---|
| 804 | int nIterClip=0,
|
---|
| 805 | bool getResidual=true);
|
---|
| 806 | std::vector<float> doLeastSquareFitting(const std::vector<float>& data,
|
---|
| 807 | const std::vector<bool>& mask,
|
---|
[2773] | 808 | const std::vector<std::vector<double> >& model,
|
---|
[2767] | 809 | std::vector<float>& params,
|
---|
| 810 | float& rms,
|
---|
| 811 | std::vector<bool>& finalMask,
|
---|
| 812 | int& nClipped,
|
---|
| 813 | float thresClip=3.0,
|
---|
| 814 | int nIterClip=0,
|
---|
| 815 | bool getResidual=true);
|
---|
| 816 | std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
|
---|
[2645] | 817 | const std::vector<bool>& mask,
|
---|
[2767] | 818 | std::vector<int>& idxEdge,
|
---|
[2645] | 819 | std::vector<float>& params,
|
---|
[2767] | 820 | float& rms,
|
---|
[2737] | 821 | std::vector<bool>& finalMask,
|
---|
[2767] | 822 | float clipth,
|
---|
| 823 | int clipn);
|
---|
| 824 | std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
|
---|
| 825 | const std::vector<bool>& mask,
|
---|
| 826 | int nPiece,
|
---|
| 827 | std::vector<int>& idxEdge,
|
---|
| 828 | std::vector<float>& params,
|
---|
[2737] | 829 | float& rms,
|
---|
[2767] | 830 | std::vector<bool>& finalMask,
|
---|
| 831 | float clipth,
|
---|
| 832 | int clipn);
|
---|
[2012] | 833 | std::vector<float> doCubicSplineFitting(const std::vector<float>& data,
|
---|
| 834 | const std::vector<bool>& mask,
|
---|
[2081] | 835 | int nPiece,
|
---|
[2767] | 836 | bool useGivenPieceBoundary,
|
---|
[2064] | 837 | std::vector<int>& idxEdge,
|
---|
[2012] | 838 | std::vector<float>& params,
|
---|
[2767] | 839 | float& rms,
|
---|
| 840 | std::vector<bool>& finalMask,
|
---|
[2193] | 841 | int& nClipped,
|
---|
[2012] | 842 | float thresClip=3.0,
|
---|
[2767] | 843 | int nIterClip=0,
|
---|
[2094] | 844 | bool getResidual=true);
|
---|
[2773] | 845 | std::vector<float> doCubicSplineLeastSquareFitting(const std::vector<float>& data,
|
---|
| 846 | const std::vector<bool>& mask,
|
---|
| 847 | const std::vector<std::vector<double> >& model,
|
---|
| 848 | int nPiece,
|
---|
| 849 | bool useGivenPieceBoundary,
|
---|
| 850 | std::vector<int>& idxEdge,
|
---|
| 851 | std::vector<float>& params,
|
---|
| 852 | float& rms,
|
---|
| 853 | std::vector<bool>& finalMask,
|
---|
| 854 | int& nClipped,
|
---|
| 855 | float thresClip=3.0,
|
---|
| 856 | int nIterClip=0,
|
---|
| 857 | bool getResidual=true);
|
---|
[2047] | 858 | std::vector<float> doSinusoidFitting(const std::vector<float>& data,
|
---|
| 859 | const std::vector<bool>& mask,
|
---|
[2081] | 860 | const std::vector<int>& waveNumbers,
|
---|
[2047] | 861 | std::vector<float>& params,
|
---|
[2767] | 862 | float& rms,
|
---|
| 863 | std::vector<bool>& finalMask,
|
---|
| 864 | float clipth,
|
---|
| 865 | int clipn);
|
---|
| 866 | std::vector<float> doSinusoidFitting(const std::vector<float>& data,
|
---|
| 867 | const std::vector<bool>& mask,
|
---|
| 868 | const std::vector<int>& waveNumbers,
|
---|
| 869 | std::vector<float>& params,
|
---|
| 870 | float& rms,
|
---|
| 871 | std::vector<bool>& finalMask,
|
---|
[2193] | 872 | int& nClipped,
|
---|
[2047] | 873 | float thresClip=3.0,
|
---|
[2767] | 874 | int nIterClip=0,
|
---|
[2094] | 875 | bool getResidual=true);
|
---|
[2773] | 876 | std::vector<std::vector<double> > getSinusoidModel(const std::vector<int>& waveNumbers, int nchan);
|
---|
| 877 | std::vector<std::vector<std::vector<double> > > getSinusoidModelReservoir(const std::vector<int>& waveNumbers,
|
---|
| 878 | std::vector<int>& nChanNos);
|
---|
| 879 | std::vector<int> selectWaveNumbers(const std::vector<int>& addNWaves,
|
---|
| 880 | const std::vector<int>& rejectNWaves);
|
---|
| 881 | std::vector<int> selectWaveNumbers(const int whichrow,
|
---|
| 882 | const std::vector<bool>& chanMask,
|
---|
| 883 | //const std::string& fftInfo,
|
---|
| 884 | const bool applyFFT,
|
---|
| 885 | const std::string& fftMethod,
|
---|
| 886 | const std::string& fftThresh,
|
---|
| 887 | const std::vector<int>& addNWaves,
|
---|
| 888 | const std::vector<int>& rejectNWaves);
|
---|
| 889 | int getIdxOfNchan(const int nChan, const std::vector<int>& nChanNos);
|
---|
[2767] | 890 | void parseFFTInfo(const std::string& fftInfo,
|
---|
| 891 | bool& applyFFT,
|
---|
| 892 | std::string& fftMethod,
|
---|
| 893 | std::string& fftThresh);
|
---|
[2773] | 894 | void parseFFTThresholdInfo(const std::string& fftThresh,
|
---|
| 895 | std::string& fftThAttr,
|
---|
| 896 | float& fftThSigma,
|
---|
| 897 | int& fftThTop);
|
---|
[2186] | 898 | void doSelectWaveNumbers(const int whichrow,
|
---|
| 899 | const std::vector<bool>& chanMask,
|
---|
| 900 | const std::string& fftMethod,
|
---|
| 901 | const float fftThSigma,
|
---|
| 902 | const int fftThTop,
|
---|
| 903 | const std::string& fftThAttr,
|
---|
| 904 | std::vector<int>& nWaves);
|
---|
[2411] | 905 | void addAuxWaveNumbers(const int whichrow,
|
---|
| 906 | const std::vector<int>& addNWaves,
|
---|
[2186] | 907 | const std::vector<int>& rejectNWaves,
|
---|
| 908 | std::vector<int>& nWaves);
|
---|
[2411] | 909 | void setWaveNumberListUptoNyquistFreq(const int whichrow,
|
---|
| 910 | std::vector<int>& nWaves);
|
---|
[2773] | 911 | void initialiseBaselining(const std::string& blfile,
|
---|
| 912 | std::ofstream& ofs,
|
---|
| 913 | const bool outLogger,
|
---|
| 914 | bool& outTextFile,
|
---|
| 915 | bool& csvFormat,
|
---|
| 916 | casa::String& coordInfo,
|
---|
| 917 | bool& hasSameNchan,
|
---|
| 918 | const std::string& progressInfo,
|
---|
| 919 | bool& showProgress,
|
---|
| 920 | int& minNRow,
|
---|
| 921 | casa::Vector<casa::Double>& timeSecCol);
|
---|
| 922 | void finaliseBaselining(const bool outBaselineTable,
|
---|
| 923 | STBaselineTable* pbt,
|
---|
| 924 | const string& bltable,
|
---|
| 925 | const bool outTextFile,
|
---|
| 926 | std::ofstream& ofs);
|
---|
| 927 | void initLineFinder(const std::vector<int>& edge,
|
---|
| 928 | const float threshold,
|
---|
| 929 | const int chanAvgLimit,
|
---|
| 930 | STLineFinder& lineFinder);
|
---|
[2012] | 931 | bool hasSameNchanOverIFs();
|
---|
| 932 | std::string getMaskRangeList(const std::vector<bool>& mask,
|
---|
| 933 | int whichrow,
|
---|
| 934 | const casa::String& coordInfo,
|
---|
[2047] | 935 | bool hasSameNchan,
|
---|
| 936 | bool verbose=false);
|
---|
| 937 | std::vector<int> getMaskEdgeIndices(const std::vector<bool>& mask);
|
---|
[2641] | 938 | std::string formatBaselineParamsHeader(int whichrow, const std::string& masklist, bool verbose, bool csvformat) const;
|
---|
| 939 | std::string formatBaselineParamsFooter(float rms, int nClipped, bool verbose, bool csvformat) const;
|
---|
[2012] | 940 | std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask);
|
---|
[2773] | 941 | std::vector<bool> getCompositeChanMask(int whichrow, const std::vector<bool>& inMask, const std::vector<int>& edge, std::vector<int>& currEdge, STLineFinder& lineFinder);
|
---|
[2641] | 942 | 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);
|
---|
| 943 | 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] | 944 | void parseProgressInfo(const std::string& progressInfo, bool& showProgress, int& minNRow);
|
---|
| 945 | void showProgressOnTerminal(const int nProcessed, const int nTotal, const bool showProgress=true, const int nTotalThreshold=1000);
|
---|
[1994] | 946 |
|
---|
| 947 | void applyChanFlag( casa::uInt whichrow, const std::vector<bool>& msk, casa::uChar flagval);
|
---|
| 948 |
|
---|
[2713] | 949 | double doCalculateModelSelectionCriteria(const std::string& valname,
|
---|
| 950 | const std::vector<float>& spec,
|
---|
| 951 | const std::vector<bool>& mask,
|
---|
| 952 | const std::string& blfunc,
|
---|
| 953 | int order);
|
---|
[2737] | 954 | double doGetRms(const std::vector<bool>& mask, const casa::Vector<casa::Float>& spec);
|
---|
[2767] | 955 | std::string packFittingResults(const int irow, const std::vector<float>& params, const float rms);
|
---|
| 956 | void parseBlInfo(const std::string& blInfo, int& whichrow, STBaselineFunc::FuncName& ftype, std::vector<int>& fpar, std::vector<bool>& mask, float& thresClip, int& nIterClip, bool& useLineFinder, float& thresLF, std::vector<int>& edgeLF, int& avgLF);
|
---|
| 957 | std::vector<float> doApplyBaselineTable(std::vector<float>& spec, std::vector<bool>& mask, const STBaselineFunc::FuncName ftype, std::vector<int>& fpar, std::vector<float>& params, float&rms);
|
---|
| 958 | std::vector<float> doSubtractBaseline(std::vector<float>& spec, std::vector<bool>& mask, const STBaselineFunc::FuncName ftype, std::vector<int>& fpar, std::vector<float>& params, float&rms, std::vector<bool>& finalmask, float clipth, int clipn, bool uself, int irow, float lfth, std::vector<int>& lfedge, int lfavg);
|
---|
[2713] | 959 |
|
---|
[2] | 960 | };
|
---|
[824] | 961 | } // namespace
|
---|
| 962 |
|
---|
[2] | 963 | #endif
|
---|