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