DP3
Predict.h
Go to the documentation of this file.
1 // Copyright (C) 2021 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #ifndef DP3_STEPS_PREDICT_H_
5 #define DP3_STEPS_PREDICT_H_
6 
7 #include "steps/Step.h"
8 
9 #include <mutex>
10 
11 namespace dp3 {
12 namespace common {
13 class ParameterSet;
14 }
15 
16 namespace steps {
17 class BdaAverager;
18 
24 class Predict : public ModelDataStep {
25  public:
32  Predict(const common::ParameterSet& parset, const std::string& prefix,
33  MsType input_type = MsType::kRegular);
34 
42  Predict(const common::ParameterSet& parset, const std::string& prefix,
43  const std::vector<std::string>& source_patterns,
44  MsType input_type = MsType::kRegular);
45 
46  ~Predict() override {}
47 
48  common::Fields getRequiredFields() const override {
49  // The actual work occurs in sub-steps, which come after Predict in the
50  // step list.
51  return {};
52  }
53 
54  common::Fields getProvidedFields() const override {
55  // The actual work occurs in sub-steps, which come after Predict in the
56  // step list.
57  return {};
58  }
59 
60  bool process(std::unique_ptr<base::DPBuffer>) override;
61 
62  bool process(std::unique_ptr<base::BdaBuffer>) override;
63 
64  void finish() override;
65 
66  void show(std::ostream&) const override;
67 
69  void setNextStep(std::shared_ptr<Step> next_step) override;
70 
72 
73  void SetOperation(const std::string& operation);
74 
75  void updateInfo(const base::DPInfo&) override;
76 
77  bool accepts(MsType dt) const override { return dt == ms_type_; }
78 
79  MsType outputs() const override { return ms_type_; }
80 
85  void SetThreadData(std::mutex* mutex);
86 
87  private:
92  void Initialize(const common::ParameterSet& parset, const std::string& prefix,
93  const std::vector<std::string>& source_patterns,
94  MsType input_type);
95 
97  const MsType ms_type_;
98 
99  bool use_fast_predict_{false};
100 
101  std::vector<std::shared_ptr<Step>> internal_steps_;
102  std::shared_ptr<BdaAverager> bda_averager_;
103  std::shared_ptr<ModelDataStep> predict_step_;
104 };
105 
106 } // namespace steps
107 } // namespace dp3
108 
109 #endif
Class to hold code for virtual base class for Flaggers in DP3.
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
Common interface for steps that produce model data.
Definition: Step.h:172
DP3 step class that predicts visibilities from a source model. This step contains OnePredict sub-step...
Definition: Predict.h:24
~Predict() override
Definition: Predict.h:46
bool process(std::unique_ptr< base::BdaBuffer >) override
Predict(const common::ParameterSet &parset, const std::string &prefix, const std::vector< std::string > &source_patterns, MsType input_type=MsType::kRegular)
void show(std::ostream &) const override
Show the step parameters.
void SetThreadData(std::mutex *mutex)
void setNextStep(std::shared_ptr< Step > next_step) override
Ensures that all steps, including internal sub-steps, form a single list.
MsType outputs() const override
Return which datatype this step outputs.
Definition: Predict.h:79
bool process(std::unique_ptr< base::DPBuffer >) override
bool accepts(MsType dt) const override
Boolean if this step can process this type of data.
Definition: Predict.h:77
void finish() override
Finish the processing of this step and subsequent steps.
void SetOperation(const std::string &operation)
common::Fields getRequiredFields() const override
Get the fields required by the current step.
Definition: Predict.h:48
common::Fields getProvidedFields() const override
Definition: Predict.h:54
void updateInfo(const base::DPInfo &) override
Predict(const common::ParameterSet &parset, const std::string &prefix, MsType input_type=MsType::kRegular)
base::Direction GetFirstDirection() const override
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