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