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