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