9 #ifndef DP3_STEPS_PREFLAGGER_H_
10 #define DP3_STEPS_PREFLAGGER_H_
12 #include <casacore/measures/Measures/MDirection.h>
14 #include <xtensor/containers/xtensor.hpp>
70 return fields |= itsPSet.getRequiredFields();
77 bool process(std::unique_ptr<base::DPBuffer> buffer)
override;
87 void show(std::ostream&)
const override;
93 void showTimings(std::ostream&,
double duration)
const override;
105 enum Oper { OpParen = -1, OpOr = -2, OpAnd = -3, OpNot = -4 };
108 typedef std::shared_ptr<PSet>
ShPtr;
118 if (itsFlagOnAmpl || itsFlagOnPhase || itsFlagOnReal || itsFlagOnImag) {
124 for (
const std::shared_ptr<PSet>& sub_pset : itsPSets) {
125 fields |= sub_pset->getRequiredFields();
131 xt::xtensor<uint8_t, 2>*
process(base::DPBuffer&,
unsigned int timeSlot,
132 const xt::xtensor<bool, 1>& matchBL,
140 void show(std::ostream&,
bool showName)
const;
144 bool matchTime(
double time,
unsigned int timeSlot)
const;
147 bool matchRange(
double v,
const std::vector<double>& ranges)
const;
159 bool flagAzEl(
double time);
163 void testAzEl(casacore::MDirection::Convert& converter,
unsigned int blnr,
164 int ant,
const std::vector<int>& ant1,
165 const std::vector<int>& ant2);
186 std::vector<double> fillTimes(
const std::vector<std::string>& str,
187 bool asTime,
bool canEndBeforeStart);
192 double getSeconds(
const std::string& str,
bool asTime,
bool usepm);
198 void fillChannels(
const base::DPInfo&);
206 std::vector<float> fillValuePerCorr(
const common::ParameterValue& value,
207 float defVal,
bool& doFlag);
211 xt::xtensor<int, 1> handleFreqRanges(
const std::vector<double>& chanFreqs);
215 void getValue(
const std::string& str,
double& value,
216 casacore::String& unit);
219 double getFreqHz(
double value,
const casacore::String& unit);
223 std::vector<std::string> exprToRpn(
const std::string& expr);
225 const base::DPInfo* itsInfo;
227 std::string itsStrExpr;
228 bool itsFlagOnTimeOnly;
237 base::BaselineSelection itsSelBL;
240 casacore::Matrix<bool> itsFlagBL;
241 std::vector<double> itsAzimuth;
242 std::vector<double> itsElevation;
243 std::vector<double> itsTimes;
244 std::vector<double> itsLST;
245 std::vector<double> itsATimes;
246 std::vector<double> itsRTimes;
247 std::vector<unsigned int> itsTimeSlot;
248 std::vector<float> itsAmplMin;
249 std::vector<float> itsAmplMax;
250 std::vector<float> itsPhaseMin;
251 std::vector<float> itsPhaseMax;
252 std::vector<float> itsRealMin;
253 std::vector<float> itsRealMax;
254 std::vector<float> itsImagMin;
255 std::vector<float> itsImagMax;
256 std::vector<unsigned int> itsChannels;
257 std::vector<std::string> itsStrChan;
258 std::vector<std::string> itsStrFreq;
259 std::vector<std::string> itsStrTime;
260 std::vector<std::string> itsStrLST;
261 std::vector<std::string>
263 std::vector<std::string>
265 std::vector<std::string> itsStrAzim;
266 std::vector<std::string> itsStrElev;
267 std::vector<int> itsRpn;
268 std::vector<PSet::ShPtr> itsPSets;
269 xt::xtensor<bool, 1> itsChanFlags;
272 xt::xtensor<uint8_t, 2> itsFlags;
273 xt::xtensor<bool, 1> itsMatchBL;
277 void setFlags(
const xt::xtensor<uint8_t, 2>& in,
283 void clearFlags(
const xt::xtensor<uint8_t, 2>& in,
292 unsigned int itsCount;
293 base::FlagCounter itsFlagCounter;
Class to handle the baseline selection.
Buffer holding the data of a timeslot/band.
Class to keep counts of nr of flagged points.
Class to hold code for virtual base class for Flaggers in DP3.
xt::xtensor< double, 2 > UvwType
Definition: DPBuffer.h:98
xt::xtensor< bool, 3 > FlagsType
Definition: DPBuffer.h:97
xt::xtensor< float, 3 > WeightsType
Definition: DPBuffer.h:96
aocommon::xt::UTensor< std::complex< float >, 3 > DataType
Definition: DPBuffer.h:95
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
DP3 step class to flag data on channel, baseline, or time.
Definition: PreFlagger.h:52
void show(std::ostream &) const override
Show the step parameters.
PreFlagger(const common::ParameterSet &, const std::string &prefix)
void finish() override
Finish the processing of this step and subsequent steps.
void showCounts(std::ostream &) const override
Show the flag counts.
friend class TestPSet
Make this Test class a friend, so it can access private code.
Definition: PreFlagger.h:54
common::Fields getRequiredFields() const override
Get the fields required by the current step.
Definition: PreFlagger.h:65
common::Fields getProvidedFields() const override
Definition: PreFlagger.h:73
void showTimings(std::ostream &, double duration) const override
Show the timings.
bool process(std::unique_ptr< base::DPBuffer > buffer) override
Mode
Definition: PreFlagger.h:57
void updateInfo(const base::DPInfo &) override
Abstract base class for a DP3 step.
Definition: Step.h:52
static constexpr dp3::common::Fields kWeightsField
Definition: Step.h:64
std::shared_ptr< Step > ShPtr
Definition: Step.h:54
static constexpr dp3::common::Fields kUvwField
Definition: Step.h:66
static constexpr dp3::common::Fields kDataField
Definition: Step.h:60
static constexpr dp3::common::Fields kFlagsField
Definition: Step.h:62
BaseTimer< std::chrono::steady_clock > NSTimer
Definition: Timer.h:129
Definition: AntennaFlagger.h:17