casacore
MSMetaData.h
Go to the documentation of this file.
1 //# MSMetaData.h
2 //# Copyright (C) 1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: MSMetaData.h 21586 2015-03-25 13:46:25Z gervandiepen $
27 
28 #ifndef MS_MSMETADATA_H
29 #define MS_MSMETADATA_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/casa/Quanta/QVector.h>
33 #include <casacore/measures/Measures/MFrequency.h>
34 #include <casacore/measures/Measures/MPosition.h>
35 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
36 #include <casacore/ms/MeasurementSets/MSPointingColumns.h>
37 #include <casacore/casa/Utilities/CountedPtr.h>
38 #include <casacore/tables/Tables/TableProxy.h>
39 #include <map>
40 
41 namespace casacore {
42 
43 template <class T> class ArrayColumn;
44 struct ArrayKey;
45 struct ScanKey;
46 struct SourceKey;
47 struct SubScanKey;
48 
49 // <summary>
50 // Class to interrogate an MS for metadata. Interrogation happens on demand
51 // and resulting metadata are stored for use by subsequent queries if the
52 // cache has not exceeded the specified limit. Caching of MS main table columns
53 // has been removed because the cache can be swamped by columns for large
54 // MSes, meaning that smaller data structures, which are more computationally
55 // expensive to create, aren't cached. Also, the column data is usually only
56 // needed temporarily to compute smaller data structures, and the column data
57 // is not particularly expensive to recreate if necessary.
58 // Parallel processing is enabled using openmp.
59 // </summary>
60 
61 class MSMetaData {
62 
63 public:
64 
65  // for retrieving stats
69  BOTH
70  };
71 
72  enum SQLDSwitch {
75  SQLD_ONLY
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
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 
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  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 
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
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
547 
548  // get the number of observations (from the OBSERVATIONS table) in the dataset
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
566 
567  // get the number of data description IDs (from the DATA_DESCRIPTION table)
569 
570  // get the number of unflagged rows
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 
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, rownr_t 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.
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, rownr_t> 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;
730  mutable std::map<ScanKey, std::set<uInt> > _scanToSpwsMap, _scanToDDIDsMap;
732  mutable std::map<Int, std::set<uInt> > _fieldToSpwMap;
733  mutable std::map<ScanKey, std::set<Int> > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap;
734  mutable std::map<Int, std::set<Int> > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap;
735  mutable std::map<std::pair<uInt, uInt>, uInt> _spwPolIDToDataDescIDMap;
736  mutable std::map<String, std::set<uInt> > _antennaNameToIDMap;
737  mutable std::shared_ptr<const std::map<ScanKey, ScanProperties> > _scanProperties;
738  mutable std::shared_ptr<const std::map<SubScanKey, SubScanProperties> > _subScanProperties;
739 
740  mutable std::map<String, std::set<Int> > _intentToFieldIDMap;
741  mutable std::map<String, std::set<ScanKey> > _intentToScansMap;
742  mutable std::map<String, std::set<SubScanKey> > _intentToSubScansMap;
743  mutable std::map<std::pair<ScanKey, uInt>, std::set<uInt> > _scanSpwToPolIDMap;
744  mutable std::set<String> _uniqueIntents;
747  mutable std::shared_ptr<std::map<SubScanKey, rownr_t> > _subScanToNACRowsMap, _subScanToNXCRowsMap;
748  mutable std::shared_ptr<std::map<Int, rownr_t> > _fieldToNACRowsMap, _fieldToNXCRowsMap;
749  mutable std::map<ScanKey, std::set<String> > _scanToIntentsMap;
750  mutable std::shared_ptr<const std::map<SubScanKey, std::set<String> > > _subScanToIntentsMap;
751  mutable vector<std::set<String> > _stateToIntentsMap, _spwToIntentsMap, _fieldToIntentsMap;
752  mutable vector<SpwProperties> _spwInfo;
753  mutable vector<std::set<Int> > _spwToFieldIDsMap, _obsToArraysMap;
754  mutable vector<std::set<ScanKey> > _spwToScansMap, _ddidToScansMap, _fieldToScansMap;
755 
756  mutable vector<String> _fieldNames, _antennaNames, _observatoryNames,
758  mutable vector<vector<String> > _schedules;
759  mutable vector<vector<Int> > _corrTypes;
760  mutable vector<Array<Int> >_corrProds;
761 
762  mutable std::shared_ptr<std::map<ScanKey, std::set<Double> > > _scanToTimesMap;
763  std::map<String, std::set<uInt> > _intentToSpwsMap;
764  mutable std::map<String, std::set<Double> > _intentToTimesMap;
765 
766  std::shared_ptr<std::map<Int, std::set<Double> > > _fieldToTimesMap;
767  std::shared_ptr<std::map<Double, std::set<Int> > > _timeToFieldsMap;
768 
769  mutable vector<MPosition> _observatoryPositions, _antennaPositions;
770  mutable vector<QVD > _antennaOffsets;
775  mutable std::shared_ptr<vector<Double> > _unflaggedFieldNACRows, _unflaggedFieldNXCRows;
776  mutable std::shared_ptr<std::map<SubScanKey, Double> > _unflaggedSubScanNACRows, _unflaggedSubScanNXCRows;
778  const vector<const Table*> _taqlTempTable;
779 
781  vector<std::map<Int, Quantity> > _firstExposureTimeMap;
783 
784  mutable std::set<ArrayKey> _arrayKeys;
785  mutable std::set<ScanKey> _scanKeys;
786  mutable std::set<SubScanKey> _subscans;
787  mutable std::map<ScanKey, std::set<SubScanKey> > _scanToSubScans;
788  mutable std::map<ArrayKey, std::set<SubScanKey> > _arrayToSubScans;
789 
790  mutable vector<std::pair<MEpoch, MEpoch> > _timeRangesForObs;
791 
792  mutable vector<MDirection> _phaseDirs, _sourceDirs;
793 
794  mutable vector<std::pair<Quantity, Quantity> > _properMotions;
795 
796  mutable std::map<SourceKey, SourceProperties> _sourceInfo;
797  mutable std::shared_ptr<std::set<Int> > _ephemFields;
798  mutable std::shared_ptr<const Quantum<Vector<Double> > > _sourceTimes;
799 
800  // disallow copy constructor and = operator
803 
804  // This comment from thunter in the original ValueMapping python class
805  // # Determine the number of polarizations for the first OBSERVE_TARGET intent.
806  // # Used by plotbandpass for BPOLY plots since the number of pols cannot be inferred
807  // # correctly from the caltable alone. You cannot not simply use the first row, because
808  // # it may be a pointing scan which may have different number of polarizations than what
809  // # the TARGET and BANDPASS calibrator will have.
810  // # -- T. Hunter
811  // uInt _getNumberOfPolarizations();
812 
813  void _setSpwInfo(const MeasurementSet& ms);
814 
815  // set metadata from OBSERVATION table
817 
818  Bool _cacheUpdated(const Float incrementInBytes) const;
819 
820  void _checkField(uInt fieldID) const;
821 
822  void _checkScan(const ScanKey& key) const;
823 
824  void _checkScans(const std::set<ScanKey>& scanKeys) const;
825 
826  void _checkSubScan(const SubScanKey& key) const;
827 
828  static void _checkTolerance(const Double tol);
829 
831  std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
832  std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
833  Bool showProgress
834  ) const;
835 
836  static void _getScalarIntColumn(
837  Vector<Int>& v, TableProxy& table, const String& colname,
838  rownr_t beginRow, rownr_t nrows
839  );
840 
842  Vector<Double>& v, TableProxy& table, const String& colname,
843  rownr_t beginRow, rownr_t nrows
844  );
845 
847  Quantum<Vector<Double> >& v, TableProxy& table, const String& colname,
848  rownr_t beginRow, rownr_t nrows
849  );
850 
852  std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
853  std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
854  const std::vector<
855  std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
856  >& props
857  ) const;
858 
860  Record& parent, const ArrayKey& arrayKey,
861  const std::map<SubScanKey, SubScanProperties>& subScanProps
862  ) const;
863 
865  Record& parent, rownr_t& scanNRows, std::set<Int>& antennasForScan,
866  const ScanKey& scanKey, const std::map<SubScanKey, SubScanProperties>& subScanProps
867  ) const;
868 
870  Record& parent,
871  const SubScanProperties& subScanProps
872  );
873 
874  // convert a QVD in frequency units to velocity units using
875  // the give reference frequency. No explicit checking is done
876  // for unit correctness of the inputs.
877  static QVD _freqWidthToVelWidth(const QVD& v, const Quantity& refFreq);
878 
879  // if _scanProps has been generated, just return it. If the caller has
880  // configured the object to generate _scanProps at some point, this call will
881  // generate it. Otherwise, the returned object contains a null pointer.
882  std::shared_ptr<const std::map<ScanKey, ScanProperties> > _generateScanPropsIfWanted() const;
883 
884  // if _subScanProperties has been generated, just return it. If
885  // the caller has configured the object to generate _subScanPropertiess
886  // at some point, this call will generate it. Otherwise, the returned object
887  // contains a null pointer.
888  std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >
890 
891  vector<String> _getAntennaNames(
892  std::map<String, std::set<uInt> >& namesToIDsMap
893  ) const;
894 
895  vector<MPosition> _getAntennaPositions() const;
896 
898  std::shared_ptr<Vector<Int> >& ant1,
899  std::shared_ptr<Vector<Int> >& ant2
900  ) const;
901 
902  std::shared_ptr<Vector<Int> > _getArrayIDs() const;
903 
904  std::map<ArrayKey, std::set<SubScanKey> > _getArrayKeysToSubScanKeys() const;
905 
906  // Uses openmp for parallel processing
907  std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
909  const Vector<Int>& scans, const Vector<Int>& fields,
910  const Vector<Int>& ddIDs, const Vector<Int>& states,
911  const Vector<Double>& times, const Vector<Int>& arrays,
912  const Vector<Int>& observations, const Vector<Int>& ant1,
913  const Vector<Int>& ant2, const Quantum<Vector<Double> >& exposureTimes,
914  const Quantum<Vector<Double> >& intervalTimes, const vector<uInt>& ddIDToSpw,
915  rownr_t beginRow, rownr_t endRow
916  ) const;
917 
918  std::shared_ptr<Vector<Int> > _getDataDescIDs() const;
919 
920  // get the field IDs of ephemeris objects
921  std::shared_ptr<std::set<Int> > _getEphemFieldIDs() const;
922 
923  std::shared_ptr<Quantum<Vector<Double> > > _getExposureTimes() const;
924 
925  std::shared_ptr<Vector<Int> > _getFieldIDs() const;
926 
927  // If there are no intents, then fieldToIntentsMap will be of length
928  // nFields() and all of its entries will be the empty set, and
929  // intentToFieldsMap will be empty
931  vector<std::set<String> >& fieldToIntentsMap,
932  std::map<String, std::set<Int> >& intentToFieldsMap
933  );
934 
936  vector<std::set<ScanKey> >& fieldToScansMap,
937  std::map<ScanKey, std::set<Int> >& scanToFieldsMap
938  ) const;
939 
941  std::map<Int, std::set<uInt> >& fieldToSpwMap,
942  vector<std::set<Int> >& spwToFieldMap
943  ) const;
944 
946  std::map<Int, std::set<Int> >& fieldToStatesMap,
947  std::map<Int, std::set<Int> >& stateToFieldsMap
948  );
949 
951  std::shared_ptr<std::map<Int, std::set<Double> > >& fieldToTimesMap,
952  std::shared_ptr<std::map<Double, std::set<Int> > >& timesToFieldMap
953  );
954 
955  std::shared_ptr<ArrayColumn<Bool> > _getFlags() const;
956 
957  std::map<String, std::set<Double> > _getIntentsToTimesMap() const;
958 
959  std::shared_ptr<Quantum<Vector<Double> > > _getIntervals() const;
960 
961  std::shared_ptr<Vector<Int> > _getObservationIDs() const;
962 
963  std::shared_ptr<Vector<Int> > _getScans() const;
964 
965  vector<std::set<String> > _getSpwToIntentsMap();
966 
967  std::shared_ptr<Vector<Int> > _getStateIDs() const;
968 
969  std::shared_ptr<Vector<Double> > _getTimes() const;
970 
971  //std::shared_ptr<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;
972 
973  Bool _hasIntent(const String& intent) const;
974 
975  Bool _hasFieldID(Int fieldID) const;
976 
977  Bool _hasStateID(Int stateID) const;
978 
979  void _hasAntennaID(Int antennaID);
980 
981  std::map<Double, Double> _getTimeToTotalBWMap(
982  const Vector<Double>& times, const Vector<Int>& ddIDs
983  );
984 
986  const MSPointingColumns& pCols, const Int& index,
987  const Double& time
988  ) const;
989 
990  //map<SubScanKey, Quantity> _getMeanExposureTimes() const;
991 
992  vector<std::set<Int> > _getObservationIDToArrayIDsMap() const;
993 
994  vector<MPosition> _getObservatoryPositions();
995 
997  rownr_t& nACRows, rownr_t& nXCRows,
998  std::map<SubScanKey, rownr_t>*& subScanToNACRowsMap,
999  std::map<SubScanKey, rownr_t>*& subScanToNXCRowsMap,
1000  std::map<Int, rownr_t>*& fieldToNACRowsMap,
1001  std::map<Int, rownr_t>*& fieldToNXCRowsMap
1002  ) const;
1003 
1005  rownr_t& nACRows, rownr_t& nXCRows,
1006  std::shared_ptr<std::map<SubScanKey, rownr_t> >& scanToNACRowsMap,
1007  std::shared_ptr<std::map<SubScanKey, rownr_t> >& scanToNXCRowsMap,
1008  std::shared_ptr<std::map<Int, rownr_t> >& fieldToNACRowsMap,
1009  std::shared_ptr<std::map<Int, rownr_t> >& fieldToNXCRowsMap
1010  ) const;
1011 
1012  // get scan properties
1013  std::shared_ptr<const std::map<ScanKey, MSMetaData::ScanProperties> > _getScanProperties(
1014  Bool showProgress
1015  ) const;
1016 
1017  // get the scan keys in the specified set that have the associated arrayKey
1018  std::set<ScanKey> _getScanKeys(
1019  const std::set<ScanKey>& scanKeys, const ArrayKey& arrayKey
1020  ) const;
1021 
1022  // get all valid scan numbers associated with the specified arrayKey
1023  std::set<Int> _getScanNumbers(const ArrayKey& arrayKey) const;
1024 
1026  std::map<ScanKey, std::set<uInt> >& scanToDDIDMap,
1027  vector<std::set<ScanKey> >& ddIDToScanMap
1028  ) const;
1029 
1031  std::map<ScanKey, std::set<String> >& scanToIntentsMap,
1032  std::map<String, std::set<ScanKey> >& intentToScansMap
1033  ) const;
1034 
1036  std::map<ScanKey, std::set<uInt> >& scanToSpwMap,
1037  vector<std::set<ScanKey> >& spwToScanMap
1038  ) const;
1039 
1040  std::map<ScanKey, std::set<Int> > _getScanToAntennasMap() const;
1041 
1042  std::map<ScanKey, std::set<SubScanKey> > _getScanToSubScansMap() const;
1043 
1044  std::shared_ptr<std::map<ScanKey, std::set<Double> > > _getScanToTimesMap() const;
1045 
1046  std::map<SourceKey, SourceProperties> _getSourceInfo() const;
1047 
1048  vector<SpwProperties> _getSpwInfo(
1049  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw,
1050  std::set<uInt>& fdmSpw, std::set<uInt>& wvrSpw,
1051  std::set<uInt>& sqldSpw
1052  ) const;
1053 
1055  vector<std::set<String> >& spwToIntentsMap,
1056  std::map<String, std::set<uInt> >& intentToSpwsMap
1057  );
1058 
1059  vector<SpwProperties> _getSpwInfo2(
1060  std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw, std::set<uInt>& fdmSpw,
1061  std::set<uInt>& wvrSpw, std::set<uInt>& sqldSpw
1062  ) const;
1063 
1065  vector<std::set<String> >& statesToIntentsMap,
1066  std::set<String>& uniqueIntents
1067  ) const;
1068 
1069  vector<String> _getStationNames();
1070 
1072  std::shared_ptr<const std::map<SubScanKey, std::set<String> > >& subScanToIntentsMap,
1073  std::map<String, std::set<SubScanKey> >& intentToSubScansMap
1074  ) const;
1075 
1077  std::shared_ptr<const std::map<ScanKey, ScanProperties> >& scanProps,
1078  std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >& subScanProps,
1079  Bool showProgress
1080  ) const;
1081 
1082  std::set<SubScanKey> _getSubScanKeys() const;
1083 
1084  // get subscans related to the given scan
1085  std::set<SubScanKey> _getSubScanKeys(const ScanKey& scanKey) const;
1086 
1088  Double& nACRows, Double& nXCRows,
1089  std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNACRowsMap,
1090  std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNXCRowsMap,
1091  std::shared_ptr<vector<Double> >& fieldToNACRowsMap,
1092  std::shared_ptr<vector<Double> >& fieldToNXCRowsMap
1093  ) const;
1094 
1096  Double& nACRows, Double& nXCRows,
1097  vector<Double>*& fieldNACRows, vector<Double>*& fieldNXCRows,
1098  std::map<SubScanKey, Double>*& scanNACRows,
1099  std::map<SubScanKey, Double>*& scanNXCRows
1100  ) const;
1101 
1103  FirstExposureTimeMap& current, const FirstExposureTimeMap& test
1104  );
1105 
1107  FirstExposureTimeMap& current, Int dataDescID,
1108  Double time, Double exposure, const Unit& eunit
1109  );
1110 
1111  static uInt _sizeof(const std::map<Double, MSMetaData::TimeStampProperties> & m);
1112 
1113  template <class T>
1114  static uInt _sizeof(const std::map<T, std::set<String> >& m);
1115 
1116  template <class T, class U>
1117  static uInt _sizeof(const std::map<T, std::set<U> >& m);
1118 
1119  template <class T, class U>
1120  static uInt _sizeof(const std::map<T, U>& m);
1121 
1122  static uInt _sizeof(const vector<std::set<String> >& m);
1123 
1124  static uInt _sizeof(const vector<String>& m);
1125 
1126  static uInt _sizeof(const vector<vector<String> >& m);
1127 
1128  template <class T>
1129  static uInt _sizeof(const vector<T>& v);
1130 
1131  static uInt _sizeof(const Quantum<Vector<Double> >& m);
1132 
1133  template <class T>
1134  static uInt _sizeof(const vector<std::set<T> >& v);
1135 
1136  template <class T> static uInt _sizeof(const std::map<String, std::set<T> >& map);
1137 
1138  static uInt _sizeof(const vector<std::map<Int, Quantity> >& map);
1139 
1140  static uInt _sizeof(const std::map<std::pair<Int, uInt>, std::set<uInt> >& map);
1141 
1142  static std::map<Int, uInt> _toUIntMap(const Vector<Int>& v);
1143 
1144  template <class T> std::shared_ptr<Vector<T> > _getMainScalarColumn(
1146  ) const;
1147 
1148 };
1149 
1150 
1151 
1152 }
1153 
1154 #endif
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
vector< std::set< uInt > > getAntennaIDs(const vector< String > &antennaNames) const
The returned IDs are ordered in the way they appear in the atenna table.
Bool _hasIntent(const String &intent) const
std::shared_ptr<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;
MPosition getObservatoryPosition(uInt which) const
get the position of the specified telescope (observatory).
void _getFieldsAndTimesMaps(std::shared_ptr< std::map< Int, std::set< Double > > > &fieldToTimesMap, std::shared_ptr< std::map< Double, std::set< Int > > > &timesToFieldMap)
vector< std::vector< String > > getAntennaStations(const vector< String > &antennaNames)
get the antenna stations for the specified antenna names.
vector< Int > _numCorrs
Definition: MSMetaData.h:782
std::set< Int > _uniqueAntennaIDs
Definition: MSMetaData.h:745
uInt nObservations() const
get the number of observations (from the OBSERVATIONS table) in the dataset
vector< std::set< ScanKey > > getFieldToScansMap() const
get the mapping of field ID to scans
vector< Double > getBandWidths() const
vector< MPosition > _getObservatoryPositions()
uInt nSpw(Bool includewvr) const
get number of spectral windows
std::shared_ptr< const Quantum< Vector< Double > > > _sourceTimes
Definition: MSMetaData.h:798
vector< vector< Double > > getEdgeChans()
void _createSubScanRecords(Record &parent, rownr_t &scanNRows, std::set< Int > &antennasForScan, const ScanKey &scanKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
std::map< Int, std::set< uInt > > getFieldsToSpwsMap() const
get the mapping of fields to spws
std::shared_ptr< std::map< SubScanKey, rownr_t > > _subScanToNXCRowsMap
Definition: MSMetaData.h:747
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...
uInt nUniqueSourceIDsFromSourceTable() const
Number of unique values from SOURCE.SOURCE_ID.
MSMetaData(const MSMetaData &)
disallow copy constructor and = operator
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
std::set< uInt > getAntennaIDs(const String &antennaName) const
get all the antenna IDs for the antenna with the specified name.
std::set< uInt > getTDMSpw()
ALMA-specific.
std::set< String > getFieldNamesForSpw(const uInt spw)
get the set of field names corresponding to the specified spectral window.
static uInt _sizeof(const vector< std::set< T > > &v)
std::map< ScanKey, std::set< SubScanKey > > _scanToSubScans
Definition: MSMetaData.h:787
vector< String > getSourceNames() const
SOURCE.NAME.
std::set< uInt > getSpwsForField(const Int fieldID) const
get a set of spectral windows corresponding to the specified fieldID
void _checkScan(const ScanKey &key) const
std::shared_ptr< Vector< Int > > _getFieldIDs() const
QVD getAntennaOffset(const String &name) const
If the antenna name appears mulitple times, this will return the offset for the first occurrence of i...
uInt nStates() const
number of unique states (number of rows from the STATE table)
void _getScansAndDDIDMaps(std::map< ScanKey, std::set< uInt > > &scanToDDIDMap, vector< std::set< ScanKey > > &ddIDToScanMap) const
vector< String > _observers
Definition: MSMetaData.h:757
std::set< Int > getFieldIDsForSpw(const uInt spw)
get the set of field IDs corresponding to the specified spectral window.
const vector< const Table * > _taqlTempTable
Definition: MSMetaData.h:778
std::set< uInt > _avgSpw
Definition: MSMetaData.h:746
static uInt _sizeof(const std::map< std::pair< Int, uInt >, std::set< uInt > > &map)
std::shared_ptr< Vector< Int > > _getScans() const
QVD getAntennaOffset(uInt which) const
get the position of the specified antenna relative to the observatory position.
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 ...
vector< SpwProperties > _spwInfo
Definition: MSMetaData.h:752
Double nUnflaggedRows(CorrelationType cType) const
const Float _maxCacheMB
Definition: MSMetaData.h:726
vector< MFrequency > getRefFreqs() const
void setShowProgress(Bool b)
Definition: MSMetaData.h:661
rownr_t nRows(CorrelationType cType, Int arrayID, Int observationID, Int scanNumber, Int fieldID) const
std::set< Int > _getScanNumbers(const ArrayKey &arrayKey) const
get all valid scan numbers associated with the specified arrayKey
void _getFieldsAndScansMaps(vector< std::set< ScanKey > > &fieldToScansMap, std::map< ScanKey, std::set< Int > > &scanToFieldsMap) const
vector< std::set< ScanKey > > _ddidToScansMap
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...
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.
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::map< String, std::set< Double > > _getIntentsToTimesMap() const
std::set< Int > getFieldIDsForField(const String &field) const
get the field IDs for the specified field name.
vector< QVD > getChanEffectiveBWs(Bool asVelWidths) const
get the effective bandwidth for each channel.
vector< String > getAntennaStations(const vector< uInt > &antennaIDs=vector< uInt >())
get the antenna stations for the specified antenna IDs
std::shared_ptr< std::map< ScanKey, std::set< Double > > > _getScanToTimesMap() const
std::shared_ptr< const Quantum< Vector< Double > > > getSourceTimes() const
SOURCE.TIME.
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,...
vector< Int > _source_sourceIDs
Definition: MSMetaData.h:782
std::shared_ptr< std::set< Int > > _ephemFields
Definition: MSMetaData.h:797
vector< QVD > getChanWidths() const
std::set< uInt > getSpwsForField(const String &fieldName)
get a set of spectral windows corresponding to the specified field name
vector< vector< MPosition > > getAntennaPositions(const vector< String > &names)
names cannot be empty.
std::shared_ptr< const std::map< ScanKey, ScanProperties > > _generateScanPropsIfWanted() const
if _scanProps has been generated, just return it.
std::shared_ptr< const std::map< ScanKey, MSMetaData::ScanProperties > > _getScanProperties(Bool showProgress) const
get scan properties
std::vector< std::set< Double > > getTimesForSpws(Bool showProgress=True) const
get a map of spectral windows to unique timestamps.
std::set< uInt > getSQLDSpw()
ALMA-specific.
static void _createTimeStampRecords(Record &parent, const SubScanProperties &subScanProps)
vector< String > _sourceNames
Definition: MSMetaData.h:757
Double nUnflaggedRows(CorrelationType cType, Int fieldID) const
vector< std::set< ScanKey > > _fieldToScansMap
Definition: MSMetaData.h:754
std::shared_ptr< Vector< T > > _getMainScalarColumn(MSMainEnums::PredefinedColumns col) const
static void _getScalarQuantDoubleColumn(Quantum< Vector< Double > > &v, TableProxy &table, const String &colname, rownr_t beginRow, rownr_t nrows)
std::set< Int > getUniqueFieldIDs() const
get unique field IDs that exist in the main table.
vector< String > getAntennaNames(std::map< String, std::set< uInt > > &namesToIDsMap, const vector< uInt > &antennaIDs=vector< uInt >(0)) const
Bool _hasStateID(Int stateID) const
std::set< Int > getFieldsForIntent(uInt sourceID) const
get the field IDs associated with the specified source.
Record getSummary() const
get a data structure, consumable by users, representing a summary of the dataset
vector< QVD > _antennaOffsets
Definition: MSMetaData.h:770
vector< String > _getStationNames()
std::set< Int > _uniqueFieldIDs
Definition: MSMetaData.h:745
const String _taqlTableName
Definition: MSMetaData.h:777
static uInt _sizeof(const std::map< T, U > &m)
vector< String > _stationNames
Definition: MSMetaData.h:757
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > _subScanProperties
Definition: MSMetaData.h:738
vector< String > _fieldCodes
Definition: MSMetaData.h:757
std::set< SubScanKey > _subscans
Definition: MSMetaData.h:786
vector< MDirection > _phaseDirs
Definition: MSMetaData.h:792
std::map< Int, std::pair< Double, Quantity > > FirstExposureTimeMap
Definition: MSMetaData.h:89
vector< uInt > nChans() const
std::map< Int, std::set< Int > > _sourceToFieldsMap
Definition: MSMetaData.h:734
vector< QVD > getChanFreqs() const
std::map< ScanKey, std::set< Int > > _getScanToAntennasMap() const
static uInt _sizeof(const std::map< T, std::set< U > > &m)
std::shared_ptr< Vector< Int > > _getArrayIDs() const
vector< Quantity > getCenterFreqs() const
std::set< Int > getScanNumbers(Int obsID, Int arrayID) const
get unique scan numbers
std::map< String, std::set< SubScanKey > > _intentToSubScansMap
Definition: MSMetaData.h:742
std::shared_ptr< std::map< SubScanKey, Double > > _unflaggedSubScanNXCRows
Definition: MSMetaData.h:776
MSMetaData operator=(const MSMetaData &)
static uInt _sizeof(const vector< vector< String > > &m)
Bool hasBBCNo() const
static QVD _freqWidthToVelWidth(const QVD &v, const Quantity &refFreq)
convert a QVD in frequency units to velocity units using the give reference frequency.
vector< std::pair< MEpoch, MEpoch > > _timeRangesForObs
Definition: MSMetaData.h:790
vector< String > getFieldNames() const
get a list of the field names in the order in which they appear in the FIELD table.
std::map< Int, std::set< Int > > getFieldsForSourceMap() const
MDirection _getInterpolatedDirection(const MSPointingColumns &pCols, const Int &index, const Double &time) const
std::set< Int > getScansForState(Int stateID, Int obsID, Int arrayID) const
get a set of scan numbers for the specified stateID, obsID, and arrayID.
uInt nDataDescriptions() const
get the number of data description IDs (from the DATA_DESCRIPTION table)
std::set< Int > getFieldsForTimes(Double center, Double tol)
Get the fields which fail into the specified time range (center-tol to center+tol)
std::set< uInt > _uniqueDataDescIDs
Definition: MSMetaData.h:746
void _getFieldsAndSpwMaps(std::map< Int, std::set< uInt > > &fieldToSpwMap, vector< std::set< Int > > &spwToFieldMap) const
std::set< uInt > _sqldSpw
Definition: MSMetaData.h:746
ColumnStats getIntervalStatistics() const
get statistics related to the values of the INTERVAL column.
std::shared_ptr< std::map< Int, rownr_t > > _fieldToNACRowsMap
Definition: MSMetaData.h:748
QVD getAntennaDiameters() const
get the antenna diameters
Quantity getEffectiveTotalExposureTime()
get the effective total exposure time.
std::map< ScanKey, std::set< Int > > _scanToStatesMap
Definition: MSMetaData.h:733
std::set< SubScanKey > _getSubScanKeys() const
std::set< ScanKey > _scanKeys
Definition: MSMetaData.h:785
Double nUnflaggedRows() const
get the number of unflagged rows
static uInt _sizeof(const Quantum< Vector< Double > > &m)
vector< std::set< ScanKey > > _spwToScansMap
Definition: MSMetaData.h:754
static void _getScalarDoubleColumn(Vector< Double > &v, TableProxy &table, const String &colname, rownr_t beginRow, rownr_t nrows)
std::map< Int, std::set< Int > > _stateToFieldsMap
Definition: MSMetaData.h:734
std::set< Double > getTimesForField(Int fieldID)
get the times for which the specified field was observed
vector< String > getFieldCodes() const
get the values of the CODE column from the field table
std::map< ArrayKey, std::set< SubScanKey > > _arrayToSubScans
Definition: MSMetaData.h:788
std::pair< Double, Double > getTimeRangeForScan(const ScanKey &scanKey) const
get the time range for the specified scan.
vector< std::set< String > > _fieldToIntentsMap
Definition: MSMetaData.h:751
rownr_t nRows(CorrelationType cType, uInt fieldID) const
std::shared_ptr< const std::map< SubScanKey, std::set< String > > > _subScanToIntentsMap
Definition: MSMetaData.h:750
std::map< ScanKey, std::set< uInt > > getScanToSpwsMap() const
get the complete mapping of scans to spws
vector< uInt > getBBCNos() const
Bool _forceSubScanPropsToCache
Definition: MSMetaData.h:780
void _getUnflaggedRowStats(Double &nACRows, Double &nXCRows, vector< Double > *&fieldNACRows, vector< Double > *&fieldNXCRows, std::map< SubScanKey, Double > *&scanNACRows, std::map< SubScanKey, Double > *&scanNXCRows) const
static void _modifyFirstExposureTimeIfNecessary(FirstExposureTimeMap &current, Int dataDescID, Double time, Double exposure, const Unit &eunit)
vector< Array< Int > > getCorrProducts() const
POLARIZATION.CORR_PRODUCT.
vector< std::pair< Quantity, Quantity > > _properMotions
Definition: MSMetaData.h:794
static void _modifyFirstExposureTimeIfNecessary(FirstExposureTimeMap &current, const FirstExposureTimeMap &test)
std::set< SubScanKey > _getSubScanKeys(const ScanKey &scanKey) const
get subscans related to the given scan
vector< String > getFieldNamesForFieldIDs(const vector< uInt > &fieldIDs)
get the field names associated with the specified field IDs.
std::set< Double > getTimesForIntent(const String &intent) const
get the time stamps associated with the specified intent
static std::map< Int, uInt > _toUIntMap(const Vector< Int > &v)
Bool _hasFieldID(Int fieldID) const
void _checkField(uInt fieldID) const
std::map< Int, std::set< uInt > > _fieldToSpwMap
Definition: MSMetaData.h:732
std::set< uInt > getWVRSpw() const
ALMA-specific.
uInt nArrays()
get the number of arrays (from the ARRAY table) in the dataset
virtual std::set< uInt > getSpwsForIntent(const String &intent)
get a set of spectral windows for which the specified intent applies.
Quantity _exposureTime
Definition: MSMetaData.h:773
std::map< String, std::set< Int > > _intentToFieldIDMap
Definition: MSMetaData.h:740
std::map< ScanKey, std::set< Int > > _scanToFieldsMap
Definition: MSMetaData.h:733
vector< String > _projects
Definition: MSMetaData.h:757
vector< QVD > getAntennaOffsets() const
vector< SpwProperties > _getSpwInfo2(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
static uInt _sizeof(const vector< String > &m)
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...
std::map< uInt, std::set< Double > > getSpwToTimesForScan(const ScanKey &scan) const
std::set< Int > getFieldsForScans(const std::set< ScanKey > &scans) const
get the field IDs associated with the specified scans
vector< vector< Int > > _corrTypes
Definition: MSMetaData.h:759
std::map< ScanKey, std::set< uInt > > _scanToDDIDsMap
Definition: MSMetaData.h:730
vector< MPosition > _getAntennaPositions() const
std::shared_ptr< Vector< Int > > _getStateIDs() const
std::map< std::pair< uInt, uInt >, uInt > getSpwIDPolIDToDataDescIDMap() const
The first value of the pair is spw, the second is polarization ID.
Bool _cacheUpdated(const Float incrementInBytes) const
vector< std::set< String > > _stateToIntentsMap
Definition: MSMetaData.h:751
std::set< String > _uniqueIntents
Definition: MSMetaData.h:744
vector< MDirection > getSourceDirections() const
SOURCE.DIRECTION.
std::set< String > getIntentsForSubScan(const SubScanKey &subScan) const
static void _checkTolerance(const Double tol)
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::map< ScanKey, std::set< String > > _scanToIntentsMap
Definition: MSMetaData.h:749
std::set< uInt > getSpwsForScan(const ScanKey &scan) const
get the set of spectral windows for the specified scan.
SubScanProperties getSubScanProperties(const SubScanKey &subScan, Bool showProgress=False) const
get the sub scan properties for the specified sub scan.
std::shared_ptr< std::map< Int, std::set< Double > > > _fieldToTimesMap
Definition: MSMetaData.h:766
void _getFieldsAndStatesMaps(std::map< Int, std::set< Int > > &fieldToStatesMap, std::map< Int, std::set< Int > > &stateToFieldsMap)
std::map< String, std::set< ScanKey > > _intentToScansMap
Definition: MSMetaData.h:741
vector< std::pair< Quantity, Quantity > > getProperMotions() const
SOURCE.PROPER_MOTION, first value in pair is longitudinal proper motion, second is latiduninal.
void _getSpwsAndIntentsMaps(vector< std::set< String > > &spwToIntentsMap, std::map< String, std::set< uInt > > &intentToSpwsMap)
std::set< String > getIntentsForField(Int fieldID)
get a set of intents corresponding to a specified field
vector< std::set< Int > > _spwToFieldIDsMap
Definition: MSMetaData.h:753
std::set< uInt > _tdmSpw
Definition: MSMetaData.h:746
Double nUnflaggedRows(CorrelationType cType, Int arrayID, uInt observationID, Int scanNumber, uInt fieldID) const
std::map< String, std::set< uInt > > _intentToSpwsMap
Definition: MSMetaData.h:763
vector< std::set< Int > > _getObservationIDToArrayIDsMap() const
map<SubScanKey, Quantity> _getMeanExposureTimes() const;
const std::set< Int > & getUniqueAntennaIDs() const
get the unique antennas (the union of the ANTENNA_1 and ANTENNA_2 columns) from the main table
std::set< uInt > getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const
get polarization IDs for the specified scan and spwid
void _checkSubScan(const SubScanKey &key) const
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),...
std::vector< std::set< uInt > > getSpwToDataDescriptionIDMap() const
get a mapping of spectral window ID to data descrption IDs
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > _generateSubScanPropsIfWanted() const
if _subScanProperties has been generated, just return it.
vector< vector< Int > > getCorrTypes() const
POLARIZATION.CORR_TYPE.
std::set< uInt > getFDMSpw()
ALMA-specific.
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::set< SubScanKey > getSubScanKeys(const ArrayKey &arrayKey) const
get all sub scan keys for the specified array key.
vector< std::set< String > > _spwToIntentsMap
Definition: MSMetaData.h:751
std::set< Int > getFieldsForIntent(const String &intent)
get the field IDs associated with the specified intent.
std::set< Int > getScansForIntent(const String &intent, Int obsID, Int arrayID) const
get the scans associated with the specified intent
std::shared_ptr< const std::map< ScanKey, std::pair< Double, Double > > > getScanToTimeRangeMap() const
get the map of scans to time ranges.
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.
std::set< Int > getFieldsForScan(const ScanKey &scan) const
get field IDs associated with the specified scan number.
vector< Array< Int > > _corrProds
Definition: MSMetaData.h:760
vector< String > _observatoryNames
Definition: MSMetaData.h:756
std::shared_ptr< const std::map< SubScanKey, std::set< String > > > getSubScanToIntentsMap() 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...
uInt nAntennas() const
get the number of antennas in the ANTENNA table
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > getSubScanProperties(Bool showProgress=False) const
std::set< Int > getScansForSpw(uInt spw, Int obsID, Int arrayID) const
get the set of scan numbers for the specified spectral window.
vector< String > _antennaNames
Definition: MSMetaData.h:756
std::shared_ptr< vector< Double > > _unflaggedFieldNACRows
Definition: MSMetaData.h:775
void _checkScans(const std::set< ScanKey > &scanKeys) const
std::set< ScanKey > getScanKeys(const ArrayKey &arrayKey) const
get all ScanKeys in the dataset that have the specified arrayKey.
std::map< Int, std::set< String > > getFieldNamesForSourceMap() const
Matrix< Bool > getUniqueBaselines()
std::map<Double, Double> getExposuresForTimes() const;
std::map< std::pair< ScanKey, uInt >, std::set< uInt > > _scanSpwToPolIDMap
Definition: MSMetaData.h:743
vector< String > _getAntennaNames(std::map< String, std::set< uInt > > &namesToIDsMap) const
std::vector< QVD > getAntennaOffsets(const String &name) const
If the antenna name appears mulitple times, this will return all the offsets for it,...
vector< String > getSpwNames() const
get a map of the spwIDs to spw names from the spw table
std::set< uInt > getSpwIDs() const
get all the spws associated with the data description IDs listed in the main table.
std::map< Int, std::set< Int > > _fieldToStatesMap
Definition: MSMetaData.h:734
std::set< Int > getUniqueFiedIDs() const
DEPRECATED because of spelling error.
Definition: MSMetaData.h:634
void _getScanAndSubScanProperties(std::shared_ptr< const std::map< ScanKey, ScanProperties > > &scanProps, std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > &subScanProps, Bool showProgress) const
std::set< Double > getTimesForScan(const ScanKey &scan) const
get the times for the specified scan.
std::set< uInt > getUniqueSpwIDs() const
get the unique spectral window IDs represented by the data description IDs that appear in the main ta...
std::map< std::pair< uInt, uInt >, uInt > _spwPolIDToDataDescIDMap
Definition: MSMetaData.h:735
uInt nScans()
get the number of scans in the dataset
void _getStateToIntentsMap(vector< std::set< String > > &statesToIntentsMap, std::set< String > &uniqueIntents) const
std::set< Int > _uniqueStateIDs
Definition: MSMetaData.h:745
CorrelationType
for retrieving stats
Definition: MSMetaData.h:66
uInt nFields() const
get the number of fields.
vector< Int > getNetSidebands() const
std::set< String > getIntentsForField(String field)
get a set of intents corresponding to a specified field name
std::set< String > getIntents() const
get all intents, in no particular (nor guaranteed) order.
vector< String > getObservatoryNames()
get telescope names in the order they are listed in the OBSERVATION table.
std::set< Int > getAntennasForScan(const ScanKey &scan) const
get the set of antenna IDs for the specified scan.
std::map< ScanKey, FirstExposureTimeMap > getScanToFirstExposureTimeMap(Bool showProgress) const
get map of scans to first exposure times
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< QVD > getChanResolutions(Bool asVelWidths) const
get the resolution for each channel.
static uInt _sizeof(const std::map< String, std::set< T > > &map)
std::set< ScanKey > getScanKeys() const
get all ScanKeys in the dataset
void _getRowStats(rownr_t &nACRows, rownr_t &nXCRows, std::shared_ptr< std::map< SubScanKey, rownr_t > > &scanToNACRowsMap, std::shared_ptr< std::map< SubScanKey, rownr_t > > &scanToNXCRowsMap, std::shared_ptr< std::map< Int, rownr_t > > &fieldToNACRowsMap, std::shared_ptr< std::map< Int, rownr_t > > &fieldToNXCRowsMap) const
std::set< Double > getTimesForScans(std::set< ScanKey > scans) const
Get the times for the specified scans.
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
rownr_t nRows() const
get the number of visibilities
vector< String > getProjects() const
get the contents of the PROJECT column from the OBSERVATIONS table
std::shared_ptr< std::map< Double, std::set< Int > > > _timeToFieldsMap
Definition: MSMetaData.h:767
void _setObservation(const MeasurementSet &ms)
set metadata from OBSERVATION table
std::shared_ptr< vector< Double > > _unflaggedFieldNXCRows
Definition: MSMetaData.h:775
std::map< SourceKey, std::shared_ptr< vector< String > > > getTransitions() const
get the transitions from the SOURCE table.
std::set< String > getIntentsForSpw(const uInt spw)
get a set of intents corresponding to the specified spectral window
vector< std::set< String > > _getSpwToIntentsMap()
std::shared_ptr< Vector< Int > > _getDataDescIDs() const
void _getScansAndIntentsMaps(std::map< ScanKey, std::set< String > > &scanToIntentsMap, std::map< String, std::set< ScanKey > > &intentToScansMap) const
Float getCache() const
Definition: MSMetaData.h:582
vector< std::pair< MEpoch, MEpoch > > getTimeRangesOfObservations() const
get the time ranges from the OBSERVATION table
std::set< uInt > _fdmSpw
Definition: MSMetaData.h:746
std::set< uInt > getSpwsForSubScan(const SubScanKey &subScan) const
get the set of spectral windows for the specified subscan.
std::map< String, std::set< Double > > _intentToTimesMap
Definition: MSMetaData.h:764
void _getAntennas(std::shared_ptr< Vector< Int > > &ant1, std::shared_ptr< Vector< Int > > &ant2) const
vector< Int > getNumCorrs() const
number of correlations from the polarization table.
vector< String > getObservers() const
get the contents of the OBSERVER column from the OBSERVATIONS table
vector< uInt > getDataDescIDToSpwMap() const
static uInt _sizeof(const vector< std::set< String > > &m)
std::set< uInt > getUniqueDataDescIDs() const
get unique data description IDs that exist in the main table
std::set< Int > getStatesForScan(Int obsID, Int arrayID, Int scan) const
get the stateIDs associated with the specified scan.
std::map< Double, Double > _getTimeToTotalBWMap(const Vector< Double > &times, const Vector< Int > &ddIDs)
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< MDirection > _sourceDirs
Definition: MSMetaData.h:792
std::set< String > getIntentsForScan(const ScanKey &scan) const
static void _getScalarIntColumn(Vector< Int > &v, TableProxy &table, const String &colname, rownr_t beginRow, rownr_t nrows)
std::set< uInt > _wvrSpw
Definition: MSMetaData.h:746
vector< MPosition > _antennaPositions
Definition: MSMetaData.h:769
std::shared_ptr< std::map< SubScanKey, rownr_t > > _subScanToNACRowsMap
Definition: MSMetaData.h:747
std::map< ScanKey, std::set< Int > > _scanToAntennasMap
Definition: MSMetaData.h:733
std::map< SourceKey, SourceProperties > _sourceInfo
Definition: MSMetaData.h:796
std::shared_ptr< std::map< ScanKey, std::set< Double > > > _scanToTimesMap
Definition: MSMetaData.h:762
const MeasurementSet * getMS() const
Definition: MSMetaData.h:659
std::shared_ptr< Quantum< Vector< Double > > > _getExposureTimes() const
std::map< ArrayKey, std::set< SubScanKey > > _getArrayKeysToSubScanKeys() const
vector< uInt > _dataDescIDToSpwMap
Definition: MSMetaData.h:731
std::shared_ptr< const std::map< SubScanKey, rownr_t > > getNRowMap(CorrelationType type) const
vector< Int > _field_sourceIDs
Definition: MSMetaData.h:782
std::map< String, std::set< ScanKey > > getIntentToScansMap()
std::map< SourceKey, SourceProperties > _getSourceInfo() const
std::shared_ptr< std::set< Int > > _getEphemFieldIDs() const
get the field IDs of ephemeris objects
vector< Int > getFieldTableSourceIDs() const
Get the FIELD.SOURCE_ID column.
std::set< ArrayKey > _arrayKeys
Definition: MSMetaData.h:784
std::shared_ptr< Quantum< Vector< Double > > > _getIntervals() const
static uInt _sizeof(const vector< std::map< Int, Quantity > > &map)
void _setSpwInfo(const MeasurementSet &ms)
This comment from thunter in the original ValueMapping python class.
static uInt _sizeof(const std::map< Double, MSMetaData::TimeStampProperties > &m)
vector< vector< String > > _schedules
Definition: MSMetaData.h:758
std::shared_ptr< std::map< Int, rownr_t > > _fieldToNXCRowsMap
Definition: MSMetaData.h:748
std::set< Int > getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field ID.
rownr_t nRows(CorrelationType cType)
std::shared_ptr< Vector< Double > > _getTimes() const
std::vector< std::set< ScanKey > > getSpwToScansMap() const
get the complete mapping of spws to scans
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
void _getScansAndSpwMaps(std::map< ScanKey, std::set< uInt > > &scanToSpwMap, vector< std::set< ScanKey > > &spwToScanMap) const
std::set< Int > getScansForField(const String &field, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field.
vector< std::set< Int > > _obsToArraysMap
Definition: MSMetaData.h:753
std::map< String, std::set< uInt > > _antennaNameToIDMap
Definition: MSMetaData.h:736
vector< MPosition > getAntennaPositions(const vector< uInt > &which=std::vector< uInt >(0)) const
get the positions of the specified antennas.
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::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< uInt, std::set< uInt > > getBBCNosToSpwMap(SQLDSwitch sqldSwitch)
void _hasAntennaID(Int antennaID)
std::shared_ptr< std::map< SubScanKey, Double > > _unflaggedSubScanNACRows
Definition: MSMetaData.h:776
Float getMaxCacheSizeMB() const
max cache size in MB
Definition: MSMetaData.h:453
vector< vector< String > > getSchedules() const
get the contents of the SCHEDULE column from the OBSERVATIONS table Note that the embedded vectors ma...
vector< std::map< Int, Quantity > > _firstExposureTimeMap
Definition: MSMetaData.h:781
vector< uInt > _dataDescIDToPolIDMap
Definition: MSMetaData.h:731
Matrix< Bool > _uniqueBaselines
Definition: MSMetaData.h:772
vector< Quantity > getMeanFreqs() const
void _createScanRecords(Record &parent, const ArrayKey &arrayKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
vector< String > _fieldNames
Definition: MSMetaData.h:756
vector< MDirection > getPhaseDirs(const MEpoch &ep=MEpoch(Quantity(0.0, Unit("s")))) const
get the phase directions from the FIELD subtable.
vector< Int > getSourceTableSourceIDs() const
Get the SOURCE.SOURCE_ID column.
static uInt _sizeof(const std::map< T, std::set< String > > &m)
vector< uInt > getDataDescIDToPolIDMap() const
std::set< uInt > getChannelAvgSpw()
ALMA-specific.
vector< SpwProperties > _getSpwInfo(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
vector< MPosition > _observatoryPositions
Definition: MSMetaData.h:769
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 > > _getObservationIDs() const
void _getSubScansAndIntentsMaps(std::shared_ptr< const std::map< SubScanKey, std::set< String > > > &subScanToIntentsMap, std::map< String, std::set< SubScanKey > > &intentToSubScansMap) const
std::pair< Double, Double > getTimeRange(Bool showProgress=False) const
get the time range for the entire dataset.
std::shared_ptr< ArrayColumn< Bool > > _getFlags() const
std::map< String, std::set< uInt > > getIntentToSpwsMap()
std::map< ScanKey, std::set< Int > > getScanToStatesMap() const
get the mapping of scans to states
std::map< String, std::set< Int > > getIntentToFieldsMap()
std::map< ScanKey, std::set< SubScanKey > > _getScanToSubScansMap() const
std::map< SourceKey, std::shared_ptr< vector< MFrequency > > > getRestFrequencies() const
get rest frequencies from the SOURCE table
std::shared_ptr< const std::map< ScanKey, ScanProperties > > _scanProperties
Definition: MSMetaData.h:737
std::map< ScanKey, std::set< uInt > > _scanToSpwsMap
Definition: MSMetaData.h:730
void _computeScanAndSubScanProperties(std::shared_ptr< std::map< ScanKey, MSMetaData::ScanProperties > > &scanProps, std::shared_ptr< std::map< SubScanKey, MSMetaData::SubScanProperties > > &subScanProps, Bool showProgress) const
static uInt _sizeof(const vector< T > &v)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
this file contains all the compiler specific defines
Definition: mainpage.dox:28
std::set< ScanKey > scanKeys(const std::set< Int > &scans, const ArrayKey &arrayKey)
construct scan keys given a set of scan numbers and an ArrayKey
const Bool False
Definition: aipstype.h:44
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1580
unsigned int uInt
Definition: aipstype.h:51
ScanKey scanKey(const SubScanKey &subScanKey)
create a ScanKey from a SubScanKey, just omits the SubScanKey's fieldID
Definition: MSKeys.h:66
float Float
Definition: aipstype.h:54
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Quantum< Double > Quantity
Definition: Quantum.h:38
const Bool True
Definition: aipstype.h:43
double Double
Definition: aipstype.h:55
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
An ArrayKey is a unique combination of observation ID and array ID Negative values are allowed to ind...
Definition: MSKeys.h:89
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp,...
Definition: MSMetaData.h:675
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
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
std::map< uInt, std::set< Double > > times
times for each spectral window
Definition: MSMetaData.h:685
std::map< uInt, rownr_t > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:680
represents non-primary key data for a SOURCE table row
Definition: MSMetaData.h:713
std::shared_ptr< vector< MFrequency > > restfreq
Definition: MSMetaData.h:715
std::shared_ptr< vector< String > > transition
Definition: MSMetaData.h:716
QVD effbw
EFFECTIVE_BANDWIDTH.
Definition: MSMetaData.h:707
MFrequency reffreq
from the REF_FREQUENCY column
Definition: MSMetaData.h:704
Quantity meanfreq
The sum of all channel frequencies divided by the number of channels.
Definition: MSMetaData.h:694
vector< Double > edgechans
The center frequencies of the two channels at the edges of the window.
Definition: MSMetaData.h:701
Quantity centerfreq
The mean of the low frequency extent of the lowest frequency channel and the high frequency extend of...
Definition: MSMetaData.h:698
rownr_t xcRows
number of cross-correlation rows.
Definition: MSMetaData.h:95
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
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp,...
Definition: MSMetaData.h:107
rownr_t acRows
number of auto-correlation rows
Definition: MSMetaData.h:93
std::map< Double, TimeStampProperties > timeProps
Definition: MSMetaData.h:113
std::map< uInt, rownr_t > spwNRows
number of rows for each spectral window
Definition: MSMetaData.h:111
A scan is a unique combination of observation ID, array ID, and scan number Negative values are allow...
Definition: MSKeys.h:59
A sub scan is a unique combination of observation ID, array ID, scan number, and field ID.
Definition: MSKeys.h:42