casa  5.7.0-16
 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, 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 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  uInt nRows() const;
249 
250  uInt nRows(CorrelationType cType);
251 
252  std::shared_ptr<const std::map<SubScanKey, uInt> > getNRowMap(CorrelationType type) const;
253 
254  uInt nRows(
255  CorrelationType cType, Int arrayID, Int observationID,
256  Int scanNumber, Int fieldID
257  ) const;
258 
259  uInt 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  std::map<uInt, std::set<uInt> > getBBCNosToSpwMap(SQLDSwitch sqldSwitch);
401 
402  vector<vector<Double> > getEdgeChans();
403  //Get the phase direction for a given field id and epoch
404  //interpolate polynomial if it is the field id is such or use ephemerides table
405  //if that is attached to that field id
407  const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const ;
408 
409  // Get the reference direction for a given field ID and epoch interpolate
410  // polynomial if it is the field ID is such or use ephemerides table
411  // if that is attached to that field ID
413  const uInt fieldID,
414  const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))
415  ) const;
416 
417  // get the field IDs for the specified field name. Case insensitive.
418  std::set<Int> getFieldIDsForField(const String& field) const;
419 
420  // get a list of the field names in the order in which they appear in the
421  // FIELD table.
422  vector<String> getFieldNames() const;
423 
424  // get field IDs associated with the specified scan number.
425  std::set<Int> getFieldsForScan(const ScanKey& scan) const;
426 
427  // get the field IDs associated with the specified scans
428  std::set<Int> getFieldsForScans(
429  const std::set<Int>& scans, Int obsID, Int arrayID
430  ) const;
431 
432  // get the field IDs associated with the specified scans
433  std::set<Int> getFieldsForScans(const std::set<ScanKey>& scans) const;
434 
435  // get the field IDs associated with the specified intent.
436  std::set<Int> getFieldsForIntent(const String& intent);
437 
438  // get the field IDs associated with the specified source.
439  std::set<Int> getFieldsForIntent(uInt sourceID) const;
440 
441  std::map<Int, std::set<Int> > getFieldsForSourceMap() const;
442 
443  std::map<Int, std::set<String> > getFieldNamesForSourceMap() const;
444 
445  // get the field names associated with the specified field IDs. If <src>fieldIDs</src>
446  // is empty, a vector of all the field names is returned.
447  vector<String> getFieldNamesForFieldIDs(const vector<uInt>& fieldIDs);
448 
449  // Get the fields which fail into the specified time range (center-tol to center+tol)
450  std::set<Int> getFieldsForTimes(Double center, Double tol);
451 
452  // max cache size in MB
453  Float getMaxCacheSizeMB() const { return _maxCacheMB; }
454 
455  // get telescope names in the order they are listed in the OBSERVATION table. These are
456  // the telescopes (observatories), not the antenna names.
457  vector<String> getObservatoryNames();
458 
459  // get the position of the specified telescope (observatory).
461 
462  // get the phase directions from the FIELD subtable. The <src>ep</src> parameter
463  // specifies for which epoch to return the directions of any ephemeris objects
464  // in the data set. It is ignored for non-ephemeris objects.
465  vector<MDirection> getPhaseDirs(const MEpoch& ep=MEpoch(Quantity(0.0, Unit("s")))) const;
466 
467  // get all ScanKeys in the dataset
468  std::set<ScanKey> getScanKeys() const;
469 
470  // get all ScanKeys in the dataset that have the specified <src>arrayKey</src>.
471  // If negative values for either the obsID and/or arrayID portions of the ArrayKey
472  // indicate that all obsIDs and/or arrayIDs should be used.
473  std::set<ScanKey> getScanKeys(const ArrayKey& arrayKey) const;
474 
475  // get the scans associated with the specified intent
476  std::set<Int> getScansForIntent(
477  const String& intent, Int obsID, Int arrayID
478  ) const;
479 
480  // get the scan numbers associated with the specified field ID.
481  std::set<Int> getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const;
482 
483  // get the scan numbers associated with the specified field. Subclasses should not implement or override.
484  std::set<Int> getScansForField(const String& field, Int obsID, Int arrayID) const;
485 
486  // The first value of the pair is spw, the second is polarization ID.
487  std::map<std::pair<uInt, uInt>, uInt> getSpwIDPolIDToDataDescIDMap() const;
488 
489  // get a map of the spwIDs to spw names from the spw table
490  vector<String> getSpwNames() const;
491 
492  // get all the spws associated with the data description IDs listed in the main table.
493  // This will not correspond to a list of the row numbers in the SPECTRAL_WINDOW table
494  // if there are data description IDs that are not in the main table.
495  std::set<uInt> getSpwIDs() const;
496 
497  // get all sub scan keys for the specified array key.
498  std::set<SubScanKey> getSubScanKeys(const ArrayKey& arrayKey) const;
499 
500  // get the sub scan properties for the specified sub scan.
501 
502  SubScanProperties getSubScanProperties(
503  const SubScanKey& subScan, Bool showProgress=False
504  ) const;
505 
506  std::shared_ptr<const std::map<SubScanKey, SubScanProperties> > getSubScanProperties(
507  Bool showProgress=False
508  ) const;
509 
510  // If True, force the subscan properties structure to be
511  // cached regardless of the stipulations on the maximum cache. Normally,
512  // the subscan properties structure is small compared to the size of any
513  // one column that is necessary to create it, and since creating this
514  // structure can be very expensive, especially for large datasets, it
515  // is often a good idea to cache it if it will be accessed many times.
517 
518  // get a data structure, consumable by users, representing a summary of the dataset
519  Record getSummary() const;
520 
521  // get the times for which the specified field was observed
522  std::set<Double> getTimesForField(Int fieldID);
523 
524  // get the time stamps associated with the specified intent
525  std::set<Double> getTimesForIntent(const String& intent) const;
526  Bool hasBBCNo() const;
527 
528  //std::map<Double, Double> getExposuresForTimes() const;
529 
530  // get the unique baselines in the MS. These are not necessarily every combination of the
531  // n(n-1)/2 possible antenna pairs, but rather the number of unique baselines represented in
532  // the main MS table, which in theory can be less than n(n-1)/2 (for example if samples for
533  // certain antenna pairs are not recorded. The returned Matrix is nAnts x nAnts in size. Pairs
534  // that are true represent baselines represented in the main MS table.
536 
537  // get the number of unique baselines represented in the main MS table which in theory can be
538  // less than n*(n-1)/2. If <src>includeAutoCorrelation</src> is True, include autocorrelation
539  // "baselines" in the enumeration.
540  virtual uInt nBaselines(Bool includeAutoCorrelation=False);
541 
542  // get the effective total exposure time. This is the effective time spent collecting unflagged data.
544 
545  // get the number of scans in the dataset
546  uInt nScans();
547 
548  // get the number of observations (from the OBSERVATIONS table) in the dataset
549  uInt nObservations() const;
550 
551  // get the contents of the OBSERVER column from the OBSERVATIONS table
552  vector<String> getObservers() const;
553 
554  // get the contents of the PROJECT column from the OBSERVATIONS table
555  vector<String> getProjects() const;
556 
557  // get the contents of the SCHEDULE column from the OBSERVATIONS table
558  // Note that the embedded vectors may have different lengths
559  vector<vector<String> > getSchedules() const;
560 
561  // get the time ranges from the OBSERVATION table
562  vector<std::pair<MEpoch, MEpoch> > getTimeRangesOfObservations() const;
563 
564  // get the number of arrays (from the ARRAY table) in the dataset
565  uInt nArrays();
566 
567  // get the number of data description IDs (from the DATA_DESCRIPTION table)
568  uInt nDataDescriptions() const;
569 
570  // get the number of unflagged rows
571  Double nUnflaggedRows() const;
572 
574 
576  CorrelationType cType, Int arrayID, uInt observationID,
577  Int scanNumber, uInt fieldID
578  ) const;
579 
580  Double nUnflaggedRows(CorrelationType cType, Int fieldID) const;
581 
582  inline Float getCache() const { return _cacheMB;}
583 
584  vector<Double> getBandWidths() const;
585 
586  vector<Quantity> getCenterFreqs() const;
587 
588  // get the effective bandwidth for each channel. Each element in
589  // the returned vector represents a separate spectral window, with
590  // ID given by its location in the vector. If asVelWidths is True,
591  // convert the values to velocity widths.
592  vector<QVD> getChanEffectiveBWs(Bool asVelWidths) const;
593 
594  vector<QVD > getChanFreqs() const;
595 
596  // get the resolution for each channel. Each element in
597  // the returned vector represents a separate spectral window, with
598  // ID given by its location in the vector. If asVelWidths is True,
599  // convert the values to velocity widths.
600  vector<QVD> getChanResolutions(Bool asVelWidths) const;
601 
602  vector<QVD > getChanWidths() const;
603 
604  vector<Quantity> getMeanFreqs() const;
605 
606  vector<Int> getNetSidebands() const;
607 
608  vector<MFrequency> getRefFreqs() const;
609 
610  vector<uInt> nChans() const;
611 
612  uInt nPol();
613 
614  // DEPRECATED
615  // get a map of data desc ID, scan number pair to exposure time for the first time
616  // for that data desc ID, scan number pair
617  std::vector<std::map<Int, Quantity> > getFirstExposureTimeMap();
618 
619  // get map of scans to first exposure times
620  std::map<ScanKey, FirstExposureTimeMap> getScanToFirstExposureTimeMap(Bool showProgress) const;
621 
622  // get polarization IDs for the specified scan and spwid
623  std::set<uInt> getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const;
624 
625  // get the unique antennas (the union of the ANTENNA_1 and ANTENNA_2 columns) from
626  // the main table
627  const std::set<Int>& getUniqueAntennaIDs() const;
628 
629  // get unique data description IDs that exist in the main table
630  std::set<uInt> getUniqueDataDescIDs() const;
631 
632  // DEPRECATED because of spelling error. Use getUniqueFieldIDs()
633  // instead.
634  inline std::set<Int> getUniqueFiedIDs() const {
635  return getUniqueFieldIDs();
636  }
637 
638  // get unique field IDs that exist in the main table.
639  std::set<Int> getUniqueFieldIDs() const;
640 
641  // get the pointing directions associated with antenna1 and antenna2 for
642  // the specified row of the main MS table
643  std::pair<MDirection, MDirection> getPointingDirection(
644  Int& ant1, Int& ant2, Double& time, uInt row,
645  Bool interpolate=false, Int initialguess=0
646  ) const;
647 
648  // get the time range for the entire dataset. min(TIME(x) - 0.5*INTERVAL(x)) to
649  // max(TIME(x) + 0.5*INTERVAL(x))
650  std::pair<Double, Double> getTimeRange(Bool showProgress=False) const;
651 
652  // Number of unique values from SOURCE.SOURCE_ID
654 
655  // get the unique spectral window IDs represented by the data description
656  // IDs that appear in the main table
657  std::set<uInt> getUniqueSpwIDs() const;
658 
659  const MeasurementSet* getMS() const { return _ms; }
660 
662 
663  // get statistics related to the values of the INTERVAL column. Returned
664  // values are in seconds. All values in this column are used in the computation,
665  // including those which associated row flags may be set.
666  ColumnStats getIntervalStatistics() const;
667 
668 private:
669 
670  struct ScanProperties {
671  // The Int represents the data description ID,
672  // The Double represents the time of the first time stamp,
673  // The Quantity represents the exposure time for the corresponding
674  // data description ID and time stamp
676  // the key is the spwID, the value is the meanInterval for
677  // the subscan and that spwID
678  std::map<uInt, Quantity> meanInterval;
679  // number of rows for each spectral window
680  std::map<uInt, uInt> spwNRows;
681  // time range (which takes into account helf of the corresponding
682  // interval, which is not accounted for in the SubScanProperties times
683  std::pair<Double, Double> timeRange;
684  // times for each spectral window
685  std::map<uInt, std::set<Double> > times;
686  };
687 
688  struct SpwProperties {
693  // The sum of all channel frequencies divided by the number of channels
695  // The mean of the low frequency extent of the lowest frequency channel and
696  // the high frequency extend of the highest frequency channel. Often, but not
697  // necessarily, the same as meanfreq
700  // The center frequencies of the two channels at the edges of the window
701  vector<Double> edgechans;
703  // from the REF_FREQUENCY column
706  // EFFECTIVE_BANDWIDTH
708  // RESOLUTION
710  };
711 
712  // represents non-primary key data for a SOURCE table row
715  std::shared_ptr<vector<MFrequency> > restfreq;
716  std::shared_ptr<vector<String> > transition;
717  };
718 
719  // The general pattern is that a mutable gets set only once, on demand, when its
720  // setter is called for the first time. If this pattern is broken, defective behavior
721  // will occur.
722 
725  mutable Float _cacheMB;
729  mutable std::map<ScanKey, std::set<uInt> > _scanToSpwsMap, _scanToDDIDsMap;
731  mutable std::map<Int, std::set<uInt> > _fieldToSpwMap;
732  mutable std::map<ScanKey, std::set<Int> > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap;
733  mutable std::map<Int, std::set<Int> > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap;
734  mutable std::map<std::pair<uInt, uInt>, uInt> _spwPolIDToDataDescIDMap;
735  mutable std::map<String, std::set<uInt> > _antennaNameToIDMap;
736  mutable std::shared_ptr<const std::map<ScanKey, ScanProperties> > _scanProperties;
737  mutable std::shared_ptr<const std::map<SubScanKey, SubScanProperties> > _subScanProperties;
738 
739  mutable std::map<String, std::set<Int> > _intentToFieldIDMap;
740  mutable std::map<String, std::set<ScanKey> > _intentToScansMap;
741  mutable std::map<String, std::set<SubScanKey> > _intentToSubScansMap;
742  mutable std::map<std::pair<ScanKey, uInt>, std::set<uInt> > _scanSpwToPolIDMap;
743  mutable std::set<String> _uniqueIntents;
746  mutable std::shared_ptr<std::map<SubScanKey, uInt> > _subScanToNACRowsMap, _subScanToNXCRowsMap;
747  mutable std::shared_ptr<std::map<Int, uInt> > _fieldToNACRowsMap, _fieldToNXCRowsMap;
748  mutable std::map<ScanKey, std::set<String> > _scanToIntentsMap;
749  mutable std::shared_ptr<const std::map<SubScanKey, std::set<String> > > _subScanToIntentsMap;
750  mutable vector<std::set<String> > _stateToIntentsMap, _spwToIntentsMap, _fieldToIntentsMap;
751  mutable vector<SpwProperties> _spwInfo;
752  mutable vector<std::set<Int> > _spwToFieldIDsMap, _obsToArraysMap;
753  mutable vector<std::set<ScanKey> > _spwToScansMap, _ddidToScansMap, _fieldToScansMap;
754 
755  mutable vector<String> _fieldNames, _antennaNames, _observatoryNames,
757  mutable vector<vector<String> > _schedules;
758  mutable vector<vector<Int> > _corrTypes;
759  mutable vector<Array<Int> >_corrProds;
760 
761  mutable std::shared_ptr<std::map<ScanKey, std::set<Double> > > _scanToTimesMap;
762  std::map<String, std::set<uInt> > _intentToSpwsMap;
763  mutable std::map<String, std::set<Double> > _intentToTimesMap;
764 
765  std::shared_ptr<std::map<Int, std::set<Double> > > _fieldToTimesMap;
766  std::shared_ptr<std::map<Double, std::set<Int> > > _timeToFieldsMap;
767 
768  mutable vector<MPosition> _observatoryPositions, _antennaPositions;
769  mutable vector<QVD > _antennaOffsets;
774  mutable std::shared_ptr<vector<Double> > _unflaggedFieldNACRows, _unflaggedFieldNXCRows;
775  mutable std::shared_ptr<std::map<SubScanKey, Double> > _unflaggedSubScanNACRows, _unflaggedSubScanNXCRows;
777  const vector<const Table*> _taqlTempTable;
778 
780  vector<std::map<Int, Quantity> > _firstExposureTimeMap;
782 
783  mutable std::set<ArrayKey> _arrayKeys;
784  mutable std::set<ScanKey> _scanKeys;
785  mutable std::set<SubScanKey> _subscans;
786  mutable std::map<ScanKey, std::set<SubScanKey> > _scanToSubScans;
787  mutable std::map<ArrayKey, std::set<SubScanKey> > _arrayToSubScans;
788 
789  mutable vector<std::pair<MEpoch, MEpoch> > _timeRangesForObs;
790 
791  mutable vector<MDirection> _phaseDirs, _sourceDirs;
792 
793  mutable vector<std::pair<Quantity, Quantity> > _properMotions;
794 
795  mutable std::map<SourceKey, SourceProperties> _sourceInfo;
796  mutable std::shared_ptr<std::set<Int> > _ephemFields;
797  mutable std::shared_ptr<const Quantum<Vector<Double> > > _sourceTimes;
798 
799  // disallow copy constructor and = operator
800  MSMetaData(const MSMetaData&);
802 
803  // This comment from thunter in the original ValueMapping python class
804  // # Determine the number of polarizations for the first OBSERVE_TARGET intent.
805  // # Used by plotbandpass for BPOLY plots since the number of pols cannot be inferred
806  // # correctly from the caltable alone. You cannot not simply use the first row, because
807  // # it may be a pointing scan which may have different number of polarizations than what
808  // # the TARGET and BANDPASS calibrator will have.
809  // # -- T. Hunter
810  // uInt _getNumberOfPolarizations();
811 
812  void _setSpwInfo(const MeasurementSet& ms);
813 
814  // set metadata from OBSERVATION table
815  void _setObservation(const MeasurementSet& ms);
816 
817  Bool _cacheUpdated(const Float incrementInBytes) const;
818 
819  void _checkField(uInt fieldID) const;
820 
821  void _checkScan(const ScanKey& key) const;
822 
823  void _checkScans(const std::set<ScanKey>& scanKeys) const;
824 
825  void _checkSubScan(const SubScanKey& key) const;
826 
827  static void _checkTolerance(const Double tol);
828 
830  std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
831  std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
832  Bool showProgress
833  ) const;
834 
835  static void _getScalarIntColumn(
836  Vector<Int>& v, TableProxy& table, const String& colname,
837  Int beginRow, Int nrows
838  );
839 
840  static void _getScalarDoubleColumn(
841  Vector<Double>& v, TableProxy& table, const String& colname,
842  Int beginRow, Int nrows
843  );
844 
845  static void _getScalarQuantDoubleColumn(
846  Quantum<Vector<Double> >& v, TableProxy& table, const String& colname,
847  Int beginRow, Int nrows
848  );
849 
850  void _mergeScanProps(
851  std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
852  std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
853  const std::vector<
854  std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
855  >& props
856  ) const;
857 
858  void _createScanRecords(
859  Record& parent, const ArrayKey& arrayKey,
860  const std::map<SubScanKey, SubScanProperties>& subScanProps
861  ) const;
862 
864  Record& parent, uInt& scanNRows, std::set<Int>& antennasForScan,
865  const ScanKey& scanKey, const std::map<SubScanKey, SubScanProperties>& subScanProps
866  ) const;
867 
868  static void _createTimeStampRecords(
869  Record& parent,
870  const SubScanProperties& subScanProps
871  );
872 
873  // convert a QVD in frequency units to velocity units using
874  // the give reference frequency. No explicit checking is done
875  // for unit correctness of the inputs.
876  static QVD _freqWidthToVelWidth(const QVD& v, const Quantity& refFreq);
877 
878  // if _scanProps has been generated, just return it. If the caller has
879  // configured the object to generate _scanProps at some point, this call will
880  // generate it. Otherwise, the returned object contains a null pointer.
881  std::shared_ptr<const std::map<ScanKey, ScanProperties> > _generateScanPropsIfWanted() const;
882 
883  // if _subScanProperties has been generated, just return it. If
884  // the caller has configured the object to generate _subScanPropertiess
885  // at some point, this call will generate it. Otherwise, the returned object
886  // contains a null pointer.
887  std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >
889 
890  vector<String> _getAntennaNames(
891  std::map<String, std::set<uInt> >& namesToIDsMap
892  ) const;
893 
894  vector<MPosition> _getAntennaPositions() const;
895 
896  void _getAntennas(
897  std::shared_ptr<Vector<Int> >& ant1,
898  std::shared_ptr<Vector<Int> >& ant2
899  ) const;
900 
901  std::shared_ptr<Vector<Int> > _getArrayIDs() const;
902 
903  std::map<ArrayKey, std::set<SubScanKey> > _getArrayKeysToSubScanKeys() const;
904 
905  // Uses openmp for parallel processing
906  std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
908  const Vector<Int>& scans, const Vector<Int>& fields,
909  const Vector<Int>& ddIDs, const Vector<Int>& states,
910  const Vector<Double>& times, const Vector<Int>& arrays,
911  const Vector<Int>& observations, const Vector<Int>& ant1,
912  const Vector<Int>& ant2, const Quantum<Vector<Double> >& exposureTimes,
913  const Quantum<Vector<Double> >& intervalTimes, const vector<uInt>& ddIDToSpw,
914  uInt beginRow, uInt endRow
915  ) const;
916 
917  std::shared_ptr<Vector<Int> > _getDataDescIDs() const;
918 
919  // get the field IDs of ephemeris objects
920  std::shared_ptr<std::set<Int> > _getEphemFieldIDs() const;
921 
922  std::shared_ptr<Quantum<Vector<Double> > > _getExposureTimes() const;
923 
924  std::shared_ptr<Vector<Int> > _getFieldIDs() const;
925 
926  // If there are no intents, then fieldToIntentsMap will be of length
927  // nFields() and all of its entries will be the empty set, and
928  // intentToFieldsMap will be empty
930  vector<std::set<String> >& fieldToIntentsMap,
931  std::map<String, std::set<Int> >& intentToFieldsMap
932  );
933 
935  vector<std::set<ScanKey> >& fieldToScansMap,
936  std::map<ScanKey, std::set<Int> >& scanToFieldsMap
937  ) const;
938 
940  std::map<Int, std::set<uInt> >& fieldToSpwMap,
941  vector<std::set<Int> >& spwToFieldMap
942  ) const;
943 
945  std::map<Int, std::set<Int> >& fieldToStatesMap,
946  std::map<Int, std::set<Int> >& stateToFieldsMap
947  );
948 
950  std::shared_ptr<std::map<Int, std::set<Double> > >& fieldToTimesMap,
951  std::shared_ptr<std::map<Double, std::set<Int> > >& timesToFieldMap
952  );
953 
954  std::shared_ptr<ArrayColumn<Bool> > _getFlags() const;
955 
956  std::map<String, std::set<Double> > _getIntentsToTimesMap() const;
957 
958  std::shared_ptr<Quantum<Vector<Double> > > _getIntervals() const;
959 
960  std::shared_ptr<Vector<Int> > _getObservationIDs() const;
961 
962  std::shared_ptr<Vector<Int> > _getScans() const;
963 
964  vector<std::set<String> > _getSpwToIntentsMap();
965 
966  std::shared_ptr<Vector<Int> > _getStateIDs() const;
967 
968  std::shared_ptr<Vector<Double> > _getTimes() const;
969 
970  //std::shared_ptr<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;
971 
972  Bool _hasIntent(const String& intent) const;
973 
974  Bool _hasFieldID(Int fieldID) const;
975 
976  Bool _hasStateID(Int stateID) const;
977 
978  void _hasAntennaID(Int antennaID);
979 
980  std::map<Double, Double> _getTimeToTotalBWMap(
981  const Vector<Double>& times, const Vector<Int>& ddIDs
982  );
983 
985  const ROMSPointingColumns& pCols, const Int& index,
986  const Double& time
987  ) const;
988 
989  //map<SubScanKey, Quantity> _getMeanExposureTimes() const;
990 
991  vector<std::set<Int> > _getObservationIDToArrayIDsMap() const;
992 
993  vector<MPosition> _getObservatoryPositions();
994 
995  void _getRowStats(
996  uInt& nACRows, uInt& nXCRows,
997  std::map<SubScanKey, uInt>*& subScanToNACRowsMap,
998  std::map<SubScanKey, uInt>*& subScanToNXCRowsMap,
999  std::map<Int, uInt>*& fieldToNACRowsMap,
1000  std::map<Int, uInt>*& fieldToNXCRowsMap
1001  ) const;
1002 
1003  void _getRowStats(
1004  uInt& nACRows, uInt& nXCRows,
1005  std::shared_ptr<std::map<SubScanKey, uInt> >& scanToNACRowsMap,
1006  std::shared_ptr<std::map<SubScanKey, uInt> >& scanToNXCRowsMap,
1007  std::shared_ptr<std::map<Int, uInt> >& fieldToNACRowsMap,
1008  std::shared_ptr<std::map<Int, uInt> >& fieldToNXCRowsMap
1009  ) const;
1010 
1011  // get scan properties
1012  std::shared_ptr<const std::map<ScanKey, MSMetaData::ScanProperties> > _getScanProperties(
1013  Bool showProgress
1014  ) const;
1015 
1016  // get the scan keys in the specified set that have the associated arrayKey
1017  std::set<ScanKey> _getScanKeys(
1018  const std::set<ScanKey>& scanKeys, const ArrayKey& arrayKey
1019  ) const;
1020 
1021  // get all valid scan numbers associated with the specified arrayKey
1022  std::set<Int> _getScanNumbers(const ArrayKey& arrayKey) const;
1023 
1024  void _getScansAndDDIDMaps(
1025  std::map<ScanKey, std::set<uInt> >& scanToDDIDMap,
1026  vector<std::set<ScanKey> >& ddIDToScanMap
1027  ) const;
1028 
1030  std::map<ScanKey, std::set<String> >& scanToIntentsMap,
1031  std::map<String, std::set<ScanKey> >& intentToScansMap
1032  ) const;
1033 
1034  void _getScansAndSpwMaps(
1035  std::map<ScanKey, std::set<uInt> >& scanToSpwMap,
1036  vector<std::set<ScanKey> >& spwToScanMap
1037  ) const;
1038 
1039  std::map<ScanKey, std::set<Int> > _getScanToAntennasMap() const;
1040 
1041  std::map<ScanKey, std::set<SubScanKey> > _getScanToSubScansMap() const;
1042 
1043  std::shared_ptr<std::map<ScanKey, std::set<Double> > > _getScanToTimesMap() const;
1044 
1045  std::map<SourceKey, SourceProperties> _getSourceInfo() const;
1046 
1047  vector<SpwProperties> _getSpwInfo(
1048  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw,
1049  std::set<uInt>& fdmSpw, std::set<uInt>& wvrSpw,
1050  std::set<uInt>& sqldSpw
1051  ) const;
1052 
1054  vector<std::set<String> >& spwToIntentsMap,
1055  std::map<String, std::set<uInt> >& intentToSpwsMap
1056  );
1057 
1058  vector<SpwProperties> _getSpwInfo2(
1059  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw, std::set<uInt>& fdmSpw,
1060  std::set<uInt>& wvrSpw, std::set<uInt>& sqldSpw
1061  ) const;
1062 
1063  void _getStateToIntentsMap(
1064  vector<std::set<String> >& statesToIntentsMap,
1065  std::set<String>& uniqueIntents
1066  ) const;
1067 
1068  vector<String> _getStationNames();
1069 
1071  std::shared_ptr<const std::map<SubScanKey, std::set<String> > >& subScanToIntentsMap,
1072  std::map<String, std::set<SubScanKey> >& intentToSubScansMap
1073  ) const;
1074 
1076  std::shared_ptr<const std::map<ScanKey, ScanProperties> >& scanProps,
1077  std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >& subScanProps,
1078  Bool showProgress
1079  ) const;
1080 
1081  std::set<SubScanKey> _getSubScanKeys() const;
1082 
1083  // get subscans related to the given scan
1084  std::set<SubScanKey> _getSubScanKeys(const ScanKey& scanKey) const;
1085 
1086  void _getUnflaggedRowStats(
1087  Double& nACRows, Double& nXCRows,
1088  std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNACRowsMap,
1089  std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNXCRowsMap,
1090  std::shared_ptr<vector<Double> >& fieldToNACRowsMap,
1091  std::shared_ptr<vector<Double> >& fieldToNXCRowsMap
1092  ) const;
1093 
1094  void _getUnflaggedRowStats(
1095  Double& nACRows, Double& nXCRows,
1096  vector<Double>*& fieldNACRows, vector<Double>*& fieldNXCRows,
1097  std::map<SubScanKey, Double>*& scanNACRows,
1098  std::map<SubScanKey, Double>*& scanNXCRows
1099  ) const;
1100 
1102  FirstExposureTimeMap& current, const FirstExposureTimeMap& test
1103  );
1104 
1106  FirstExposureTimeMap& current, Int dataDescID,
1107  Double time, Double exposure, const Unit& eunit
1108  );
1109 
1110  static uInt _sizeof(const std::map<Double, MSMetaData::TimeStampProperties> & m);
1111 
1112  template <class T>
1113  static uInt _sizeof(const std::map<T, std::set<String> >& m);
1114 
1115  template <class T, class U>
1116  static uInt _sizeof(const std::map<T, std::set<U> >& m);
1117 
1118  template <class T, class U>
1119  static uInt _sizeof(const std::map<T, U>& m);
1120 
1121  static uInt _sizeof(const vector<std::set<String> >& m);
1122 
1123  static uInt _sizeof(const vector<String>& m);
1124 
1125  static uInt _sizeof(const vector<vector<String> >& m);
1126 
1127  template <class T>
1128  static uInt _sizeof(const vector<T>& v);
1129 
1130  static uInt _sizeof(const Quantum<Vector<Double> >& m);
1131 
1132  template <class T>
1133  static uInt _sizeof(const vector<std::set<T> >& v);
1134 
1135  template <class T> static uInt _sizeof(const std::map<String, std::set<T> >& map);
1136 
1137  static uInt _sizeof(const vector<std::map<Int, Quantity> >& map);
1138 
1139  static uInt _sizeof(const std::map<std::pair<Int, uInt>, std::set<uInt> >& map);
1140 
1141  static std::map<Int, uInt> _toUIntMap(const Vector<Int>& v);
1142 
1143  template <class T> std::shared_ptr<Vector<T> > _getMainScalarColumn(
1145  ) const;
1146 
1147 };
1148 
1149 
1150 
1151 }
1152 
1153 #endif
std::shared_ptr< const std::map< SubScanKey, std::set< String > > > _subScanToIntentsMap
Definition: MSMetaData.h:749
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:704
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...
void _getRowStats(uInt &nACRows, uInt &nXCRows, std::map< SubScanKey, uInt > *&subScanToNACRowsMap, std::map< SubScanKey, uInt > *&subScanToNXCRowsMap, std::map< Int, uInt > *&fieldToNACRowsMap, std::map< Int, uInt > *&fieldToNXCRowsMap) const
vector< std::set< Int > > _obsToArraysMap
Definition: MSMetaData.h:752
int Int
Definition: aipstype.h:50
std::set< SubScanKey > _subscans
Definition: MSMetaData.h:785
void setForceSubScanPropsToCache(Bool b)
If True, force the subscan properties structure to be cached regardless of the stipulations on the ma...
Definition: MSMetaData.h:516
vector< String > getSpwNames() const
get a map of the spwIDs to spw names from the spw table
std::set< uInt > _avgSpw
Definition: MSMetaData.h:745
vector< vector< Int > > _corrTypes
Definition: MSMetaData.h:758
vector< uInt > _dataDescIDToSpwMap
Definition: MSMetaData.h:730
vector< MPosition > _observatoryPositions
Definition: MSMetaData.h:768
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
vector< MPosition > _getObservatoryPositions()
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:762
std::shared_ptr< std::map< Int, uInt > > _fieldToNXCRowsMap
Definition: MSMetaData.h:747
std::map< Int, std::set< Int > > _stateToFieldsMap
Definition: MSMetaData.h:733
std::map< Double, TimeStampProperties > timeProps
Definition: MSMetaData.h:113
uInt nSpw(Bool includewvr) const
get number of spectral windows
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1537
std::map< ScanKey, std::set< SubScanKey > > _getScanToSubScansMap() const
vector< MDirection > _phaseDirs
Definition: MSMetaData.h:791
std::map< SourceKey, SourceProperties > _sourceInfo
Definition: MSMetaData.h:795
std::map< String, std::set< Int > > _intentToFieldIDMap
Definition: MSMetaData.h:739
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
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:793
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:786
std::shared_ptr< std::map< Int, uInt > > _fieldToNACRowsMap
Definition: MSMetaData.h:747
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:753
std::map< ScanKey, std::set< Int > > _scanToFieldsMap
Definition: MSMetaData.h:732
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.
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:745
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.
static void _getScalarIntColumn(Vector< Int > &v, TableProxy &table, const String &colname, Int beginRow, Int nrows)
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
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:745
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:678
vector< Int > _field_sourceIDs
Definition: MSMetaData.h:781
vector< String > _projects
Definition: MSMetaData.h:755
vector< std::set< String > > _spwToIntentsMap
Definition: MSMetaData.h:750
std::map< String, std::set< Double > > _intentToTimesMap
Definition: MSMetaData.h:763
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< String > getFieldCodes() const
get the values of the CODE column from the field table
vector< String > _observers
Definition: MSMetaData.h:755
vector< QVD > _antennaOffsets
Definition: MSMetaData.h:769
vector< String > _sourceNames
Definition: MSMetaData.h:755
std::map< Int, std::set< uInt > > _fieldToSpwMap
Definition: MSMetaData.h:731
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:683
vector< Array< Int > > _corrProds
Definition: MSMetaData.h:759
std::shared_ptr< Vector< T > > _getMainScalarColumn(MSMainEnums::PredefinedColumns col) const
std::set< uInt > _uniqueDataDescIDs
Definition: MSMetaData.h:745
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:784
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp...
Definition: MSMetaData.h:675
vector< QVD > getChanResolutions(Bool asVelWidths) const
get the resolution for each channel.
vector< QVD > getChanFreqs() const
virtual casacore::String type() const
Implements RegionShape::type.
Definition: RegionShapes.h:548
std::map< uInt, uInt > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:111
void _createSubScanRecords(Record &parent, uInt &scanNRows, std::set< Int > &antennasForScan, const ScanKey &scanKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
vector< std::pair< MEpoch, MEpoch > > _timeRangesForObs
Definition: MSMetaData.h:789
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:753
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
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
vector< uInt > nChans() const
std::map< uInt, std::set< Double > > times
times for each spectral window
Definition: MSMetaData.h:685
High-level interface to tables.
Definition: TableProxy.h:103
MSMetaData operator=(const MSMetaData &)
vector< String > _observatoryNames
Definition: MSMetaData.h:755
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:774
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:750
const MeasurementSet * getMS() const
Definition: MSMetaData.h:659
A Measure: instant in time.
Definition: MEpoch.h:104
vector< std::set< String > > _getSpwToIntentsMap()
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:723
vector< Int > _numCorrs
Definition: MSMetaData.h:781
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:796
Quantity _exposureTime
Definition: MSMetaData.h:772
std::shared_ptr< vector< Double > > _unflaggedFieldNXCRows
Definition: MSMetaData.h:774
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:755
std::shared_ptr< std::map< Double, std::set< Int > > > _timeToFieldsMap
Definition: MSMetaData.h:766
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:742
std::shared_ptr< const Quantum< Vector< Double > > > _sourceTimes
Definition: MSMetaData.h:797
std::map< ArrayKey, std::set< SubScanKey > > _arrayToSubScans
Definition: MSMetaData.h:787
std::shared_ptr< Vector< Int > > _getObservationIDs() const
std::shared_ptr< const std::map< ScanKey, ScanProperties > > _scanProperties
Definition: MSMetaData.h:736
std::shared_ptr< Vector< Int > > _getArrayIDs() const
represents non-primary key data for a SOURCE table row
Definition: MSMetaData.h:713
QVD effbw
EFFECTIVE_BANDWIDTH.
Definition: MSMetaData.h:707
vector< std::map< Int, Quantity > > _firstExposureTimeMap
Definition: MSMetaData.h:780
std::map< ScanKey, std::set< Int > > _scanToStatesMap
Definition: MSMetaData.h:732
vector< MPosition > _antennaPositions
Definition: MSMetaData.h:768
defines physical units
Definition: Unit.h:189
A Measure: wave characteristics.
Definition: MFrequency.h:161
void interpolate(const casacore::String &interpmethod)
Interpolate for time variable source.
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::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:744
const Float _maxCacheMB
Definition: MSMetaData.h:726
std::map< ScanKey, std::set< uInt > > _scanToSpwsMap
Definition: MSMetaData.h:729
vector< Int > getNetSidebands() const
vector< MDirection > _sourceDirs
Definition: MSMetaData.h:791
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:729
std::map< Int, std::set< Int > > getFieldsForSourceMap() const
A class to provide easy read-only access to MSPointing columns.
std::map< Int, std::set< Int > > _fieldToStatesMap
Definition: MSMetaData.h:733
const String _taqlTableName
Definition: MSMetaData.h:776
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< 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
vector< Double > edgechans
The center frequencies of the two channels at the edges of the window.
Definition: MSMetaData.h:701
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.
DEFAULT IMPLEMENTATIONS Default implementation of PlotSingleData that supports raw arrays
Definition: PlotData.h:301
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:765
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:748
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:737
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:744
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:694
vector< uInt > getDataDescIDToPolIDMap() const
std::shared_ptr< Vector< Int > > _getScans() const
std::shared_ptr< std::map< SubScanKey, uInt > > _subScanToNXCRowsMap
Definition: MSMetaData.h:746
std::map< std::pair< uInt, uInt >, uInt > _spwPolIDToDataDescIDMap
Definition: MSMetaData.h:734
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:698
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::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...
MDirection _getInterpolatedDirection(const ROMSPointingColumns &pCols, const Int &index, const Double &time) const
std::map< String, std::set< SubScanKey > > _intentToSubScansMap
Definition: MSMetaData.h:741
std::map< String, std::set< ScanKey > > _intentToScansMap
Definition: MSMetaData.h:740
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
static void _getScalarQuantDoubleColumn(Quantum< Vector< Double > > &v, TableProxy &table, const String &colname, Int beginRow, Int nrows)
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:716
std::set< Int > getUniqueFiedIDs() const
DEPRECATED because of spelling error.
Definition: MSMetaData.h:634
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...
uInt acRows
number of auto-correlation rows
Definition: MSMetaData.h:93
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:781
const vector< const Table * > _taqlTempTable
Definition: MSMetaData.h:777
Bool _hasFieldID(Int fieldID) const
uInt nRows() const
get the number of visibilities
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.
vector< std::set< String > > _fieldToIntentsMap
Definition: MSMetaData.h:750
vector< String > getSourceNames() const
SOURCE.NAME.
std::set< ArrayKey > _arrayKeys
Definition: MSMetaData.h:783
std::map< uInt, uInt > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:680
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:743
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:453
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:733
vector< MPosition > _getAntennaPositions() const
std::set< Int > _uniqueStateIDs
Definition: MSMetaData.h:744
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:715
static void _modifyFirstExposureTimeIfNecessary(FirstExposureTimeMap &current, const FirstExposureTimeMap &test)
vector< Int > getNumCorrs() const
number of correlations from the polarization table.
std::map< String, std::set< uInt > > _antennaNameToIDMap
Definition: MSMetaData.h:735
vector< SpwProperties > _spwInfo
Definition: MSMetaData.h:751
Bool hasBBCNo() const
vector< uInt > _dataDescIDToPolIDMap
Definition: MSMetaData.h:730
std::set< Int > getStatesForScan(Int obsID, Int arrayID, Int scan) const
get the stateIDs associated with the specified scan.
Bool _forceSubScanPropsToCache
Definition: MSMetaData.h:779
std::shared_ptr< std::map< ScanKey, std::set< Double > > > _scanToTimesMap
Definition: MSMetaData.h:761
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:732
vector< vector< Double > > getEdgeChans()
Quantity getEffectiveTotalExposureTime()
get the effective total exposure time.
vector< vector< String > > _schedules
Definition: MSMetaData.h:757
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::shared_ptr< const std::map< SubScanKey, uInt > > getNRowMap(CorrelationType type) const
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:223
std::set< uInt > _sqldSpw
Definition: MSMetaData.h:745
Matrix< Bool > _uniqueBaselines
Definition: MSMetaData.h:771
vector< String > _getStationNames()
vector< std::set< Int > > _getObservationIDToArrayIDsMap() const
map&lt;SubScanKey, Quantity&gt; _getMeanExposureTimes() const;
std::shared_ptr< std::map< SubScanKey, uInt > > _subScanToNACRowsMap
Definition: MSMetaData.h:746
std::set< Int > getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field ID.
uInt xcRows
number of cross-correlation rows.
Definition: MSMetaData.h:95
vector< std::set< ScanKey > > _spwToScansMap
Definition: MSMetaData.h:753
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:755
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:755
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:775
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:755
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:752
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.
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:775
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:745
void setShowProgress(Bool b)
Definition: MSMetaData.h:661
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:582
std::map< SourceKey, SourceProperties > _getSourceInfo() const
vector< Array< Int > > getCorrProducts() const
POLARIZATION.CORR_PRODUCT.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
std::map< ScanKey, std::set< Int > > getScanToStatesMap() const
get the mapping of scans to states