Source
void FlagAgentAntennaIntegrations::checkAnyPolarizationFlagged(const casacore::Cube<casacore::Bool> &polChanRowFlags,
//# FlagAgentRFlag.cc: This file contains the implementation of the FlagAgentAntennaIntegrations class.
//#
//# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
//# Copyright (C) Associated Universities, Inc. Washington DC, USA 2017, All rights reserved.
//# Copyright (C) European Southern Observatory, 2017, All rights reserved.
//#
//# This library is free software; you can redistribute it and/or
//# modify it under the terms of the GNU Lesser General Public
//# License as published by the Free software Foundation; either
//# version 2.1 of the License, or (at your option) any later version.
//#
//# This library is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY, without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//# Lesser General Public License for more details.
//#
//# You should have received a copy of the GNU Lesser General Public
//# License along with this library; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
//# MA 02111-1307 USA
//# $Id: $
namespace casa { //# NAMESPACE CASA - BEGIN
/**
* Will use the per-row iteration approach, with vis-buffer preprocessing.
*
* @param dh Data handler, just passed to the base class
* @param config Flag agent configuration object, antint specific parameters are processed
* @param writePrivateFlagCube Write option for the base class
* @param flag Flag for the base class
*/
FlagAgentAntennaIntegrations::FlagAgentAntennaIntegrations(
FlagDataHandler *dh, casacore::Record config,
casacore::Bool writePrivateFlagCube,
casacore::Bool flag):
FlagAgentBase(dh, config, FlagAgentBase::ROWS_PREPROCESS_BUFFER, writePrivateFlagCube,
flag)
{
logger_p->origin(casacore::LogOrigin(agentName_p,__FUNCTION__,WHERE));
setAgentParameters(config, flagDataHandler_p->antennaNames_p);
}
/**
* Deal with parameters specific to 'antint'.
*
* minchanfrac: fraction of channels with flagged antenna to initiate flagging.
* verbose: boolean to print the timestamps of the integrations that are flagged
*
* @param config A flagdata configuration/parameters object
*/
void FlagAgentAntennaIntegrations::setAgentParameters(casacore::Record config,
casacore::Vector<casacore::String> *antennaNames)
{
const auto fields = config.nfields();
*logger_p << casacore::LogIO::NORMAL << "The configuration received by this agent has "
<< fields << " fields with the following values:" << casacore::LogIO::POST;
std::ostringstream ostr;
config.print(ostr);
*logger_p << casacore::LogIO::NORMAL << ostr.str() << casacore::LogIO::POST;
const auto minChanOpt = "minchanfrac";
int found = config.fieldNumber(minChanOpt);
if (found >= 0) {
minChanThreshold_p = config.asDouble(minChanOpt);
}
const auto antOpt = "antint_ref_antenna";
found = config.fieldNumber(antOpt);
if (found >= 0) {
casacore::String antintAnt = config.asString(antOpt);
antIdx_p = findAntennaID(antintAnt, antennaNames);
*logger_p << casacore::LogIO::NORMAL << "Found requested antenna of interest, with "
"name: " << antintAnt << ", and index: " << antIdx_p << casacore::LogIO::POST;
} else {
throw casacore::AipsError(casacore::String("The parameter ") + antOpt + " was not "
"given. This parameter is mandatory in this flagging mode.");
}
const auto verboseOpt = "verbose";
found = config.fieldNumber(verboseOpt);