8 #ifndef DP3_STEPS_MSREADER_H_
9 #define DP3_STEPS_MSREADER_H_
11 #include <casacore/casa/Arrays/Slicer.h>
12 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
13 #include <casacore/tables/Tables/TableIter.h>
108 bool allow_missing_data =
false);
112 bool process(std::unique_ptr<base::DPBuffer> buffer)
override;
125 void show(std::ostream&)
const override;
137 const casacore::Table&
table()
const override {
return ms_; }
150 return extra_data_column_names_;
162 const std::string& start_channel_string,
163 const std::string& n_channels_string,
unsigned int n_channels);
167 void SelectBaselines();
172 void InitializeColumns(
bool allow_missing_data,
173 const std::string& data_column_name,
174 const std::string& flag_column_name,
175 const std::string& weight_column_name);
184 void InitializeIterator(
bool force_auto_weight);
189 void ReadAntennas(
const casacore::Table&
table);
194 void ReadArrayInformation();
201 const std::string& prefix);
205 void SkipFirstTimes(
double& first_time,
double interval);
208 void InitializeChannels(
int spectralWindow);
212 void ReadChannelProperties(
int spectralWindow);
215 void ReadPolarizations(
int spectralWindow);
222 void GetWeights(
const casacore::RefRows& rowNrs,
base::DPBuffer&);
224 casacore::MeasurementSet ms_;
225 casacore::Table selection_ms_;
226 casacore::TableIterator ms_iterator_;
227 std::vector<std::string> extra_data_column_names_;
228 std::string start_channel_expression_{
"0"};
229 std::string n_channels_expression_{
"0"};
230 std::string baseline_selection_{};
232 bool auto_weight_{
false};
233 bool has_weight_spectrum_{
false};
234 bool use_flags_{
true};
235 bool use_all_channels_{
false};
236 bool missing_data_{
false};
240 double time_tolerance_{1.0e-2};
242 double time_correction_{0.0};
243 double next_time_{0.0};
244 double previous_time_{0.0};
245 unsigned int n_read_{0};
246 unsigned int n_inserted_{0};
247 casacore::Slicer column_slicer_;
248 casacore::Slicer array_slicer_;
249 std::unique_ptr<base::UVWCalculator> uvw_calculator_;
250 base::FlagCounter flag_counter_;
Buffer holding the data of a timeslot/band.
Class to keep counts of nr of flagged points.
Class to calculate UVW coordinates Note: this code is used by LOFAR and APERTIF software.
Buffer holding the data of a timeslot/band.
Definition: DPBuffer.h:92
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Class to keep counts of nr of flagged points.
Definition: FlagCounter.h:35
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
DP3 step reading from an MS.
Definition: MsReader.h:101
void show(std::ostream &) const override
Show the step parameters.
static std::pair< unsigned int, unsigned int > ParseChannelSelection(const std::string &start_channel_string, const std::string &n_channels_string, unsigned int n_channels)
MsReader(const casacore::MeasurementSet &ms, const common::ParameterSet &parset, const std::string &prefix, bool allow_missing_data=false)
const casacore::Table & table() const override
Get the main MS table.
Definition: MsReader.h:137
void updateInfo(const base::DPInfo &) override
Do nothing, since MsReader sets its info in the constructor.
Definition: MsReader.h:118
bool AutoWeight() const
Definition: MsReader.h:153
void getUVW(const casacore::RefRows &rowNrs, double time, base::DPBuffer &)
Read the UVW at the given row numbers into the buffer.
void addToMS(const std::string &) override
Definition: MsReader.h:122
const std::string & BaselineSelection() const
Get the baseline selection.
Definition: MsReader.h:143
void showCounts(std::ostream &) const override
If needed, show the flag counts.
bool MissingData() const
Is the data column missing?
Definition: MsReader.h:146
void finish() override
Finish the processing of this step and subsequent steps.
std::string msName() const override
Get the name of the MS.
const std::vector< std::string > & ExtraDataColumnNames() const
Get the names of the extra data columns that are also read.
Definition: MsReader.h:149
void showTimings(std::ostream &, double duration) const override
Show the timings.
bool process(std::unique_ptr< base::DPBuffer > buffer) override
static void FlagInfinityNan(base::DPBuffer &buffer, base::FlagCounter &flagCounter)
Flags infinite and Not-a-Number values.
BaseTimer< std::chrono::steady_clock > NSTimer
Definition: Timer.h:129
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53