00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MS_MSMETADATA_H
00029 #define MS_MSMETADATA_H
00030
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/casa/Quanta/QVector.h>
00033 #include <casacore/measures/Measures/MFrequency.h>
00034 #include <casacore/measures/Measures/MPosition.h>
00035 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
00036 #include <casacore/ms/MeasurementSets/MSPointingColumns.h>
00037 #include <casacore/casa/Utilities/CountedPtr.h>
00038 #include <map>
00039
00040 namespace casacore {
00041
00042 template <class T> class ArrayColumn;
00043 struct ArrayKey;
00044 struct ScanKey;
00045 struct SourceKey;
00046 struct SubScanKey;
00047
00048
00049
00050
00051
00052
00053
00054
00055 class MSMetaData {
00056
00057 public:
00058
00059
00060 enum CorrelationType {
00061 AUTO,
00062 CROSS,
00063 BOTH
00064 };
00065
00066 enum SQLDSwitch {
00067 SQLD_INCLUDE,
00068 SQLD_EXCLUDE,
00069 SQLD_ONLY
00070 };
00071
00072 struct TimeStampProperties {
00073 std::set<Int> ddIDs;
00074 uInt nrows;
00075 };
00076
00077 typedef std::map<Int, std::pair<Double, Quantity> > FirstExposureTimeMap;
00078
00079 struct SubScanProperties {
00080
00081 uInt acRows;
00082
00083 uInt xcRows;
00084 std::set<Int> antennas;
00085 Double beginTime;
00086 std::set<uInt> ddIDs;
00087 Double endTime;
00088
00089
00090 std::map<uInt, Quantity> meanInterval;
00091
00092
00093
00094
00095 FirstExposureTimeMap firstExposureTime;
00096 Quantity meanExposureTime;
00097 std::set<uInt> spws;
00098
00099 std::map<uInt, uInt> spwNRows;
00100 std::set<Int> stateIDs;
00101 std::map<Double, TimeStampProperties> timeProps;
00102 };
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 MSMetaData(const MeasurementSet *const &ms, const Float maxCacheSizeMB);
00114
00115 virtual ~MSMetaData();
00116
00117
00118 QVD getAntennaDiameters() const;
00119
00120
00121 uInt getAntennaID(const String& antennaName) const;
00122
00123 vector<uInt> getAntennaIDs(const vector<String>& antennaNames) const;
00124
00125
00126 vector<String> getAntennaNames(
00127 std::map<String, uInt>& namesToIDsMap,
00128 const vector<uInt>& antennaIDs=vector<uInt>(0)
00129 ) const;
00130
00131
00132 vector<String> getAntennaStations(const vector<uInt>& antennaIDs=vector<uInt>());
00133
00134
00135 vector<String> getAntennaStations(const vector<String>& antennaNames);
00136
00137
00138 std::set<Int> getAntennasForScan(const ScanKey& scan) const;
00139
00140
00141 vector<Array<Int> > getCorrProducts() const;
00142
00143
00144 vector<vector<Int> > getCorrTypes() const;
00145
00146 vector<uInt> getDataDescIDToSpwMap() const;
00147
00148 vector<uInt> getDataDescIDToPolIDMap() const;
00149
00150
00151 vector<Int> getFieldTableSourceIDs() const;
00152
00153
00154 vector<std::set<ScanKey> > getFieldToScansMap() const;
00155
00156 std::map<String, std::set<Int> > getIntentToFieldsMap();
00157
00158 std::map<String, std::set<ScanKey> > getIntentToScansMap();
00159
00160 std::map<String, std::set<uInt> > getIntentToSpwsMap();
00161
00162 std::set<String> getIntentsForScan(const ScanKey& scan) const;
00163
00164 std::set<String> getIntentsForSubScan(const SubScanKey& subScan) const;
00165
00166 SHARED_PTR<const std::map<SubScanKey, std::set<String> > > getSubScanToIntentsMap() const;
00167
00168
00169 std::set<String> getIntents() const;
00170
00171
00172 std::set<String> getIntentsForField(Int fieldID);
00173
00174
00175 std::set<String> getIntentsForSpw(const uInt spw);
00176
00177
00178 vector<Int> getNumCorrs() const;
00179
00180
00181
00182 vector<std::pair<Quantity, Quantity> > getProperMotions() const;
00183
00184
00185 std::set<Int> getScanNumbers(Int obsID, Int arrayID) const;
00186
00187
00188
00189
00190 std::set<Int> getScansForState(
00191 Int stateID, Int obsID, Int arrayID
00192 ) const;
00193
00194
00195 std::map<ScanKey, std::set<Int> > getScanToStatesMap() const;
00196
00197
00198 vector<MDirection> getSourceDirections() const;
00199
00200
00201 vector<String> getSourceNames() const;
00202
00203
00204
00205
00206 vector<Int> getSourceTableSourceIDs() const;
00207
00208
00209
00210 virtual std::set<uInt> getSpwsForIntent(const String& intent);
00211
00212
00213 uInt nRows() const;
00214
00215 uInt nRows(CorrelationType cType);
00216
00217 SHARED_PTR<const std::map<SubScanKey, uInt> > getNRowMap(CorrelationType type) const;
00218
00219 uInt nRows(
00220 CorrelationType cType, Int arrayID, Int observationID,
00221 Int scanNumber, Int fieldID
00222 ) const;
00223
00224 uInt nRows(CorrelationType cType, uInt fieldID) const;
00225
00226
00227 uInt nSpw(Bool includewvr) const;
00228
00229
00230 uInt nStates() const;
00231
00232
00233 uInt nFields() const;
00234
00235
00236 std::vector<std::set<uInt> > getSpwToDataDescriptionIDMap() const;
00237
00238
00239 std::set<uInt> getSpwsForField(const Int fieldID) const;
00240
00241
00242 std::set<uInt> getSpwsForField(const String& fieldName);
00243
00244
00245 vector<String> getFieldCodes() const;
00246
00247
00248 std::set<Int> getFieldIDsForSpw(const uInt spw);
00249
00250
00251 std::set<String> getFieldNamesForSpw(const uInt spw);
00252
00253
00254 std::map<Int, std::set<uInt> > getFieldsToSpwsMap() const;
00255
00256
00257 std::map<SourceKey, SHARED_PTR<vector<MFrequency> > > getRestFrequencies() const;
00258
00259
00260 std::set<uInt> getSpwsForScan(const ScanKey& scan) const;
00261
00262
00263 std::set<uInt> getSpwsForSubScan(const SubScanKey& subScan) const;
00264
00265
00266 std::set<Int> getScansForSpw(uInt spw, Int obsID, Int arrayID) const;
00267
00268
00269 std::map<ScanKey, std::set<uInt> > getScanToSpwsMap() const;
00270
00271
00272 std::vector<std::set<ScanKey> > getSpwToScansMap() const;
00273
00274
00275
00276 std::map<SourceKey, SHARED_PTR<vector<String> > > getTransitions() const;
00277
00278
00279 uInt nAntennas() const;
00280
00281
00282
00283 std::set<uInt> getTDMSpw();
00284
00285
00286
00287 std::set<uInt> getFDMSpw();
00288
00289
00290 std::set<uInt> getChannelAvgSpw();
00291
00292
00293 std::set<uInt> getWVRSpw() const;
00294
00295
00296 std::set<uInt> getSQLDSpw();
00297
00298
00299
00300
00301 std::set<Int> getScansForTimes(
00302 Double center, Double tol, Int obsID, Int arrayID
00303 ) const;
00304
00305
00306 std::set<Double> getTimesForScans(std::set<ScanKey> scans) const;
00307
00308
00309
00310 std::set<Double> getTimesForScan(const ScanKey& scan) const;
00311
00312 std::map<uInt, std::set<Double> > getSpwToTimesForScan(const ScanKey& scan) const;
00313
00314
00315
00316
00317 std::pair<Double, Double> getTimeRangeForScan(const ScanKey& scanKey) const;
00318
00319
00320 SHARED_PTR<const std::map<ScanKey, std::pair<Double,Double> > > getScanToTimeRangeMap() const;
00321
00322
00323
00324
00325
00326
00327 std::set<Int> getStatesForScan(Int obsID, Int arrayID, Int scan) const;
00328
00329
00330
00331
00332
00333
00334 QVD getAntennaOffset(uInt which);
00335
00336 QVD getAntennaOffset(const String& name);
00337
00338 vector<QVD > getAntennaOffsets() const;
00339
00340
00341
00342 vector<MPosition> getAntennaPositions(
00343 const vector<uInt>& which=std::vector<uInt>(0)
00344 ) const;
00345
00346
00347 vector<MPosition> getAntennaPositions(const vector<String>& names);
00348
00349
00350
00351 std::map<uInt, Double> getAverageIntervalsForScan(const ScanKey& scan) const;
00352
00353
00354
00355 std::map<uInt, Quantity> getAverageIntervalsForSubScan(const SubScanKey& subScan) const;
00356
00357 vector<uInt> getBBCNos() const;
00358
00359 std::map<uInt, std::set<uInt> > getBBCNosToSpwMap(SQLDSwitch sqldSwitch);
00360
00361 vector<vector<Double> > getEdgeChans();
00362
00363
00364
00365 MDirection phaseDirFromFieldIDAndTime(const uInt fieldID,
00366 const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const ;
00367
00368
00369
00370
00371 MDirection getReferenceDirection(
00372 const uInt fieldID,
00373 const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))
00374 ) const;
00375
00376
00377 std::set<Int> getFieldIDsForField(const String& field) const;
00378
00379
00380 vector<String> getFieldNames() const;
00381
00382
00383 std::set<Int> getFieldsForScan(const ScanKey& scan) const;
00384
00385
00386 std::set<Int> getFieldsForScans(
00387 const std::set<Int>& scans, Int obsID, Int arrayID
00388 ) const;
00389
00390
00391 std::set<Int> getFieldsForScans(const std::set<ScanKey>& scans) const;
00392
00393
00394 std::set<Int> getFieldsForIntent(const String& intent);
00395
00396
00397 std::set<Int> getFieldsForIntent(uInt sourceID) const;
00398
00399 std::map<Int, std::set<Int> > getFieldsForSourceMap() const;
00400
00401 std::map<Int, std::set<String> > getFieldNamesForSourceMap() const;
00402
00403
00404
00405 vector<String> getFieldNamesForFieldIDs(const vector<uInt>& fieldIDs);
00406
00407
00408 std::set<Int> getFieldsForTimes(Double center, Double tol);
00409
00410
00411 Float getMaxCacheSizeMB() const { return _maxCacheMB; }
00412
00413
00414
00415 vector<String> getObservatoryNames();
00416
00417
00418 MPosition getObservatoryPosition(uInt which) const;
00419
00420
00421
00422
00423 vector<MDirection> getPhaseDirs(const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const;
00424
00425
00426 std::set<ScanKey> getScanKeys() const;
00427
00428
00429
00430
00431 std::set<ScanKey> getScanKeys(const ArrayKey& arrayKey) const;
00432
00433
00434 std::set<Int> getScansForIntent(
00435 const String& intent, Int obsID, Int arrayID
00436 ) const;
00437
00438
00439 std::set<Int> getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const;
00440
00441
00442 std::set<Int> getScansForField(const String& field, Int obsID, Int arrayID) const;
00443
00444
00445 std::map<std::pair<uInt, uInt>, uInt> getSpwIDPolIDToDataDescIDMap() const;
00446
00447
00448 vector<String> getSpwNames() const;
00449
00450
00451
00452
00453 std::set<uInt> getSpwIDs() const;
00454
00455
00456 std::set<SubScanKey> getSubScanKeys(const ArrayKey& arrayKey) const;
00457
00458
00459
00460 SubScanProperties getSubScanProperties(
00461 const SubScanKey& subScan, Bool showProgress=False
00462 ) const;
00463
00464 SHARED_PTR<const std::map<SubScanKey, SubScanProperties> > getSubScanProperties(
00465 Bool showProgress=False
00466 ) const;
00467
00468
00469
00470
00471
00472
00473
00474 void setForceSubScanPropsToCache(Bool b) { _forceSubScanPropsToCache = b; }
00475
00476
00477 Record getSummary() const;
00478
00479
00480 std::set<Double> getTimesForField(Int fieldID);
00481
00482
00483 std::set<Double> getTimesForIntent(const String& intent) const;
00484 Bool hasBBCNo() const;
00485
00486
00487
00488
00489
00490
00491
00492
00493 Matrix<Bool> getUniqueBaselines();
00494
00495
00496
00497
00498 virtual uInt nBaselines(Bool includeAutoCorrelation=False);
00499
00500
00501 Quantity getEffectiveTotalExposureTime();
00502
00503
00504 uInt nScans();
00505
00506
00507 uInt nObservations() const;
00508
00509
00510 vector<String> getObservers() const;
00511
00512
00513 vector<String> getProjects() const;
00514
00515
00516
00517 vector<vector<String> > getSchedules() const;
00518
00519
00520 vector<std::pair<MEpoch, MEpoch> > getTimeRangesOfObservations() const;
00521
00522
00523 uInt nArrays();
00524
00525
00526 uInt nDataDescriptions() const;
00527
00528
00529 Double nUnflaggedRows() const;
00530
00531 Double nUnflaggedRows(CorrelationType cType) const;
00532
00533 Double nUnflaggedRows(
00534 CorrelationType cType, Int arrayID, uInt observationID,
00535 Int scanNumber, uInt fieldID
00536 ) const;
00537
00538 Double nUnflaggedRows(CorrelationType cType, Int fieldID) const;
00539
00540 inline Float getCache() const { return _cacheMB;}
00541
00542 vector<Double> getBandWidths() const;
00543
00544 vector<Quantity> getCenterFreqs() const;
00545
00546
00547
00548
00549
00550 vector<QVD> getChanEffectiveBWs(Bool asVelWidths) const;
00551
00552 vector<QVD > getChanFreqs() const;
00553
00554
00555
00556
00557
00558 vector<QVD> getChanResolutions(Bool asVelWidths) const;
00559
00560 vector<QVD > getChanWidths() const;
00561
00562 vector<Quantity> getMeanFreqs() const;
00563
00564 vector<Int> getNetSidebands() const;
00565
00566 vector<MFrequency> getRefFreqs() const;
00567
00568 vector<uInt> nChans() const;
00569
00570 uInt nPol();
00571
00572
00573
00574
00575 std::vector<std::map<Int, Quantity> > getFirstExposureTimeMap();
00576
00577
00578 std::map<ScanKey, FirstExposureTimeMap> getScanToFirstExposureTimeMap(Bool showProgress) const;
00579
00580
00581 std::set<uInt> getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const;
00582
00583
00584
00585 const std::set<Int>& getUniqueAntennaIDs() const;
00586
00587
00588 std::set<uInt> getUniqueDataDescIDs() const;
00589
00590
00591
00592 inline std::set<Int> getUniqueFiedIDs() const {
00593 return getUniqueFieldIDs();
00594 }
00595
00596
00597 std::set<Int> getUniqueFieldIDs() const;
00598
00599
00600
00601 std::pair<MDirection, MDirection> getPointingDirection(
00602 Int& ant1, Int& ant2, Double& time, uInt row,
00603 Bool interpolate=false, Int initialguess=0
00604 ) const;
00605
00606
00607
00608 std::pair<Double, Double> getTimeRange(Bool showProgress=False) const;
00609
00610
00611 uInt nUniqueSourceIDsFromSourceTable() const;
00612
00613
00614
00615 std::set<uInt> getUniqueSpwIDs() const;
00616
00617 const MeasurementSet* getMS() const { return _ms; }
00618
00619 void setShowProgress(Bool b) { _showProgress = b; }
00620
00621 private:
00622
00623 struct ScanProperties {
00624
00625
00626
00627
00628 FirstExposureTimeMap firstExposureTime;
00629
00630
00631 std::map<uInt, Quantity> meanInterval;
00632
00633 std::map<uInt, uInt> spwNRows;
00634
00635
00636 std::pair<Double, Double> timeRange;
00637
00638 std::map<uInt, std::set<Double> > times;
00639 };
00640
00641 struct SpwProperties {
00642 Double bandwidth;
00643 QVD chanfreqs;
00644 QVD chanwidths;
00645 Int netsideband;
00646
00647 Quantity meanfreq;
00648
00649
00650
00651 Quantity centerfreq;
00652 uInt nchans;
00653
00654 vector<Double> edgechans;
00655 uInt bbcno;
00656
00657 MFrequency reffreq;
00658 String name;
00659
00660 QVD effbw;
00661
00662 QVD resolution;
00663 };
00664
00665
00666 struct SourceProperties {
00667 String name;
00668 SHARED_PTR<vector<MFrequency> > restfreq;
00669 SHARED_PTR<vector<String> > transition;
00670 };
00671
00672
00673
00674
00675
00676 const MeasurementSet* _ms;
00677 Bool _showProgress;
00678 mutable Float _cacheMB;
00679 const Float _maxCacheMB;
00680 mutable uInt _nStates, _nACRows, _nXCRows, _nSpw, _nFields, _nAntennas,
00681 _nObservations, _nScans, _nArrays, _nrows, _nPol, _nDataDescIDs;
00682 mutable std::map<ScanKey, std::set<uInt> > _scanToSpwsMap, _scanToDDIDsMap;
00683 mutable vector<uInt> _dataDescIDToSpwMap, _dataDescIDToPolIDMap;
00684 mutable std::map<Int, std::set<uInt> > _fieldToSpwMap;
00685 mutable std::map<ScanKey, std::set<Int> > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap;
00686 mutable std::map<Int, std::set<Int> > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap;
00687 mutable std::map<std::pair<uInt, uInt>, uInt> _spwPolIDToDataDescIDMap;
00688 mutable std::map<String, uInt> _antennaNameToIDMap;
00689 mutable SHARED_PTR<const std::map<ScanKey, ScanProperties> > _scanProperties;
00690 mutable SHARED_PTR<const std::map<SubScanKey, SubScanProperties> > _subScanProperties;
00691
00692 mutable std::map<String, std::set<Int> > _intentToFieldIDMap;
00693 mutable std::map<String, std::set<ScanKey> > _intentToScansMap;
00694 mutable std::map<String, std::set<SubScanKey> > _intentToSubScansMap;
00695 mutable std::map<std::pair<ScanKey, uInt>, std::set<uInt> > _scanSpwToPolIDMap;
00696 mutable std::set<String> _uniqueIntents;
00697 mutable std::set<Int> _uniqueFieldIDs, _uniqueStateIDs, _uniqueAntennaIDs;
00698 mutable std::set<uInt> _avgSpw, _tdmSpw, _fdmSpw, _wvrSpw, _sqldSpw, _uniqueDataDescIDs;
00699 mutable SHARED_PTR<Vector<Int> > _antenna1, _antenna2, _scans, _fieldIDs,
00700 _stateIDs, _dataDescIDs, _observationIDs, _arrayIDs;
00701 mutable SHARED_PTR<std::map<SubScanKey, uInt> > _subScanToNACRowsMap, _subScanToNXCRowsMap;
00702 mutable SHARED_PTR<std::map<Int, uInt> > _fieldToNACRowsMap, _fieldToNXCRowsMap;
00703 mutable std::map<ScanKey, std::set<String> > _scanToIntentsMap;
00704 mutable SHARED_PTR<const std::map<SubScanKey, std::set<String> > > _subScanToIntentsMap;
00705 mutable vector<std::set<String> > _stateToIntentsMap, _spwToIntentsMap, _fieldToIntentsMap;
00706 mutable vector<SpwProperties> _spwInfo;
00707 mutable vector<std::set<Int> > _spwToFieldIDsMap, _obsToArraysMap;
00708 mutable vector<std::set<ScanKey> > _spwToScansMap, _ddidToScansMap, _fieldToScansMap;
00709
00710 mutable vector<String> _fieldNames, _antennaNames, _observatoryNames,
00711 _stationNames, _observers, _projects, _sourceNames, _fieldCodes;
00712 mutable vector<vector<String> > _schedules;
00713 mutable vector<vector<Int> > _corrTypes;
00714 mutable vector<Array<Int> >_corrProds;
00715
00716 mutable SHARED_PTR<Vector<Double> > _times;
00717 mutable SHARED_PTR<Quantum<Vector<Double> > > _exposures, _intervals;
00718 mutable SHARED_PTR<std::map<ScanKey, std::set<Double> > > _scanToTimesMap;
00719 std::map<String, std::set<uInt> > _intentToSpwsMap;
00720 mutable std::map<String, std::set<Double> > _intentToTimesMap;
00721
00722 SHARED_PTR<std::map<Int, std::set<Double> > > _fieldToTimesMap;
00723 SHARED_PTR<std::map<Double, std::set<Int> > > _timeToFieldsMap;
00724
00725 mutable vector<MPosition> _observatoryPositions, _antennaPositions;
00726 mutable vector<QVD > _antennaOffsets;
00727 mutable QVD _antennaDiameters;
00728 Matrix<Bool> _uniqueBaselines;
00729 Quantity _exposureTime;
00730 mutable Double _nUnflaggedACRows, _nUnflaggedXCRows;
00731 mutable SHARED_PTR<vector<Double> > _unflaggedFieldNACRows, _unflaggedFieldNXCRows;
00732 mutable SHARED_PTR<std::map<SubScanKey, Double> > _unflaggedSubScanNACRows, _unflaggedSubScanNXCRows;
00733 const String _taqlTableName;
00734 const vector<const Table*> _taqlTempTable;
00735 mutable SHARED_PTR<ArrayColumn<Bool> > _flagsColumn;
00736
00737 mutable Bool _spwInfoStored, _forceSubScanPropsToCache;
00738 vector<std::map<Int, Quantity> > _firstExposureTimeMap;
00739 mutable vector<Int> _numCorrs, _source_sourceIDs, _field_sourceIDs;
00740
00741 mutable std::set<ArrayKey> _arrayKeys;
00742 mutable std::set<ScanKey> _scanKeys;
00743 mutable std::set<SubScanKey> _subscans;
00744 mutable std::map<ScanKey, std::set<SubScanKey> > _scanToSubScans;
00745 mutable std::map<ArrayKey, std::set<SubScanKey> > _arrayToSubScans;
00746
00747 mutable vector<std::pair<MEpoch, MEpoch> > _timeRangesForObs;
00748
00749 mutable vector<MDirection> _phaseDirs, _sourceDirs;
00750
00751 mutable vector<std::pair<Quantity, Quantity> > _properMotions;
00752
00753 mutable std::map<SourceKey, SourceProperties> _sourceInfo;
00754 mutable SHARED_PTR<std::set<Int> > _ephemFields;
00755
00756
00757 MSMetaData(const MSMetaData&);
00758 MSMetaData operator =(const MSMetaData&);
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769 void _setSpwInfo(const MeasurementSet& ms);
00770
00771
00772 void _setObservation(const MeasurementSet& ms);
00773
00774 Bool _cacheUpdated(const Float incrementInBytes) const;
00775
00776 void _checkField(uInt fieldID) const;
00777
00778 void _checkScan(const ScanKey& key) const;
00779
00780 void _checkScans(const std::set<ScanKey>& scanKeys) const;
00781
00782 void _checkSubScan(const SubScanKey& key) const;
00783
00784 static void _checkTolerance(const Double tol);
00785
00786 void _computeScanAndSubScanProperties(
00787 SHARED_PTR<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
00788 SHARED_PTR<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
00789 Bool showProgress
00790 ) const;
00791
00792 void _createScanRecords(
00793 Record& parent, const ArrayKey& arrayKey,
00794 const std::map<SubScanKey, SubScanProperties>& subScanProps
00795 ) const;
00796
00797 void _createSubScanRecords(
00798 Record& parent, uInt& scanNRows, std::set<Int>& antennasForScan,
00799 const ScanKey& scanKey, const std::map<SubScanKey, SubScanProperties>& subScanProps
00800 ) const;
00801
00802 static void _createTimeStampRecords(
00803 Record& parent,
00804 const SubScanProperties& subScanProps
00805 );
00806
00807
00808
00809
00810 static QVD _freqWidthToVelWidth(const QVD& v, const Quantity& refFreq);
00811
00812
00813
00814
00815 SHARED_PTR<const map<ScanKey, ScanProperties> > _generateScanPropsIfWanted() const;
00816
00817
00818
00819
00820
00821 SHARED_PTR<const map<SubScanKey, SubScanProperties> >
00822 _generateSubScanPropsIfWanted() const;
00823
00824 vector<String> _getAntennaNames(
00825 std::map<String, uInt>& namesToIDsMap
00826 ) const;
00827
00828 vector<MPosition> _getAntennaPositions() const;
00829
00830 void _getAntennas(
00831 SHARED_PTR<Vector<Int> >& ant1,
00832 SHARED_PTR<Vector<Int> >& ant2
00833 ) const;
00834
00835 SHARED_PTR<Vector<Int> > _getArrayIDs() const;
00836
00837 std::map<ArrayKey, std::set<SubScanKey> > _getArrayKeysToSubScanKeys() const;
00838
00839
00840 pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
00841 _getChunkSubScanProperties(
00842 SHARED_PTR<const Vector<Int> > scans, SHARED_PTR<const Vector<Int> > fields,
00843 SHARED_PTR<const Vector<Int> > ddIDs, SHARED_PTR<const Vector<Int> > states,
00844 SHARED_PTR<const Vector<Double> > times, SHARED_PTR<const Vector<Int> > arrays,
00845 SHARED_PTR<const Vector<Int> > observations, SHARED_PTR<const Vector<Int> > ant1,
00846 SHARED_PTR<const Vector<Int> > ant2, SHARED_PTR<const Quantum<Vector<Double> > > exposureTimes,
00847 SHARED_PTR<const Quantum<Vector<Double> > > intervalTimes, const vector<uInt>& ddIDToSpw,
00848 uInt beginRow, uInt endRow
00849 ) const;
00850
00851 SHARED_PTR<Vector<Int> > _getDataDescIDs() const;
00852
00853
00854 SHARED_PTR<std::set<Int> > _getEphemFieldIDs() const;
00855
00856 SHARED_PTR<Quantum<Vector<Double> > > _getExposureTimes() const;
00857
00858 SHARED_PTR<Vector<Int> > _getFieldIDs() const;
00859
00860
00861
00862
00863 void _getFieldsAndIntentsMaps(
00864 vector<std::set<String> >& fieldToIntentsMap,
00865 std::map<String, std::set<Int> >& intentToFieldsMap
00866 );
00867
00868 void _getFieldsAndScansMaps(
00869 vector<std::set<ScanKey> >& fieldToScansMap,
00870 std::map<ScanKey, std::set<Int> >& scanToFieldsMap
00871 ) const;
00872
00873 void _getFieldsAndSpwMaps(
00874 std::map<Int, std::set<uInt> >& fieldToSpwMap,
00875 vector<std::set<Int> >& spwToFieldMap
00876 ) const;
00877
00878 void _getFieldsAndStatesMaps(
00879 std::map<Int, std::set<Int> >& fieldToStatesMap,
00880 std::map<Int, std::set<Int> >& stateToFieldsMap
00881 );
00882
00883 void _getFieldsAndTimesMaps(
00884 SHARED_PTR<std::map<Int, std::set<Double> > >& fieldToTimesMap,
00885 SHARED_PTR<std::map<Double, std::set<Int> > >& timesToFieldMap
00886 );
00887
00888 SHARED_PTR<ArrayColumn<Bool> > _getFlags() const;
00889
00890 std::map<String, std::set<Double> > _getIntentsToTimesMap() const;
00891
00892 SHARED_PTR<Quantum<Vector<Double> > > _getIntervals() const;
00893
00894 SHARED_PTR<Vector<Int> > _getObservationIDs() const;
00895
00896 SHARED_PTR<Vector<Int> > _getScans() const;
00897
00898 vector<std::set<String> > _getSpwToIntentsMap();
00899
00900 SHARED_PTR<Vector<Int> > _getStateIDs() const;
00901
00902 SHARED_PTR<Vector<Double> > _getTimes() const;
00903
00904
00905
00906 Bool _hasIntent(const String& intent) const;
00907
00908 Bool _hasFieldID(Int fieldID) const;
00909
00910 Bool _hasStateID(Int stateID) const;
00911
00912 void _hasAntennaID(Int antennaID);
00913
00914 std::map<Double, Double> _getTimeToTotalBWMap(
00915 const Vector<Double>& times, const Vector<Int>& ddIDs
00916 );
00917
00918 MDirection _getInterpolatedDirection(
00919 const ROMSPointingColumns& pCols, const Int& index,
00920 const Double& time
00921 ) const;
00922
00923
00924
00925 vector<std::set<Int> > _getObservationIDToArrayIDsMap() const;
00926
00927 vector<MPosition> _getObservatoryPositions();
00928
00929 void _getRowStats(
00930 uInt& nACRows, uInt& nXCRows,
00931 std::map<SubScanKey, uInt>*& subScanToNACRowsMap,
00932 std::map<SubScanKey, uInt>*& subScanToNXCRowsMap,
00933 std::map<Int, uInt>*& fieldToNACRowsMap,
00934 std::map<Int, uInt>*& fieldToNXCRowsMap
00935 ) const;
00936
00937 void _getRowStats(
00938 uInt& nACRows, uInt& nXCRows,
00939 SHARED_PTR<std::map<SubScanKey, uInt> >& scanToNACRowsMap,
00940 SHARED_PTR<std::map<SubScanKey, uInt> >& scanToNXCRowsMap,
00941 SHARED_PTR<std::map<Int, uInt> >& fieldToNACRowsMap,
00942 SHARED_PTR<std::map<Int, uInt> >& fieldToNXCRowsMap
00943 ) const;
00944
00945
00946 SHARED_PTR<const std::map<ScanKey, MSMetaData::ScanProperties> > _getScanProperties(
00947 Bool showProgress
00948 ) const;
00949
00950
00951 std::set<ScanKey> _getScanKeys(
00952 const std::set<ScanKey>& scanKeys, const ArrayKey& arrayKey
00953 ) const;
00954
00955
00956 std::set<Int> _getScanNumbers(const ArrayKey& arrayKey) const;
00957
00958 void _getScansAndDDIDMaps(
00959 std::map<ScanKey, std::set<uInt> >& scanToDDIDMap,
00960 vector<std::set<ScanKey> >& ddIDToScanMap
00961 ) const;
00962
00963 void _getScansAndIntentsMaps(
00964 std::map<ScanKey, std::set<String> >& scanToIntentsMap,
00965 std::map<String, std::set<ScanKey> >& intentToScansMap
00966 ) const;
00967
00968 void _getScansAndSpwMaps(
00969 std::map<ScanKey, std::set<uInt> >& scanToSpwMap,
00970 vector<std::set<ScanKey> >& spwToScanMap
00971 ) const;
00972
00973 std::map<ScanKey, std::set<Int> > _getScanToAntennasMap() const;
00974
00975 std::map<ScanKey, std::set<SubScanKey> > _getScanToSubScansMap() const;
00976
00977 SHARED_PTR<std::map<ScanKey, std::set<Double> > > _getScanToTimesMap() const;
00978
00979 std::map<SourceKey, SourceProperties> _getSourceInfo() const;
00980
00981 vector<SpwProperties> _getSpwInfo(
00982 std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw,
00983 std::set<uInt>& fdmSpw, std::set<uInt>& wvrSpw,
00984 std::set<uInt>& sqldSpw
00985 ) const;
00986
00987 void _getSpwsAndIntentsMaps(
00988 vector<std::set<String> >& spwToIntentsMap,
00989 std::map<String, std::set<uInt> >& intentToSpwsMap
00990 );
00991
00992 vector<SpwProperties> _getSpwInfo2(
00993 std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw, std::set<uInt>& fdmSpw,
00994 std::set<uInt>& wvrSpw, std::set<uInt>& sqldSpw
00995 ) const;
00996
00997 void _getStateToIntentsMap(
00998 vector<std::set<String> >& statesToIntentsMap,
00999 std::set<String>& uniqueIntents
01000 ) const;
01001
01002 vector<String> _getStationNames();
01003
01004 void _getSubScansAndIntentsMaps(
01005 SHARED_PTR<const std::map<SubScanKey, std::set<String> > >& subScanToIntentsMap,
01006 std::map<String, std::set<SubScanKey> >& intentToSubScansMap
01007 ) const;
01008
01009 void _getScanAndSubScanProperties(
01010 SHARED_PTR<const std::map<ScanKey, ScanProperties> >& scanProps,
01011 SHARED_PTR<const std::map<SubScanKey, SubScanProperties> >& subScanProps,
01012 Bool showProgress
01013 ) const;
01014
01015 std::set<SubScanKey> _getSubScanKeys() const;
01016
01017
01018 std::set<SubScanKey> _getSubScanKeys(const ScanKey& scanKey) const;
01019
01020 void _getUnflaggedRowStats(
01021 Double& nACRows, Double& nXCRows,
01022 SHARED_PTR<std::map<SubScanKey, Double> >& subScanToNACRowsMap,
01023 SHARED_PTR<std::map<SubScanKey, Double> >& subScanToNXCRowsMap,
01024 SHARED_PTR<vector<Double> >& fieldToNACRowsMap,
01025 SHARED_PTR<vector<Double> >& fieldToNXCRowsMap
01026 ) const;
01027
01028 void _getUnflaggedRowStats(
01029 Double& nACRows, Double& nXCRows,
01030 vector<Double>*& fieldNACRows, vector<Double>*& fieldNXCRows,
01031 std::map<SubScanKey, Double>*& scanNACRows,
01032 std::map<SubScanKey, Double>*& scanNXCRows
01033 ) const;
01034
01035 static void _modifyFirstExposureTimeIfNecessary(
01036 FirstExposureTimeMap& current, const FirstExposureTimeMap& test
01037 );
01038
01039 static void _modifyFirstExposureTimeIfNecessary(
01040 FirstExposureTimeMap& current, Int dataDescID,
01041 Double time, Double exposure, const Unit& eunit
01042 );
01043
01044 static uInt _sizeof(const std::map<Double, MSMetaData::TimeStampProperties> & m);
01045
01046 template <class T>
01047 static uInt _sizeof(const std::map<T, std::set<String> >& m);
01048
01049 template <class T, class U>
01050 static uInt _sizeof(const std::map<T, std::set<U> >& m);
01051
01052 template <class T, class U>
01053 static uInt _sizeof(const std::map<T, U>& m);
01054
01055 static uInt _sizeof(const vector<std::set<String> >& m);
01056
01057 static uInt _sizeof(const vector<String>& m);
01058
01059 static uInt _sizeof(const vector<vector<String> >& m);
01060
01061 template <class T>
01062 static uInt _sizeof(const vector<T>& v);
01063
01064 static uInt _sizeof(const Quantum<Vector<Double> >& m);
01065
01066 template <class T>
01067 static uInt _sizeof(const vector<std::set<T> >& v);
01068
01069 template <class T> static uInt _sizeof(const std::map<String, std::set<T> >& map);
01070
01071 static uInt _sizeof(const vector<std::map<Int, Quantity> >& map);
01072
01073 static uInt _sizeof(const std::map<std::pair<Int, uInt>, std::set<uInt> >& map);
01074
01075 static std::map<Int, uInt> _toUIntMap(const Vector<Int>& v);
01076
01077 template <class T> SHARED_PTR<Vector<T> > _getMainScalarColumn(
01078 MSMainEnums::PredefinedColumns col
01079 ) const;
01080
01081 };
01082
01083
01084
01085 }
01086
01087 #endif