casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MS_MSMETADATA_H
27#define MS_MSMETADATA_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/Quanta/QVector.h>
31#include <casacore/measures/Measures/MFrequency.h>
32#include <casacore/measures/Measures/MPosition.h>
33#include <casacore/ms/MeasurementSets/MeasurementSet.h>
34#include <casacore/ms/MeasurementSets/MSPointingColumns.h>
35#include <casacore/tables/Tables/TableProxy.h>
36#include <map>
37#include <memory>
38
39namespace casacore {
40
41template <class T> class ArrayColumn;
42struct ArrayKey;
43struct ScanKey;
44struct SourceKey;
45struct SubScanKey;
46
47// <summary>
48// Class to interrogate an MS for metadata. Interrogation happens on demand
49// and resulting metadata are stored for use by subsequent queries if the
50// cache has not exceeded the specified limit. Caching of MS main table columns
51// has been removed because the cache can be swamped by columns for large
52// MSes, meaning that smaller data structures, which are more computationally
53// expensive to create, aren't cached. Also, the column data is usually only
54// needed temporarily to compute smaller data structures, and the column data
55// is not particularly expensive to recreate if necessary.
56// Parallel processing is enabled using openmp.
57// </summary>
58
60
61public:
62
63 // for retrieving stats
69
75
77 std::set<Int> ddIDs;
79 };
80
86
87 typedef std::map<Int, std::pair<Double, Quantity> > FirstExposureTimeMap;
88
90 // number of auto-correlation rows
92 // number of cross-correlation rows.
94 std::set<Int> antennas;
96 std::set<uInt> ddIDs;
98 // the key is the spwID, the value is the meanInterval for
99 // the subscan and that spwID
100 std::map<uInt, Quantity> meanInterval;
101 // The Int represents the data description ID,
102 // The Double represents the time of the first time stamp,
103 // The Quantity represents the exposure time for the corresponding
104 // data description ID and time stamp
107 std::set<uInt> spws;
108 // number of rows for each spectral window
109 std::map<uInt, rownr_t> spwNRows;
110 std::set<Int> stateIDs;
111 std::map<Double, TimeStampProperties> timeProps;
112 };
113
114 // construct an object which stores a pointer to the MS and queries the MS
115 // only as necessary. The MeasurementSet pointer passed in should not go out
116 // of scope in the calling code until the caller has finished with this object,
117 // or else subsequent method calls on this object will result in a segmentation
118 // fault; the pointer is not copied.
119 // <src>maxCacheSizeMB</src> is the maximum cache size in megabytes. <=0 means
120 // do not use a cache, in which case, each method call will have to (re)query
121 // the MS. It is highly recommended to use a cache of reasonable size for the
122 // specified MS if multiple methods are going to be called.
123 MSMetaData(const MeasurementSet *const &ms, const Float maxCacheSizeMB);
124
125 virtual ~MSMetaData();
126
127 // get the antenna diameters
129
130 // if the antenna name appears multiple times in the antenna table, the *last* ID
131 // that it is associated with is returned.
132 uInt getAntennaID(const String& antennaName) const;
133
134 // get all the antenna IDs for the antenna with the specified name.
135 std::set<uInt> getAntennaIDs(const String& antennaName) const;
136
137 // The returned IDs are ordered in the way they appear in the atenna table
138 vector<std::set<uInt> > getAntennaIDs(const vector<String>& antennaNames) const;
139
140 // In the first instance of getAntennaNames, namesToID map will have the *last* ID
141 // of the antenna name, if it appears multiple times in the antenna table. In the second
142 // occurrence, namesToIDsMap will have the full set of IDs for antenna names that appear
143 // multiple times.
144
145 vector<String> getAntennaNames(
146 std::map<String, uInt>& namesToIDsMap,
147 const vector<uInt>& antennaIDs=vector<uInt>(0)
148 ) const;
149
150 vector<String> getAntennaNames(
151 std::map<String, std::set<uInt> >& namesToIDsMap,
152 const vector<uInt>& antennaIDs=vector<uInt>(0)
153 ) const;
154
155 // get the antenna stations for the specified antenna IDs
156 vector<String> getAntennaStations(const vector<uInt>& antennaIDs=vector<uInt>());
157
158 // get the antenna stations for the specified antenna names. The outer vector is ordered
159 // respective to antennaNames. Because an antenna name can appear more than once in
160 // the antenna table, the inner vector is ordered by row number in which that antenna name
161 // appears.
162 vector<std::vector<String> > getAntennaStations(const vector<String>& antennaNames);
163
164 // get the set of antenna IDs for the specified scan.
165 std::set<Int> getAntennasForScan(const ScanKey& scan) const;
166
167 // POLARIZATION.CORR_PRODUCT
168 vector<Array<Int> > getCorrProducts() const;
169
170 // POLARIZATION.CORR_TYPE
171 vector<vector<Int> > getCorrTypes() const;
172
173 vector<uInt> getDataDescIDToSpwMap() const;
174
175 vector<uInt> getDataDescIDToPolIDMap() const;
176
177 // Get the FIELD.SOURCE_ID column.
178 vector<Int> getFieldTableSourceIDs() const;
179
180 // get the mapping of field ID to scans
181 vector<std::set<ScanKey> > getFieldToScansMap() const;
182
183 std::map<String, std::set<Int> > getIntentToFieldsMap();
184
185 std::map<String, std::set<ScanKey> > getIntentToScansMap();
186
187 std::map<String, std::set<uInt> > getIntentToSpwsMap();
188
189 std::set<String> getIntentsForScan(const ScanKey& scan) const;
190
191 std::set<String> getIntentsForSubScan(const SubScanKey& subScan) const;
192
193 std::shared_ptr<const std::map<SubScanKey, std::set<String> > > getSubScanToIntentsMap() const;
194
195 // get all intents, in no particular (nor guaranteed) order.
196 std::set<String> getIntents() const;
197
198 // get a set of intents corresponding to a specified field
199 std::set<String> getIntentsForField(Int fieldID);
200
201 // get a set of intents corresponding to a specified field name
202 std::set<String> getIntentsForField(String field);
203
204 // get a set of intents corresponding to the specified spectral window
205 std::set<String> getIntentsForSpw(const uInt spw);
206
207 // number of correlations from the polarization table.
208 vector<Int> getNumCorrs() const;
209
210 //SOURCE.PROPER_MOTION, first value in pair is longitudinal proper motion,
211 // second is latiduninal
212 vector<std::pair<Quantity, Quantity> > getProperMotions() const;
213
214 // get unique scan numbers
215 std::set<Int> getScanNumbers(Int obsID, Int arrayID) const;
216
217 // get a set of scan numbers for the specified stateID, obsID, and arrayID.
218 // If obsID and/or arrayID is negative, all observation IDs and/or array IDs
219 // will be used.
220 std::set<Int> getScansForState(
221 Int stateID, Int obsID, Int arrayID
222 ) const;
223
224 // get the mapping of scans to states
225 std::map<ScanKey, std::set<Int> > getScanToStatesMap() const;
226
227 // SOURCE.DIRECTION
228 vector<MDirection> getSourceDirections() const;
229
230 // SOURCE.NAME
231 vector<String> getSourceNames() const;
232
233 // Get the SOURCE.SOURCE_ID column. This is a very unfortunate column name,
234 // because generally an "ID" column of the table with the same name refers to
235 // the row number in that table. But not in this case.
236 vector<Int> getSourceTableSourceIDs() const;
237
238 // SOURCE.TIME
239 std::shared_ptr<const Quantum<Vector<Double> > > getSourceTimes() const;
240
241 // get a set of spectral windows for which the specified <src>intent</src>
242 // applies.
243 virtual std::set<uInt> getSpwsForIntent(const String& intent);
244
245 // get the number of visibilities
246 rownr_t nRows() const;
247
249
250 std::shared_ptr<const std::map<SubScanKey, rownr_t> > getNRowMap(CorrelationType type) const;
251
253 CorrelationType cType, Int arrayID, Int observationID,
254 Int scanNumber, Int fieldID
255 ) const;
256
257 rownr_t nRows(CorrelationType cType, uInt fieldID) const;
258
259 // get number of spectral windows
260 uInt nSpw(Bool includewvr) const;
261
262 // number of unique states (number of rows from the STATE table)
263 uInt nStates() const;
264
265 // get the number of fields.
266 uInt nFields() const;
267
268 // get a mapping of spectral window ID to data descrption IDs
269 std::vector<std::set<uInt> > getSpwToDataDescriptionIDMap() const;
270
271 // get a set of spectral windows corresponding to the specified fieldID
272 std::set<uInt> getSpwsForField(const Int fieldID) const;
273
274 // get a set of spectral windows corresponding to the specified field name
275 std::set<uInt> getSpwsForField(const String& fieldName);
276
277 // get the values of the CODE column from the field table
278 vector<String> getFieldCodes() const;
279
280 // get the set of field IDs corresponding to the specified spectral window.
281 std::set<Int> getFieldIDsForSpw(const uInt spw);
282
283 // get the set of field names corresponding to the specified spectral window.
284 std::set<String> getFieldNamesForSpw(const uInt spw);
285
286 // get the mapping of fields to spws
287 std::map<Int, std::set<uInt> > getFieldsToSpwsMap() const;
288
289 // get rest frequencies from the SOURCE table
290 std::map<SourceKey, std::shared_ptr<vector<MFrequency> > > getRestFrequencies() const;
291
292 // get the set of spectral windows for the specified scan.
293 std::set<uInt> getSpwsForScan(const ScanKey& scan) const;
294
295 // get the set of spectral windows for the specified subscan.
296 std::set<uInt> getSpwsForSubScan(const SubScanKey& subScan) const;
297
298 // get the set of scan numbers for the specified spectral window.
299 std::set<Int> getScansForSpw(uInt spw, Int obsID, Int arrayID) const;
300
301 // get the complete mapping of scans to spws
302 std::map<ScanKey, std::set<uInt> > getScanToSpwsMap() const;
303
304 // get the complete mapping of spws to scans
305 std::vector<std::set<ScanKey> > getSpwToScansMap() const;
306
307 // get the transitions from the SOURCE table. If there are no transitions
308 // for a particular key, the shared ptr contains the null ptr.
309 std::map<SourceKey, std::shared_ptr<vector<String> > > getTransitions() const;
310
311 // get the number of antennas in the ANTENNA table
313
314 // ALMA-specific. get set of spectral windows used for TDM. These are windows that have
315 // 64, 128, or 256 channels
316 std::set<uInt> getTDMSpw();
317
318 // ALMA-specific. get set of spectral windows used for FDM. These are windows that do not
319 // have 1, 4, 64, 128, or 256 channels.
320 std::set<uInt> getFDMSpw();
321
322 // ALMA-specific. get spectral windows that have been averaged. These are windows with 1 channel.
323 std::set<uInt> getChannelAvgSpw();
324
325 // ALMA-specific. Get the spectral window set used for WVR measurements. These have 4 channels each.
326 std::set<uInt> getWVRSpw() const;
327
328 // ALMA-specific. Get the square law detector (total power) spectral windows.
329 std::set<uInt> getSQLDSpw();
330
331 // Get the scan numbers which fail into the specified time range (center-tol to center+tol),
332 // inclusive. A negative value of obsID and/or arrayID indicates that all observation IDs
333 // and/or all arrayIDs should be used.
334 std::set<Int> getScansForTimes(
335 Double center, Double tol, Int obsID, Int arrayID
336 ) const;
337
338 // Get the times for the specified scans
339 std::set<Double> getTimesForScans(std::set<ScanKey> scans) const;
340
341 // get the times for the specified scan.
342 // The return values come from the TIME column.
343 std::set<Double> getTimesForScan(const ScanKey& scan) const;
344
345 std::map<uInt, std::set<Double> > getSpwToTimesForScan(const ScanKey& scan) const;
346
347 // get the time range for the specified scan. The pair will contain
348 // the start and stop time of the scan, determined from min(TIME(x)-0.5*INTERVAL(x)) and
349 // max(TIME(x)-0.5*INTERVAL(x))
350 std::pair<Double, Double> getTimeRangeForScan(const ScanKey& scanKey) const;
351
352 // get the map of scans to time ranges.
353 std::shared_ptr<const std::map<ScanKey, std::pair<Double,Double> > > getScanToTimeRangeMap() const;
354
355 // get the stateIDs associated with the specified scan. If obsID and/or arrayID
356 // is negative, all observation IDs and/or array IDs will be used.
357 std::set<Int> getStatesForScan(Int obsID, Int arrayID, Int scan) const;
358
359 // get a map of spectral windows to unique timestamps.
360 std::vector<std::set<Double> > getTimesForSpws(Bool showProgress=True) const;
361
362 // get the position of the specified antenna relative to the observatory position.
363 // the three vector returned represents the longitudinal, latitudinal, and elevation
364 // offsets (elements 0, 1, and 2 respectively). The longitude and latitude offsets are
365 // measured along the surface of a sphere centered at the earth's center and whose surface
366 // intersects the position of the observatory.
368
369 // If the antenna name appears mulitple times, this will return the offset for the first
370 // occurrence of it in the antenna table
371 QVD getAntennaOffset(const String& name) const;
372
373 // If the antenna name appears mulitple times, this will return all the offsets for it,
374 // in the order they appear in the antenna table
375 std::vector<QVD> getAntennaOffsets(const String& name) const;
376
377 vector<QVD > getAntennaOffsets() const;
378
379 // get the positions of the specified antennas. If <src>which</src> is empty, return
380 // all antenna positions.
381 vector<MPosition> getAntennaPositions(
382 const vector<uInt>& which=std::vector<uInt>(0)
383 ) const;
384
385 // <src>names</src> cannot be empty.
386 vector<vector<MPosition> > getAntennaPositions(const vector<String>& names);
387
388 // the first key in the returned map is the spectral window ID, the second is
389 // the average interval for the specified scan for that spw.
390 std::map<uInt, Double> getAverageIntervalsForScan(const ScanKey& scan) const;
391
392 // the first key in the returned map is the spectral window ID, the second is
393 // the average interval for the specified sub scan for that spw.
394 std::map<uInt, Quantity> getAverageIntervalsForSubScan(const SubScanKey& subScan) const;
395
396 vector<uInt> getBBCNos() const;
397
398 vector<String> getCorrBits() 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
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
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 // ALMA specific CAS-13973 get receiver bands for each spw
669 // values of -1 indicate no info found for those spws.
670 vector<int> getSpwReceiverBands() const;
671
672 // ALMA specific CAS-13973 get subwindows for each spw
673 // values of -1 indicate no info found for those spws.
674 // The SPW subwindow name is established by the ALMA Observing
675 // Tool and is recorded in each project's scheduling blocks.
676 // Here is an example for one spw whose subwindow name is
677 // "SW-1", as indicated by the name field. Currently, these
678 // values can range up to "SW-4", as a maximumn of 4 spws per
679 // baseband are currently offered on the ALMA correlators.
680 //
681 // <sbl:ACASpectralWindow sideBand="LSB"
682 // windowFunction="HANNING" polnProducts="XX,YY" synthProf="ACA_CDP">
683 // <sbl:centerFrequency unit="GHz">3.0</sbl:centerFrequency>
684 // <sbl:spectralAveragingFactor>1</sbl:spectralAveragingFactor>
685 // <sbl:name>SW-1</sbl:name>
686 // <sbl:effectiveBandwidth unit="GHz">2.0</sbl:effectiveBandwidth>
687 // <sbl:effectiveNumberOfChannels>128</sbl:effectiveNumberOfChannels>
688 // <sbl:associatedSpectralWindowNumberInPair>0</sbl:associatedSpectralWindowNumberInPair>
689 // <sbl:useThisSpectralWindow>true</sbl:useThisSpectralWindow>
690 // <sbl:representativeWindow>false</sbl:representativeWindow>
691 // <sbl:frqChProfReproduction>true</sbl:frqChProfReproduction>
692 // <sbl:ChannelAverageRegion>
693 // <sbl:startChannel>6</sbl:startChannel>
694 // <sbl:numberChannels>115</sbl:numberChannels>
695 // </sbl:ChannelAverageRegion>
696 // </sbl:ACASpectralWindow>
697 vector<int> getSpwSubwindows() const;
698
699private:
700
702 // The Int represents the data description ID,
703 // The Double represents the time of the first time stamp,
704 // The Quantity represents the exposure time for the corresponding
705 // data description ID and time stamp
707 // the key is the spwID, the value is the meanInterval for
708 // the subscan and that spwID
709 std::map<uInt, Quantity> meanInterval;
710 // number of rows for each spectral window
711 std::map<uInt, rownr_t> spwNRows;
712 // time range (which takes into account helf of the corresponding
713 // interval, which is not accounted for in the SubScanProperties times
714 std::pair<Double, Double> timeRange;
715 // times for each spectral window
716 std::map<uInt, std::set<double> > times;
717 };
718
720 double bandwidth;
724 // The sum of all channel frequencies divided by the number of channels
726 // The mean of the low frequency extent of the lowest frequency channel and
727 // the high frequency extend of the highest frequency channel. Often, but not
728 // necessarily, the same as meanfreq
731 // The center frequencies of the two channels at the edges of the window
732 vector<double> edgechans;
734 // from the REF_FREQUENCY column
737 // EFFECTIVE_BANDWIDTH
739 // RESOLUTION
741 // CAS-13749 value for adhoc ALMA-specific SPECTRAL_WINDOW column
743 // CAS-13973 ALMA specific quantities sw = subwindow, rb = receiver band
744 int rb;
745 int sw;
746 };
747
748 // represents non-primary key data for a SOURCE table row
751 std::shared_ptr<vector<MFrequency> > restfreq;
752 std::shared_ptr<vector<String> > transition;
753 };
754
755 // The general pattern is that a mutable gets set only once, on demand, when its
756 // setter is called for the first time. If this pattern is broken, defective behavior
757 // will occur.
758
766 mutable std::map<ScanKey, std::set<uInt> > _scanToSpwsMap, _scanToDDIDsMap;
768 mutable std::map<Int, std::set<uInt> > _fieldToSpwMap;
769 mutable std::map<ScanKey, std::set<Int> > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap;
770 mutable std::map<Int, std::set<Int> > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap;
771 mutable std::map<std::pair<uInt, uInt>, uInt> _spwPolIDToDataDescIDMap;
772 mutable std::vector<std::vector<uInt>> _spwIDToPolIDMap;
773 mutable std::map<String, std::set<uInt> > _antennaNameToIDMap;
774 mutable std::shared_ptr<const std::map<ScanKey, ScanProperties> > _scanProperties;
775 mutable std::shared_ptr<const std::map<SubScanKey, SubScanProperties> > _subScanProperties;
776
777 mutable std::map<String, std::set<Int> > _intentToFieldIDMap;
778 mutable std::map<String, std::set<ScanKey> > _intentToScansMap;
779 mutable std::map<String, std::set<SubScanKey> > _intentToSubScansMap;
780 mutable std::map<std::pair<ScanKey, uInt>, std::set<uInt> > _scanSpwToPolIDMap;
781 mutable std::set<String> _uniqueIntents;
784 mutable std::shared_ptr<std::map<SubScanKey, rownr_t> > _subScanToNACRowsMap, _subScanToNXCRowsMap;
785 mutable std::shared_ptr<std::map<Int, rownr_t> > _fieldToNACRowsMap, _fieldToNXCRowsMap;
786 mutable std::map<ScanKey, std::set<String> > _scanToIntentsMap;
787 mutable std::shared_ptr<const std::map<SubScanKey, std::set<String> > > _subScanToIntentsMap;
788 mutable vector<std::set<String> > _stateToIntentsMap, _spwToIntentsMap, _fieldToIntentsMap;
789 mutable vector<SpwProperties> _spwInfo;
790 mutable vector<std::set<Int> > _spwToFieldIDsMap, _obsToArraysMap;
791 mutable vector<std::set<ScanKey> > _spwToScansMap, _ddidToScansMap, _fieldToScansMap;
792
795 mutable vector<vector<String> > _schedules;
796 mutable vector<vector<Int> > _corrTypes;
797 mutable vector<Array<Int> >_corrProds;
798
799 mutable std::shared_ptr<std::map<ScanKey, std::set<Double> > > _scanToTimesMap;
800 std::map<String, std::set<uInt> > _intentToSpwsMap;
801 mutable std::map<String, std::set<Double> > _intentToTimesMap;
802
803 std::shared_ptr<std::map<Int, std::set<Double> > > _fieldToTimesMap;
804 std::shared_ptr<std::map<Double, std::set<Int> > > _timeToFieldsMap;
805
806 mutable vector<MPosition> _observatoryPositions, _antennaPositions;
807 mutable vector<QVD > _antennaOffsets;
812 mutable std::shared_ptr<vector<Double> > _unflaggedFieldNACRows, _unflaggedFieldNXCRows;
813 mutable std::shared_ptr<std::map<SubScanKey, Double> > _unflaggedSubScanNACRows, _unflaggedSubScanNXCRows;
815 const vector<const Table*> _taqlTempTable;
816
818 vector<std::map<Int, Quantity> > _firstExposureTimeMap;
820
821 mutable std::set<ArrayKey> _arrayKeys;
822 mutable std::set<ScanKey> _scanKeys;
823 mutable std::set<SubScanKey> _subscans;
824 mutable std::map<ScanKey, std::set<SubScanKey> > _scanToSubScans;
825 mutable std::map<ArrayKey, std::set<SubScanKey> > _arrayToSubScans;
826
827 mutable vector<std::pair<MEpoch, MEpoch> > _timeRangesForObs;
828
829 mutable vector<MDirection> _phaseDirs, _sourceDirs;
830
831 mutable vector<std::pair<Quantity, Quantity> > _properMotions;
832
833 mutable std::map<SourceKey, SourceProperties> _sourceInfo;
834 mutable std::shared_ptr<std::set<Int> > _ephemFields;
835 mutable std::shared_ptr<const Quantum<Vector<Double> > > _sourceTimes;
836
837 // disallow copy constructor and = operator
840
841 // This comment from thunter in the original ValueMapping python class
842 // # Determine the number of polarizations for the first OBSERVE_TARGET intent.
843 // # Used by plotbandpass for BPOLY plots since the number of pols cannot be inferred
844 // # correctly from the caltable alone. You cannot not simply use the first row, because
845 // # it may be a pointing scan which may have different number of polarizations than what
846 // # the TARGET and BANDPASS calibrator will have.
847 // # -- T. Hunter
848 // uInt _getNumberOfPolarizations();
849
851
852 // set metadata from OBSERVATION table
854
855 Bool _cacheUpdated(const Float incrementInBytes) const;
856
857 void _checkField(uInt fieldID) const;
858
859 void _checkScan(const ScanKey& key) const;
860
861 void _checkScans(const std::set<ScanKey>& scanKeys) const;
862
863 void _checkSubScan(const SubScanKey& key) const;
864
865 static void _checkTolerance(const Double tol);
866
868 std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
869 std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
870 Bool showProgress
871 ) const;
872
874 Vector<Int>& v, TableProxy& table, const String& colname,
875 rownr_t beginRow, rownr_t nrows
876 );
877
879 Vector<Double>& v, TableProxy& table, const String& colname,
880 rownr_t beginRow, rownr_t nrows
881 );
882
884 Quantum<Vector<Double> >& v, TableProxy& table, const String& colname,
885 rownr_t beginRow, rownr_t nrows
886 );
887
889 std::shared_ptr<std::map<ScanKey, MSMetaData::ScanProperties> >& scanProps,
890 std::shared_ptr<std::map<SubScanKey, MSMetaData::SubScanProperties> >& subScanProps,
891 const std::vector<
892 std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
893 >& props
894 ) const;
895
897 Record& parent, const ArrayKey& arrayKey,
898 const std::map<SubScanKey, SubScanProperties>& subScanProps
899 ) const;
900
902 Record& parent, rownr_t& scanNRows, std::set<Int>& antennasForScan,
903 const ScanKey& scanKey, const std::map<SubScanKey, SubScanProperties>& subScanProps
904 ) const;
905
907 Record& parent,
908 const SubScanProperties& subScanProps
909 );
910
911 // convert a QVD in frequency units to velocity units using
912 // the give reference frequency. No explicit checking is done
913 // for unit correctness of the inputs.
914 static QVD _freqWidthToVelWidth(const QVD& v, const Quantity& refFreq);
915
916 // if _scanProps has been generated, just return it. If the caller has
917 // configured the object to generate _scanProps at some point, this call will
918 // generate it. Otherwise, the returned object contains a null pointer.
919 std::shared_ptr<const std::map<ScanKey, ScanProperties> > _generateScanPropsIfWanted() const;
920
921 // if _subScanProperties has been generated, just return it. If
922 // the caller has configured the object to generate _subScanPropertiess
923 // at some point, this call will generate it. Otherwise, the returned object
924 // contains a null pointer.
925 std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >
927
928 vector<String> _getAntennaNames(
929 std::map<String, std::set<uInt> >& namesToIDsMap
930 ) const;
931
932 vector<MPosition> _getAntennaPositions() const;
933
935 std::shared_ptr<Vector<Int> >& ant1,
936 std::shared_ptr<Vector<Int> >& ant2
937 ) const;
938
939 std::shared_ptr<Vector<Int> > _getArrayIDs() const;
940
941 std::map<ArrayKey, std::set<SubScanKey> > _getArrayKeysToSubScanKeys() const;
942
943 // Uses openmp for parallel processing
944 std::pair<std::map<ScanKey, ScanProperties>, std::map<SubScanKey, SubScanProperties> >
946 const Vector<Int>& scans, const Vector<Int>& fields,
947 const Vector<Int>& ddIDs, const Vector<Int>& states,
948 const Vector<Double>& times, const Vector<Int>& arrays,
949 const Vector<Int>& observations, const Vector<Int>& ant1,
950 const Vector<Int>& ant2, const Quantum<Vector<Double> >& exposureTimes,
951 const Quantum<Vector<Double> >& intervalTimes, const vector<uInt>& ddIDToSpw,
952 rownr_t beginRow, rownr_t endRow
953 ) const;
954
955 std::shared_ptr<Vector<Int> > _getDataDescIDs() const;
956
957 // get the field IDs of ephemeris objects
958 std::shared_ptr<std::set<Int> > _getEphemFieldIDs() const;
959
960 std::shared_ptr<Quantum<Vector<Double> > > _getExposureTimes() const;
961
962 std::shared_ptr<Vector<Int> > _getFieldIDs() const;
963
964 // If there are no intents, then fieldToIntentsMap will be of length
965 // nFields() and all of its entries will be the empty set, and
966 // intentToFieldsMap will be empty
968 vector<std::set<String> >& fieldToIntentsMap,
969 std::map<String, std::set<Int> >& intentToFieldsMap
970 );
971
973 vector<std::set<ScanKey> >& fieldToScansMap,
974 std::map<ScanKey, std::set<Int> >& scanToFieldsMap
975 ) const;
976
978 std::map<Int, std::set<uInt> >& fieldToSpwMap,
979 vector<std::set<Int> >& spwToFieldMap
980 ) const;
981
983 std::map<Int, std::set<Int> >& fieldToStatesMap,
984 std::map<Int, std::set<Int> >& stateToFieldsMap
985 );
986
988 std::shared_ptr<std::map<Int, std::set<Double> > >& fieldToTimesMap,
989 std::shared_ptr<std::map<Double, std::set<Int> > >& timesToFieldMap
990 );
991
992 std::shared_ptr<ArrayColumn<Bool> > _getFlags() const;
993
994 std::map<String, std::set<Double> > _getIntentsToTimesMap() const;
995
996 std::shared_ptr<Quantum<Vector<Double> > > _getIntervals() const;
997
998 std::shared_ptr<Vector<Int> > _getObservationIDs() const;
999
1000 std::shared_ptr<Vector<Int> > _getScans() const;
1001
1002 vector<std::set<String> > _getSpwToIntentsMap();
1003
1004 // polarization ids will be sorted in ascending order in all
1005 // member vectors
1006 std::vector<std::vector<uInt>> _getSpwToPolMap() const;
1007
1008 std::shared_ptr<Vector<Int> > _getStateIDs() const;
1009
1010 std::shared_ptr<Vector<Double> > _getTimes() const;
1011
1012 //std::shared_ptr<std::map<Double, TimeStampProperties> > _getTimeStampProperties() const;
1013
1014 Bool _hasIntent(const String& intent) const;
1015
1016 Bool _hasFieldID(Int fieldID) const;
1017
1018 Bool _hasStateID(Int stateID) const;
1019
1020 void _hasAntennaID(Int antennaID);
1021
1022 std::map<Double, Double> _getTimeToTotalBWMap(
1023 const Vector<Double>& times, const Vector<Int>& ddIDs
1024 );
1025
1027 const MSPointingColumns& pCols, const Int& index,
1028 const Double& time
1029 ) const;
1030
1031 //map<SubScanKey, Quantity> _getMeanExposureTimes() const;
1032
1033 vector<std::set<Int> > _getObservationIDToArrayIDsMap() const;
1034
1035 vector<MPosition> _getObservatoryPositions();
1036
1038 rownr_t& nACRows, rownr_t& nXCRows,
1039 std::map<SubScanKey, rownr_t>*& subScanToNACRowsMap,
1040 std::map<SubScanKey, rownr_t>*& subScanToNXCRowsMap,
1041 std::map<Int, rownr_t>*& fieldToNACRowsMap,
1042 std::map<Int, rownr_t>*& fieldToNXCRowsMap
1043 ) const;
1044
1046 rownr_t& nACRows, rownr_t& nXCRows,
1047 std::shared_ptr<std::map<SubScanKey, rownr_t> >& scanToNACRowsMap,
1048 std::shared_ptr<std::map<SubScanKey, rownr_t> >& scanToNXCRowsMap,
1049 std::shared_ptr<std::map<Int, rownr_t> >& fieldToNACRowsMap,
1050 std::shared_ptr<std::map<Int, rownr_t> >& fieldToNXCRowsMap
1051 ) const;
1052
1053 // get scan properties
1054 std::shared_ptr<const std::map<ScanKey, MSMetaData::ScanProperties> > _getScanProperties(
1055 Bool showProgress
1056 ) const;
1057
1058 // get the scan keys in the specified set that have the associated arrayKey
1059 std::set<ScanKey> _getScanKeys(
1060 const std::set<ScanKey>& scanKeys, const ArrayKey& arrayKey
1061 ) const;
1062
1063 // get all valid scan numbers associated with the specified arrayKey
1064 std::set<Int> _getScanNumbers(const ArrayKey& arrayKey) const;
1065
1067 std::map<ScanKey, std::set<uInt> >& scanToDDIDMap,
1068 vector<std::set<ScanKey> >& ddIDToScanMap
1069 ) const;
1070
1072 std::map<ScanKey, std::set<String> >& scanToIntentsMap,
1073 std::map<String, std::set<ScanKey> >& intentToScansMap
1074 ) const;
1075
1077 std::map<ScanKey, std::set<uInt> >& scanToSpwMap,
1078 vector<std::set<ScanKey> >& spwToScanMap
1079 ) const;
1080
1081 std::map<ScanKey, std::set<Int> > _getScanToAntennasMap() const;
1082
1083 std::map<ScanKey, std::set<SubScanKey> > _getScanToSubScansMap() const;
1084
1085 std::shared_ptr<std::map<ScanKey, std::set<Double> > > _getScanToTimesMap() const;
1086
1087 std::map<SourceKey, SourceProperties> _getSourceInfo() const;
1088
1089 vector<SpwProperties> _getSpwInfo(
1090 std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw,
1091 std::set<uInt>& fdmSpw, std::set<uInt>& wvrSpw,
1092 std::set<uInt>& sqldSpw
1093 ) const;
1094
1096 vector<std::set<String> >& spwToIntentsMap,
1097 std::map<String, std::set<uInt> >& intentToSpwsMap
1098 );
1099
1100 vector<SpwProperties> _getSpwInfo2(
1101 std::set<uInt>& avgSpw, std::set<uInt>& tdmSpw, std::set<uInt>& fdmSpw,
1102 std::set<uInt>& wvrSpw, std::set<uInt>& sqldSpw
1103 ) const;
1104
1106 vector<std::set<String> >& statesToIntentsMap,
1107 std::set<String>& uniqueIntents
1108 ) const;
1109
1110 vector<String> _getStationNames();
1111
1113 std::shared_ptr<const std::map<SubScanKey, std::set<String> > >& subScanToIntentsMap,
1114 std::map<String, std::set<SubScanKey> >& intentToSubScansMap
1115 ) const;
1116
1118 std::shared_ptr<const std::map<ScanKey, ScanProperties> >& scanProps,
1119 std::shared_ptr<const std::map<SubScanKey, SubScanProperties> >& subScanProps,
1120 Bool showProgress
1121 ) const;
1122
1123 std::set<SubScanKey> _getSubScanKeys() const;
1124
1125 // get subscans related to the given scan
1126 std::set<SubScanKey> _getSubScanKeys(const ScanKey& scanKey) const;
1127
1129 Double& nACRows, Double& nXCRows,
1130 std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNACRowsMap,
1131 std::shared_ptr<std::map<SubScanKey, Double> >& subScanToNXCRowsMap,
1132 std::shared_ptr<vector<Double> >& fieldToNACRowsMap,
1133 std::shared_ptr<vector<Double> >& fieldToNXCRowsMap
1134 ) const;
1135
1137 Double& nACRows, Double& nXCRows,
1138 vector<Double>*& fieldNACRows, vector<Double>*& fieldNXCRows,
1139 std::map<SubScanKey, Double>*& scanNACRows,
1140 std::map<SubScanKey, Double>*& scanNXCRows
1141 ) const;
1142
1144 FirstExposureTimeMap& current, const FirstExposureTimeMap& test
1145 );
1146
1148 FirstExposureTimeMap& current, Int dataDescID,
1149 Double time, Double exposure, const Unit& eunit
1150 );
1151
1152 static uInt _sizeof(const std::map<Double, MSMetaData::TimeStampProperties> & m);
1153
1154 template <class T>
1155 static uInt _sizeof(const std::map<T, std::set<String> >& m);
1156
1157 template <class T, class U>
1158 static uInt _sizeof(const std::map<T, std::set<U> >& m);
1159
1160 template <class T, class U>
1161 static uInt _sizeof(const std::map<T, U>& m);
1162
1163 static uInt _sizeof(const vector<std::set<String> >& m);
1164
1165 static uInt _sizeof(const vector<String>& m);
1166
1167 static uInt _sizeof(const vector<vector<String> >& m);
1168
1169 template <class T>
1170 static uInt _sizeof(const vector<T>& v);
1171
1173
1174 template <class T>
1175 static uInt _sizeof(const vector<std::set<T> >& v);
1176
1177 template <class T> static uInt _sizeof(const std::map<String, std::set<T> >& map);
1178
1179 static uInt _sizeof(const vector<std::map<Int, Quantity> >& map);
1180
1181 static uInt _sizeof(const std::map<std::pair<Int, uInt>, std::set<uInt> >& map);
1182
1183 static std::map<Int, uInt> _toUIntMap(const Vector<Int>& v);
1184
1185 template <class T> std::shared_ptr<Vector<T> > _getMainScalarColumn(
1187 ) const;
1188
1189 std::shared_ptr<vector<int>> _almaReceiverBands(uint nspw) const;
1190
1191};
1192
1193}
1194
1195#endif
PredefinedColumns
The Main table colums with predefined meaning.
Definition MSMainEnums.h:62
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...
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)
std::shared_ptr< ArrayColumn< Bool > > _getFlags() const
vector< std::pair< Quantity, Quantity > > getProperMotions() const
SOURCE.PROPER_MOTION, first value in pair is longitudinal proper motion, second is latiduninal.
vector< Int > _numCorrs
Definition MSMetaData.h:819
std::set< Int > _uniqueAntennaIDs
Definition MSMetaData.h:782
std::map< Double, Double > _getTimeToTotalBWMap(const Vector< Double > &times, const Vector< Int > &ddIDs)
uInt nObservations() const
get the number of observations (from the OBSERVATIONS table) in the dataset
std::map< uInt, std::set< Double > > getSpwToTimesForScan(const ScanKey &scan) const
vector< String > _getAntennaNames(std::map< String, std::set< uInt > > &namesToIDsMap) const
vector< Quantity > getCenterFreqs() const
uInt nSpw(Bool includewvr) const
get number of spectral windows
std::shared_ptr< const Quantum< Vector< Double > > > _sourceTimes
Definition MSMetaData.h:835
std::set< Int > getScansForSpw(uInt spw, Int obsID, Int arrayID) const
get the set of scan numbers for the specified spectral window.
void _createSubScanRecords(Record &parent, rownr_t &scanNRows, std::set< Int > &antennasForScan, const ScanKey &scanKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
std::shared_ptr< Vector< Double > > _getTimes() const
std::shared_ptr< std::map< SubScanKey, rownr_t > > _subScanToNXCRowsMap
Definition MSMetaData.h:784
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::shared_ptr< Vector< T > > _getMainScalarColumn(MSMainEnums::PredefinedColumns col) const
std::set< Int > getAntennasForScan(const ScanKey &scan) const
get the set of antenna IDs for the specified scan.
std::set< Int > getFieldIDsForField(const String &field) const
get the field IDs for the specified field name.
static uInt _sizeof(const vector< std::set< T > > &v)
std::map< ScanKey, std::set< SubScanKey > > _scanToSubScans
Definition MSMetaData.h:824
vector< uInt > nChans() const
std::vector< std::vector< uInt > > _getSpwToPolMap() const
polarization ids will be sorted in ascending order in all member vectors
void _checkScan(const ScanKey &key) 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...
std::set< String > getIntentsForField(Int fieldID)
get a set of intents corresponding to a specified field
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
std::vector< std::set< ScanKey > > getSpwToScansMap() const
get the complete mapping of spws to scans
vector< String > _observers
Definition MSMetaData.h:794
std::shared_ptr< Vector< Int > > _getDataDescIDs() const
Matrix< Bool > getUniqueBaselines()
std::map<Double, Double> getExposuresForTimes() const;
const vector< const Table * > _taqlTempTable
Definition MSMetaData.h:815
std::set< uInt > _avgSpw
Definition MSMetaData.h:783
static uInt _sizeof(const std::map< std::pair< Int, uInt >, std::set< uInt > > &map)
vector< vector< Double > > getEdgeChans()
QVD getAntennaOffset(uInt which) const
get the position of the specified antenna relative to the observatory position.
vector< Int > getNumCorrs() const
number of correlations from the polarization table.
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::set< uInt > getSpwIDs() const
get all the spws associated with the data description IDs listed in the main table.
vector< SpwProperties > _spwInfo
Definition MSMetaData.h:789
vector< MFrequency > getRefFreqs() const
std::shared_ptr< vector< int > > _almaReceiverBands(uint nspw) const
Double nUnflaggedRows(CorrelationType cType) const
const MeasurementSet * getMS() const
Definition MSMetaData.h:659
std::shared_ptr< const std::map< ScanKey, std::pair< Double, Double > > > getScanToTimeRangeMap() const
get the map of scans to time ranges.
const Float _maxCacheMB
Definition MSMetaData.h:762
void setShowProgress(Bool b)
Definition MSMetaData.h:661
rownr_t nRows(CorrelationType cType, Int arrayID, Int observationID, Int scanNumber, Int fieldID) const
std::map< String, std::set< Double > > _getIntentsToTimesMap() const
void _getFieldsAndScansMaps(vector< std::set< ScanKey > > &fieldToScansMap, std::map< ScanKey, std::set< Int > > &scanToFieldsMap) const
vector< std::set< ScanKey > > _ddidToScansMap
Definition MSMetaData.h:791
uInt getAntennaID(const String &antennaName) const
if the antenna name appears multiple times in the antenna table, the last ID that it is associated wi...
std::set< uInt > getSpwsForField(const String &fieldName)
get a set of spectral windows corresponding to the specified field name
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::set< Int > getFieldsForScan(const ScanKey &scan) const
get field IDs associated with the specified scan number.
vector< MPosition > getAntennaPositions(const vector< uInt > &which=std::vector< uInt >(0)) const
get the positions of the specified antennas.
std::set< String > getIntentsForField(String field)
get a set of intents corresponding to a specified field name
std::map< Int, std::set< String > > getFieldNamesForSourceMap() const
vector< Double > getBandWidths() const
vector< Int > _source_sourceIDs
Definition MSMetaData.h:819
std::shared_ptr< std::set< Int > > _ephemFields
Definition MSMetaData.h:834
vector< String > getFieldNamesForFieldIDs(const vector< uInt > &fieldIDs)
get the field names associated with the specified field IDs.
vector< Int > getFieldTableSourceIDs() const
Get the FIELD.SOURCE_ID column.
std::set< uInt > getSQLDSpw()
ALMA-specific.
static void _createTimeStampRecords(Record &parent, const SubScanProperties &subScanProps)
vector< String > _sourceNames
Definition MSMetaData.h:794
Double nUnflaggedRows(CorrelationType cType, Int fieldID) const
vector< std::set< ScanKey > > _fieldToScansMap
Definition MSMetaData.h:791
std::vector< std::set< uInt > > getSpwToDataDescriptionIDMap() const
get a mapping of spectral window ID to data descrption IDs
static void _getScalarQuantDoubleColumn(Quantum< Vector< Double > > &v, TableProxy &table, const String &colname, rownr_t beginRow, rownr_t nrows)
vector< QVD > getChanResolutions(Bool asVelWidths) const
get the resolution for each channel.
Bool _hasStateID(Int stateID) const
vector< Quantity > getMeanFreqs() const
vector< int > getSpwSubwindows() const
ALMA specific CAS-13973 get subwindows for each spw values of -1 indicate no info found for those spw...
vector< QVD > getChanFreqs() const
Record getSummary() const
get a data structure, consumable by users, representing a summary of the dataset
std::set< uInt > getTDMSpw()
ALMA-specific.
std::shared_ptr< Quantum< Vector< Double > > > _getExposureTimes() const
vector< QVD > _antennaOffsets
Definition MSMetaData.h:807
std::set< Int > _uniqueFieldIDs
Definition MSMetaData.h:782
const String _taqlTableName
Definition MSMetaData.h:814
static uInt _sizeof(const std::map< T, U > &m)
vector< String > _stationNames
Definition MSMetaData.h:794
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > _subScanProperties
Definition MSMetaData.h:775
vector< String > _fieldCodes
Definition MSMetaData.h:794
std::set< SubScanKey > _subscans
Definition MSMetaData.h:823
vector< MDirection > _phaseDirs
Definition MSMetaData.h:829
std::map< Int, std::pair< Double, Quantity > > FirstExposureTimeMap
Definition MSMetaData.h:87
std::map< Int, std::set< Int > > _sourceToFieldsMap
Definition MSMetaData.h:770
std::set< String > getIntentsForSpw(const uInt spw)
get a set of intents corresponding to the specified spectral window
std::vector< QVD > getAntennaOffsets(const String &name) const
If the antenna name appears mulitple times, this will return all the offsets for it,...
static uInt _sizeof(const std::map< T, std::set< U > > &m)
std::map< String, std::set< SubScanKey > > _intentToSubScansMap
Definition MSMetaData.h:779
std::shared_ptr< std::map< SubScanKey, Double > > _unflaggedSubScanNXCRows
Definition MSMetaData.h:813
MSMetaData operator=(const MSMetaData &)
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< String > getIntentsForSubScan(const SubScanKey &subScan) const
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:827
MDirection _getInterpolatedDirection(const MSPointingColumns &pCols, const Int &index, const Double &time) const
std::vector< std::vector< uInt > > _spwIDToPolIDMap
Definition MSMetaData.h:772
vector< String > getSourceNames() const
SOURCE.NAME.
std::map< ArrayKey, std::set< SubScanKey > > _getArrayKeysToSubScanKeys() const
vector< std::vector< String > > getAntennaStations(const vector< String > &antennaNames)
get the antenna stations for the specified antenna names.
vector< uInt > getBBCNos() const
uInt nDataDescriptions() const
get the number of data description IDs (from the DATA_DESCRIPTION table)
std::set< uInt > _uniqueDataDescIDs
Definition MSMetaData.h:783
void _getFieldsAndSpwMaps(std::map< Int, std::set< uInt > > &fieldToSpwMap, vector< std::set< Int > > &spwToFieldMap) const
std::set< uInt > _sqldSpw
Definition MSMetaData.h:783
vector< QVD > getAntennaOffsets() const
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:785
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:769
std::pair< Double, Double > getTimeRange(Bool showProgress=False) const
get the time range for the entire dataset.
vector< std::set< Int > > _getObservationIDToArrayIDsMap() const
map<SubScanKey, Quantity> _getMeanExposureTimes() const;
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::set< ScanKey > _scanKeys
Definition MSMetaData.h:822
std::map< ScanKey, std::set< SubScanKey > > _getScanToSubScansMap() const
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:791
std::shared_ptr< std::set< Int > > _getEphemFieldIDs() const
get the field IDs of ephemeris objects
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:770
vector< MDirection > getSourceDirections() const
SOURCE.DIRECTION.
std::set< uInt > getFDMSpw()
ALMA-specific.
std::map< ArrayKey, std::set< SubScanKey > > _arrayToSubScans
Definition MSMetaData.h:825
std::map< std::pair< uInt, uInt >, uInt > getSpwIDPolIDToDataDescIDMap() const
The first value of the pair is spw, the second is polarization ID.
vector< std::set< String > > _fieldToIntentsMap
Definition MSMetaData.h:788
std::vector< std::set< Double > > getTimesForSpws(Bool showProgress=True) const
get a map of spectral windows to unique timestamps.
rownr_t nRows(CorrelationType cType, uInt fieldID) const
std::shared_ptr< const std::map< SubScanKey, std::set< String > > > _subScanToIntentsMap
Definition MSMetaData.h:787
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)
std::set< uInt > getChannelAvgSpw()
ALMA-specific.
vector< std::pair< Quantity, Quantity > > _properMotions
Definition MSMetaData.h:831
static void _modifyFirstExposureTimeIfNecessary(FirstExposureTimeMap &current, const FirstExposureTimeMap &test)
vector< uInt > getDataDescIDToSpwMap() const
Bool _hasFieldID(Int fieldID) const
void _checkField(uInt fieldID) const
std::map< Int, std::set< uInt > > _fieldToSpwMap
Definition MSMetaData.h:768
std::shared_ptr< const std::map< ScanKey, MSMetaData::ScanProperties > > _getScanProperties(Bool showProgress) const
get scan properties
uInt nArrays()
get the number of arrays (from the ARRAY table) in the dataset
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< String, std::set< Int > > _intentToFieldIDMap
Definition MSMetaData.h:777
vector< QVD > getChanEffectiveBWs(Bool asVelWidths) const
get the effective bandwidth for each channel.
std::map< ScanKey, std::set< Int > > _scanToFieldsMap
Definition MSMetaData.h:769
vector< String > _projects
Definition MSMetaData.h:794
vector< Int > getNetSidebands() const
vector< vector< Int > > getCorrTypes() const
POLARIZATION.CORR_TYPE.
std::set< ScanKey > getScanKeys(const ArrayKey &arrayKey) const
get all ScanKeys in the dataset that have the specified arrayKey.
static uInt _sizeof(const vector< String > &m)
vector< vector< Int > > _corrTypes
Definition MSMetaData.h:796
std::map< ScanKey, std::set< uInt > > _scanToDDIDsMap
Definition MSMetaData.h:766
vector< MPosition > _getAntennaPositions() const
Bool _cacheUpdated(const Float incrementInBytes) const
vector< std::set< String > > _stateToIntentsMap
Definition MSMetaData.h:788
std::set< String > _uniqueIntents
Definition MSMetaData.h:781
std::set< uInt > getWVRSpw() const
ALMA-specific.
static void _checkTolerance(const Double tol)
std::map< ScanKey, std::set< String > > _scanToIntentsMap
Definition MSMetaData.h:786
SubScanProperties getSubScanProperties(const SubScanKey &subScan, Bool showProgress=False) const
get the sub scan properties for the specified sub scan.
std::set< SubScanKey > getSubScanKeys(const ArrayKey &arrayKey) const
get all sub scan keys for the specified array key.
std::shared_ptr< std::map< Int, std::set< Double > > > _fieldToTimesMap
Definition MSMetaData.h:803
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:778
void _getSpwsAndIntentsMaps(vector< std::set< String > > &spwToIntentsMap, std::map< String, std::set< uInt > > &intentToSpwsMap)
std::set< uInt > getPolarizationIDs(uInt obsID, Int arrayID, Int scan, uInt spwid) const
get polarization IDs for the specified scan and spwid
vector< std::set< Int > > _spwToFieldIDsMap
Definition MSMetaData.h:790
std::set< uInt > _tdmSpw
Definition MSMetaData.h:783
Double nUnflaggedRows(CorrelationType cType, Int arrayID, uInt observationID, Int scanNumber, uInt fieldID) const
vector< vector< MPosition > > getAntennaPositions(const vector< String > &names)
names cannot be empty.
std::map< String, std::set< uInt > > _intentToSpwsMap
Definition MSMetaData.h:800
std::set< Int > getScansForIntent(const String &intent, Int obsID, Int arrayID) const
get the scans associated with the specified intent
vector< String > getFieldCodes() const
get the values of the CODE column from the field table
void _checkSubScan(const SubScanKey &key) const
std::set< Int > getStatesForScan(Int obsID, Int arrayID, Int scan) const
get the stateIDs associated with the specified scan.
vector< uInt > getDataDescIDToPolIDMap() 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.
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
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
vector< std::set< String > > _spwToIntentsMap
Definition MSMetaData.h:788
vector< String > getCorrBits() const
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::shared_ptr< Vector< Int > > _getFieldIDs() const
std::shared_ptr< const std::map< SubScanKey, std::set< String > > > getSubScanToIntentsMap() const
std::set< Int > getUniqueFiedIDs() const
DEPRECATED because of spelling error.
Definition MSMetaData.h:634
std::set< Int > _getScanNumbers(const ArrayKey &arrayKey) const
get all valid scan numbers associated with the specified arrayKey
vector< Array< Int > > _corrProds
Definition MSMetaData.h:797
vector< String > _observatoryNames
Definition MSMetaData.h:793
uInt nAntennas() const
get the number of antennas in the ANTENNA table
vector< String > _antennaNames
Definition MSMetaData.h:793
std::map< Int, std::set< Int > > getFieldsForSourceMap() const
std::shared_ptr< vector< Double > > _unflaggedFieldNACRows
Definition MSMetaData.h:812
void _checkScans(const std::set< ScanKey > &scanKeys) const
std::map< String, std::set< Int > > getIntentToFieldsMap()
std::map< std::pair< ScanKey, uInt >, std::set< uInt > > _scanSpwToPolIDMap
Definition MSMetaData.h:780
std::shared_ptr< const std::map< ScanKey, ScanProperties > > _generateScanPropsIfWanted() const
if _scanProps has been generated, just return it.
vector< String > getFieldNames() const
get a list of the field names in the order in which they appear in the FIELD table.
vector< Array< Int > > getCorrProducts() const
POLARIZATION.CORR_PRODUCT.
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > getSubScanProperties(Bool showProgress=False) const
std::shared_ptr< Vector< Int > > _getObservationIDs() const
std::set< Int > getFieldIDsForSpw(const uInt spw)
get the set of field IDs corresponding to the specified spectral window.
vector< std::set< ScanKey > > getFieldToScansMap() const
get the mapping of field ID to scans
std::set< SubScanKey > _getSubScanKeys(const ScanKey &scanKey) const
get subscans related to the given scan
std::map< Int, std::set< Int > > _fieldToStatesMap
Definition MSMetaData.h:770
void _getScanAndSubScanProperties(std::shared_ptr< const std::map< ScanKey, ScanProperties > > &scanProps, std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > &subScanProps, Bool showProgress) const
std::map< std::pair< uInt, uInt >, uInt > _spwPolIDToDataDescIDMap
Definition MSMetaData.h:771
std::shared_ptr< Vector< Int > > _getScans() const
std::shared_ptr< Quantum< Vector< Double > > > _getIntervals() const
uInt nScans()
get the number of scans in the dataset
void _getStateToIntentsMap(vector< std::set< String > > &statesToIntentsMap, std::set< String > &uniqueIntents) const
virtual std::set< uInt > getSpwsForIntent(const String &intent)
get a set of spectral windows for which the specified intent applies.
std::set< String > getIntentsForScan(const ScanKey &scan) const
vector< std::set< String > > _getSpwToIntentsMap()
vector< std::pair< MEpoch, MEpoch > > getTimeRangesOfObservations() const
get the time ranges from the OBSERVATION table
std::set< Int > _uniqueStateIDs
Definition MSMetaData.h:782
std::map< ScanKey, std::set< uInt > > getScanToSpwsMap() const
get the complete mapping of scans to spws
std::set< uInt > getSpwsForSubScan(const SubScanKey &subScan) const
get the set of spectral windows for the specified subscan.
CorrelationType
for retrieving stats
Definition MSMetaData.h:64
uInt nFields() const
get the number of fields.
std::map< SourceKey, std::shared_ptr< vector< MFrequency > > > getRestFrequencies() const
get rest frequencies from the SOURCE table
std::set< String > getIntents() const
get all intents, in no particular (nor guaranteed) order.
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< SubScanKey > _getSubScanKeys() const
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 ...
static uInt _sizeof(const std::map< String, std::set< T > > &map)
std::set< String > getFieldNamesForSpw(const uInt spw)
get the set of field names corresponding to the specified spectral window.
vector< String > getSpwNames() const
get a map of the spwIDs to spw names from the spw table
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
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
std::map< String, std::set< ScanKey > > getIntentToScansMap()
std::set< Int > getScanNumbers(Int obsID, Int arrayID) const
get unique scan numbers
std::shared_ptr< std::map< Double, std::set< Int > > > _timeToFieldsMap
Definition MSMetaData.h:804
void _setObservation(const MeasurementSet &ms)
set metadata from OBSERVATION table
std::set< uInt > getUniqueDataDescIDs() const
get unique data description IDs that exist in the main table
std::set< Double > getTimesForField(Int fieldID)
get the times for which the specified field was observed
std::shared_ptr< vector< Double > > _unflaggedFieldNXCRows
Definition MSMetaData.h:812
vector< MDirection > getPhaseDirs(const MEpoch &ep=MEpoch(Quantity(0.0, Unit("s")))) const
get the phase directions from the FIELD subtable.
std::set< Int > getFieldsForIntent(uInt sourceID) const
get the field IDs associated with the specified source.
static std::map< Int, uInt > _toUIntMap(const Vector< Int > &v)
vector< String > getObservatoryNames()
get telescope names in the order they are listed in the OBSERVATION table.
void _getScansAndIntentsMaps(std::map< ScanKey, std::set< String > > &scanToIntentsMap, std::map< String, std::set< ScanKey > > &intentToScansMap) const
std::map< ScanKey, std::set< Int > > getScanToStatesMap() const
get the mapping of scans to states
Float getCache() const
Definition MSMetaData.h:582
std::set< uInt > _fdmSpw
Definition MSMetaData.h:783
std::map< String, std::set< Double > > _intentToTimesMap
Definition MSMetaData.h:801
std::map< ScanKey, std::set< Int > > _getScanToAntennasMap() const
std::set< Int > getUniqueFieldIDs() const
get unique field IDs that exist in the main table.
std::set< Int > getFieldsForScans(const std::set< Int > &scans, Int obsID, Int arrayID) const
get the field IDs associated with the specified scans
void _getAntennas(std::shared_ptr< Vector< Int > > &ant1, std::shared_ptr< Vector< Int > > &ant2) 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::set< Int > getScansForField(const String &field, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field.
std::shared_ptr< const std::map< SubScanKey, SubScanProperties > > _generateSubScanPropsIfWanted() const
if _subScanProperties has been generated, just return it.
std::set< uInt > getUniqueSpwIDs() const
get the unique spectral window IDs represented by the data description IDs that appear in the main ta...
static uInt _sizeof(const vector< std::set< String > > &m)
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:759
std::set< uInt > getAntennaIDs(const String &antennaName) const
get all the antenna IDs for the antenna with the specified name.
vector< String > getProjects() const
get the contents of the PROJECT column from the OBSERVATIONS table
vector< MDirection > _sourceDirs
Definition MSMetaData.h:829
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...
static void _getScalarIntColumn(Vector< Int > &v, TableProxy &table, const String &colname, rownr_t beginRow, rownr_t nrows)
vector< QVD > getChanWidths() const
vector< String > getObservers() const
get the contents of the OBSERVER column from the OBSERVATIONS table
vector< int > getSpwReceiverBands() const
ALMA specific CAS-13973 get receiver bands for each spw values of -1 indicate no info found for those...
std::set< uInt > _wvrSpw
Definition MSMetaData.h:783
vector< MPosition > _antennaPositions
Definition MSMetaData.h:806
std::shared_ptr< std::map< SubScanKey, rownr_t > > _subScanToNACRowsMap
Definition MSMetaData.h:784
std::map< ScanKey, std::set< Int > > _scanToAntennasMap
Definition MSMetaData.h:769
std::map< SourceKey, SourceProperties > _sourceInfo
Definition MSMetaData.h:833
std::shared_ptr< std::map< ScanKey, std::set< Double > > > _scanToTimesMap
Definition MSMetaData.h:799
std::shared_ptr< const Quantum< Vector< Double > > > getSourceTimes() const
SOURCE.TIME.
vector< uInt > _dataDescIDToSpwMap
Definition MSMetaData.h:767
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...
vector< Int > _field_sourceIDs
Definition MSMetaData.h:819
vector< SpwProperties > _getSpwInfo2(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
vector< SpwProperties > _getSpwInfo(std::set< uInt > &avgSpw, std::set< uInt > &tdmSpw, std::set< uInt > &fdmSpw, std::set< uInt > &wvrSpw, std::set< uInt > &sqldSpw) const
std::set< Double > getTimesForScans(std::set< ScanKey > scans) const
Get the times for the specified scans.
std::pair< Double, Double > getTimeRangeForScan(const ScanKey &scanKey) const
get the time range for the specified scan.
std::map< uInt, std::set< uInt > > getBBCNosToSpwMap(SQLDSwitch sqldSwitch)
std::set< ArrayKey > _arrayKeys
Definition MSMetaData.h:821
static uInt _sizeof(const vector< std::map< Int, Quantity > > &map)
std::set< Int > getFieldsForIntent(const String &intent)
get the field IDs associated with the specified intent.
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:795
std::shared_ptr< std::map< Int, rownr_t > > _fieldToNXCRowsMap
Definition MSMetaData.h:785
rownr_t nRows(CorrelationType cType)
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
vector< std::set< Int > > _obsToArraysMap
Definition MSMetaData.h:790
vector< std::set< uInt > > getAntennaIDs(const vector< String > &antennaNames) const
The returned IDs are ordered in the way they appear in the atenna table.
std::map< String, std::set< uInt > > _antennaNameToIDMap
Definition MSMetaData.h:773
std::map< SourceKey, std::shared_ptr< vector< String > > > getTransitions() const
get the transitions from the SOURCE table.
vector< vector< String > > getSchedules() const
get the contents of the SCHEDULE column from the OBSERVATIONS table Note that the embedded vectors ma...
void _hasAntennaID(Int antennaID)
vector< Int > getSourceTableSourceIDs() const
Get the SOURCE.SOURCE_ID column.
std::shared_ptr< std::map< SubScanKey, Double > > _unflaggedSubScanNACRows
Definition MSMetaData.h:813
Float getMaxCacheSizeMB() const
max cache size in MB
Definition MSMetaData.h:453
std::shared_ptr< const std::map< SubScanKey, rownr_t > > getNRowMap(CorrelationType type) const
vector< String > getAntennaStations(const vector< uInt > &antennaIDs=vector< uInt >())
get the antenna stations for the specified antenna IDs
vector< String > getAntennaNames(std::map< String, std::set< uInt > > &namesToIDsMap, const vector< uInt > &antennaIDs=vector< uInt >(0)) const
vector< std::map< Int, Quantity > > _firstExposureTimeMap
Definition MSMetaData.h:818
vector< uInt > _dataDescIDToPolIDMap
Definition MSMetaData.h:767
Matrix< Bool > _uniqueBaselines
Definition MSMetaData.h:809
vector< MPosition > _getObservatoryPositions()
std::set< Double > getTimesForIntent(const String &intent) const
get the time stamps associated with the specified intent
std::set< Int > getScansForFieldID(Int fieldID, Int obsID, Int arrayID) const
get the scan numbers associated with the specified field ID.
void _createScanRecords(Record &parent, const ArrayKey &arrayKey, const std::map< SubScanKey, SubScanProperties > &subScanProps) const
vector< String > _fieldNames
Definition MSMetaData.h:793
std::shared_ptr< Vector< Int > > _getStateIDs() const
vector< String > _getStationNames()
std::set< uInt > getSpwsForScan(const ScanKey &scan) const
get the set of spectral windows for the specified scan.
static uInt _sizeof(const std::map< T, std::set< String > > &m)
std::shared_ptr< Vector< Int > > _getArrayIDs() const
vector< MPosition > _observatoryPositions
Definition MSMetaData.h:806
std::map< Int, std::set< uInt > > getFieldsToSpwsMap() const
get the mapping of fields to spws
std::map< ScanKey, FirstExposureTimeMap > getScanToFirstExposureTimeMap(Bool showProgress) const
get map of scans to first exposure times
std::set< Int > getFieldsForScans(const std::set< ScanKey > &scans) const
get the field IDs associated with the specified scans
void _getSubScansAndIntentsMaps(std::shared_ptr< const std::map< SubScanKey, std::set< String > > > &subScanToIntentsMap, std::map< String, std::set< SubScanKey > > &intentToSubScansMap) const
std::set< ScanKey > getScanKeys() const
get all ScanKeys in the dataset
std::set< uInt > getSpwsForField(const Int fieldID) const
get a set of spectral windows corresponding to the specified fieldID
std::map< SourceKey, SourceProperties > _getSourceInfo() const
std::shared_ptr< std::map< ScanKey, std::set< Double > > > _getScanToTimesMap() const
std::set< Double > getTimesForScan(const ScanKey &scan) const
get the times for the specified scan.
std::map< String, std::set< uInt > > getIntentToSpwsMap()
std::shared_ptr< const std::map< ScanKey, ScanProperties > > _scanProperties
Definition MSMetaData.h:774
std::map< ScanKey, std::set< uInt > > _scanToSpwsMap
Definition MSMetaData.h:766
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
const Bool False
Definition aipstype.h:42
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1584
unsigned int uInt
Definition aipstype.h:49
ScanKey scanKey(const SubScanKey &subScanKey)
create a ScanKey from a SubScanKey, just omits the SubScanKey's fieldID
Definition MSKeys.h:64
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
std::set< ScanKey > scanKeys(const std::set< Int > &scans, const ArrayKey &arrayKey)
construct scan keys given a set of scan numbers and an ArrayKey
Quantum< Double > Quantity
Definition Quantum.h:39
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44
An ArrayKey is a unique combination of observation ID and array ID Negative values are allowed to ind...
Definition MSKeys.h:87
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp,...
Definition MSMetaData.h:706
std::map< uInt, Quantity > meanInterval
the key is the spwID, the value is the meanInterval for the subscan and that spwID
Definition MSMetaData.h:709
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:714
std::map< uInt, std::set< double > > times
times for each spectral window
Definition MSMetaData.h:716
std::map< uInt, rownr_t > spwNRows
number of rows for each spectral window
Definition MSMetaData.h:711
represents non-primary key data for a SOURCE table row
Definition MSMetaData.h:749
std::shared_ptr< vector< MFrequency > > restfreq
Definition MSMetaData.h:751
std::shared_ptr< vector< String > > transition
Definition MSMetaData.h:752
vector< double > edgechans
The center frequencies of the two channels at the edges of the window.
Definition MSMetaData.h:732
String corrbit
CAS-13749 value for adhoc ALMA-specific SPECTRAL_WINDOW column.
Definition MSMetaData.h:742
QVD effbw
EFFECTIVE_BANDWIDTH.
Definition MSMetaData.h:738
MFrequency reffreq
from the REF_FREQUENCY column
Definition MSMetaData.h:735
int rb
CAS-13973 ALMA specific quantities sw = subwindow, rb = receiver band.
Definition MSMetaData.h:744
Quantity meanfreq
The sum of all channel frequencies divided by the number of channels.
Definition MSMetaData.h:725
Quantity centerfreq
The mean of the low frequency extent of the lowest frequency channel and the high frequency extend of...
Definition MSMetaData.h:729
rownr_t xcRows
number of cross-correlation rows.
Definition MSMetaData.h:93
std::map< uInt, Quantity > meanInterval
the key is the spwID, the value is the meanInterval for the subscan and that spwID
Definition MSMetaData.h:100
FirstExposureTimeMap firstExposureTime
The Int represents the data description ID, The Double represents the time of the first time stamp,...
Definition MSMetaData.h:105
rownr_t acRows
number of auto-correlation rows
Definition MSMetaData.h:91
std::map< Double, TimeStampProperties > timeProps
Definition MSMetaData.h:111
std::map< uInt, rownr_t > spwNRows
number of rows for each spectral window
Definition MSMetaData.h:109
A scan is a unique combination of observation ID, array ID, and scan number Negative values are allow...
Definition MSKeys.h:57
A sub scan is a unique combination of observation ID, array ID, scan number, and field ID.
Definition MSKeys.h:40