DP3
Filter.h
Go to the documentation of this file.
1 // Filter.h: DP3 step to filter out baselines and channels
2 // Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 
8 
9 #ifndef DP3_STEPS_FILTER_H_
10 #define DP3_STEPS_FILTER_H_
11 
12 #include "Step.h"
13 #include "base/BaselineSelection.h"
14 #include "base/DPBuffer.h"
15 #include "common/ParameterSet.h"
16 #include "common/Timer.h"
17 
18 namespace dp3 {
19 namespace steps {
21 
91 
92 class Filter final : public Step {
93  public:
95  Filter();
96 
99  Filter(const common::ParameterSet&, const std::string& prefix);
100 
103 
104  ~Filter() override;
105 
107 
109 
112  bool process(std::unique_ptr<base::DPBuffer> buffer) override;
113 
115  void finish() override;
116 
118  void updateInfo(const base::DPInfo&) override;
119 
121  void show(std::ostream&) const override;
122 
124  void showTimings(std::ostream&, double duration) const override;
125 
128  void addToMS(const std::string& msName) override;
129 
131  bool hasSelection() const { return itsDoSelect; }
132 
134  const std::vector<unsigned int>& getIndicesBL() const { return itsSelBL; }
135 
136  private:
139  casacore::Vector<int> createIdMap(
140  common::rownr_t nrId,
141  const casacore::Vector<common::rownr_t>& removedIds) const;
142 
147  casacore::Vector<common::rownr_t> renumberSubTable(
148  const casacore::Table& ms, const casacore::String& name,
149  const casacore::String& colName,
150  const casacore::Vector<common::rownr_t>& removedAnt,
151  const casacore::Vector<int>& antMap, common::rownr_t& nrId) const;
152 
153  std::string itsName;
154  casacore::String itsStartChanStr;
155  casacore::String itsNrChanStr;
156  bool itsRemoveAnt;
157  base::BaselineSelection itsBaselines;
158  unsigned int itsStartChan;
159  std::vector<unsigned int> itsSelBL;
160  bool itsDoSelect;
161  common::NSTimer itsTimer;
162 };
163 
164 } // namespace steps
165 } // namespace dp3
166 
167 #endif
Class to handle the baseline selection.
Buffer holding the data of a timeslot/band.
Class to hold code for virtual base class for Flaggers in DP3.
Class containing a few static functions to parse a baseline selection string.
Definition: BaselineSelection.h:47
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Definition: Fields.h:16
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
DP3 step to filter out baselines and channels.
Definition: Filter.h:92
Filter()
Default constructor.
bool hasSelection() const
Does the filter step has an actual selection?
Definition: Filter.h:131
Filter(const base::BaselineSelection &)
Construct the object for the given MS and baseline selection.
void finish() override
Finish the processing of this step and subsequent steps.
common::Fields getRequiredFields() const override
Get the fields required by the current step.
void addToMS(const std::string &msName) override
void updateInfo(const base::DPInfo &) override
Update the general info.
Filter(const common::ParameterSet &, const std::string &prefix)
common::Fields getProvidedFields() const override
const std::vector< unsigned int > & getIndicesBL() const
Get the indices of the selected baselines.
Definition: Filter.h:134
void show(std::ostream &) const override
Show the step parameters.
~Filter() override
bool process(std::unique_ptr< base::DPBuffer > buffer) override
void showTimings(std::ostream &, double duration) const override
Show the timings.
Abstract base class for a DP3 step.
Definition: Step.h:52
unsigned int rownr_t
Definition: Types.h:19
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53