//# License along with this library; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
#ifndef ChannelAverageTVI_H_
#define ChannelAverageTVI_H_
#include <mstransform/TVI/FreqAxisTVI.h>
#include <casacore/ms/MeasurementSets/MSSpWindowColumns.h>
namespace casa { //# NAMESPACE CASA - BEGIN
namespace vi { //# NAMESPACE VI - BEGIN
//////////////////////////////////////////////////////////////////////////
// ChannelAverageTVI class
//////////////////////////////////////////////////////////////////////////
casacore::Bool weightSpectrumExists () const {return true;}
casacore::Bool sigmaSpectrumExists () const {return true;}
casacore::Vector<casacore::Double> getFrequencies ( casacore::Double time, casacore::Int frameOfReference,
casacore::Int spectralWindowId, casacore::Int msId) const;
void writeFlag (const casacore::Cube<casacore::Bool> & flag);
const casacore::ROMSSpWindowColumns& spectralWindowSubtablecols() const override;
casacore::Int nSpectralWindows () const override;
void propagateChanAvgFlags (const casacore::Cube<casacore::Bool> &avgFlagCube, casacore::Cube<casacore::Bool> &expandedFlagCube);
casacore::Bool parseConfiguration(const casacore::Record &configuration);
casacore::Vector<casacore::Int> chanbin_p;
std::map<casacore::Int,casacore::uInt > spwChanbinMap_p;
casacore::Vector<casacore::Int> chanbin_p;
mutable std::map<casacore::Int,casacore::uInt > spwChanbinMap_p; // Must be accessed from const methods
mutable casacore::Double Tfl_,Tws_,Tcd_,Tmd_,Tss_,Tchave_;
casacore::MSSpectralWindow newSPWSubtable_p;
std::unique_ptr<casacore::MSSpWindowColumns> newSPWSubtablecols_p;
//////////////////////////////////////////////////////////////////////////
// ChannelAverageTVIFactory class
//////////////////////////////////////////////////////////////////////////
class ChannelAverageTVIFactory : public ViFactory