[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
|
---|
| 16 | #include <string>
|
---|
| 17 | #include <vector>
|
---|
| 18 | // AIPS++
|
---|
[455] | 19 | #include <casa/aips.h>
|
---|
[1931] | 20 | #include <casa/Containers/Record.h>
|
---|
[322] | 21 | #include <casa/Arrays/MaskedArray.h>
|
---|
[80] | 22 | #include <casa/BasicSL/String.h>
|
---|
[824] | 23 | #include <casa/Utilities/CountedPtr.h>
|
---|
| 24 |
|
---|
[80] | 25 | #include <tables/Tables/Table.h>
|
---|
[322] | 26 | #include <tables/Tables/ArrayColumn.h>
|
---|
| 27 | #include <tables/Tables/ScalarColumn.h>
|
---|
| 28 |
|
---|
[824] | 29 | #include <measures/TableMeasures/ScalarMeasColumn.h>
|
---|
| 30 |
|
---|
[1598] | 31 | #include <coordinates/Coordinates/SpectralCoordinate.h>
|
---|
| 32 |
|
---|
[1819] | 33 | #include <casa/Arrays/Vector.h>
|
---|
| 34 | #include <casa/Quanta/Quantum.h>
|
---|
| 35 |
|
---|
| 36 | #include <casa/Exceptions/Error.h>
|
---|
| 37 |
|
---|
[894] | 38 | #include "Logger.h"
|
---|
[901] | 39 | #include "STHeader.h"
|
---|
[824] | 40 | #include "STFrequencies.h"
|
---|
| 41 | #include "STWeather.h"
|
---|
| 42 | #include "STFocus.h"
|
---|
| 43 | #include "STTcal.h"
|
---|
| 44 | #include "STMolecules.h"
|
---|
| 45 | #include "STSelector.h"
|
---|
[860] | 46 | #include "STHistory.h"
|
---|
[896] | 47 | #include "STPol.h"
|
---|
[960] | 48 | #include "STFit.h"
|
---|
[972] | 49 | #include "STFitEntry.h"
|
---|
[1907] | 50 | #include "STFitter.h"
|
---|
[2] | 51 |
|
---|
[824] | 52 | namespace asap {
|
---|
[2] | 53 |
|
---|
[824] | 54 | /**
|
---|
| 55 | * This class contains and wraps a casa::Table, which is used to store
|
---|
| 56 | * all the information. This can be either a MemoryTable or a
|
---|
| 57 | * disk based Table.
|
---|
| 58 | * It provides access functions to the underlying table
|
---|
| 59 | * It contains n subtables:
|
---|
| 60 | * @li weather
|
---|
| 61 | * @li frequencies
|
---|
| 62 | * @li molecules
|
---|
| 63 | * @li tcal
|
---|
| 64 | * @li focus
|
---|
| 65 | * @li fits
|
---|
| 66 | *
|
---|
| 67 | * @brief The main ASAP data container
|
---|
| 68 | * @author Malte Marquarding
|
---|
| 69 | * @date
|
---|
| 70 | * @version
|
---|
| 71 | */
|
---|
[890] | 72 | class Scantable : private Logger
|
---|
[824] | 73 | {
|
---|
[902] | 74 |
|
---|
| 75 | friend class STMath;
|
---|
| 76 |
|
---|
[2] | 77 | public:
|
---|
[824] | 78 | /**
|
---|
| 79 | * Default constructor
|
---|
| 80 | */
|
---|
[1350] | 81 | explicit Scantable(casa::Table::TableType ttype = casa::Table::Memory);
|
---|
[19] | 82 |
|
---|
[824] | 83 | /**
|
---|
| 84 | * Create a Scantable object form an existing table on disk
|
---|
| 85 | * @param[in] name the name of the existing Scantable
|
---|
| 86 | */
|
---|
[1385] | 87 | explicit Scantable(const std::string& name, casa::Table::TableType ttype = casa::Table::Memory);
|
---|
[2] | 88 |
|
---|
[824] | 89 | /// @fixme this is only sensible for MemoryTables....
|
---|
| 90 | Scantable(const Scantable& other, bool clear=true);
|
---|
[161] | 91 |
|
---|
[824] | 92 | /**
|
---|
| 93 | * Destructor
|
---|
| 94 | */
|
---|
| 95 | virtual ~Scantable();
|
---|
[745] | 96 |
|
---|
[824] | 97 | /**
|
---|
| 98 | * get a const reference to the underlying casa::Table
|
---|
[1104] | 99 | * @return const \ref casa::Table reference
|
---|
[824] | 100 | */
|
---|
| 101 | const casa::Table& table() const;
|
---|
[19] | 102 |
|
---|
[824] | 103 | /**
|
---|
| 104 | * get a reference to the underlying casa::Table with the Selection
|
---|
| 105 | * object applied if set
|
---|
| 106 | * @return casa::Table reference
|
---|
| 107 | */
|
---|
| 108 | casa::Table& table();
|
---|
[21] | 109 |
|
---|
[845] | 110 |
|
---|
| 111 | /**
|
---|
| 112 | * Get a handle to the selection object
|
---|
| 113 | * @return constant STSelector reference
|
---|
| 114 | */
|
---|
| 115 | const STSelector& getSelection() const { return selector_; }
|
---|
| 116 |
|
---|
| 117 | /**
|
---|
| 118 | * Set the data to be a subset as defined by the STSelector
|
---|
| 119 | * @param selection a STSelector object
|
---|
| 120 | */
|
---|
[824] | 121 | void setSelection(const STSelector& selection);
|
---|
[845] | 122 |
|
---|
| 123 | /**
|
---|
| 124 | * unset the selection of the data
|
---|
| 125 | */
|
---|
[824] | 126 | void unsetSelection();
|
---|
| 127 | /**
|
---|
| 128 | * set the header
|
---|
[1295] | 129 | * @param[in] sth an STHeader object
|
---|
[824] | 130 | */
|
---|
[901] | 131 | void setHeader( const STHeader& sth );
|
---|
[386] | 132 |
|
---|
[824] | 133 | /**
|
---|
| 134 | * get the header information
|
---|
[901] | 135 | * @return an STHeader object
|
---|
[824] | 136 | */
|
---|
[901] | 137 | STHeader getHeader( ) const;
|
---|
[1068] | 138 |
|
---|
[824] | 139 | /**
|
---|
| 140 | * Checks if the "other" Scantable is conformant with this,
|
---|
| 141 | * i.e. if header values are the same.
|
---|
| 142 | * @param[in] other another Scantable
|
---|
| 143 | * @return true or false
|
---|
| 144 | */
|
---|
| 145 | bool conformant( const Scantable& other);
|
---|
[430] | 146 |
|
---|
[824] | 147 | /**
|
---|
[1068] | 148 | *
|
---|
| 149 | * @param stype The type of the source, 0 = on, 1 = off
|
---|
| 150 | */
|
---|
| 151 | void setSourceType(int stype);
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | /**
|
---|
[1104] | 155 | * The number of scans in the table
|
---|
[824] | 156 | * @return number of scans in the table
|
---|
| 157 | */
|
---|
[845] | 158 | int nscan() const;
|
---|
[490] | 159 |
|
---|
[915] | 160 | casa::MEpoch::Types getTimeReference() const;
|
---|
[21] | 161 |
|
---|
[1411] | 162 |
|
---|
| 163 | casa::MEpoch getEpoch(int whichrow) const;
|
---|
| 164 |
|
---|
[824] | 165 | /**
|
---|
| 166 | * Get global antenna position
|
---|
[845] | 167 | * @return casa::MPosition
|
---|
[824] | 168 | */
|
---|
| 169 | casa::MPosition getAntennaPosition() const;
|
---|
[490] | 170 |
|
---|
[1441] | 171 | /**
|
---|
| 172 | * the @ref casa::MDirection for a specific row
|
---|
| 173 | * @param[in] whichrow the row number
|
---|
| 174 | * return casa::MDirection
|
---|
| 175 | */
|
---|
[987] | 176 | casa::MDirection getDirection( int whichrow ) const;
|
---|
[1598] | 177 |
|
---|
[1441] | 178 | /**
|
---|
| 179 | * get the direction type as a string, e.g. "J2000"
|
---|
| 180 | * @param[in] whichrow the row number
|
---|
| 181 | * return the direction string
|
---|
| 182 | */
|
---|
[1068] | 183 | std::string getDirectionString( int whichrow ) const;
|
---|
| 184 |
|
---|
[1441] | 185 | /**
|
---|
| 186 | * set the direction type as a string, e.g. "J2000"
|
---|
| 187 | * @param[in] refstr the direction type
|
---|
| 188 | */
|
---|
[987] | 189 | void setDirectionRefString(const std::string& refstr="");
|
---|
[1441] | 190 |
|
---|
[1104] | 191 | /**
|
---|
| 192 | * get the direction reference string
|
---|
| 193 | * @return a string describing the direction reference
|
---|
| 194 | */
|
---|
[1598] | 195 | std::string getDirectionRefString() const;
|
---|
[987] | 196 |
|
---|
[824] | 197 | /**
|
---|
[845] | 198 | * Return the Flux unit of the data, e.g. "Jy" or "K"
|
---|
| 199 | * @return string
|
---|
[824] | 200 | */
|
---|
| 201 | std::string getFluxUnit() const;
|
---|
[472] | 202 |
|
---|
[824] | 203 | /**
|
---|
[845] | 204 | * Set the Flux unit of the data
|
---|
| 205 | * @param unit a string representing the unit, e.g "Jy" or "K"
|
---|
[824] | 206 | */
|
---|
| 207 | void setFluxUnit( const std::string& unit );
|
---|
[472] | 208 |
|
---|
[824] | 209 | /**
|
---|
[1189] | 210 | * Set the Stokes type of the data
|
---|
[1295] | 211 | * @param feedtype a string representing the type, e.g "circular" or "linear"
|
---|
[1189] | 212 | */
|
---|
| 213 | void setFeedType( const std::string& feedtype );
|
---|
| 214 |
|
---|
| 215 | /**
|
---|
[824] | 216 | *
|
---|
[845] | 217 | * @param instrument a string representing an insturment. see xxx
|
---|
[824] | 218 | */
|
---|
| 219 | void setInstrument( const std::string& instrument );
|
---|
[2] | 220 |
|
---|
[845] | 221 | /**
|
---|
| 222 | * (Re)calculate the azimuth and elevationnfor all rows
|
---|
| 223 | */
|
---|
[824] | 224 | void calculateAZEL();
|
---|
[745] | 225 |
|
---|
[824] | 226 | /**
|
---|
[845] | 227 | * "hard" flag the data, this flags everything selected in setSelection()
|
---|
[1104] | 228 | * param[in] msk a boolean mask of length nchan describing the points to
|
---|
| 229 | * to be flagged
|
---|
[824] | 230 | */
|
---|
[1430] | 231 | //void flag( const std::vector<bool>& msk = std::vector<bool>());
|
---|
| 232 | void flag( const std::vector<bool>& msk = std::vector<bool>(), bool unflag=false);
|
---|
[455] | 233 |
|
---|
[852] | 234 | /**
|
---|
[1819] | 235 | * Flag the data in a row-based manner. (CAS-1433 Wataru Kawasaki)
|
---|
| 236 | * param[in] rows list of row numbers to be flagged
|
---|
| 237 | */
|
---|
| 238 | void flagRow( const std::vector<casa::uInt>& rows = std::vector<casa::uInt>(), bool unflag=false);
|
---|
| 239 |
|
---|
| 240 | /**
|
---|
| 241 | * Get flagRow info at the specified row. If true, the whole data
|
---|
| 242 | * at the row should be flagged.
|
---|
| 243 | */
|
---|
| 244 | bool getFlagRow(int whichrow) const
|
---|
| 245 | { return (flagrowCol_(whichrow) > 0); }
|
---|
| 246 |
|
---|
| 247 | /**
|
---|
| 248 | * Flag the data outside a specified range (in a channel-based manner).
|
---|
| 249 | * (CAS-1807 Wataru Kawasaki)
|
---|
| 250 | */
|
---|
| 251 | void clip(const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
|
---|
| 252 |
|
---|
| 253 | /**
|
---|
| 254 | * Return a list of booleans with the size of nchan for a specified row, to get info
|
---|
| 255 | * about which channel is clipped.
|
---|
| 256 | */
|
---|
| 257 | std::vector<bool> getClipMask(int whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag);
|
---|
| 258 | void srchChannelsToClip(casa::uInt whichrow, const casa::Float uthres, const casa::Float dthres, bool clipoutside, bool unflag,
|
---|
| 259 | casa::Vector<casa::uChar> flgs);
|
---|
| 260 |
|
---|
| 261 | /**
|
---|
[852] | 262 | * Return a list of row numbers with respect to the original table.
|
---|
[902] | 263 | * @return a list of unsigned ints
|
---|
[852] | 264 | */
|
---|
| 265 | std::vector<unsigned int> rownumbers() const;
|
---|
[845] | 266 |
|
---|
[852] | 267 |
|
---|
[845] | 268 | /**
|
---|
| 269 | * Get the number of beams in the data or a specific scan
|
---|
| 270 | * @param scanno the scan number to get the number of beams for.
|
---|
| 271 | * If scanno<0 the number is retrieved from the header.
|
---|
| 272 | * @return an integer number
|
---|
| 273 | */
|
---|
[824] | 274 | int nbeam(int scanno=-1) const;
|
---|
[845] | 275 | /**
|
---|
| 276 | * Get the number of IFs in the data or a specific scan
|
---|
| 277 | * @param scanno the scan number to get the number of IFs for.
|
---|
| 278 | * If scanno<0 the number is retrieved from the header.
|
---|
| 279 | * @return an integer number
|
---|
| 280 | */
|
---|
[824] | 281 | int nif(int scanno=-1) const;
|
---|
[845] | 282 | /**
|
---|
| 283 | * Get the number of polarizations in the data or a specific scan
|
---|
| 284 | * @param scanno the scan number to get the number of polarizations for.
|
---|
| 285 | * If scanno<0 the number is retrieved from the header.
|
---|
| 286 | * @return an integer number
|
---|
| 287 | */
|
---|
[824] | 288 | int npol(int scanno=-1) const;
|
---|
[794] | 289 |
|
---|
[896] | 290 | std::string getPolType() const;
|
---|
| 291 |
|
---|
[845] | 292 |
|
---|
| 293 | /**
|
---|
| 294 | * Get the number of integartion cycles
|
---|
| 295 | * @param scanno the scan number to get the number of rows for.
|
---|
| 296 | * If scanno<0 the number is retrieved from the header.
|
---|
[1104] | 297 | * @return the number of rows (for the specified scanno)
|
---|
[845] | 298 | */
|
---|
[824] | 299 | int nrow(int scanno=-1) const;
|
---|
[794] | 300 |
|
---|
[1111] | 301 | int getBeam(int whichrow) const;
|
---|
[1694] | 302 | std::vector<uint> getBeamNos() const { return getNumbers(beamCol_); }
|
---|
[50] | 303 |
|
---|
[847] | 304 | int getIF(int whichrow) const;
|
---|
[1694] | 305 | std::vector<uint> getIFNos() const { return getNumbers(ifCol_); }
|
---|
[1111] | 306 |
|
---|
[847] | 307 | int getPol(int whichrow) const;
|
---|
[1694] | 308 | std::vector<uint> getPolNos() const { return getNumbers(polCol_); }
|
---|
[1111] | 309 |
|
---|
[1694] | 310 | std::vector<uint> getScanNos() const { return getNumbers(scanCol_); }
|
---|
[865] | 311 | int getScan(int whichrow) const { return scanCol_(whichrow); }
|
---|
[1111] | 312 |
|
---|
[1819] | 313 | //TT addition
|
---|
| 314 | std::vector<uint> getMolNos() {return getNumbers(mmolidCol_); }
|
---|
| 315 |
|
---|
[1111] | 316 | /**
|
---|
| 317 | * Get the number of channels in the data or a specific IF. This currently
|
---|
| 318 | * varies only with IF number
|
---|
| 319 | * @param ifno the IF number to get the number of channels for.
|
---|
| 320 | * If ifno<0 the number is retrieved from the header.
|
---|
| 321 | * @return an integer number
|
---|
| 322 | */
|
---|
| 323 | int nchan(int ifno=-1) const;
|
---|
[923] | 324 | int getChannels(int whichrow) const;
|
---|
[206] | 325 |
|
---|
[1111] | 326 | int ncycle(int scanno=-1) const;
|
---|
| 327 | int getCycle(int whichrow) const { return cycleCol_(whichrow); }
|
---|
| 328 |
|
---|
[847] | 329 | double getInterval(int whichrow) const
|
---|
| 330 | { return integrCol_(whichrow); }
|
---|
[845] | 331 |
|
---|
[865] | 332 | float getTsys(int whichrow) const
|
---|
| 333 | { return casa::Vector<casa::Float>(tsysCol_(whichrow))(0); }
|
---|
[847] | 334 | float getElevation(int whichrow) const
|
---|
| 335 | { return elCol_(whichrow); }
|
---|
| 336 | float getAzimuth(int whichrow) const
|
---|
| 337 | { return azCol_(whichrow); }
|
---|
[865] | 338 | float getParAngle(int whichrow) const
|
---|
[1819] | 339 | { return focus().getParAngle(mfocusidCol_(whichrow)); }
|
---|
| 340 | int getTcalId(int whichrow) const
|
---|
| 341 | { return mtcalidCol_(whichrow); }
|
---|
[386] | 342 |
|
---|
[865] | 343 | std::string getSourceName(int whichrow) const
|
---|
| 344 | { return srcnCol_(whichrow); }
|
---|
| 345 |
|
---|
[847] | 346 | std::vector<bool> getMask(int whichrow) const;
|
---|
[896] | 347 | std::vector<float> getSpectrum(int whichrow,
|
---|
[905] | 348 | const std::string& poltype = "" ) const;
|
---|
[847] | 349 |
|
---|
[884] | 350 | void setSpectrum(const std::vector<float>& spec, int whichrow);
|
---|
| 351 |
|
---|
[902] | 352 | std::string getPolarizationLabel(int index, const std::string& ptype) const
|
---|
| 353 | { return STPol::getPolLabel(index, ptype ); }
|
---|
[401] | 354 |
|
---|
[845] | 355 | /**
|
---|
| 356 | * Write the Scantable to disk
|
---|
| 357 | * @param filename the output file name
|
---|
| 358 | */
|
---|
[824] | 359 | void makePersistent(const std::string& filename);
|
---|
[745] | 360 |
|
---|
[860] | 361 | std::vector<std::string> getHistory() const
|
---|
| 362 | { return historyTable_.getHistory(); };
|
---|
[483] | 363 |
|
---|
[860] | 364 | void addHistory(const std::string& hist) { historyTable_.addEntry(hist); }
|
---|
[488] | 365 |
|
---|
[860] | 366 | void appendToHistoryTable(const STHistory& otherhist)
|
---|
| 367 | { historyTable_.append(otherhist); }
|
---|
| 368 |
|
---|
[824] | 369 | std::string summary(bool verbose=false);
|
---|
[1947] | 370 | //std::string getTime(int whichrow=-1, bool showdate=true) const;
|
---|
| 371 | std::string getTime(int whichrow=-1, bool showdate=true, casa::uInt prec=0) const;
|
---|
[1350] | 372 | double getIntTime(int whichrow) const { return integrCol_(whichrow); }
|
---|
[19] | 373 |
|
---|
[847] | 374 | // returns unit, conversion frame, doppler, base-frame
|
---|
[18] | 375 |
|
---|
[847] | 376 | /**
|
---|
| 377 | * Get the frequency set up
|
---|
| 378 | * This is forwarded to the STFrequencies subtable
|
---|
| 379 | * @return unit, frame, doppler
|
---|
| 380 | */
|
---|
| 381 | std::vector<std::string> getCoordInfo() const
|
---|
| 382 | { return freqTable_.getInfo(); };
|
---|
| 383 |
|
---|
| 384 | void setCoordInfo(std::vector<string> theinfo)
|
---|
| 385 | { return freqTable_.setInfo(theinfo); };
|
---|
| 386 |
|
---|
[865] | 387 |
|
---|
| 388 | std::vector<double> getAbcissa(int whichrow) const;
|
---|
| 389 |
|
---|
[1730] | 390 | std::vector<float> getWeather(int whichrow) const;
|
---|
| 391 |
|
---|
[847] | 392 | std::string getAbcissaLabel(int whichrow) const;
|
---|
| 393 | std::vector<double> getRestFrequencies() const
|
---|
| 394 | { return moleculeTable_.getRestFrequencies(); }
|
---|
[1819] | 395 | std::vector<double> getRestFrequency(int id) const
|
---|
| 396 | { return moleculeTable_.getRestFrequency(id); }
|
---|
[847] | 397 |
|
---|
[1819] | 398 | /**
|
---|
[1170] | 399 | void setRestFrequencies(double rf, const std::string& name = "",
|
---|
| 400 | const std::string& = "Hz");
|
---|
[1819] | 401 | **/
|
---|
| 402 | // Modified by Takeshi Nakazato 05/09/2008
|
---|
| 403 | /***
|
---|
| 404 | void setRestFrequencies(vector<double> rf, const vector<std::string>& name = "",
|
---|
| 405 | const std::string& = "Hz");
|
---|
| 406 | ***/
|
---|
| 407 | void setRestFrequencies(vector<double> rf,
|
---|
| 408 | const vector<std::string>& name = vector<std::string>(1,""),
|
---|
| 409 | const std::string& = "Hz");
|
---|
[847] | 410 |
|
---|
[1819] | 411 | //void setRestFrequencies(const std::string& name);
|
---|
| 412 | void setRestFrequencies(const vector<std::string>& name);
|
---|
| 413 |
|
---|
[1360] | 414 | void shift(int npix);
|
---|
| 415 |
|
---|
[1598] | 416 | casa::SpectralCoordinate getSpectralCoordinate(int whichrow) const;
|
---|
| 417 |
|
---|
[987] | 418 | void convertDirection(const std::string& newframe);
|
---|
| 419 |
|
---|
[824] | 420 | STFrequencies& frequencies() { return freqTable_; }
|
---|
[1375] | 421 | const STFrequencies& frequencies() const { return freqTable_; }
|
---|
[824] | 422 | STWeather& weather() { return weatherTable_; }
|
---|
[1375] | 423 | const STWeather& weather() const { return weatherTable_; }
|
---|
[824] | 424 | STFocus& focus() { return focusTable_; }
|
---|
[1375] | 425 | const STFocus& focus() const { return focusTable_; }
|
---|
[824] | 426 | STTcal& tcal() { return tcalTable_; }
|
---|
[1375] | 427 | const STTcal& tcal() const { return tcalTable_; }
|
---|
[824] | 428 | STMolecules& molecules() { return moleculeTable_; }
|
---|
[1375] | 429 | const STMolecules& molecules() const { return moleculeTable_; }
|
---|
[860] | 430 | STHistory& history() { return historyTable_; }
|
---|
[1375] | 431 | const STHistory& history() const { return historyTable_; }
|
---|
[972] | 432 | STFit& fit() { return fitTable_; }
|
---|
[1375] | 433 | const STFit& fit() const { return fitTable_; }
|
---|
[2] | 434 |
|
---|
[902] | 435 | std::vector<std::string> columnNames() const;
|
---|
[896] | 436 |
|
---|
[972] | 437 | void addFit(const STFitEntry& fit, int row);
|
---|
| 438 | STFitEntry getFit(int row) const
|
---|
| 439 | { STFitEntry fe; fitTable_.getEntry(fe, mfitidCol_(row)); return fe; }
|
---|
| 440 |
|
---|
[1391] | 441 | //Added by TT
|
---|
| 442 | /**
|
---|
| 443 | * Get the antenna name
|
---|
| 444 | * @return antenna name string
|
---|
| 445 | */
|
---|
[1819] | 446 | casa::String getAntennaName() const;
|
---|
[1391] | 447 |
|
---|
| 448 | /**
|
---|
| 449 | * For GBT MS data only. check a scan list
|
---|
| 450 | * against the information found in GBT_GO table for
|
---|
| 451 | * scan number orders to get correct pairs.
|
---|
| 452 | * @param[in] scan list
|
---|
| 453 | * @return status
|
---|
| 454 | */
|
---|
| 455 | int checkScanInfo(const std::vector<int>& scanlist) const;
|
---|
| 456 |
|
---|
| 457 | /**
|
---|
| 458 | * Get the direction as a vector, for a specific row
|
---|
| 459 | * @param[in] whichrow the row numbyyer
|
---|
| 460 | * @return the direction in a vector
|
---|
| 461 | */
|
---|
| 462 | std::vector<double> getDirectionVector(int whichrow) const;
|
---|
| 463 |
|
---|
[1586] | 464 | /**
|
---|
| 465 | * Set a flag indicating whether the data was parallactified
|
---|
| 466 | * @param[in] flag true or false
|
---|
| 467 | */
|
---|
[1598] | 468 | void parallactify(bool flag)
|
---|
[1727] | 469 | { focus().setParallactify(flag); }
|
---|
| 470 |
|
---|
[1819] | 471 | /**
|
---|
| 472 | * Reshape spectrum
|
---|
| 473 | * @param[in] nmin, nmax minimum and maximum channel
|
---|
| 474 | * @param[in] irow row number
|
---|
| 475 | *
|
---|
| 476 | * 30/07/2008 Takeshi Nakazato
|
---|
| 477 | **/
|
---|
| 478 | void reshapeSpectrum( int nmin, int nmax ) throw( casa::AipsError );
|
---|
| 479 | void reshapeSpectrum( int nmin, int nmax, int irow ) ;
|
---|
| 480 |
|
---|
| 481 | /**
|
---|
| 482 | * Change channel number under fixed bandwidth
|
---|
| 483 | * @param[in] nchan, dnu new channel number and spectral resolution
|
---|
| 484 | * @param[in] irow row number
|
---|
| 485 | *
|
---|
| 486 | * 27/08/2008 Takeshi Nakazato
|
---|
| 487 | **/
|
---|
| 488 | void regridChannel( int nchan, double dnu ) ;
|
---|
| 489 | void regridChannel( int nchan, double dnu, int irow ) ;
|
---|
| 490 |
|
---|
[1907] | 491 | bool getFlagtraFast(int whichrow);
|
---|
[1819] | 492 |
|
---|
[1931] | 493 | void polyBaselineBatch(const std::vector<bool>& mask, int order);
|
---|
| 494 | STFitEntry polyBaseline(const std::vector<bool>& mask, int order, int rowno);
|
---|
[1907] | 495 |
|
---|
[824] | 496 | private:
|
---|
[896] | 497 |
|
---|
| 498 | casa::Matrix<casa::Float> getPolMatrix( casa::uInt whichrow ) const;
|
---|
| 499 |
|
---|
[824] | 500 | /**
|
---|
| 501 | * Turns a time vale into a formatted string
|
---|
| 502 | * @param x
|
---|
| 503 | * @return
|
---|
| 504 | */
|
---|
| 505 | std::string formatSec(casa::Double x) const;
|
---|
[18] | 506 |
|
---|
[824] | 507 | std::string formatTime(const casa::MEpoch& me, bool showdate)const;
|
---|
[1947] | 508 | std::string formatTime(const casa::MEpoch& me, bool showdate, casa::uInt prec)const;
|
---|
[22] | 509 |
|
---|
[824] | 510 | /**
|
---|
| 511 | * Turns a casa::MDirection into a nicely formatted string
|
---|
| 512 | * @param md an casa::MDirection
|
---|
| 513 | * @return
|
---|
| 514 | */
|
---|
| 515 | std::string formatDirection(const casa::MDirection& md) const;
|
---|
[19] | 516 |
|
---|
[824] | 517 | /**
|
---|
| 518 | * Create a unique file name for the paged (temporary) table
|
---|
| 519 | * @return just the name
|
---|
| 520 | */
|
---|
| 521 | static casa::String generateName();
|
---|
[286] | 522 |
|
---|
[824] | 523 | /**
|
---|
| 524 | * attach to cached columns
|
---|
| 525 | */
|
---|
| 526 | void attach();
|
---|
[50] | 527 |
|
---|
[824] | 528 | /**
|
---|
| 529 | * Set up the main casa::Table
|
---|
| 530 | */
|
---|
| 531 | void setupMainTable();
|
---|
[88] | 532 |
|
---|
[859] | 533 | void attachSubtables();
|
---|
[865] | 534 | void copySubtables(const Scantable& other);
|
---|
| 535 |
|
---|
[824] | 536 | /**
|
---|
| 537 | * Convert an "old" asap1 style row index into a new index
|
---|
| 538 | * @param[in] therow
|
---|
| 539 | * @return and index into @table_
|
---|
| 540 | */
|
---|
| 541 | int rowToScanIndex(int therow);
|
---|
[212] | 542 |
|
---|
[1694] | 543 | std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
|
---|
[1111] | 544 |
|
---|
[1586] | 545 | static const casa::uInt version_ = 3;
|
---|
[286] | 546 |
|
---|
[824] | 547 | STSelector selector_;
|
---|
[236] | 548 |
|
---|
[824] | 549 | casa::Table::TableType type_;
|
---|
[465] | 550 |
|
---|
[824] | 551 | // the actual data
|
---|
| 552 | casa::Table table_;
|
---|
| 553 | casa::Table originalTable_;
|
---|
[745] | 554 |
|
---|
[824] | 555 | STTcal tcalTable_;
|
---|
| 556 | STFrequencies freqTable_;
|
---|
| 557 | STWeather weatherTable_;
|
---|
| 558 | STFocus focusTable_;
|
---|
| 559 | STMolecules moleculeTable_;
|
---|
[860] | 560 | STHistory historyTable_;
|
---|
[960] | 561 | STFit fitTable_;
|
---|
[860] | 562 |
|
---|
[824] | 563 | // Cached Columns to avoid reconstructing them for each row get/put
|
---|
[847] | 564 | casa::ScalarColumn<casa::Double> integrCol_;
|
---|
[824] | 565 | casa::MDirection::ScalarColumn dirCol_;
|
---|
[847] | 566 | casa::MEpoch::ScalarColumn timeCol_;
|
---|
[923] | 567 | casa::ScalarColumn<casa::Float> azCol_;
|
---|
| 568 | casa::ScalarColumn<casa::Float> elCol_;
|
---|
[824] | 569 | casa::ScalarColumn<casa::String> srcnCol_, fldnCol_;
|
---|
[1819] | 570 | casa::ScalarColumn<casa::uInt> scanCol_, beamCol_, ifCol_, polCol_, cycleCol_, flagrowCol_;
|
---|
[1068] | 571 | casa::ScalarColumn<casa::Int> rbeamCol_, srctCol_;
|
---|
[865] | 572 | casa::ArrayColumn<casa::Float> specCol_, tsysCol_;
|
---|
[824] | 573 | casa::ArrayColumn<casa::uChar> flagsCol_;
|
---|
[430] | 574 |
|
---|
[824] | 575 | // id in frequencies table
|
---|
| 576 | casa::ScalarColumn<casa::uInt> mfreqidCol_;
|
---|
| 577 | // id in tcal table
|
---|
| 578 | casa::ScalarColumn<casa::uInt> mtcalidCol_;
|
---|
[430] | 579 |
|
---|
[824] | 580 | casa::ArrayColumn<casa::String> histitemCol_;
|
---|
[972] | 581 | casa::ScalarColumn<casa::Int> mfitidCol_;
|
---|
[824] | 582 | casa::ScalarColumn<casa::uInt> mweatheridCol_;
|
---|
[322] | 583 |
|
---|
[824] | 584 | casa::ScalarColumn<casa::uInt> mfocusidCol_;
|
---|
| 585 |
|
---|
| 586 | casa::ScalarColumn<casa::uInt> mmolidCol_;
|
---|
| 587 |
|
---|
[896] | 588 | static std::map<std::string, STPol::STPolFactory *> factories_;
|
---|
| 589 | void initFactories();
|
---|
| 590 |
|
---|
[1819] | 591 | /**
|
---|
| 592 | * Add an auxiliary column to the main table and attach it to a
|
---|
| 593 | * cached column. Use for adding new columns that the original asap2
|
---|
| 594 | * tables do not have.
|
---|
| 595 | * @param[in] col reference to the cached column to be attached
|
---|
| 596 | * @param[in] colName column name in asap table
|
---|
| 597 | * @param[in] defValue default value to fill in the column
|
---|
| 598 | *
|
---|
| 599 | * 25/10/2009 Wataru Kawasaki
|
---|
| 600 | */
|
---|
| 601 | template<class T, class T2> void attachAuxColumnDef(casa::ScalarColumn<T>&,
|
---|
| 602 | const casa::String&,
|
---|
| 603 | const T2&);
|
---|
| 604 | template<class T, class T2> void attachAuxColumnDef(casa::ArrayColumn<T>&,
|
---|
| 605 | const casa::String&,
|
---|
| 606 | const casa::Array<T2>&);
|
---|
[1907] | 607 |
|
---|
| 608 | void doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter);
|
---|
[2] | 609 | };
|
---|
| 610 |
|
---|
[824] | 611 |
|
---|
| 612 | } // namespace
|
---|
| 613 |
|
---|
[2] | 614 | #endif
|
---|