00001 //# FlagMSHandler.h: This file contains the interface definition of the FlagMSHandler class. 00002 //# 00003 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) 00004 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. 00005 //# Copyright (C) European Southern Observatory, 2011, All rights reserved. 00006 //# 00007 //# This library is free software; you can redistribute it and/or 00008 //# modify it under the terms of the GNU Lesser General Public 00009 //# License as published by the Free software Foundation; either 00010 //# version 2.1 of the License, or (at your option) any later version. 00011 //# 00012 //# This library is distributed in the hope that it will be useful, 00013 //# but WITHOUT ANY WARRANTY, without even the implied warranty of 00014 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 //# Lesser General Public License for more details. 00016 //# 00017 //# You should have received a copy of the GNU Lesser General Public 00018 //# License along with this library; if not, write to the Free Software 00019 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00020 //# MA 02111-1307 USA 00021 //# $Id: $ 00022 00023 #ifndef FlagMSHandler_H_ 00024 #define FlagMSHandler_H_ 00025 00026 #include <flagging/Flagging/FlagDataHandler.h> 00027 #include <msvis/MSVis/ViFrequencySelection.h> 00028 00029 namespace casa { //# NAMESPACE CASA - BEGIN 00030 00031 // Flag Data Handler class definition 00032 class FlagMSHandler: public FlagDataHandler 00033 { 00034 00035 public: 00036 00037 // Default constructor 00038 // NOTE: Time interval 0 groups all time steps together in one chunk. 00039 FlagMSHandler(string msname, uShort iterationApproach = SUB_INTEGRATION, Double timeInterval = 0); 00040 00041 // Default destructor 00042 ~FlagMSHandler(); 00043 00044 // Open Measurement Set 00045 bool open(); 00046 00047 // Close Measurement Set 00048 bool close(); 00049 00050 // Generate selected Measurement Set 00051 bool selectData(); 00052 00053 // Parse MSSelection expression 00054 bool parseExpression(MSSelection &parser); 00055 00056 // Generate Visibility Iterator 00057 bool generateIterator(); 00058 00059 // Move to next chunk 00060 bool nextChunk(); 00061 00062 // Move to next buffer 00063 bool nextBuffer(); 00064 00065 // Write flag cube into MS 00066 bool flushFlags(); 00067 00068 // Provide table name (for flag version) 00069 String getTableName(); 00070 00071 // Check if a given column is available in the MS 00072 // (typically for checking existence of CORRECTED_DATA 00073 bool checkIfColumnExists(String column); 00074 00075 // Signal true when a progress summary has to be printed 00076 bool summarySignal(); 00077 00078 // Get the MS PROCESSOR sub-table 00079 bool processorTable(); 00080 00081 // Get a Float visCube and return a Complex one 00082 Cube<Complex>& weightVisCube(); 00083 00084 Cube<Complex> weight_spectrum_p; 00085 00086 private: 00087 00088 // Mapping functions 00089 virtual void generateScanStartStopMap(); 00090 00091 // Swap MS to check what is the maximum RAM memory needed 00092 void preSweep(); 00093 00094 // Apply channel selection for asyn or normal iterator 00095 // NOTE: We always have to do this, even if there is no SPW:channel selection 00096 void applyChannelSelection(vi::VisibilityIterator2 *visIter); 00097 00098 00099 // Measurement set section 00100 MeasurementSet *selectedMeasurementSet_p; 00101 MeasurementSet *originalMeasurementSet_p; 00102 00103 // RO Visibility Iterator 00104 vi::VisibilityIterator2 *preAveragingVI_p; 00105 vi::VisibilityIterator2 *visibilityIterator_p; 00106 vi::FrequencySelectionUsingChannels *channelSelector_p; 00107 00108 }; 00109 00110 } //# NAMESPACE CASA - END 00111 00112 #endif /* FlagMSHandler_H_ */