DP3
BdaExpander.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 
7 
8 #ifndef DP3_STEPS_BDAEXPANDER_H_
9 #define DP3_STEPS_BDAEXPANDER_H_
10 
11 #include <map>
12 #include <utility>
13 #include <vector>
14 
15 #include "base/BdaBuffer.h"
16 #include "base/DPBuffer.h"
17 #include "steps/Step.h"
18 
19 #include "common/Timer.h"
20 
21 namespace dp3 {
22 namespace steps {
23 
26 
32 
33 class BdaExpander : public Step {
34  public:
35  explicit BdaExpander(const std::string& prefix);
36 
37  common::Fields getRequiredFields() const override { return kUvwField; }
38 
39  common::Fields getProvidedFields() const override {
40  // The BdaExpander only provides fields that are already present in the
41  // input BdaBuffer -> return an empty Fields object.
42  return {};
43  }
44 
49  bool process(std::unique_ptr<base::BdaBuffer>) override;
50 
51  void finish() override;
52 
53  void updateInfo(const base::DPInfo&) override;
54 
55  void show(std::ostream&) const override;
56 
57  void showTimings(std::ostream&, double duration) const override;
58 
59  bool accepts(MsType dt) const override { return dt == MsType::kBda; }
60 
61  private:
66  void CopyData(const base::BdaBuffer& bda_buffer,
67  const base::BdaBuffer::Row& bda_row,
68  std::unique_ptr<dp3::base::DPBuffer>& buf_out,
69  int time_averaging_factor = 1);
70 
71  struct RegularBufferElement {
72  RegularBufferElement(size_t n_baselines, unsigned int n_corr,
73  unsigned int n_chan, double current_time,
74  double current_exposure);
75 
76  std::vector<bool> baseline;
77  std::unique_ptr<dp3::base::DPBuffer> regular_buffer;
78  };
79 
80  std::map<unsigned int, RegularBufferElement> RB_elements;
81 
90  std::vector<std::vector<int>> channels_mapping_;
91 
92  unsigned int next_time_slot_to_process_;
93 
94  common::NSTimer timer_;
95  std::string step_name_;
96 };
97 
98 } // namespace steps
99 } // namespace dp3
100 
101 #endif
Buffer holding baseline-dependently averaged (BDA) data.
Buffer holding the data of a timeslot/band.
Class to hold code for virtual base class for Flaggers in DP3.
Definition: BdaBuffer.h:25
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Definition: Fields.h:16
DP3 step that expands BDA data in BdaBuffers to regular data in DPBuffers.
Definition: BdaExpander.h:33
void show(std::ostream &) const override
Show the step parameters.
BdaExpander(const std::string &prefix)
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: BdaExpander.h:59
common::Fields getRequiredFields() const override
Get the fields required by the current step.
Definition: BdaExpander.h:37
common::Fields getProvidedFields() const override
Definition: BdaExpander.h:39
void showTimings(std::ostream &, double duration) const override
bool process(std::unique_ptr< base::BdaBuffer >) override
void updateInfo(const base::DPInfo &) override
Abstract base class for a DP3 step.
Definition: Step.h:52
static constexpr dp3::common::Fields kUvwField
Definition: Step.h:66
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
Definition: BdaBuffer.h:27