DP3
BdaGroupPredict.h
Go to the documentation of this file.
1 // BdaGroupPredict.h: class to directly predict baseline dependent averaged
2 // (BDA) visibilities from a source model Copyright (C) 2020 ASTRON (Netherlands
3 // Institute for Radio Astronomy) SPDX-License-Identifier: GPL-3.0-or-later
4 
9 
10 #ifndef DP3_BDAGROUPPREDICT_H
11 #define DP3_BDAGROUPPREDICT_H
12 
13 #include "InputStep.h"
14 
15 #include "base/BdaBuffer.h"
16 
17 #include <map>
18 #include <queue>
19 #include <utility>
20 
21 namespace dp3 {
22 namespace common {
23 class ParameterSet;
24 }
25 
26 namespace steps {
27 
30 
32  public:
35  BdaGroupPredict(const common::ParameterSet&, const std::string& prefix);
36 
44  BdaGroupPredict(const common::ParameterSet&, const std::string& prefix,
45  const std::vector<std::string>& source_patterns);
46 
47  ~BdaGroupPredict() override;
48 
50 
57  bool process(std::unique_ptr<base::BdaBuffer>) override;
58 
59  void finish() override;
60 
61  void updateInfo(const base::DPInfo&) override;
62 
63  void show(std::ostream&) const override;
64 
65  void showTimings(std::ostream&, double duration) const override;
66 
67  bool accepts(MsType dt) const override { return dt == MsType::kBda; }
68 
69  MsType outputs() const override { return MsType::kBda; }
70 
72 
73  private:
74  // Need to store a reference to the parset to create the OnePredict
75  // substeps in updateInfo()
76  const common::ParameterSet& parset_;
77  std::string name_;
78 
79  // Structure to keep track how many rows in a BdaBuffer have been processed
80  struct BufferInfo {
81  std::unique_ptr<base::BdaBuffer> buffer;
82  size_t nr_rows_filled;
83  };
84 
86  std::queue<BufferInfo> buffers_;
87 
88  std::vector<std::string> source_patterns_;
89 
91  class BaselineGroup;
92 
95  std::map<std::pair<int, int>, BaselineGroup> averaging_to_baseline_group_map_;
96 
100  std::vector<std::pair<BaselineGroup*, int>> index_to_baseline_group_map_;
101 
102  common::NSTimer timer_;
103 };
104 
105 } // namespace steps
106 } // namespace dp3
107 
108 #endif
Buffer holding baseline-dependently averaged (BDA) data.
Abstract base class for a Step generating input.
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 class to predict BDA visibilities from a source model.
Definition: BdaGroupPredict.h:31
BdaGroupPredict(const common::ParameterSet &, const std::string &prefix, const std::vector< std::string > &source_patterns)
bool process(std::unique_ptr< base::BdaBuffer >) override
base::Direction GetFirstDirection() const override
void show(std::ostream &) const override
Show the step parameters.
common::Fields getRequiredFields() const override
Get the fields required by the current step.
void finish() override
Finish the processing of this step and subsequent steps.
bool accepts(MsType dt) const override
Boolean if this step can process this type of data.
Definition: BdaGroupPredict.h:67
void showTimings(std::ostream &, double duration) const override
BdaGroupPredict(const common::ParameterSet &, const std::string &prefix)
MsType outputs() const override
Return which datatype this step outputs.
Definition: BdaGroupPredict.h:69
void updateInfo(const base::DPInfo &) override
Common interface for steps that produce model data.
Definition: Step.h:172
MsType
To check compatibility between steps before running.
Definition: Step.h:57
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53
A direction on the celestial sphere.
Definition: Direction.h:15