casacore
MSMetaData.h
Go to the documentation of this file.
1 //# MSMetaData.h
2 //# Copyright (C) 1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: MSMetaData.h 21586 2015-03-25 13:46:25Z gervandiepen $
27 
28 #ifndef MS_MSMETADATA_H
29 #define MS_MSMETADATA_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/casa/Quanta/QVector.h>
33 #include <casacore/measures/Measures/MFrequency.h>
34 #include <casacore/measures/Measures/MPosition.h>
35 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
36 #include <casacore/ms/MeasurementSets/MSPointingColumns.h>
37 #include <casacore/casa/Utilities/CountedPtr.h>
38 #include <map>
39 
40 namespace casacore {
41 
42 template <class T> class ArrayColumn;
43 struct ArrayKey;
44 struct ScanKey;
45 struct SourceKey;
46 struct SubScanKey;
47 
48 // <summary>
49 // Class to interrogate an MS for metadata. Interrogation happens on demand
50 // and resulting metadata are stored for use by subsequent queries if the
51 // cache has not exceeded the specified limit.
52 // Parallel processing is enabled using openmp.
53 // </summary>
54 
55 class MSMetaData {
56 
57 public:
58 
59  // for retrieving stats
64  };
65 
66  enum SQLDSwitch {
70  };
71 
73  std::set<Int> ddIDs;
75  };
76 
77  typedef std::map<Int, std::pair<Double, Quantity> > FirstExposureTimeMap;
78 
80  // number of auto-correlation rows
82  // number of cross-correlation rows.
84  std::set<Int> antennas;
86  std::set<uInt> ddIDs;
88  // the key is the spwID, the value is the meanInterval for
89  // the subscan and that spwID
90  std::map<uInt, Quantity> meanInterval;
91  // The Int represents the data description ID,
92  // The Double represents the time of the first time stamp,
93  // The Quantity represents the exposure time for the corresponding
94  // data description ID and time stamp
95  FirstExposureTimeMap firstExposureTime;
97  std::set<uInt> spws;
98  // number of rows for each spectral window
99  std::map<uInt, uInt> spwNRows;
100  std::set<Int> stateIDs;
101  std::map<Double, TimeStampProperties> timeProps;
102  };
103 
104  // construct an object which stores a pointer to the MS and queries the MS
105  // only as necessary. The MeasurementSet pointer passed in should not go out
106  // of scope in the calling code until the caller has finished with this object,
107  // or else subsequent method calls on this object will result in a segmentation
108  // fault; the pointer is not copied.
109  // <src>maxCacheSizeMB</src> is the maximum cache size in megabytes. <=0 means
110  // do not use a cache, in which case, each method call will have to (re)query
111  // the MS. It is highly recommended to use a cache of reasonable size for the
112  // specified MS if multiple methods are going to be called.
113  MSMetaData(const MeasurementSet *const &ms, const Float maxCacheSizeMB);
114 
115  virtual ~MSMetaData();
116 
117  // get the antenna diameters
118  QVD getAntennaDiameters() const;
119 
120  // get the antenna ID for the antenna with the specified name.
121  uInt getAntennaID(const String& antennaName) const;
122 
123  vector<uInt> getAntennaIDs(const vector<String>& antennaNames) const;
124 
125  // get the name of the antenna for the specified antenna ID
126  vector<String> getAntennaNames(
127  std::map<String, uInt>& namesToIDsMap,
128  const vector<uInt>& antennaIDs=vector<uInt>(0)
129  ) const;
130 
131  // get the antenna stations for the specified antenna IDs
132  vector<String> getAntennaStations(const vector<uInt>& antennaIDs=vector<uInt>());
133 
134  // get the antenna stations for the specified antenna names
135  vector<String> getAntennaStations(const vector<String>& antennaNames);
136 
137  // get the set of antenna IDs for the specified scan.
138  std::set<Int> getAntennasForScan(const ScanKey& scan) const;
139 
140  // POLARIZATION.CORR_PRODUCT
141  vector<Array<Int> > getCorrProducts() const;
142 
143  // POLARIZATION.CORR_TYPE
144  vector<vector<Int> > getCorrTypes() const;
145 
146  vector<uInt> getDataDescIDToSpwMap() const;
147 
148  vector<uInt> getDataDescIDToPolIDMap() const;
149 
150  // Get the FIELD.SOURCE_ID column.
151  vector<Int> getFieldTableSourceIDs() const;
152 
153  // get the mapping of field ID to scans
154  vector<std::set<ScanKey> > getFieldToScansMap() const;
155 
156  std::map<String, std::set<Int> > getIntentToFieldsMap();
157 
158  std::map<String, std::set<ScanKey> > getIntentToScansMap();
159 
160  std::map<String, std::set<uInt> > getIntentToSpwsMap();
161 
162  std::set<String> getIntentsForScan(const ScanKey& scan) const;
163 
164  std::set<String> getIntentsForSubScan(const SubScanKey& subScan) const;
165 
166  SHARED_PTR<const std::map<SubScanKey, std::set<String> > > getSubScanToIntentsMap() const;
167 
168  // get all intents, in no particular (nor guaranteed) order.
169  std::set<String> getIntents() const;
170 
171  // get a set of intents corresponding to a specified field
172  std::set<String> getIntentsForField(Int fieldID);
173 
174  // get a set of intents corresponding to the specified spectral window
175  std::set<String> getIntentsForSpw(const uInt spw);
176 
177  // number of correlations from the polarization table.
178  vector<Int> getNumCorrs() const;
179 
180  //SOURCE.PROPER_MOTION, first value in pair is longitudinal proper motion,
181  // second is latiduninal
182  vector<std::pair<Quantity, Quantity> > getProperMotions() const;
183 
184  // get unique scan numbers
185  std::set<Int> getScanNumbers(Int obsID, Int arrayID) const;
186 
187  // get a set of scan numbers for the specified stateID, obsID, and arrayID.
188  // If obsID and/or arrayID is negative, all observation IDs and/or array IDs
189  // will be used.
190  std::set<Int> getScansForState(
191  Int stateID, Int obsID, Int arrayID
192  ) const;
193 
194  // get the mapping of scans to states
195  std::map<ScanKey, std::set<Int> > getScanToStatesMap() const;
196 
197  // SOURCE.DIRECTION
198  vector<MDirection> getSourceDirections() const;
199 
200  // SOURCE.NAME
201  vector<String> getSourceNames() const;
202 
203  // Get the SOURCE.SOURCE_ID column. This is a very unfortunate column name,
204  // because generally an "ID" column of the table with the same name refers to
205  // the row number in that table. But not in this case.
206  vector<Int> getSourceTableSourceIDs() const;
207 
208  // get a set of spectral windows for which the specified <src>intent</src>
209  // applies.
210  virtual std::set<uInt> getSpwsForIntent(const String& intent);
211 
212  // get the number of visibilities
213  uInt nRows() const;
214 
215  uInt nRows(CorrelationType cType);
216 
217  SHARED_PTR<const std::map<SubScanKey, uInt> > getNRowMap(CorrelationType type) const;
218 
219  uInt nRows(
220  CorrelationType cType, Int arrayID, Int observationID,
221  Int scanNumber, Int fieldID
222  ) const;
223 
224  uInt nRows(CorrelationType cType, uInt fieldID) const;
225 
226  // get number of spectral windows
227  uInt nSpw(Bool includewvr) const;
228 
229  // number of unique states (number of rows from the STATE table)
230  uInt nStates() const;
231 
232  // get the number of fields.
233  uInt nFields() const;
234 
235  // get a mapping of spectral window ID to data descrption IDs
236  std::vector<std::set<uInt> > getSpwToDataDescriptionIDMap() const;
237 
238  // get a set of spectral windows corresponding to the specified fieldID
239  std::set<uInt> getSpwsForField(const Int fieldID) const;
240 
241  // get a set of spectral windows corresponding to the specified field name
242  std::set<uInt> getSpwsForField(const String& fieldName);
243 
244  // get the values of the CODE column from the field table
245  vector<String> getFieldCodes() const;
246 
247  // get the set of field IDs corresponding to the specified spectral window.
248  std::set<Int> getFieldIDsForSpw(const uInt spw);
249 
250  // get the set of field names corresponding to the specified spectral window.
251  std::set<String> getFieldNamesForSpw(const uInt spw);
252 
253  // get the mapping of fields to spws
254  std::map<Int, std::set<uInt> > getFieldsToSpwsMap() const;
255 
256  // get rest frequencies from the SOURCE table
257  std::map<SourceKey, SHARED_PTR<vector<MFrequency> > > getRestFrequencies() const;
258 
259  // get the set of spectral windows for the specified scan.
260  std::set<uInt> getSpwsForScan(const ScanKey& scan) const;
261 
262  // get the set of spectral windows for the specified subscan.
263  std::set<uInt> getSpwsForSubScan(const SubScanKey& subScan) const;
264 
265  // get the set of scan numbers for the specified spectral window.
266  std::set<Int> getScansForSpw(uInt spw, Int obsID, Int arrayID) const;
267 
268  // get the complete mapping of scans to spws
269  std::map<ScanKey, std::set<uInt> > getScanToSpwsMap() const;
270 
271  // get the complete mapping of spws to scans
272  std::vector<std::set<ScanKey> > getSpwToScansMap() const;
273 
274  // get the transitions from the SOURCE table. If there are no transitions
275  // for a particular key, the shared ptr contains the null ptr.
276  std::map<SourceKey, SHARED_PTR<vector<String> > > getTransitions() const;
277 
278  // get the number of antennas in the ANTENNA table
279  uInt nAntennas() const;
280 
281  // ALMA-specific. get set of spectral windows used for TDM. These are windows that have
282  // 64, 128, or 256 channels
283  std::set<uInt> getTDMSpw();
284 
285  // ALMA-specific. get set of spectral windows used for FDM. These are windows that do not
286  // have 1, 4, 64, 128, or 256 channels.
287  std::set<uInt> getFDMSpw();
288 
289  // ALMA-specific. get spectral windows that have been averaged. These are windows with 1 channel.
290  std::set<uInt> getChannelAvgSpw();
291 
292  // ALMA-specific. Get the spectral window set used for WVR measurements. These have 4 channels each.
293  std::set<uInt> getWVRSpw() const;
294 
295  // ALMA-specific. Get the square law detector (total power) spectral windows.
296  std::set<uInt> getSQLDSpw();
297 
298  // Get the scan numbers which fail into the specified time range (center-tol to center+tol),
299  // inclusive. A negative value of obsID and/or arrayID indicates that all observation IDs
300  // and/or all arrayIDs should be used.
301  std::set<Int> getScansForTimes(
302  Double center, Double tol, Int obsID, Int arrayID
303  ) const;
304 
305  // Get the times for the specified scans
306  std::set<Double> getTimesForScans(std::set<ScanKey> scans) const;
307 
308  // get the times for the specified scan.
309  // The return values come from the TIME column.
310  std::set<Double> getTimesForScan(const ScanKey& scan) const;
311 
312  std::map<uInt, std::set<Double> > getSpwToTimesForScan(const ScanKey& scan) const;
313 
314  // get the time range for the specified scan. The pair will contain
315  // the start and stop time of the scan, determined from min(TIME(x)-0.5*INTERVAL(x)) and
316  // max(TIME(x)-0.5*INTERVAL(x))
317  std::pair<Double, Double> getTimeRangeForScan(const ScanKey& scanKey) const;
318 
319  // get the map of scans to time ranges.
320  SHARED_PTR<const std::map<ScanKey, std::pair<Double,Double> > > getScanToTimeRangeMap() const;
321 
322  // get the times for the specified scan
323  // std::set<Double> getTimesForScan(const uInt scan) const;
324 
325  // get the stateIDs associated with the specified scan. If obsID and/or arrayID
326  // is negative, all observation IDs and/or array IDs will be used.
327  std::set<Int> getStatesForScan(Int obsID, Int arrayID, Int scan) const;
328 
329  // get the position of the specified antenna relative to the observatory position.
330  // the three vector returned represents the longitudinal, latitudinal, and elevation
331  // offsets (elements 0, 1, and 2 respectively). The longitude and latitude offsets are
332  // measured along the surface of a sphere centered at the earth's center and whose surface
333  // intersects the position of the observatory.
334  QVD getAntennaOffset(uInt which);
335 
336  QVD getAntennaOffset(const String& name);
337 
338  vector<QVD > getAntennaOffsets() const;
339 
340  // get the positions of the specified antennas. If <src>which</src> is empty, return
341  // all antenna positions.
342  vector<MPosition> getAntennaPositions(
343  const vector<uInt>& which=std::vector<uInt>(0)
344  ) const;
345 
346  // <src>names</src> cannot be empty.
347  vector<MPosition> getAntennaPositions(const vector<String>& names);
348 
349  // the first key in the returned map is the spectral window ID, the second is
350  // the average interval for the specified scan for that spw.
351  std::map<uInt, Double> getAverageIntervalsForScan(const ScanKey& scan) const;
352 
353  // the first key in the returned map is the spectral window ID, the second is
354  // the average interval for the specified sub scan for that spw.
355  std::map<uInt, Quantity> getAverageIntervalsForSubScan(const SubScanKey& subScan) const;
356 
357  vector<uInt> getBBCNos() const;
358 
359  std::map<uInt, std::set<uInt> > getBBCNosToSpwMap(SQLDSwitch sqldSwitch);
360 
361  vector<vector<Double> > getEdgeChans();
362  //Get the phase direction for a given field id and epoch
363  //interpolate polynomial if it is the field id is such or use ephemerides table
364  //if that is attached to that field id
366  const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const ;
367 
368  // Get the reference direction for a given field ID and epoch interpolate
369  // polynomial if it is the field ID is such or use ephemerides table
370  // if that is attached to that field ID
372  const uInt fieldID,
373  const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))
374  ) const;
375 
376  // get the field IDs for the specified field name. Case insensitive.
377  std::set<Int> getFieldIDsForField(const String& field) const;
378 
379  // get a list of the field names in the order in which they appear in the FIELD table.
380  vector<String> getFieldNames() const;
381 
382  // get field IDs associated with the specified scan number.
383  std::set<Int> getFieldsForScan(const ScanKey& scan) const;
384 
385  // get the field IDs associated with the specified scans
386  std::set<Int> getFieldsForScans(
387  const std::set<Int>& scans, Int obsID, Int arrayID
388  ) const;
389 
390  // get the field IDs associated with the specified scans
391  std::set<Int> getFieldsForScans(const std::set<ScanKey>& scans) const;
392 
393  // get the field IDs associated with the specified intent.
394  std::set<Int> getFieldsForIntent(const String& intent);
395 
396  // get the field IDs associated with the specified source.
397  std::set<Int> getFieldsForIntent(uInt sourceID) const;
398 
399  std::map<Int, std::set<Int> > getFieldsForSourceMap() const;
400 
401  std::map<Int, std::set<String> > getFieldNamesForSourceMap() const;
402 
403  // get the field names associated with the specified field IDs. If <src>fieldIDs</src>
404  // is empty, a vector of all the field names is returned.
405  vector<String> getFieldNamesForFieldIDs(const vector<uInt>& fieldIDs);
406 
407  // Get the fields which fail into the specified time range (center-tol to center+tol)
408  std::set<Int> getFieldsForTimes(Double center, Double tol);
409 
410  // max cache size in MB
411  Float getMaxCacheSizeMB() const { return _maxCacheMB; }
412 
413  // get telescope names in the order they are listed in the OBSERVATION table. These are
414  // the telescopes (observatories), not the antenna names.
415  vector<String> getObservatoryNames();
416 
417  // get the position of the specified telescope (observatory).
419 
420  // get the phase directions from the FIELD subtable. The <src>ep</src> parameter
421  // specifies for which epoch to return the directions of any ephemeris objects
422  // in the data set. It is ignored for non-ephemeris objects.
423  vector<MDirection> getPhaseDirs(const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const;
424 
425  // get all ScanKeys in the dataset
426  std::set<ScanKey> getScanKeys() const;
427 
428  // get all ScanKeys in the dataset that have the specified <src>arrayKey</src>.
429  // If negative values for either the obsID and/or arrayID portions of the ArrayKey
430  // indicate that all obsIDs and/or arrayIDs should be used.
431  std::set<ScanKey> getScanKeys(const ArrayKey& arrayKey) const;
432 
433  // get the scans associated with the specified intent
434  std::set<Int> getScansForIntent(
435  const String& intent, Int obsID, Int arrayID
436  ) const;
437 
438  // get the scan numbers associated with the specified field ID.
439  std::set<Int> getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const;
440 
441  // get the scan numbers associated with the specified field. Subclasses should not implement or override.
442  std::set<Int> getScansForField(const String& field, Int obsID, Int arrayID) const;
443 
444  // The first value of the pair is spw, the second is polarization ID.
445  std::map<std::pair<uInt, uInt>, uInt> getSpwIDPolIDToDataDescIDMap() const;
446 
447  // get a map of the spwIDs to spw names from the spw table
448  vector<String> getSpwNames() const;
449 
450  // get all the spws associated with the data description IDs listed in the main table.
451  // This will not correspond to a list of the row numbers in the SPECTRAL_WINDOW table
452  // if there are data description IDs that are not in the main table.
453  std::set<uInt> getSpwIDs() const;
454 
455  // get all sub scan keys for the specified array key.
456  std::set<SubScanKey> getSubScanKeys(const ArrayKey& arrayKey) const;
457 
458  // get the sub scan properties for the specified sub scan.
459 
461  const SubScanKey& subScan, Bool showProgress=False
462  ) const;
463 
464  SHARED_PTR<const std::map<SubScanKey, SubScanProperties> > getSubScanProperties(
465  Bool showProgress=False
466  ) const;
467 
468  // If True, force the subscan properties structure to be
469  // cached regardless of the stipulations on the maximum cache. Normally,
470  // the subscan properties structure is small compared to the size of any
471  // one column that is necessary to create it, and since creating this
472  // structure can be very expensive, especially for large datasets, it
473  // is often a good idea to cache it if it will be accessed many times.
475 
476  // get a data structure, consumable by users, representing a summary of the dataset
477  Record getSummary() const;
478 
479  // get the times for which the specified field was observed
480  std::set<Double> getTimesForField(Int fieldID);
481 
482  // get the time stamps associated with the specified intent
483  std::set<Double> getTimesForIntent(const String& intent) const;
484  Bool hasBBCNo() const;
485 
486  //std::map<Double, Double> getExposuresForTimes() const;
487 
488  // get the unique baselines in the MS. These are not necessarily every combination of the
489  // n(n-1)/2 possible antenna pairs, but rather the number of unique baselines represented in
490  // the main MS table, which in theory can be less than n(n-1)/2 (for example if samples for
491  // certain antenna pairs are not recorded. The returned Matrix is nAnts x nAnts in size. Pairs
492  // that are true represent baselines represented in the main MS table.
494 
495  // get the number of unique baselines represented in the main MS table which in theory can be
496  // less than n*(n-1)/2. If <src>includeAutoCorrelation</src> is True, include autocorrelation
497  // "baselines" in the enumeration.
498  virtual uInt nBaselines(Bool includeAutoCorrelation=False);
499 
500  // get the effective total exposure time. This is the effective time spent collecting unflagged data.
502 
503  // get the number of scans in the dataset
504  uInt nScans();
505 
506  // get the number of observations (from the OBSERVATIONS table) in the dataset
507  uInt nObservations() const;
508 
509  // get the contents of the OBSERVER column from the OBSERVATIONS table
510  vector<String> getObservers() const;
511 
512  // get the contents of the PROJECT column from the OBSERVATIONS table
513  vector<String> getProjects() const;
514 
515  // get the contents of the SCHEDULE column from the OBSERVATIONS table
516  // Note that the embedded vectors may have different lengths
517  vector<vector<String> > getSchedules() const;
518 
519  // get the time ranges from the OBSERVATION table
520  vector<std::pair<MEpoch, MEpoch> > getTimeRangesOfObservations() const;
521 
522  // get the number of arrays (from the ARRAY table) in the dataset
523  uInt nArrays();
524 
525  // get the number of data description IDs (from the DATA_DESCRIPTION table)
526  uInt nDataDescriptions() const;
527 
528  // get the number of unflagged rows
529  Double nUnflaggedRows() const;
530 
532 
534  CorrelationType cType, Int arrayID, uInt observationID,
535  Int scanNumber, uInt fieldID
536  ) const;
537 
538  Double nUnflaggedRows(CorrelationType cType, Int fieldID) const;
539 
540  inline Float getCache() const { return _cacheMB;}
541 
542  vector<Double> getBandWidths() const;
543 
544  vector<Quantity> getCenterFreqs() const;
545 
546  // get the effective bandwidth for each channel. Each element in
547  // the returned vector represents a separate spectral window, with
548  // ID given by its location in the vector. If asVelWidths is True,
549  // convert the values to velocity widths.
550  vector<QVD> getChanEffectiveBWs(Bool asVelWidths) const;
551 
552  vector<QVD > getChanFreqs() const;
553 
554  // get the resolution for each channel. Each element in
555  // the returned vector represents a separate spectral window, with
556  // ID given by its location in the vector. If asVelWidths is True,
557  // convert the values to velocity widths.
558  vector<QVD> getChanResolutions(Bool asVelWidths) const;
559 
560  vector<QVD > getChanWidths() const;
561 
562  vector<Quantity> getMeanFreqs() const;
563 
564  vector<Int> getNetSidebands() const;
565 
566  vector<MFrequency> getRefFreqs() const;
567 
568  vector<uInt> nChans() const;
569 
570  uInt nPol();
571 
572  // DEPRECATED
573  // get a map of data desc ID, scan number pair to exposure time for the first time
574  // for that data desc ID, scan number pair
575  std::vector<std::map<Int, Quantity> > getFirstExposureTimeMap();
576 
577  // get map of scans to first exposure times
578  std::map<ScanKey, FirstExposureTimeMap> getScanToFirstExposureTimeMap(Bool showProgress) const;
579 
580  // get polarization IDs for the specified scan and spwid
581  std::set<uInt> getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const;
582 
583  // get the unique antennas (the union of the ANTENNA_1 and ANTENNA_2 columns) from
584  // the main table
585  const std::set<Int>& getUniqueAntennaIDs() const;
586 
587  // get unique data description IDs that exist in the main table
588  std::set<uInt> getUniqueDataDescIDs() const;
589 
590  // DEPRECATED because of spelling error. Use getUniqueFieldIDs()
591  // instead.
592  inline std::set<Int> getUniqueFiedIDs() const {
593  return getUniqueFieldIDs();
594  }
595 
596  // get unique field IDs that exist in the main table.
597  std::set<Int> getUniqueFieldIDs() const;
598 
599  // get the pointing directions associated with antenna1 and antenna2 for
600  // the specified row of the main MS table
601  std::pair<MDirection, MDirection> getPointingDirection(
602  Int& ant1, Int& ant2, Double& time, uInt row,
603  Bool interpolate=false, Int initialguess=0
604  ) const;
605 
606  // get the time range for the entire dataset. min(TIME(x) - 0.5*INTERVAL(x)) to
607  // max(TIME(x) + 0.5*INTERVAL(x))
608  std::pair<Double, Double> getTimeRange(Bool showProgress=False) const;
609 
610  // Number of unique values from SOURCE.SOURCE_ID
612 
613  // get the unique spectral window IDs represented by the data description
614  // IDs that appear in the main table
615  std::set<uInt> getUniqueSpwIDs() const;
616 
617  const MeasurementSet* getMS() const { return _ms; }
618 
620 
621 private:
622 
623  struct ScanProperties {
624  // The Int represents the data description ID,
625  // The Double represents the time of the first time stamp,
626  // The Quantity represents the exposure time for the corresponding
627  // data description ID and time stamp
628  FirstExposureTimeMap firstExposureTime;
629  // the key is the spwID, the value is the meanInterval for
630  // the subscan and that spwID
631  std::map<uInt, Quantity> meanInterval;
632  // number of rows for each spectral window
633  std::map<uInt, uInt> spwNRows;
634  // time range (which takes into account helf of the corresponding
635  // interval, which is not accounted for in the SubScanProperties times
636  std::pair<Double, Double> timeRange;
637  // times for each spectral window
638  std::map<uInt, std::set<Double> > times;
639  };
640 
641  struct SpwProperties {
646  // The sum of all channel frequencies divided by the number of channels
648  // The mean of the low frequency extent of the lowest frequency channel and
649  // the high frequency extend of the highest frequency channel. Often, but not
650  // necessarily, the same as meanfreq
653  // The center frequencies of the two channels at the edges of the window
654  vector<Double> edgechans;
656  // from the REF_FREQUENCY column
659  // EFFECTIVE_BANDWIDTH
661  // RESOLUTION
663  };
664 
665  // represents non-primary key data for a SOURCE table row
668  SHARED_PTR<vector<MFrequency> > restfreq;
669  SHARED_PTR<vector<String> > transition;
670  };
671 
672  // The general pattern is that a mutable gets set only once, on demand, when its
673  // setter is called for the first time. If this pattern is broken, defective behavior
674  // will occur.
675 
678  mutable Float _cacheMB;
682  mutable std::map<ScanKey, std::set<uInt> > _scanToSpwsMap, _scanToDDIDsMap;
684  mutable std::map<Int, std::set<uInt> > _fieldToSpwMap;
685  mutable std::map<ScanKey, std::set<Int> > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap;
686  mutable std::map<Int, std::set<Int> > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap;
687  mutable std::map<std::pair<uInt, uInt>, uInt> _spwPolIDToDataDescIDMap;
688  mutable std::map<String, uInt> _antennaNameToIDMap;
689  mutable SHARED_PTR<const std::map<ScanKey, ScanProperties> > _scanProperties;
690  mutable SHARED_PTR<const std::map<SubScanKey, SubScanProperties> > _subScanProperties;
691 
692  mutable std::map<String, std::set<Int> > _intentToFieldIDMap;
693  mutable std::map<String, std::set<ScanKey> > _intentToScansMap;
694  mutable std::map<String, std::set<SubScanKey> > _intentToSubScansMap;
695  mutable std::map<std::pair<ScanKey, uInt>, std::set<uInt> > _scanSpwToPolIDMap;
696  mutable std::set<String> _uniqueIntents;
699  mutable SHARED_PTR<Vector<Int> > _antenna1, _antenna2, _scans, _fieldIDs,
701  mutable SHARED_PTR<std::map<SubScanKey, uInt> > _subScanToNACRowsMap, _subScanToNXCRowsMap;
702  mutable SHARED_PTR<std::map<Int, uInt> > _fieldToNACRowsMap, _fieldToNXCRowsMap;
703  mutable std::map<ScanKey, std::set<String> > _scanToIntentsMap;
704  mutable SHARED_PTR<const std::map<SubScanKey, std::set<String> > > _subScanToIntentsMap;
705  mutable vector<std::set<String> > _stateToIntentsMap, _spwToIntentsMap, _fieldToIntentsMap;
706  mutable vector<SpwProperties> _spwInfo;
707  mutable vector<std::set<Int> > _spwToFieldIDsMap, _obsToArraysMap;
708  mutable vector<std::set<ScanKey> > _spwToScansMap, _ddidToScansMap, _fieldToScansMap;
709 
710  mutable vector<String> _fieldNames, _antennaNames, _observatoryNames,
712  mutable vector<vector<String> > _schedules;
713  mutable vector<vector<Int> > _corrTypes;
714  mutable vector<Array<Int> >_corrProds;
715 
716  mutable SHARED_PTR<Vector<Double> > _times;
717  mutable SHARED_PTR<Quantum<Vector<Double> > > _exposures, _intervals;
718  mutable SHARED_PTR<std::map<ScanKey, std::set<Double> > > _scanToTimesMap;
719  std::map<String, std::set<uInt> > _intentToSpwsMap;
720  mutable std::map<String, std::set<Double> > _intentToTimesMap;
721 
722  SHARED_PTR<std::map<Int, std::set<Double> > > _fieldToTimesMap;
723  SHARED_PTR<std::map<Double, std::set<Int> > > _timeToFieldsMap;
724 
725  mutable vector<MPosition> _observatoryPositions, _antennaPositions;
726  mutable vector<QVD > _antennaOffsets;
731  mutable SHARED_PTR<vector<Double> > _unflaggedFieldNACRows, _unflaggedFieldNXCRows;
732  mutable SHARED_PTR<std::map<SubScanKey, Double> > _unflaggedSubScanNACRows, _unflaggedSubScanNXCRows;
734  const vector<const Table*> _taqlTempTable;
735  mutable SHARED_PTR<ArrayColumn<Bool> > _flagsColumn;
736 
738  vector<std::map<Int, Quantity> > _firstExposureTimeMap;
740 
741  mutable std::set<ArrayKey> _arrayKeys;
742  mutable std::set<ScanKey> _scanKeys;
743  mutable std::set<SubScanKey> _subscans;
744  mutable std::map<ScanKey, std::set<SubScanKey> > _scanToSubScans;
745  mutable std::map<ArrayKey, std::set<SubScanKey> > _arrayToSubScans;
746 
747  mutable vector<std::pair<MEpoch, MEpoch> > _timeRangesForObs;
748 
749  mutable vector<MDirection> _phaseDirs, _sourceDirs;
750 
751  mutable vector<std::pair<Quantity, Quantity> > _properMotions;
752 
753  mutable std::map<SourceKey, SourceProperties> _sourceInfo;
754  mutable SHARED_PTR<std::set<Int> > _ephemFields;
755 
756  // disallow copy constructor and = operator
757  MSMetaData(const MSMetaData&);
759 
760  // This comment from thunter in the original ValueMapping python class
761  // # Determine the number of polarizations for the first OBSERVE_TARGET intent.
762  // # Used by plotbandpass for BPOLY plots since the number of pols cannot be inferred
763  // # correctly from the caltable alone. You cannot not simply use the first row, because
764  // # it may be a pointing scan which may have different number of polarizations than what
765  // # the TARGET and BANDPASS calibrator will have.
766  // # -- T. Hunter
767  // uInt _getNumberOfPolarizations();
768 
769  void _setSpwInfo(const MeasurementSet& ms);
770 
771  // set metadata from OBSERVATION table
772  void _setObservation(const MeasurementSet& ms);
773 
774  Bool _cacheUpdated(const Float incrementInBytes) const;
775 
776  void _checkField(uInt fieldID) const;
777 
778  void _checkScan(const ScanKey& key) const;
779 
780  void _checkScans(const std::set<ScanKey>& scanKeys) const;
781 
782  void _checkSubScan(const SubScanKey& key) const;
783 
784  static void _checkTolerance(const Double tol);
785 
787  SHARED_PTR<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
788  SHARED_PTR<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
789  Bool showProgress
790  ) const;
791 
792  void _createScanRecords(
793  Record& parent, const ArrayKey& arrayKey,
794  const std::map<SubScanKey, SubScanProperties>& subScanProps
795  ) const;
796 
798  Record& parent, uInt& scanNRows, std::set<Int>& antennasForScan,
799  const ScanKey& scanKey, const std::map<SubScanKey, SubScanProperties>& subScanProps
800  ) const;
801 
802  static void _createTimeStampRecords(
803  Record& parent,
804  const SubScanProperties& subScanProps
805  );
806 
807  // convert a QVD in frequency units to velocity units using
808  // the give reference frequency. No explicit checking is done
809  // for unit correctness of the inputs.
810  static QVD _freqWidthToVelWidth(const QVD& v, const Quantity& refFreq);
811 
812  // if _scanProps has been generated, just return it. If the caller has
813  // configured the object to generate _scanProps at some point, this call will
814  // generate it. Otherwise, the returned object contains a null pointer.
815  SHARED_PTR<const map<ScanKey, ScanProperties> > _generateScanPropsIfWanted() const;
816 
817  // if _subScanProperties has been generated, just return it. If
818  // the caller has configured the object to generate _subScanPropertiess
819  // at some point, this call will generate it. Otherwise, the returned object
820  // contains a null pointer.
821  SHARED_PTR<const map<SubScanKey, SubScanProperties> >
823 
824  vector<String> _getAntennaNames(
825  std::map<String, uInt>& namesToIDsMap
826  ) const;
827 
828  vector<MPosition> _getAntennaPositions() const;
829 
830  void _getAntennas(
831  SHARED_PTR<Vector<Int> >& ant1,
832  SHARED_PTR<Vector<Int> >& ant2
833  ) const;
834 
835  SHARED_PTR<Vector<Int> > _getArrayIDs() const;
836 
837  std::map<ArrayKey, std::set<SubScanKey> > _getArrayKeysToSubScanKeys() const;
838 
839  // Uses openmp for parallel processing
840  pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
842  SHARED_PTR<const Vector<Int> > scans, SHARED_PTR<const Vector<Int> > fields,
843  SHARED_PTR<const Vector<Int> > ddIDs, SHARED_PTR<const Vector<Int> > states,
844  SHARED_PTR<const Vector<Double> > times, SHARED_PTR<const Vector<Int> > arrays,
845  SHARED_PTR<const Vector<Int> > observations, SHARED_PTR<const Vector<Int> > ant1,
846  SHARED_PTR<const Vector<Int> > ant2, SHARED_PTR<const Quantum<Vector<Double> > > exposureTimes,
847  SHARED_PTR<const Quantum<Vector<Double> > > intervalTimes, const vector<uInt>& ddIDToSpw,
848  uInt beginRow, uInt endRow
849  ) const;
850 
851  SHARED_PTR<Vector<Int> > _getDataDescIDs() const;
852 
853  // get the field IDs of ephemeris objects
854  SHARED_PTR<std::set<Int> > _getEphemFieldIDs() const;
855 
856  SHARED_PTR<Quantum<Vector<Double> > > _getExposureTimes() const;
857 
858  SHARED_PTR<Vector<Int> > _getFieldIDs() const;
859 
860  // If there are no intents, then fieldToIntentsMap will be of length
861  // nFields() and all of its entries will be the empty set, and
862  // intentToFieldsMap will be empty
864  vector<std::set<String> >& fieldToIntentsMap,
865  std::map<String, std::set<Int> >& intentToFieldsMap
866  );
867 
869  vector<std::set<ScanKey> >& fieldToScansMap,
870  std::map<ScanKey, std::set<Int> >& scanToFieldsMap
871  ) const;
872 
874  std::map<Int, std::set<uInt> >& fieldToSpwMap,
875  vector<std::set<Int> >& spwToFieldMap
876  ) const;
877 
879  std::map<Int, std::set<Int> >& fieldToStatesMap,
880  std::map<Int, std::set<Int> >& stateToFieldsMap
881  );
882 
884  SHARED_PTR<std::map<Int, std::set<Double> > >& fieldToTimesMap,
885  SHARED_PTR<std::map<Double, std::set<Int> > >& timesToFieldMap
886  );
887 
888  SHARED_PTR<ArrayColumn<Bool> > _getFlags() const;
889 
890  std::map<String, std::set<Double> > _getIntentsToTimesMap() const;
891 
892  SHARED_PTR<Quantum<Vector<Double> > > _getIntervals() const;
893 
894  SHARED_PTR<Vector<Int> > _getObservationIDs() const;
895 
896  SHARED_PTR<Vector<Int> > _getScans() const;
897 
898  vector<std::set<String> > _getSpwToIntentsMap();
899 
900  SHARED_PTR<Vector<Int> > _getStateIDs() const;
901 
902  SHARED_PTR<Vector<Double> > _getTimes() const;
903 
904  //SHARED_PTR<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;
905 
906  Bool _hasIntent(const String& intent) const;
907 
908  Bool _hasFieldID(Int fieldID) const;
909 
910  Bool _hasStateID(Int stateID) const;
911 
912  void _hasAntennaID(Int antennaID);
913 
914  std::map<Double, Double> _getTimeToTotalBWMap(
915  const Vector<Double>& times, const Vector<Int>& ddIDs
916  );
917 
919  const ROMSPointingColumns& pCols, const Int& index,
920  const Double& time
921  ) const;
922 
923  //map<SubScanKey, Quantity> _getMeanExposureTimes() const;
924 
925  vector<std::set<Int> > _getObservationIDToArrayIDsMap() const;
926 
927  vector<MPosition> _getObservatoryPositions();
928 
929  void _getRowStats(
930  uInt& nACRows, uInt& nXCRows,
931  std::map<SubScanKey, uInt>*& subScanToNACRowsMap,
932  std::map<SubScanKey, uInt>*& subScanToNXCRowsMap,
933  std::map<Int, uInt>*& fieldToNACRowsMap,
934  std::map<Int, uInt>*& fieldToNXCRowsMap
935  ) const;
936 
937  void _getRowStats(
938  uInt& nACRows, uInt& nXCRows,
939  SHARED_PTR<std::map<SubScanKey, uInt> >& scanToNACRowsMap,
940  SHARED_PTR<std::map<SubScanKey, uInt> >& scanToNXCRowsMap,
941  SHARED_PTR<std::map<Int, uInt> >& fieldToNACRowsMap,
942  SHARED_PTR<std::map<Int, uInt> >& fieldToNXCRowsMap
943  ) const;
944 
945  // get scan properties
946  SHARED_PTR<const std::map<ScanKey, MSMetaData::ScanProperties> > _getScanProperties(
947  Bool showProgress
948  ) const;
949 
950  // get the scan keys in the specified set that have the associated arrayKey
951  std::set<ScanKey> _getScanKeys(
952  const std::set<ScanKey>& scanKeys, const ArrayKey& arrayKey
953  ) const;
954 
955  // get all valid scan numbers associated with the specified arrayKey
956  std::set<Int> _getScanNumbers(const ArrayKey& arrayKey) const;
957 
959  std::map<ScanKey, std::set<uInt> >& scanToDDIDMap,
960  vector<std::set<ScanKey> >& ddIDToScanMap
961  ) const;
962 
964  std::map<ScanKey, std::set<String> >& scanToIntentsMap,
965  std::map<String, std::set<ScanKey> >& intentToScansMap
966  ) const;
967 
968  void _getScansAndSpwMaps(
969  std::map<ScanKey, std::set<uInt> >& scanToSpwMap,
970  vector<std::set<ScanKey> >& spwToScanMap
971  ) const;
972 
973  std::map<ScanKey, std::set<Int> > _getScanToAntennasMap() const;
974 
975  std::map<ScanKey, std::set<SubScanKey> > _getScanToSubScansMap() const;
976 
977  SHARED_PTR<std::map<ScanKey, std::set<Double> > > _getScanToTimesMap() const;
978 
979  std::map<SourceKey, SourceProperties> _getSourceInfo() const;
980 
981  vector<SpwProperties> _getSpwInfo(
982  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw,
983  std::set<uInt>& fdmSpw, std::set<uInt>& wvrSpw,
984  std::set<uInt>& sqldSpw
985  ) const;
986 
988  vector<std::set<String> >& spwToIntentsMap,
989  std::map<String, std::set<uInt> >& intentToSpwsMap
990  );
991 
992  vector<SpwProperties> _getSpwInfo2(
993  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw, std::set<uInt>& fdmSpw,
994  std::set<uInt>& wvrSpw, std::set<uInt>& sqldSpw
995  ) const;
996 
998  vector<std::set<String> >& statesToIntentsMap,
999  std::set<String>& uniqueIntents
1000  ) const;
1001 
1002  vector<String> _getStationNames();
1003 
1005  SHARED_PTR<const std::map<SubScanKey, std::set<String> > >& subScanToIntentsMap,
1006  std::map<String, std::set<SubScanKey> >& intentToSubScansMap
1007  ) const;
1008 
1010  SHARED_PTR<const std::map<ScanKey, ScanProperties> >& scanProps,
1011  SHARED_PTR<const std::map<SubScanKey, SubScanProperties> >& subScanProps,
1012  Bool showProgress
1013  ) const;
1014 
1015  std::set<SubScanKey> _getSubScanKeys() const;
1016 
1017  // get subscans related to the given scan
1018  std::set<SubScanKey> _getSubScanKeys(const ScanKey& scanKey) const;
1019 
1020  void _getUnflaggedRowStats(
1021  Double& nACRows, Double& nXCRows,
1022  SHARED_PTR<std::map<SubScanKey, Double> >& subScanToNACRowsMap,
1023  SHARED_PTR<std::map<SubScanKey, Double> >& subScanToNXCRowsMap,
1024  SHARED_PTR<vector<Double> >& fieldToNACRowsMap,
1025  SHARED_PTR<vector<Double> >& fieldToNXCRowsMap
1026  ) const;
1027 
1028  void _getUnflaggedRowStats(
1029  Double& nACRows, Double& nXCRows,
1030  vector<Double>*& fieldNACRows, vector<Double>*& fieldNXCRows,
1031  std::map<SubScanKey, Double>*& scanNACRows,
1032  std::map<SubScanKey, Double>*& scanNXCRows
1033  ) const;
1034 
1036  FirstExposureTimeMap& current, const FirstExposureTimeMap& test
1037  );
1038 
1040  FirstExposureTimeMap& current, Int dataDescID,
1041  Double time, Double exposure, const Unit& eunit
1042  );
1043 
1044  static uInt _sizeof(const std::map<Double, MSMetaData::TimeStampProperties> & m);
1045 
1046  template <class T>
1047  static uInt _sizeof(const std::map<T, std::set<String> >& m);
1048 
1049  template <class T, class U>
1050  static uInt _sizeof(const std::map<T, std::set<U> >& m);
1051 
1052  template <class T, class U>
1053  static uInt _sizeof(const std::map<T, U>& m);
1054 
1055  static uInt _sizeof(const vector<std::set<String> >& m);
1056 
1057  static uInt _sizeof(const vector<String>& m);
1058 
1059  static uInt _sizeof(const vector<vector<String> >& m);
1060 
1061  template <class T>
1062  static uInt _sizeof(const vector<T>& v);
1063 
1064  static uInt _sizeof(const Quantum<Vector<Double> >& m);
1065 
1066  template <class T>
1067  static uInt _sizeof(const vector<std::set<T> >& v);
1068 
1069  template <class T> static uInt _sizeof(const std::map<String, std::set<T> >& map);
1070 
1071  static uInt _sizeof(const vector<std::map<Int, Quantity> >& map);
1072 
1073  static uInt _sizeof(const std::map<std::pair<Int, uInt>, std::set<uInt> >& map);
1074 
1075  static std::map<Int, uInt> _toUIntMap(const Vector<Int>& v);
1076 
1077  template <class T> SHARED_PTR<Vector<T> > _getMainScalarColumn(
1079  ) const;
1080 
1081 };
1082 
1083 
1084 
1085 }
1086 
1087 #endif
vector< QVD > getAntennaOffsets() const
std::set< String > getIntentsForSubScan(const SubScanKey &subScan) const
std::map< Int, std::set< String > > getFieldNamesForSourceMap() const
SHARED_PTR< Vector< Int > > _fieldIDs
Definition: MSMetaData.h:699
std::set< SubScanKey > _getSubScanKeys() const
std::map< ScanKey, std::set< uInt > > getScanToSpwsMap() const
get the complete mapping of scans to spws
SHARED_PTR< const std::map< SubScanKey, std::set< String > > > _subScanToIntentsMap
Definition: MSMetaData.h:704
std::set< Int > getFieldIDsForField(const String &field) const
get the field IDs for the specified field name.
std::map< uInt, std::set< Double > > getSpwToTimesForScan(const ScanKey &scan) const
SHARED_PTR< Vector< Int > > _antenna2
Definition: MSMetaData.h:699
std::set< Int > getScansForSpw(uInt spw, Int obsID, Int arrayID) const
get the set of scan numbers for the specified spectral window.
vector< String > getFieldCodes() const
get the values of the CODE column from the field table
A Measure: astronomical direction.
Definition: MDirection.h:174
#define SHARED_PTR
Definition: CountedPtr.h:41
MFrequency reffreq
from the REF_FREQUENCY column
Definition: MSMetaData.h:657
SHARED_PTR< Vector< Int > > _getStateIDs() const
SubScanProperties getSubScanProperties(const SubScanKey &subScan, Bool showProgress=False) const
get the sub scan properties for the specified sub scan.
SHARED_PTR< Vector< Double > > _times
Definition: MSMetaData.h:716
SHARED_PTR< ArrayColumn< Bool > > _flagsColumn
Definition: MSMetaData.h:735
vector< uInt > getBBCNos() const
A Measure: position on Earth.
Definition: MPosition.h:79
vector< std::set< Int > > _getObservationIDToArrayIDsMap() const
map<SubScanKey, Quantity> _getMeanExposureTimes() const;
vector< std::set< Int > > _obsToArraysMap
Definition: MSMetaData.h:707
std::set< uInt > getSpwIDs() const
get all the spws associated with the data description IDs listed in the main table.
int Int
Definition: aipstype.h:50
std::set< SubScanKey > _subscans
Definition: MSMetaData.h:743
void _getSubScansAndIntentsMaps(SHARED_PTR< const std::map< SubScanKey, std::set< String > > > &subScanToIntentsMap, std::map< String, std::set< SubScanKey > > &intentToSubScansMap) const
void setForceSubScanPropsToCache(Bool b)
If True, force the subscan properties structure to be cached regardless of the stipulations on the ma...
Definition: MSMetaData.h:474
void _checkSubScan(const SubScanKey &key) const
std::set< uInt > _avgSpw
Definition: MSMetaData.h:698
vector< vector< Int > > _corrTypes
Definition: MSMetaData.h:713
std::set< Int > getStatesForScan(Int obsID, Int arrayID, Int scan) const
get the times for the specified scan std::set<Double> getTimesForScan(const uInt scan) const; ...
std::map< String, std::set< Double > > _getIntentsToTimesMap() const
vector< uInt > _dataDescIDToSpwMap
Definition: MSMetaData.h:683
vector< MPosition > _observatoryPositions
Definition: MSMetaData.h:725
static QVD _freqWidthToVelWidth(const QVD &v, const Quantity &refFreq)
convert a QVD in frequency units to velocity units using the give reference frequency.
void _getFieldsAndStatesMaps(std::map< Int, std::set< Int > > &fieldToStatesMap, std::map< Int, std::set< Int > > &stateToFieldsMap)
std::pair< Double, Double > getTimeRangeForScan(const ScanKey &scanKey) const
get the time range for the specified scan.
vector< MPosition > _getObservatoryPositions()
std::set< Int > getFieldsForIntent(const String &intent)
get the field IDs associated with the specified intent.
vector< String > getObservatoryNames()
get telescope names in the order they are listed in the OBSERVATION table.
std::map< String, std::set< uInt > > _intentToSpwsMap
Definition: MSMetaData.h:719
vector< uInt > getAntennaIDs(const vector< String > &antennaNames) const
void _getFieldsAndScansMaps(vector< std::set< ScanKey > > &fieldToScansMap, std::map< ScanKey, std::set< Int > > &scanToFieldsMap) const
std::map< Int, std::set< Int > > _stateToFieldsMap
Definition: MSMetaData.h:686
std::set< uInt > getSpwsForField(const Int fieldID) const
get a set of spectral windows corresponding to the specified fieldID
std::map< Double, TimeStampProperties > timeProps
Definition: MSMetaData.h:101
uInt nStates() const
number of unique states (number of rows from the STATE table)
SHARED_PTR< const std::map< SubScanKey, std::set< String > > > getSubScanToIntentsMap() const
std::map< ScanKey, std::set< Int > > _getScanToAntennasMap() const
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1744
vector< MDirection > _phaseDirs
Definition: MSMetaData.h:749
std::map< SourceKey, SourceProperties > _sourceInfo
Definition: MSMetaData.h:753
std::map< String, std::set< Int > > _intentToFieldIDMap
Definition: MSMetaData.h:692
vector< Quantity > getMeanFreqs() const
std::map< Int, std::pair< Double, Quantity > > FirstExposureTimeMap
Definition: MSMetaData.h:77
vector< MDirection > getSourceDirections() const
SOURCE.DIRECTION.
std::map< Double, Double > _getTimeToTotalBWMap(const Vector< Double > &times, const Vector< Int > &ddIDs)
std::pair< Double, Double > getTimeRange(Bool showProgress=False) const
get the time range for the entire dataset.
std::set< Int > getUniqueFiedIDs() const
DEPRECATED because of spelling error.
Definition: MSMetaData.h:592
std::set< ScanKey > _getScanKeys(const std::set< ScanKey > &scanKeys, const ArrayKey &arrayKey) const
get the scan keys in the specified set that have the associated arrayKey
vector< std::pair< Quantity, Quantity > > _properMotions
Definition: MSMetaData.h:751
std::map< ScanKey, std::set< SubScanKey > > _scanToSubScans
Definition: MSMetaData.h:744
void _getStateToIntentsMap(vector< std::set< String > > &statesToIntentsMap, std::set< String > &uniqueIntents) const
vector< std::set< ScanKey > > _fieldToScansMap
Definition: MSMetaData.h:708
SHARED_PTR< Quantum< Vector< Double > > > _intervals
Definition: MSMetaData.h:717
std::map< ScanKey, std::set< Int > > _scanToFieldsMap
Definition: MSMetaData.h:685
void _setSpwInfo(const MeasurementSet &ms)
This comment from thunter in the original ValueMapping python class Determine the number of polarizat...
MSMetaData(const MeasurementSet *const &ms, const Float maxCacheSizeMB)
construct an object which stores a pointer to the MS and queries the MS only as necessary.
SHARED_PTR< const std::map< SubScanKey, uInt > > getNRowMap(CorrelationType type) const
vector< QVD > getChanWidths() const
std::set< uInt > getFDMSpw()
ALMA-specific.
std::set< uInt > _tdmSpw
Definition: MSMetaData.h:698
Record getSummary() const
get a data structure, consumable by users, representing a summary of the dataset
std::set< uInt > getChannelAvgSpw()
ALMA-specific.
SHARED_PTR< Quantum< Vector< Double > > > _exposures
Definition: MSMetaData.h:717
Quantum< Double > Quantity
Definition: Quantum.h:38
vector< std::pair< MEpoch, MEpoch > > getTimeRangesOfObservations() const
get the time ranges from the OBSERVATION table
std::set< String > getIntentsForScan(const ScanKey &scan) const
Bool _hasFieldID(Int fieldID) const
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp...
Definition: MSMetaData.h:95
vector< String > getFieldNames() const
get a list of the field names in the order in which they appear in the FIELD table.
std::set< uInt > _wvrSpw
Definition: MSMetaData.h:698
SHARED_PTR< Vector< Int > > _arrayIDs
Definition: MSMetaData.h:699
uInt nUniqueSourceIDsFromSourceTable() const
Number of unique values from SOURCE.SOURCE_ID.
std::map< String, std::set< uInt > > getIntentToSpwsMap()
std::vector< std::set< ScanKey > > getSpwToScansMap() const
get the complete mapping of spws to scans
std::set< uInt > getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const
get polarization IDs for the specified scan and spwid
MDirection _getInterpolatedDirection(const ROMSPointingColumns &pCols, const Int &index, const Double &time) const
std::set< uInt > getUniqueSpwIDs() const
get the unique spectral window IDs represented by the data description IDs that appear in the main ta...
std::map< uInt, Quantity > meanInterval
the key is the spwID, the value is the meanInterval for the subscan and that spwID ...
Definition: MSMetaData.h:631
vector< Int > _field_sourceIDs
Definition: MSMetaData.h:739
vector< String > _projects
Definition: MSMetaData.h:710
vector< std::set< String > > _spwToIntentsMap
Definition: MSMetaData.h:705
SHARED_PTR< Vector< Int > > _dataDescIDs
Definition: MSMetaData.h:699
std::map< String, std::set< Double > > _intentToTimesMap
Definition: MSMetaData.h:720
vector< String > _observers
Definition: MSMetaData.h:710
vector< QVD > _antennaOffsets
Definition: MSMetaData.h:726
SHARED_PTR< std::map< Int, uInt > > _fieldToNXCRowsMap
Definition: MSMetaData.h:702
vector< String > _sourceNames
Definition: MSMetaData.h:710
void _getScansAndDDIDMaps(std::map< ScanKey, std::set< uInt > > &scanToDDIDMap, vector< std::set< ScanKey > > &ddIDToScanMap) const
std::map< Int, std::set< uInt > > _fieldToSpwMap
Definition: MSMetaData.h:684
std::pair< Double, Double > timeRange
time range (which takes into account helf of the corresponding interval, which is not accounted for i...
Definition: MSMetaData.h:636
vector< Array< Int > > _corrProds
Definition: MSMetaData.h:714
Bool _hasIntent(const String &intent) const
SHARED_PTR<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;.
vector< Int > getSourceTableSourceIDs() const
Get the SOURCE.SOURCE_ID column.
std::set< uInt > _uniqueDataDescIDs
Definition: MSMetaData.h:698
vector< vector< String > > getSchedules() const
get the contents of the SCHEDULE column from the OBSERVATIONS table Note that the embedded vectors ma...
std::set< Int > getScansForIntent(const String &intent, Int obsID, Int arrayID) const
get the scans associated with the specified intent
std::set< ScanKey > _scanKeys
Definition: MSMetaData.h:742
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp...
Definition: MSMetaData.h:628
uInt nDataDescriptions() const
get the number of data description IDs (from the DATA_DESCRIPTION table)
vector< std::pair< Quantity, Quantity > > getProperMotions() const
SOURCE.PROPER_MOTION, first value in pair is longitudinal proper motion, second is latiduninal...
std::map< uInt, uInt > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:99
void _createScanRecords(Record &parent, const ArrayKey &arrayKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
vector< Int > getNetSidebands() const
SHARED_PTR< Quantum< Vector< Double > > > _getIntervals() const
vector< std::pair< MEpoch, MEpoch > > _timeRangesForObs
Definition: MSMetaData.h:747
std::map< uInt, Double > getAverageIntervalsForScan(const ScanKey &scan) const
the first key in the returned map is the spectral window ID, the second is the average interval for t...
Class to interrogate an MS for metadata. Interrogation happens on demand and resulting metadata are s...
Definition: MSMetaData.h:55
std::pair< MDirection, MDirection > getPointingDirection(Int &ant1, Int &ant2, Double &time, uInt row, Bool interpolate=false, Int initialguess=0) const
get the pointing directions associated with antenna1 and antenna2 for the specified row of the main M...
vector< std::set< ScanKey > > _ddidToScansMap
Definition: MSMetaData.h:708
SHARED_PTR< std::map< ScanKey, std::set< Double > > > _getScanToTimesMap() const
std::set< Int > getUniqueFieldIDs() const
get unique field IDs that exist in the main table.
std::map< uInt, std::set< Double > > times
times for each spectral window
Definition: MSMetaData.h:638
MSMetaData operator=(const MSMetaData &)
vector< String > _observatoryNames
Definition: MSMetaData.h:710
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
CorrelationType
for retrieving stats
Definition: MSMetaData.h:60
std::set< Int > getScanNumbers(Int obsID, Int arrayID) const
get unique scan numbers
SHARED_PTR< const std::map< ScanKey, MSMetaData::ScanProperties > > _getScanProperties(Bool showProgress) const
get scan properties
std::set< Double > getTimesForIntent(const String &intent) const
get the time stamps associated with the specified intent
std::set< String > getIntentsForField(Int fieldID)
get a set of intents corresponding to a specified field
std::map< ScanKey, std::set< Int > > getScanToStatesMap() const
get the mapping of scans to states
SHARED_PTR< Vector< Int > > _scans
Definition: MSMetaData.h:699
uInt nScans()
get the number of scans in the dataset
vector< String > getSourceNames() const
SOURCE.NAME.
vector< String > getSpwNames() const
get a map of the spwIDs to spw names from the spw table
vector< std::set< String > > _stateToIntentsMap
Definition: MSMetaData.h:705
vector< String > _getAntennaNames(std::map< String, uInt > &namesToIDsMap) const
SHARED_PTR< Vector< Int > > _antenna1
Definition: MSMetaData.h:699
A Measure: instant in time.
Definition: MEpoch.h:104
std::map< String, uInt > _antennaNameToIDMap
Definition: MSMetaData.h:688
void _computeScanAndSubScanProperties(SHARED_PTR< std::map< ScanKey, MSMetaData::ScanProperties > > &scanProps, SHARED_PTR< std::map< SubScanKey, MSMetaData::SubScanProperties > > &subScanProps, Bool showProgress) const
vector< std::set< String > > _getSpwToIntentsMap()
MDirection phaseDirFromFieldIDAndTime(const uInt fieldID, const MEpoch &ep=MEpoch(Quantity(0.0, Unit("s")))) const
Get the phase direction for a given field id and epoch interpolate polynomial if it is the field id i...
const MeasurementSet * _ms
The general pattern is that a mutable gets set only once, on demand, when its setter is called for th...
Definition: MSMetaData.h:676
vector< Int > _numCorrs
Definition: MSMetaData.h:739
std::set< String > getIntentsForSpw(const uInt spw)
get a set of intents corresponding to the specified spectral window
std::set< Int > getFieldsForScan(const ScanKey &scan) const
get field IDs associated with the specified scan number.
void _getSpwsAndIntentsMaps(vector< std::set< String > > &spwToIntentsMap, std::map< String, std::set< uInt > > &intentToSpwsMap)
Quantity _exposureTime
Definition: MSMetaData.h:729
vector< String > _fieldNames
Definition: MSMetaData.h:710
vector< String > getFieldNamesForFieldIDs(const vector< uInt > &fieldIDs)
get the field names associated with the specified field IDs.
Double nUnflaggedRows() const
get the number of unflagged rows
std::map< std::pair< ScanKey, uInt >, std::set< uInt > > _scanSpwToPolIDMap
Definition: MSMetaData.h:695
std::map< ArrayKey, std::set< SubScanKey > > _arrayToSubScans
Definition: MSMetaData.h:745
std::set< Int > getScansForTimes(Double center, Double tol, Int obsID, Int arrayID) const
Get the scan numbers which fail into the specified time range (center-tol to center+tol), inclusive.
vector< uInt > getDataDescIDToPolIDMap() const
vector< QVD > getChanFreqs() const
represents non-primary key data for a SOURCE table row
Definition: MSMetaData.h:666
QVD effbw
EFFECTIVE_BANDWIDTH.
Definition: MSMetaData.h:660
vector< std::map< Int, Quantity > > _firstExposureTimeMap
Definition: MSMetaData.h:738
std::map< ScanKey, std::set< Int > > _scanToStatesMap
Definition: MSMetaData.h:685
vector< MPosition > _antennaPositions
Definition: MSMetaData.h:725
defines physical units
Definition: Unit.h:189
A Measure: wave characteristics.
Definition: MFrequency.h:161
std::set< Int > getFieldsForScans(const std::set< Int > &scans, Int obsID, Int arrayID) const
get the field IDs associated with the specified scans
std::map< SourceKey, SourceProperties > _getSourceInfo() const
Bool _cacheUpdated(const Float incrementInBytes) const
SHARED_PTR< const std::map< ScanKey, ScanProperties > > _scanProperties
Definition: MSMetaData.h:689
std::map< ScanKey, std::set< SubScanKey > > _getScanToSubScansMap() const
vector< String > getObservers() const
get the contents of the OBSERVER column from the OBSERVATIONS table
std::set< Int > _getScanNumbers(const ArrayKey &arrayKey) const
get all valid scan numbers associated with the specified arrayKey
std::map< Int, std::set< uInt > > getFieldsToSpwsMap() const
get the mapping of fields to spws
SHARED_PTR< ArrayColumn< Bool > > _getFlags() const
void _getFieldsAndTimesMaps(SHARED_PTR< std::map< Int, std::set< Double > > > &fieldToTimesMap, SHARED_PTR< std::map< Double, std::set< Int > > > &timesToFieldMap)
virtual uInt nBaselines(Bool includeAutoCorrelation=False)
get the number of unique baselines represented in the main MS table which in theory can be less than ...
std::map< uInt, Quantity > meanInterval
the key is the spwID, the value is the meanInterval for the subscan and that spwID ...
Definition: MSMetaData.h:90
SHARED_PTR< std::map< SubScanKey, Double > > _unflaggedSubScanNXCRows
Definition: MSMetaData.h:732
static uInt _sizeof(const std::map< Double, MSMetaData::TimeStampProperties > &m)
std::set< Int > _uniqueFieldIDs
Definition: MSMetaData.h:697
const Float _maxCacheMB
Definition: MSMetaData.h:679
vector< Int > getFieldTableSourceIDs() const
Get the FIELD.SOURCE_ID column.
std::map< ScanKey, std::set< uInt > > _scanToSpwsMap
Definition: MSMetaData.h:682
uInt nAntennas() const
get the number of antennas in the ANTENNA table
std::set< uInt > getWVRSpw() const
ALMA-specific.
vector< MDirection > _sourceDirs
Definition: MSMetaData.h:749
SHARED_PTR< Vector< Int > > _getDataDescIDs() const
std::set< ScanKey > scanKeys(const std::set< Int > &scans, const ArrayKey &arrayKey)
construct scan keys given a set of scan numbers and an ArrayKey
vector< QVD > getChanEffectiveBWs(Bool asVelWidths) const
get the effective bandwidth for each channel.
std::map< ScanKey, std::set< uInt > > _scanToDDIDsMap
Definition: MSMetaData.h:682
A class to provide easy read-only access to MSPointing columns.
std::map< Int, std::set< Int > > _fieldToStatesMap
Definition: MSMetaData.h:686
const String _taqlTableName
Definition: MSMetaData.h:733
std::map< String, std::set< ScanKey > > getIntentToScansMap()
void _getFieldsAndIntentsMaps(vector< std::set< String > > &fieldToIntentsMap, std::map< String, std::set< Int > > &intentToFieldsMap)
If there are no intents, then fieldToIntentsMap will be of length nFields() and all of its entries wi...
std::set< Int > getScansForField(const String &field, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field.
std::map< uInt, std::set< uInt > > getBBCNosToSpwMap(SQLDSwitch sqldSwitch)
SHARED_PTR< std::map< Int, uInt > > _fieldToNACRowsMap
Definition: MSMetaData.h:702
double Double
Definition: aipstype.h:55
void _checkScans(const std::set< ScanKey > &scanKeys) const
SHARED_PTR< Vector< Int > > _getScans() const
std::set< Int > getScansForState(Int stateID, Int obsID, Int arrayID) const
get a set of scan numbers for the specified stateID, obsID, and arrayID.
Bool _hasStateID(Int stateID) const
An ArrayKey is a unique combination of observation ID and array ID Negative values are allowed to ind...
Definition: MSKeys.h:89
vector< Double > edgechans
The center frequencies of the two channels at the edges of the window.
Definition: MSMetaData.h:654
void _getScanAndSubScanProperties(SHARED_PTR< const std::map< ScanKey, ScanProperties > > &scanProps, SHARED_PTR< const std::map< SubScanKey, SubScanProperties > > &subScanProps, Bool showProgress) const
SHARED_PTR< std::map< Int, std::set< Double > > > _fieldToTimesMap
Definition: MSMetaData.h:722
void _hasAntennaID(Int antennaID)
static std::map< Int, uInt > _toUIntMap(const Vector< Int > &v)
MDirection getReferenceDirection(const uInt fieldID, const MEpoch &ep=MEpoch(Quantity(0.0, Unit("s")))) const
Get the reference direction for a given field ID and epoch interpolate polynomial if it is the field ...
std::map< ScanKey, std::set< String > > _scanToIntentsMap
Definition: MSMetaData.h:703
vector< uInt > nChans() const
std::set< uInt > getUniqueDataDescIDs() const
get unique data description IDs that exist in the main table
SHARED_PTR< Vector< T > > _getMainScalarColumn(MSMainEnums::PredefinedColumns col) const
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
SHARED_PTR< std::map< SubScanKey, uInt > > _subScanToNXCRowsMap
Definition: MSMetaData.h:701
std::set< Int > getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field ID.
vector< MPosition > _getAntennaPositions() const
Float getCache() const
Definition: MSMetaData.h:540
vector< Quantity > getCenterFreqs() const
uInt nArrays()
get the number of arrays (from the ARRAY table) in the dataset
static void _checkTolerance(const Double tol)
vector< String > getProjects() const
get the contents of the PROJECT column from the OBSERVATIONS table
std::set< Int > _uniqueAntennaIDs
Definition: MSMetaData.h:697
Quantity meanfreq
The sum of all channel frequencies divided by the number of channels.
Definition: MSMetaData.h:647
std::map< uInt, Quantity > getAverageIntervalsForSubScan(const SubScanKey &subScan) const
the first key in the returned map is the spectral window ID, the second is the average interval for t...
void _getScansAndIntentsMaps(std::map< ScanKey, std::set< String > > &scanToIntentsMap, std::map< String, std::set< ScanKey > > &intentToScansMap) const
std::map< SourceKey, SHARED_PTR< vector< MFrequency > > > getRestFrequencies() const
get rest frequencies from the SOURCE table
std::map< std::pair< uInt, uInt >, uInt > _spwPolIDToDataDescIDMap
Definition: MSMetaData.h:687
vector< vector< Int > > getCorrTypes() const
POLARIZATION.CORR_TYPE.
Quantity centerfreq
The mean of the low frequency extent of the lowest frequency channel and the high frequency extend of...
Definition: MSMetaData.h:651
float Float
Definition: aipstype.h:54
Quantities (i.e. dimensioned values)
Definition: MeasValue.h:40
uInt nRows() const
get the number of visibilities
SHARED_PTR< const std::map< SubScanKey, SubScanProperties > > _subScanProperties
Definition: MSMetaData.h:690
A sub scan is a unique combination of observation ID, array ID, scan number, and field ID...
Definition: MSKeys.h:42
vector< QVD > getChanResolutions(Bool asVelWidths) const
get the resolution for each channel.
void _getFieldsAndSpwMaps(std::map< Int, std::set< uInt > > &fieldToSpwMap, vector< std::set< Int > > &spwToFieldMap) const
SHARED_PTR< vector< Double > > _unflaggedFieldNACRows
Definition: MSMetaData.h:731
vector< Double > getBandWidths() const
SHARED_PTR< Vector< Int > > _stateIDs
Definition: MSMetaData.h:699
SHARED_PTR< vector< Double > > _unflaggedFieldNXCRows
Definition: MSMetaData.h:731
const Bool False
Definition: aipstype.h:44
std::map< String, std::set< SubScanKey > > _intentToSubScansMap
Definition: MSMetaData.h:694
void _getScansAndSpwMaps(std::map< ScanKey, std::set< uInt > > &scanToSpwMap, vector< std::set< ScanKey > > &spwToScanMap) const
void _getAntennas(SHARED_PTR< Vector< Int > > &ant1, SHARED_PTR< Vector< Int > > &ant2) const
std::map< String, std::set< ScanKey > > _intentToScansMap
Definition: MSMetaData.h:693
std::set< Int > getFieldIDsForSpw(const uInt spw)
get the set of field IDs corresponding to the specified spectral window.
vector< Int > getNumCorrs() const
number of correlations from the polarization table.
SHARED_PTR< std::map< SubScanKey, Double > > _unflaggedSubScanNACRows
Definition: MSMetaData.h:732
virtual std::set< uInt > getSpwsForIntent(const String &intent)
get a set of spectral windows for which the specified intent applies.
std::set< SubScanKey > getSubScanKeys(const ArrayKey &arrayKey) const
get all sub scan keys for the specified array key.
A Table intended to hold astronomical data (a set of Measurements).
SHARED_PTR< Vector< Int > > _getFieldIDs() const
std::set< Int > getAntennasForScan(const ScanKey &scan) const
get the set of antenna IDs for the specified scan.
std::set< uInt > getSpwsForScan(const ScanKey &scan) const
get the set of spectral windows for the specified scan.
SHARED_PTR< vector< String > > transition
Definition: MSMetaData.h:669
uInt acRows
number of auto-correlation rows
Definition: MSMetaData.h:81
QVD getAntennaDiameters() const
get the antenna diameters
vector< std::set< ScanKey > > getFieldToScansMap() const
get the mapping of field ID to scans
vector< Int > _source_sourceIDs
Definition: MSMetaData.h:739
const vector< const Table * > _taqlTempTable
Definition: MSMetaData.h:734
uInt getAntennaID(const String &antennaName) const
get the antenna ID for the antenna with the specified name.
std::set< Double > getTimesForScan(const ScanKey &scan) const
get the times for the specified scan.
vector< std::set< String > > _fieldToIntentsMap
Definition: MSMetaData.h:705
uInt nFields() const
get the number of fields.
std::set< ArrayKey > _arrayKeys
Definition: MSMetaData.h:741
std::map< uInt, uInt > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:633
Matrix< Bool > getUniqueBaselines()
std::map<Double, Double> getExposuresForTimes() const;
std::set< String > _uniqueIntents
Definition: MSMetaData.h:696
uInt nObservations() const
get the number of observations (from the OBSERVATIONS table) in the dataset
SHARED_PTR< std::map< ScanKey, std::set< Double > > > _scanToTimesMap
Definition: MSMetaData.h:718
A scan is a unique combination of observation ID, array ID, and scan number Negative values are allow...
Definition: MSKeys.h:59
std::map< Int, std::set< Int > > _sourceToFieldsMap
Definition: MSMetaData.h:686
Float getMaxCacheSizeMB() const
max cache size in MB
Definition: MSMetaData.h:411
std::set< Int > _uniqueStateIDs
Definition: MSMetaData.h:697
std::vector< std::map< Int, Quantity > > getFirstExposureTimeMap()
DEPRECATED get a map of data desc ID, scan number pair to exposure time for the first time for that d...
void _getUnflaggedRowStats(Double &nACRows, Double &nXCRows, SHARED_PTR< std::map< SubScanKey, Double > > &subScanToNACRowsMap, SHARED_PTR< std::map< SubScanKey, Double > > &subScanToNXCRowsMap, SHARED_PTR< vector< Double > > &fieldToNACRowsMap, SHARED_PTR< vector< Double > > &fieldToNXCRowsMap) const
static void _modifyFirstExposureTimeIfNecessary(FirstExposureTimeMap &current, const FirstExposureTimeMap &test)
void _getRowStats(uInt &nACRows, uInt &nXCRows, std::map< SubScanKey, uInt > *&subScanToNACRowsMap, std::map< SubScanKey, uInt > *&subScanToNXCRowsMap, std::map< Int, uInt > *&fieldToNACRowsMap, std::map< Int, uInt > *&fieldToNXCRowsMap) const
vector< SpwProperties > _spwInfo
Definition: MSMetaData.h:706
vector< SpwProperties > _getSpwInfo2(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
vector< uInt > _dataDescIDToPolIDMap
Definition: MSMetaData.h:683
SHARED_PTR< std::map< SubScanKey, uInt > > _subScanToNACRowsMap
Definition: MSMetaData.h:701
Bool _forceSubScanPropsToCache
Definition: MSMetaData.h:737
std::set< Int > getFieldsForTimes(Double center, Double tol)
Get the fields which fail into the specified time range (center-tol to center+tol) ...
std::map< ScanKey, std::set< Int > > _scanToAntennasMap
Definition: MSMetaData.h:685
vector< vector< Double > > getEdgeChans()
Quantity getEffectiveTotalExposureTime()
get the effective total exposure time.
vector< vector< String > > _schedules
Definition: MSMetaData.h:712
vector< String > getAntennaStations(const vector< uInt > &antennaIDs=vector< uInt >())
get the antenna stations for the specified antenna IDs
void _checkScan(const ScanKey &key) const
SHARED_PTR< std::set< Int > > _getEphemFieldIDs() const
get the field IDs of ephemeris objects
std::vector< std::set< uInt > > getSpwToDataDescriptionIDMap() const
get a mapping of spectral window ID to data descrption IDs
std::map< Int, std::set< Int > > getFieldsForSourceMap() const
std::set< uInt > getTDMSpw()
ALMA-specific.
std::set< uInt > getSpwsForSubScan(const SubScanKey &subScan) const
get the set of spectral windows for the specified subscan.
std::map< String, std::set< Int > > getIntentToFieldsMap()
SHARED_PTR< Vector< Int > > _observationIDs
Definition: MSMetaData.h:699
vector< uInt > getDataDescIDToSpwMap() const
SHARED_PTR< Vector< Int > > _getObservationIDs() const
vector< MDirection > getPhaseDirs(const MEpoch &ep=MEpoch(Quantity(0.0, Unit("s")))) const
get the phase directions from the FIELD subtable.
static void _createTimeStampRecords(Record &parent, const SubScanProperties &subScanProps)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
std::set< uInt > _sqldSpw
Definition: MSMetaData.h:698
Matrix< Bool > _uniqueBaselines
Definition: MSMetaData.h:728
vector< String > _getStationNames()
SHARED_PTR< const std::map< ScanKey, std::pair< Double, Double > > > getScanToTimeRangeMap() const
get the map of scans to time ranges.
std::set< String > getIntents() const
get all intents, in no particular (nor guaranteed) order.
uInt xcRows
number of cross-correlation rows.
Definition: MSMetaData.h:83
vector< std::set< ScanKey > > _spwToScansMap
Definition: MSMetaData.h:708
std::set< ScanKey > getScanKeys() const
get all ScanKeys in the dataset
ScanKey scanKey(const SubScanKey &subScanKey)
create a ScanKey from a SubScanKey, just omits the SubScanKey&#39;s fieldID
Definition: MSKeys.h:66
vector< String > _antennaNames
Definition: MSMetaData.h:710
SHARED_PTR< Quantum< Vector< Double > > > _getExposureTimes() const
SHARED_PTR< Vector< Int > > _getArrayIDs() const
std::set< String > getFieldNamesForSpw(const uInt spw)
get the set of field names corresponding to the specified spectral window.
SHARED_PTR< const map< SubScanKey, SubScanProperties > > _generateSubScanPropsIfWanted() const
if _subScanProperties has been generated, just return it.
SHARED_PTR< Vector< Double > > _getTimes() const
vector< MFrequency > getRefFreqs() const
void _setObservation(const MeasurementSet &ms)
set metadata from OBSERVATION table
const MeasurementSet * getMS() const
Definition: MSMetaData.h:617
std::map< ArrayKey, std::set< SubScanKey > > _getArrayKeysToSubScanKeys() const
vector< String > _stationNames
Definition: MSMetaData.h:710
std::set< uInt > getSQLDSpw()
ALMA-specific.
vector< MPosition > getAntennaPositions(const vector< uInt > &which=std::vector< uInt >(0)) const
get the positions of the specified antennas.
MPosition getObservatoryPosition(uInt which) const
get the position of the specified telescope (observatory).
vector< String > getAntennaNames(std::map< String, uInt > &namesToIDsMap, const vector< uInt > &antennaIDs=vector< uInt >(0)) const
get the name of the antenna for the specified antenna ID
Bool hasBBCNo() const
std::map< SourceKey, SHARED_PTR< vector< String > > > getTransitions() const
get the transitions from the SOURCE table.
QVD getAntennaOffset(uInt which)
get the position of the specified antenna relative to the observatory position.
vector< String > _fieldCodes
Definition: MSMetaData.h:710
pair< std::map< ScanKey, ScanProperties >, std::map< SubScanKey, SubScanProperties > > _getChunkSubScanProperties(SHARED_PTR< const Vector< Int > > scans, SHARED_PTR< const Vector< Int > > fields, SHARED_PTR< const Vector< Int > > ddIDs, SHARED_PTR< const Vector< Int > > states, SHARED_PTR< const Vector< Double > > times, SHARED_PTR< const Vector< Int > > arrays, SHARED_PTR< const Vector< Int > > observations, SHARED_PTR< const Vector< Int > > ant1, SHARED_PTR< const Vector< Int > > ant2, SHARED_PTR< const Quantum< Vector< Double > > > exposureTimes, SHARED_PTR< const Quantum< Vector< Double > > > intervalTimes, const vector< uInt > &ddIDToSpw, uInt beginRow, uInt endRow) const
Uses openmp for parallel processing.
std::map< ScanKey, FirstExposureTimeMap > getScanToFirstExposureTimeMap(Bool showProgress) const
get map of scans to first exposure times
void _checkField(uInt fieldID) const
SHARED_PTR< const map< ScanKey, ScanProperties > > _generateScanPropsIfWanted() const
if _scanProps has been generated, just return it.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
uInt nSpw(Bool includewvr) const
get number of spectral windows
vector< std::set< Int > > _spwToFieldIDsMap
Definition: MSMetaData.h:707
SHARED_PTR< vector< MFrequency > > restfreq
Definition: MSMetaData.h:668
const std::set< Int > & getUniqueAntennaIDs() const
get the unique antennas (the union of the ANTENNA_1 and ANTENNA_2 columns) from the main table ...
std::set< Double > getTimesForField(Int fieldID)
get the times for which the specified field was observed
SHARED_PTR< std::map< Double, std::set< Int > > > _timeToFieldsMap
Definition: MSMetaData.h:723
unsigned int uInt
Definition: aipstype.h:51
std::set< uInt > _fdmSpw
Definition: MSMetaData.h:698
vector< SpwProperties > _getSpwInfo(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
void setShowProgress(Bool b)
Definition: MSMetaData.h:619
void _createSubScanRecords(Record &parent, uInt &scanNRows, std::set< Int > &antennasForScan, const ScanKey &scanKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
std::set< Double > getTimesForScans(std::set< ScanKey > scans) const
Get the times for the specified scans.
vector< Array< Int > > getCorrProducts() const
POLARIZATION.CORR_PRODUCT.
SHARED_PTR< std::set< Int > > _ephemFields
Definition: MSMetaData.h:754
std::map< std::pair< uInt, uInt >, uInt > getSpwIDPolIDToDataDescIDMap() const
The first value of the pair is spw, the second is polarization ID.