Line data Source code
1 : //# MSMetaInfoForCal.h: MS Meta info services in Calibraiton context 2 : //# Copyright (C) 2016 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 adressed 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 : //# 27 : 28 : #ifndef SYNTHESIS_MSMETAINFOFORCAL_H 29 : #define SYNTHESIS_MSMETAINFOFORCAL_H 30 : 31 : #include <casacore/casa/aips.h> 32 : #include <iostream> 33 : #include <casacore/casa/BasicSL/String.h> 34 : #include <casacore/ms/MeasurementSets/MeasurementSet.h> 35 : #include <msvis/MSVis/SimpleSimVi2.h> 36 : 37 : namespace casacore { 38 : 39 : class MSMetaData; 40 : 41 : } 42 : 43 : namespace casa { //# NAMESPACE CASA - BEGIN 44 : 45 : class MSMetaInfoForCal { 46 : 47 : public: 48 : 49 : // Construct from the filename of an MS 50 : // (If the MS doesn't exist, services will be trivialized) 51 : MSMetaInfoForCal(casacore::String msname); 52 : 53 : // Construct from a supplied MS object 54 : MSMetaInfoForCal(const casacore::MeasurementSet& ms); 55 : MSMetaInfoForCal(const casacore::MeasurementSet& ms, 56 : casacore::String msname); 57 : 58 : // Construct from nAnt,nSpw 59 : MSMetaInfoForCal(casacore::uInt nAnt,casacore::uInt nSpw,casacore::uInt nFld); 60 : 61 : // Construct from SimpleSimVi2Paremeters 62 : // (useful for testing w/ actual (spoofed) data iteration 63 : MSMetaInfoForCal(const vi::SimpleSimVi2Parameters& sspar); 64 : 65 : // Dtor 66 : ~MSMetaInfoForCal(); 67 : 68 : // The MS name 69 644 : casacore::String msname() const { return msname_; }; 70 : 71 : // Signal if a real MS was specified in ctor 72 165 : casacore::Bool msOk() const { return msOk_; }; 73 : 74 : // Return access to MSMetaData object (if avail) 75 : // Would like this to be const, but many methods in MSMetaData aren't.... 76 : casacore::MSMetaData& msmd() const; 77 : 78 : // Return accss to SimpleSimVi2Parameters object (if avail) 79 : const vi::SimpleSimVi2Parameters& ssp() const; 80 : 81 : // The number of antennas 82 28784 : casacore::uInt nAnt() const { return nAnt_;}; 83 : 84 : // Antenna name, by index 85 : casacore::String antennaName(casacore::uInt iant) const; 86 : 87 : // All antenna names, as vector 88 : void antennaNames(casacore::Vector<casacore::String>& antnames) const; 89 : 90 : // The number of spws 91 3502 : casacore::uInt nSpw() const { return nSpw_;}; 92 : 93 : // Spw name, by index 94 : casacore::String spwName(casacore::uInt ispw) const; 95 : 96 : // The number of fields 97 0 : casacore::uInt nFld() const { return nFld_;}; 98 : 99 : // Field name, by index 100 : casacore::String fieldName(casacore::uInt ifld) const; 101 : 102 : // All field names, as vector 103 : void fieldNames(casacore::Vector<casacore::String>& fldnames) const; 104 : 105 : // Field id at time 106 : casacore::Int fieldIdAtTime(casacore::Double time) const; 107 : 108 : // Scan number at time 109 : casacore::Int scanNumberAtTime(casacore::Double time) const; 110 : 111 : // Center freq for specified spw 112 : casacore::Double centerFreq(casacore::uInt ispw) const; 113 : 114 : 115 : private: 116 : 117 : // The supplied MS name 118 : casacore::String msname_; 119 : 120 : // Is the MS available (else spoof) 121 : bool msOk_; 122 : 123 : // Remember basic shapes 124 : casacore::uInt nAnt_, nSpw_, nFld_; 125 : 126 : // Spw absolute center frequencies 127 : // (this gets filled OTF, if necessary) 128 : mutable casacore::Vector<casacore::Double> centerFreqs_; 129 : 130 : // MS pointer 131 : casacore::MeasurementSet *ms_; 132 : 133 : // MSMetaData pointer 134 : casacore::MSMetaData *msmd_; 135 : 136 : // SimpleSimVi2Parameters pointer 137 : vi::SimpleSimVi2Parameters* ssp_; 138 : 139 : 140 : }; 141 : 142 : 143 : } //# NAMESPACE CASA - END 144 : 145 : #endif 146 : 147 :