Line data Source code
1 : //# FlagCalTableHandler.h: This file contains the interface definition of the FlagCalTableHandler class. 2 : //# 3 : //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) 4 : //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. 5 : //# Copyright (C) European Southern Observatory, 2011, All rights reserved. 6 : //# 7 : //# This library is free software; you can redistribute it and/or 8 : //# modify it under the terms of the GNU Lesser General Public 9 : //# License as published by the Free software Foundation; either 10 : //# version 2.1 of the License, or (at your option) any later version. 11 : //# 12 : //# This library is distributed in the hope that it will be useful, 13 : //# but WITHOUT ANY WARRANTY, without even the implied warranty of 14 : //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 : //# Lesser General Public License for more details. 16 : //# 17 : //# You should have received a copy of the GNU Lesser General Public 18 : //# License along with this library; if not, write to the Free Software 19 : //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 : //# MA 02111-1307 USA 21 : //# $Id: $ 22 : 23 : #ifndef FlagCalTableHandler_H_ 24 : #define FlagCalTableHandler_H_ 25 : 26 : #include <flagging/Flagging/FlagDataHandler.h> 27 : 28 : #include <casacore/ms/MSSel/MSSelectionTools.h> 29 : #include <msvis/MSVis/StokesVector.h> 30 : 31 : namespace casa { //# NAMESPACE CASA - BEGIN 32 : 33 : // forward decl of CalTable related classes 34 : class NewCalTable; 35 : class CTInterface; 36 : class CTIter; 37 : class CalBuffer; 38 : 39 : namespace vi { 40 : 41 : class WeightScaling; 42 : 43 : } 44 : 45 : #if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \ 46 : (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 47 : #pragma GCC diagnostic push 48 : #pragma GCC diagnostic ignored "-Wunused-parameter" 49 : #define CASA_WPOP_UNUSED 50 : #endif 51 : 52 : class DummyBufferImpl: public vi::VisBuffer2 53 : { 54 : public: 55 0 : DummyBufferImpl() {} 56 0 : ~DummyBufferImpl() {} 57 : 58 0 : virtual void copy (const VisBuffer2 & /*other*/, casacore::Bool /*fetchIfNeeded*/) {} 59 0 : virtual void copyComponents (const VisBuffer2 & /*other*/, 60 : const VisBufferComponents2 & /*components*/, 61 : casacore::Bool /*allowShapeChange*/ = false, 62 0 : casacore::Bool /*fetchIfNeeded*/ = true) {} 63 0 : virtual void copyCoordinateInfo(const VisBuffer2 * /*other*/, casacore::Bool /*includeDirections*/, 64 : casacore::Bool /*allowShapeChange*/ = false, 65 0 : casacore::Bool /*fetchIfNeeded*/ = true) {} 66 : 67 0 : virtual void setShape (casacore::Int /*nCorrelations*/, casacore::Int /*nChannels*/, casacore::rownr_t /*nRows*/, casacore::Bool) {} 68 0 : virtual const vi::VisibilityIterator2 * getVi () const {return NULL;} 69 : 70 0 : virtual casacore::Bool isAttached () const {return true;} 71 0 : virtual casacore::Bool isFillable () const {return true;} 72 : 73 0 : virtual void writeChangesBack () {} 74 0 : virtual void initWeightSpectrum (const casacore::Cube<casacore::Float>&) {} 75 0 : virtual void initSigmaSpectrum (const casacore::Cube<casacore::Float>&) {} 76 0 : virtual void dirtyComponentsAdd (const VisBufferComponents2 & /*additionalDirtyComponents*/) {} 77 0 : virtual void dirtyComponentsAdd (VisBufferComponent2 /*component*/) {} 78 0 : virtual void dirtyComponentsClear () {} 79 0 : virtual VisBufferComponents2 dirtyComponentsGet () const { VisBufferComponents2 dummy; return dummy;} 80 0 : virtual void dirtyComponentsSet (const VisBufferComponents2 & /*dirtyComponents*/) {} 81 0 : virtual void dirtyComponentsSet (VisBufferComponent2 /*component*/) {} 82 : 83 0 : virtual const casacore::Matrix<casacore::Float> & imagingWeight() const {static casacore::Matrix<casacore::Float> dummy; return dummy;} 84 0 : void setImagingWeight (const casacore::Matrix<float> &) {} 85 : 86 0 : virtual casacore::Double getFrequency (casacore::Int /*rowInBuffer*/, casacore::Int /*frequencyIndex*/, 87 0 : casacore::Int /*frame*/ = FrameNotSpecified) const { static casacore::Double dummy; return dummy;} 88 0 : virtual const casacore::Vector<casacore::Double> & getFrequencies (casacore::Int /*rowInBuffer*/, 89 0 : casacore::Int /*frame*/ = FrameNotSpecified) const {static casacore::Vector<casacore::Double> dummy; return dummy;} 90 0 : virtual casacore::Int getChannelNumber (casacore::Int /*rowInBuffer*/, casacore::Int /*frequencyIndex*/) const {static casacore::Int dummy; return dummy;} 91 0 : virtual const casacore::Vector<casacore::Int> & getChannelNumbers (casacore::Int /*rowInBuffer*/) const {static casacore::Vector<casacore::Int> dummy; return dummy;} 92 : 93 0 : virtual void normalize() {} 94 : 95 0 : virtual void resetWeightsUsingSigma () {} 96 : 97 0 : virtual casacore::Bool isNewArrayId () const {static casacore::Bool dummy; return dummy;} 98 0 : virtual casacore::Bool isNewFieldId () const {static casacore::Bool dummy; return dummy;} 99 0 : virtual casacore::Bool isNewMs() const {static casacore::Bool dummy; return dummy;} 100 0 : virtual casacore::Bool isNewSpectralWindow () const {static casacore::Bool dummy; return dummy;} 101 0 : virtual casacore::Bool isWritable () const {static casacore::Bool dummy; return dummy;} 102 0 : virtual casacore::Int msId() const {static casacore::Int dummy; return dummy;} 103 0 : virtual casacore::String msName (casacore::Bool /*stripPath*/ = false) const {casacore::String dummy; return dummy;} 104 0 : virtual vi::Subchunk getSubchunk () const {vi::Subchunk dummy; return dummy;} 105 : 106 0 : virtual const casacore::Vector<casacore::Int> & antenna1 () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 107 0 : virtual void setAntenna1 (const casacore::Vector<casacore::Int> & /*value*/) {} 108 0 : virtual const casacore::Vector<casacore::Int> & antenna2 () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 109 0 : virtual void setAntenna2 (const casacore::Vector<casacore::Int> & /*value*/) {} 110 0 : virtual const casacore::Vector<casacore::Int>& arrayId () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 111 0 : virtual void setArrayId (const casacore::Vector<casacore::Int>&) {} 112 0 : virtual casacore::Int dataDescriptionId () const {static casacore::Int dummy; return dummy;} 113 0 : virtual void setDataDescriptionId (casacore::Int /*value*/) {} 114 0 : virtual void setDataDescriptionIds(const casacore::Vector<int>&){} 115 0 : virtual const casacore::Vector<casacore::MDirection> & direction1 () const {static casacore::Vector<casacore::MDirection> dummy; return dummy;} 116 0 : virtual const casacore::Vector<casacore::MDirection> & direction2 () const {static casacore::Vector<casacore::MDirection> dummy; return dummy;} 117 0 : virtual const casacore::Vector<casacore::Double> & exposure () const {static casacore::Vector<casacore::Double> dummy; return dummy;} 118 0 : virtual void setExposure (const casacore::Vector<casacore::Double> & /*value*/) {} 119 0 : virtual const casacore::Vector<casacore::Int> & feed1 () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 120 0 : virtual void setFeed1 (const casacore::Vector<casacore::Int> & /*value*/) {} 121 0 : virtual const casacore::Vector<casacore::Int> & feed2 () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 122 0 : virtual void setFeed2 (const casacore::Vector<casacore::Int> & /*value*/) {} 123 0 : virtual const casacore::Vector<casacore::Int>& fieldId () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 124 0 : virtual void setFieldId (const casacore::Vector<casacore::Int>&) {} 125 0 : virtual const casacore::Matrix<casacore::Bool> & flag () const {static casacore::Matrix<casacore::Bool> dummy; return dummy;} 126 0 : virtual void setFlag (const casacore::Matrix<casacore::Bool>& /*value*/) {} 127 0 : virtual const casacore::Array<casacore::Bool> & flagCategory () const {static casacore::Array<casacore::Bool> dummy; return dummy;} 128 0 : virtual void setFlagCategory (const casacore::Array<casacore::Bool>& /*value*/) {} 129 0 : virtual const casacore::Vector<casacore::Array<casacore::Bool>> & flagCategories () const {static casacore::Vector<casacore::Array<casacore::Bool>> dummy; return dummy;} 130 0 : virtual void setFlagCategories (const casacore::Vector<casacore::Array<casacore::Bool>>& /*value*/) {} 131 0 : virtual const casacore::Cube<casacore::Bool> & flagCube () const {static casacore::Cube<casacore::Bool> dummy; return dummy;} 132 0 : virtual void setFlagCube (const casacore::Cube<casacore::Bool>& /*value*/) {} 133 0 : virtual const casacore::Vector<casacore::Cube<casacore::Bool>> & flagCubes () const {static casacore::Vector<casacore::Cube<casacore::Bool>> dummy; return dummy;} 134 0 : virtual void setFlagCubes (const casacore::Vector<casacore::Cube<casacore::Bool>>& /*value*/) {} 135 0 : virtual const casacore::Vector<casacore::Bool> & flagRow () const {static casacore::Vector<casacore::Bool> dummy; return dummy;} 136 0 : virtual void setFlagRow (const casacore::Vector<casacore::Bool>& /*value*/) {} 137 0 : virtual const casacore::Vector<casacore::Int> & observationId () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 138 0 : virtual void setObservationId (const casacore::Vector<casacore::Int> & /*value*/) {} 139 0 : virtual const casacore::Vector<casacore::Int> & processorId () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 140 0 : virtual void setProcessorId (const casacore::Vector<casacore::Int> & /*value*/) {} 141 0 : virtual const casacore::Vector<casacore::Int> & scan () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 142 0 : virtual void setScan (const casacore::Vector<casacore::Int> & /*value*/) {} 143 0 : virtual const casacore::Matrix<casacore::Float> & sigma () const {static casacore::Matrix<casacore::Float> dummy; return dummy;} 144 0 : virtual void setSigma (const casacore::Matrix<casacore::Float> & /*value*/) {} 145 0 : virtual const casacore::Vector<casacore::Matrix<casacore::Float>> & sigmas () const {static casacore::Vector<casacore::Matrix<casacore::Float>> dummy; return dummy;} 146 0 : virtual void setSigmas (const casacore::Vector<casacore::Matrix<casacore::Float>> & /*value*/) {} 147 0 : virtual const casacore::Matrix<casacore::Float> & sigmaMat () const {static casacore::Matrix<casacore::Float> dummy; return dummy;} 148 0 : virtual const casacore::Vector<casacore::Int> & stateId () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 149 0 : virtual void setStateId (const casacore::Vector<casacore::Int> & /*value*/) {} 150 0 : virtual const casacore::Vector<casacore::Double> & time () const {static casacore::Vector<casacore::Double> dummy; return dummy;} 151 0 : virtual void setTime (const casacore::Vector<casacore::Double> & /*value*/) {} 152 0 : virtual const casacore::Vector<casacore::Double> & timeCentroid () const {static casacore::Vector<casacore::Double> dummy; return dummy;} 153 0 : virtual void setTimeCentroid (const casacore::Vector<casacore::Double> & /*value*/) {} 154 0 : virtual const casacore::Vector<casacore::Double> & timeInterval () const {static casacore::Vector<casacore::Double> dummy; return dummy;} 155 0 : virtual void setTimeInterval (const casacore::Vector<casacore::Double> & /*value*/) {} 156 0 : virtual const casacore::Matrix<casacore::Double> & uvw () const {static casacore::Matrix<casacore::Double> dummy; return dummy;} 157 0 : virtual void setUvw (const casacore::Matrix<casacore::Double> & /*value*/) {} 158 0 : virtual const casacore::Matrix<casacore::Float> & weight () const {static casacore::Matrix<casacore::Float> dummy; return dummy;} 159 0 : virtual void setWeight (const casacore::Matrix<casacore::Float>& /*value*/) {} 160 0 : virtual const casacore::Vector<casacore::Matrix<casacore::Float>> & weights () const {static casacore::Vector<casacore::Matrix<casacore::Float>> dummy; return dummy;} 161 0 : virtual void setWeights (const casacore::Vector<casacore::Matrix<casacore::Float>>& /*value*/) {} 162 0 : virtual const casacore::Matrix<casacore::Float> & weightMat () const {static casacore::Matrix<casacore::Float> dummy; return dummy;} 163 0 : virtual void setWeightMat (const casacore::Matrix<casacore::Float>& /*value*/) {} 164 0 : virtual const casacore::Cube<casacore::Float> & weightSpectrum () const {static casacore::Cube<casacore::Float> dummy; return dummy;} 165 0 : virtual void setWeightSpectrum (const casacore::Cube<casacore::Float>& /*value*/) {} 166 0 : virtual const casacore::Vector<casacore::Cube<casacore::Float>> & weightSpectra () const {static casacore::Vector<casacore::Cube<casacore::Float>> dummy; return dummy;} 167 0 : virtual void setWeightSpectra (const casacore::Vector<casacore::Cube<casacore::Float>>& /*value*/) {} 168 0 : virtual const casacore::Cube<float>& sigmaSpectrum() const {static casacore::Cube<casacore::Float> dummy; return dummy;} 169 0 : virtual void setSigmaSpectrum(const casacore::Cube<float>&) {} 170 0 : virtual const casacore::Vector<casacore::Cube<float>>& sigmaSpectra() const {static casacore::Vector<casacore::Cube<casacore::Float>> dummy; return dummy;} 171 0 : virtual void setSigmaSpectra (const casacore::Vector<casacore::Cube<float>>&) {} 172 : 173 0 : virtual const casacore::Cube<casacore::Complex> & visCube () const {static casacore::Cube<casacore::Complex> dummy; return dummy;} 174 0 : virtual void setVisCube(const casacore::Complex & /*c*/) {} 175 0 : virtual void setVisCube (const casacore::Cube<casacore::Complex> &){} 176 0 : virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubes () const {static casacore::Vector<casacore::Cube<casacore::Complex>> dummy; return dummy;} 177 0 : virtual void setVisCubes (const casacore::Vector<casacore::Cube<casacore::Complex>> &){} 178 0 : virtual const casacore::Matrix<CStokesVector> & vis () const {static casacore::Matrix<CStokesVector> dummy; return dummy;} 179 0 : virtual void setVis (casacore::Matrix<CStokesVector> &) {} 180 0 : virtual const casacore::Cube<casacore::Complex> & visCubeCorrected () const {static casacore::Cube<casacore::Complex> dummy; return dummy;} 181 0 : virtual void setVisCubeCorrected (const casacore::Cube<casacore::Complex> &) {} 182 0 : virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesCorrected () const {static casacore::Vector<casacore::Cube<casacore::Complex>> dummy; return dummy;} 183 0 : virtual void setVisCubesCorrected (const casacore::Vector<casacore::Cube<casacore::Complex>> &) {} 184 0 : virtual const casacore::Matrix<CStokesVector> & visCorrected () const {static casacore::Matrix<CStokesVector> dummy; return dummy;} 185 0 : virtual void setVisCorrected (const casacore::Matrix<CStokesVector> &) {} 186 0 : virtual const casacore::Cube<casacore::Float> & visCubeFloat () const {static casacore::Cube<casacore::Float> dummy; return dummy;} 187 0 : virtual void setVisCubeFloat (const casacore::Cube<casacore::Float> &) {} 188 0 : virtual const casacore::Vector<casacore::Cube<casacore::Float>> & visCubesFloat () const {static casacore::Vector<casacore::Cube<casacore::Float>> dummy; return dummy;} 189 0 : virtual void setVisCubesFloat (const casacore::Vector<casacore::Cube<casacore::Float>> &) {} 190 0 : virtual const casacore::Cube<casacore::Complex> & visCubeModel () const {static casacore::Cube<casacore::Complex> dummy; return dummy;} 191 0 : virtual void setVisCubeModel(const casacore::Complex & /*c*/) {} 192 0 : virtual void setVisCubeModel(const casacore::Cube<casacore::Complex>& /*vis*/) {} 193 0 : virtual void setVisCubeModel(const casacore::Vector<casacore::Float>& /*stokes*/) {} 194 0 : virtual const casacore::Vector<casacore::Cube<casacore::Complex>> & visCubesModel () const {static casacore::Vector<casacore::Cube<casacore::Complex>> dummy; return dummy;} 195 0 : virtual void setVisCubesModel(const casacore::Complex & /*c*/) {} 196 0 : virtual void setVisCubesModel(const casacore::Vector<casacore::Cube<casacore::Complex>>& /*vis*/) {} 197 0 : virtual const casacore::Matrix<CStokesVector> & visModel () const {static casacore::Matrix<CStokesVector> dummy; return dummy;} 198 0 : virtual void setVisModel (casacore::Matrix<CStokesVector> &) {} 199 : 200 0 : virtual casacore::MDirection azel0 (casacore::Double /*time*/) const {static casacore::MDirection dummy; return dummy;} 201 0 : virtual casacore::Vector<casacore::MDirection> & azel(casacore::Double /*time*/) const {static casacore::Vector<casacore::MDirection> dummy; return dummy;} 202 0 : virtual const casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > & cjones () const {static casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > dummy; return dummy;} 203 0 : virtual const casacore::Vector<casacore::Int> & correlationTypes () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 204 0 : virtual casacore::Vector<casacore::Float> & feedPa(casacore::Double /*time*/) const {static casacore::Vector<casacore::Float> dummy; return dummy;} 205 0 : virtual const casacore::Vector<casacore::Float> & feedPa1 () const {static casacore::Vector<casacore::Float> dummy; return dummy;} 206 0 : virtual const casacore::Vector<casacore::Float> & feedPa2 () const {static casacore::Vector<casacore::Float> dummy; return dummy;} 207 0 : virtual casacore::Double hourang(casacore::Double /*time*/) const {static casacore::Double dummy; return dummy;} 208 0 : virtual casacore::Int nAntennas () const {static casacore::Int dummy; return dummy;} 209 0 : virtual casacore::Int nChannels () const {static casacore::Int dummy; return dummy;} 210 0 : virtual casacore::Int nCorrelations () const {static casacore::Int dummy; return dummy;} 211 0 : virtual casacore::rownr_t nRows () const {static casacore::Int dummy; return dummy;} 212 0 : virtual casacore::rownr_t nShapes () const {return 1;} 213 0 : virtual const casacore::Vector<casacore::rownr_t>& nRowsPerShape () const {static casacore::Vector<casacore::rownr_t> dummy ; return dummy;} 214 0 : virtual const casacore::Vector<casacore::Int>& nChannelsPerShape () const {static casacore::Vector<casacore::Int> dummy ; return dummy;} 215 0 : virtual const casacore::Vector<casacore::Int>& nCorrelationsPerShape () const {static casacore::Vector<casacore::Int> dummy ; return dummy;} 216 0 : virtual casacore::Float parang0(casacore::Double /*time*/) const {static casacore::Float dummy; return dummy;} 217 0 : virtual casacore::Vector<casacore::Float> & parang(casacore::Double /*time*/) const {static casacore::Vector<casacore::Float> dummy; return dummy;} 218 0 : virtual const casacore::MDirection& phaseCenter () const {static casacore::MDirection dummy; return dummy;} 219 0 : virtual casacore::Int polarizationFrame () const {static casacore::Int dummy; return dummy;} 220 0 : virtual casacore::Int polarizationId () const {static casacore::Int dummy; return dummy;} 221 0 : virtual const casacore::Vector<casacore::rownr_t> & rowIds () const {static casacore::Vector<casacore::rownr_t> dummy; return dummy;} 222 0 : virtual casacore::Int spectralWindow () const {static casacore::Int dummy; return dummy;} 223 0 : virtual const casacore::Vector<casacore::Int> & spectralWindows () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 224 0 : virtual void setSpectralWindows (const casacore::Vector<casacore::Int> & /*spectralWindows*/) {} 225 0 : virtual casacore::Bool modelDataIsVirtual () const { return false;} 226 : 227 : 228 0 : virtual void setFillable (casacore::Bool /*isFillable*/) {} 229 0 : virtual const casacore::Vector<casacore::Int> & dataDescriptionIds () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 230 0 : virtual casacore::Vector<casacore::Int> getCorrelationTypes () const {static casacore::Vector<casacore::Int> dummy; return dummy;} 231 0 : virtual void validateShapes () const {} 232 : 233 0 : virtual casacore::Float getWeightScaled (casacore::Int /*row*/) const { return 0;} 234 0 : virtual casacore::Float getWeightScaled (casacore::Int /*correlation*/, casacore::Int /*row*/) const { return 0;} 235 0 : virtual casacore::Float getWeightScaled (casacore::Int /*correlation*/, casacore::Int /*channel*/, casacore::Int /*row*/) const { return 0;} 236 0 : virtual casacore::Float getSigmaScaled (casacore::Int /* row */) const { return 0;} 237 0 : virtual casacore::Float getSigmaScaled (casacore::Int /* correlation */, casacore::Int /* row */) const { return 0;} 238 0 : virtual casacore::Float getSigmaScaled (casacore::Int /* correlation */, casacore::Int /* channel */, casacore::Int /* row */) const { return 0;} 239 0 : virtual casacore::CountedPtr<vi::WeightScaling> getWeightScaling () const { return 0; } 240 : 241 0 : virtual void phaseCenterShift(const casacore::Vector<casacore::Double>& /* phase */) {}; 242 0 : virtual void phaseCenterShift(casacore::Double /* dx */, casacore::Double /* dy */) {}; 243 : 244 : 245 : protected: 246 : 247 0 : virtual void configureNewSubchunk (casacore::Int /*msId*/, const casacore::String & /*msName*/, casacore::Bool /*isNewMs*/, 248 : casacore::Bool /*isNewArrayId*/, casacore::Bool /*isNewFieldId*/, 249 : casacore::Bool /*isNewSpectralWindow*/, const vi::Subchunk & /*subchunk*/, 250 : const casacore::Vector<casacore::rownr_t>& nRowsPerShape, 251 : const casacore::Vector<casacore::Int>& nChannelsPerShape, 252 : const casacore::Vector<casacore::Int>& nCorrelationsPerShape, 253 : const casacore::Vector<casacore::Int> & /*correlations*/, 254 : const casacore::Vector<casacore::Stokes::StokesTypes> &, 255 : const casacore::Vector<casacore::Stokes::StokesTypes> &, 256 0 : casacore::CountedPtr <vi::WeightScaling> /*weightScaling*/) {} 257 0 : virtual void invalidate() {} 258 0 : virtual casacore::Bool isRekeyable () const {static casacore::Bool dummy; return dummy;} 259 0 : virtual void setRekeyable (casacore::Bool /*isRekeable*/) {} 260 : 261 : }; 262 : 263 : #ifdef CASA_WPOP 264 : #pragma GCC diagnostic pop 265 : #define CASA_WPOP 266 : #endif 267 : 268 : 269 : class CTCache 270 : { 271 : 272 : public: 273 : CTCache(CTIter *calIter); 274 : ~CTCache(); 275 : 276 : casacore::Int arrayId(); 277 : casacore::Int fieldId(); 278 : casacore::Int spectralWindow(); 279 : casacore::Vector<casacore::Int>& scan(); 280 : casacore::Vector<casacore::Double>& time(); 281 : casacore::Vector<casacore::Int>& antenna1(); 282 : casacore::Vector<casacore::Int>& antenna2(); 283 : casacore::Cube<casacore::Bool>& flagCube(); 284 : casacore::Vector<casacore::Int>& getChannelNumbers(casacore::Int rowInBuffer); 285 : casacore::Vector<casacore::Double>& getFrequencies(casacore::Int rowInBuffer,casacore::Int frame = vi::VisBuffer2::FrameNotSpecified); 286 : casacore::Int nRowChunk(); 287 : casacore::Int nRows(); 288 : casacore::Int nChannels(); 289 : casacore::Int nCorrelations(); 290 : 291 : casacore::Cube<casacore::Complex>& visCube(); 292 : casacore::Cube<casacore::Complex>& visCubeCorrected(); 293 : casacore::Cube<casacore::Complex>& visCubeModel(); 294 : 295 : // Convenient public methods for compatibility with casacore::MS-like interface 296 : casacore::Vector<casacore::Int>& observationId(); 297 : casacore::Vector<casacore::Int>& correlationTypes(); 298 : 299 : // Methods for efficient synchronization with CTIter 300 : void invalidate(); 301 : 302 : private: 303 : 304 : CTIter *calIter_p; 305 : casacore::Int field0_p; 306 : casacore::Int spw0_p; 307 : casacore::Vector<casacore::Int> field_p; 308 : casacore::Vector<casacore::Int> spw_p; 309 : casacore::Vector<casacore::Int> scan_p; 310 : casacore::Vector<casacore::Double> time_p; 311 : casacore::Vector<casacore::Int> antenna1_p; 312 : casacore::Vector<casacore::Int> antenna2_p; 313 : casacore::Cube<casacore::Bool> flagCube_p; 314 : casacore::Vector<casacore::Int> channel_p; 315 : casacore::Vector<casacore::Double> frequency_p; 316 : casacore::Cube<casacore::Complex> cparam_p; // This is an actual casacore::Cube<casacore::Complex> 317 : casacore::Cube<casacore::Complex> fparam_p; // This is in reality a casacore::Cube<casacore::Float> 318 : casacore::Cube<casacore::Complex> snr_p; // This is in reality a casacore::Cube<casacore::Float> 319 : casacore::Int nRowChunk_p; 320 : casacore::Int nRow_p; 321 : casacore::Int nChannel_p; 322 : casacore::Int nCorr_p; 323 : 324 : // Convenient members for compatibility with casacore::MS-like interface 325 : casacore::Vector<casacore::Int> observationId_p; 326 : casacore::Vector<casacore::Int> corrType_p; 327 : 328 : // Members for efficient synchronization with CTIter 329 : casacore::Bool CTfieldIdOK_p; 330 : casacore::Bool CTspectralWindowOK_p; 331 : casacore::Bool CTscanOK_p; 332 : casacore::Bool CTtimeOK_p; 333 : casacore::Bool CTantenna1OK_p; 334 : casacore::Bool CTantenna2OK_p; 335 : casacore::Bool CTflagCubeOk_p; 336 : casacore::Bool CTobservationIdOK_p; 337 : casacore::Bool CTcorrTypeOK_p; 338 : casacore::Bool CTchannelOK_p; 339 : casacore::Bool CTfrequencyOK_p; 340 : casacore::Bool CTVisCubeOK_p; 341 : casacore::Bool CTcorrectedVisCubeOK_p; 342 : casacore::Bool CTmodelVisCubeOK_p; 343 : casacore::Bool CTnRowChunkOK_p; 344 : casacore::Bool CTnRowOK_p; 345 : casacore::Bool CTnChannelOK_p; 346 : casacore::Bool CTnCorrOK_p; 347 : 348 : // Convenience methods and members to by-pass const methods issues 349 : casacore::Int& fillSpectralWindow(); 350 : casacore::Int& fillFieldId(); 351 : casacore::Int& fillnRowChunk(); 352 : 353 : }; 354 : 355 : 356 : class CTBuffer: public DummyBufferImpl 357 : { 358 : 359 : public: 360 : 361 0 : CTBuffer(CTIter *ctIter) {ctCache_p = new CTCache(ctIter);invalidate();} 362 0 : ~CTBuffer() {} 363 : 364 0 : virtual casacore::Bool existsColumn (VisBufferComponent2 id) const { 365 : return id == VisBufferComponent2::ArrayId 366 0 : || id == VisBufferComponent2::FieldId 367 0 : || id == VisBufferComponent2::SpectralWindows 368 0 : || id == VisBufferComponent2::Scan 369 0 : || id == VisBufferComponent2::Time 370 0 : || id == VisBufferComponent2::Antenna1 371 0 : || id == VisBufferComponent2::Antenna2 372 0 : || id == VisBufferComponent2::FlagCube 373 0 : || id == VisBufferComponent2::VisibilityCubeObserved 374 0 : || id == VisBufferComponent2::VisibilityCubeCorrected 375 0 : || id == VisBufferComponent2::VisibilityCubeModel 376 0 : || id == VisBufferComponent2::ObservationId 377 0 : || id == VisBufferComponent2::CorrType; 378 : } 379 : 380 0 : const casacore::Vector<casacore::Int> & arrayId() const {arrayId_p.assign (casacore::Vector<casacore::Int> (time().nelements(), ctCache_p->arrayId())); return arrayId_p;} 381 0 : const casacore::Vector<casacore::Int> & fieldId() const {fieldId_p.assign (casacore::Vector<casacore::Int> (time().nelements(), ctCache_p->fieldId())); return fieldId_p;} 382 0 : casacore::Int spectralWindow() const {return ctCache_p->spectralWindow();} 383 0 : const casacore::Vector<casacore::Int>& scan() const {return ctCache_p->scan();} 384 0 : const casacore::Vector<casacore::Double>& time() const {return ctCache_p->time();} 385 0 : const casacore::Vector<casacore::Int>& antenna1() const {return ctCache_p->antenna1();} 386 0 : const casacore::Vector<casacore::Int>& antenna2() const {return ctCache_p->antenna2();} 387 0 : const casacore::Cube<casacore::Bool>& flagCube() const {return ctCache_p->flagCube();} 388 0 : const casacore::Vector<casacore::Int>& getChannelNumbers(casacore::Int rowInBuffer) const {return ctCache_p->getChannelNumbers(rowInBuffer);} 389 0 : casacore::Vector<casacore::Int> getChannelNumbersSelected (casacore::Int /* outputChannelIndex */) const { throw casacore::AipsError ("Not Implemented");} 390 0 : const casacore::Vector<casacore::Double>& getFrequencies(casacore::Int rowInBuffer,casacore::Int /*frame*/ = vi::VisBuffer2::FrameNotSpecified) const {return ctCache_p->getFrequencies(rowInBuffer);} 391 0 : casacore::rownr_t nRows() const {return ctCache_p->nRows();} 392 0 : casacore::Int nChannels() const {return ctCache_p->nChannels();} 393 0 : casacore::Int nCorrelations() const {return ctCache_p->nCorrelations();} 394 0 : const casacore::Vector<casacore::Int> & spectralWindows () const { 395 0 : spectralWindows_p.assign (casacore::Vector<casacore::Int> (time().nelements(), ctCache_p->spectralWindow())); return spectralWindows_p;} 396 : 397 : 398 0 : const casacore::Cube<casacore::Complex>& visCube() const {return ctCache_p->visCube();} 399 0 : const casacore::Cube<casacore::Complex>& visCubeCorrected() const {return ctCache_p->visCubeCorrected();} 400 0 : const casacore::Cube<casacore::Complex>& visCubeModel() const {return ctCache_p->visCubeModel();} 401 : 402 : // Convenient public methods for compatibility with casacore::MS-like interface 403 0 : const casacore::Vector<casacore::Int>& observationId() const {return ctCache_p->observationId();} 404 0 : const casacore::Vector<casacore::Int>& correlationTypes() const {return ctCache_p->correlationTypes();} 405 0 : casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesDefined () const { throw casacore::AipsError ("Not Implemented");} 406 0 : casacore::Vector<casacore::Stokes::StokesTypes> getCorrelationTypesSelected () const { throw casacore::AipsError ("Not Implemented");} 407 : 408 : // Methods for efficient synchronization with CTIter 409 0 : void invalidate() {ctCache_p->invalidate();} 410 : 411 0 : casacore::Vector<bool>& flagRowRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 412 0 : casacore::Cube<bool>& flagCubeRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 413 0 : casacore::Vector<casacore::Cube<bool>>& flagCubesRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 414 0 : casacore::Cube<std::complex<float> >& visCubeRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 415 0 : casacore::Vector<casacore::Cube<std::complex<float>>>& visCubesRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 416 0 : casacore::Cube<std::complex<float> >& visCubeCorrectedRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 417 0 : casacore::Vector<casacore::Cube<std::complex<float>>>& visCubesCorrectedRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 418 0 : casacore::Cube<std::complex<float> >& visCubeModelRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 419 0 : casacore::Vector<casacore::Cube<std::complex<float>>>& visCubesModelRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 420 0 : casacore::Cube<float >& sigmaSpectrumRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 421 0 : casacore::Vector<casacore::Cube<float>>& sigmaSpectraRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 422 0 : casacore::Cube<float >& weightSpectrumRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 423 0 : casacore::Vector<casacore::Cube<float>>& weightSpectraRef() {throw casacore::AipsError ("Not implemented " , __FILE__, __LINE__);} 424 0 : casacore::IPosition getShape () const { return casacore::IPosition ();} 425 : 426 : private: 427 : 428 : mutable casacore::Vector<casacore::Int> arrayId_p; 429 : mutable casacore::Vector<casacore::Int> fieldId_p; 430 : mutable casacore::Vector<casacore::Int> spectralWindows_p; 431 : // CTIter *calIter_p; 432 : CTCache *ctCache_p; 433 : 434 : }; 435 : 436 : // Flag casacore::Data Handler class definition 437 : class FlagCalTableHandler: public FlagDataHandler 438 : { 439 : 440 : public: 441 : 442 : // Default constructor 443 : // NOTE: casacore::Time interval 0 groups all time steps together in one chunk. 444 : FlagCalTableHandler(string msname, casacore::uShort iterationApproach = SUB_INTEGRATION, casacore::Double timeInterval = 0); 445 : 446 : // Default destructor 447 : ~FlagCalTableHandler(); 448 : 449 : // Open CalTable 450 : bool open(); 451 : 452 : // Close CalTable 453 : bool close(); 454 : 455 : // Generate selected CalTable 456 : bool selectData(); 457 : 458 : // Parse casacore::MSSelection expression 459 : bool parseExpression(casacore::MSSelection &parser); 460 : 461 : // Generate CalIter 462 : bool generateIterator(); 463 : 464 : // Move to next chunk 465 : bool nextChunk(); 466 : 467 : // Move to next buffer 468 : bool nextBuffer(); 469 : 470 : // Write flag cube into MS 471 : bool flushFlags(); 472 : 473 : // Provide table name (for flag version) 474 : casacore::String getTableName(); 475 : 476 : // Check if a given column is available in the cal table 477 : bool checkIfColumnExists(casacore::String column); 478 : 479 : // Signal true when a progress summary has to be printed 480 : bool summarySignal(); 481 : 482 : private: 483 : 484 : // Mapping functions 485 : void generateScanStartStopMap(); 486 : 487 : // Convenient private methods for compatibility with casacore::MS-like interface 488 : casacore::Block<casacore::String> getSortColumns(casacore::Block<casacore::Int> intCols); 489 : 490 : // CatTable selection objects 491 : NewCalTable *selectedCalTable_p; 492 : NewCalTable *originalCalTable_p; 493 : CTInterface *calTableInterface_p; 494 : 495 : // Calibration casacore::Table iterator and buffer 496 : CTIter *calIter_p; 497 : CTBuffer *calBuffer_p; 498 : 499 : }; 500 : 501 : } //# NAMESPACE CASA - END 502 : 503 : #endif /* FlagCalTableHandler_H_ */