DP3
MultiMsReader.h
Go to the documentation of this file.
1 // MultiMsReader.h: DP3 step reading from multiple MSs
2 // Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 
8 
9 #ifndef DP3_STEPS_MULTIMSREADER_H_
10 #define DP3_STEPS_MULTIMSREADER_H_
11 
12 #include <casacore/tables/Tables/TableIter.h>
13 #include <casacore/tables/Tables/RefRows.h>
14 #include <casacore/casa/Arrays/Slicer.h>
15 
16 #include "base/UVWCalculator.h"
17 #include "base/FlagCounter.h"
18 #include "common/ParameterSet.h"
19 
20 #include "MsReader.h"
21 #include "ResultStep.h"
22 
23 namespace dp3 {
24 namespace steps {
26 
46 
47 class MultiMsReader final : public InputStep {
48  public:
51  MultiMsReader(const std::vector<std::string>& msNames,
52  const common::ParameterSet& parset, const std::string& prefix);
53 
54  ~MultiMsReader() override;
55 
58  bool process(std::unique_ptr<base::DPBuffer> buffer) override;
59 
61  void finish() override;
62 
64  void updateInfo(const base::DPInfo&) override;
65 
67  void show(std::ostream&) const override;
68 
70  void showCounts(std::ostream&) const override;
71 
73  void showTimings(std::ostream&, double duration) const override;
74 
76  void setFieldsToRead(const dp3::common::Fields& fields) override;
77 
79  std::string msName() const override { return readers_.front().name; }
80 
82  const casacore::Table& table() const override {
83  return readers_[first_].ms_reader->table();
84  }
85 
86  private:
89  void ValidateBands();
90 
92  void HandleBands();
93 
95  void SortBands();
96 
98  void FillBands();
99 
101  void GetWeights(std::unique_ptr<base::DPBuffer>& buffer);
102 
103  bool order_;
104  int first_;
105  unsigned int n_missing_;
106  struct Reader {
107  std::string name;
108  std::shared_ptr<MsReader> ms_reader;
109  std::shared_ptr<ResultStep> result;
110  };
111  std::vector<Reader> readers_;
112  unsigned int n_fill_channels_;
113 };
114 
115 } // namespace steps
116 } // namespace dp3
117 
118 #endif
Class to keep counts of nr of flagged points.
DP3 step reading from an MS.
Class to calculate UVW coordinates Note: this code is used by LOFAR and APERTIF software.
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
Abstract base class for a Step generating input.
Definition: InputStep.h:37
DP3 step reading from multiple MSs.
Definition: MultiMsReader.h:47
void updateInfo(const base::DPInfo &) override
Update the general info (by initializing it).
void showTimings(std::ostream &, double duration) const override
Show the timings.
std::string msName() const override
Returns (only) the name of the first MS.
Definition: MultiMsReader.h:79
MultiMsReader(const std::vector< std::string > &msNames, const common::ParameterSet &parset, const std::string &prefix)
const casacore::Table & table() const override
Returns only the first MS table.
Definition: MultiMsReader.h:82
bool process(std::unique_ptr< base::DPBuffer > buffer) override
void showCounts(std::ostream &) const override
If needed, show the flag counts.
void setFieldsToRead(const dp3::common::Fields &fields) override
Set which fields must be read.
void show(std::ostream &) const override
Show the step parameters.
void finish() override
Finish the processing of this step and subsequent steps.
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53