DP3
Transfer.h
Go to the documentation of this file.
1 // Copyright (C) 2024 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
7 
8 #ifndef DP3_STEPS_DATA_TRANSFER_H_
9 #define DP3_STEPS_DATA_TRANSFER_H_
10 
11 #include <casacore/ms/MeasurementSets/MeasurementSet.h>
12 #include <casacore/tables/Tables/TableIter.h>
13 #include "base/DPBuffer.h"
14 #include "Filter.h"
15 #include "ResultStep.h"
16 #include "Step.h"
17 #include "common/Timer.h"
18 
19 namespace dp3 {
20 namespace steps {
21 
24 
30 
33 
34 class Transfer final : public Step {
35  public:
38  explicit Transfer(const common::ParameterSet& parameter_set,
39  const std::string& prefix);
40 
42  return filter_step_->getRequiredFields();
43  }
44 
46  common::Fields provided_fields{};
47  provided_fields |= (transfer_data_ && output_buffer_name_.empty())
48  ? kDataField
49  : common::Fields();
50  provided_fields |= transfer_flags_ ? kFlagsField : common::Fields();
51  return provided_fields;
52  }
53 
54  bool process(std::unique_ptr<base::DPBuffer> buffer) final;
55 
56  void finish() final;
57 
58  void updateInfo(const base::DPInfo&) final;
59 
60  void show(std::ostream&) const final;
61 
62  void showTimings(std::ostream&, double duration) const final;
63 
64  private:
66  void ReadSourceMsVisibilities();
67 
69  void ReadSourceMsFlags();
70 
72  template <typename T>
73  void TransferSingleTimeSlot(
74  T source, T& target,
75  const std::vector<common::rownr_t>& target_row_numbers,
76  const std::vector<double>& target_frequencies) const;
77 
78  std::string name_;
79  common::NSTimer timer_;
80  std::string source_ms_path_;
81  std::string source_data_column_;
82  casacore::MeasurementSet ms_;
83  casacore::TableIterator ms_iterator_;
84 
88  base::DPBuffer::DataType data_;
89  base::DPBuffer::FlagsType flags_;
91 
94  bool transfer_data_;
95  bool transfer_flags_;
97 
99  std::string output_buffer_name_;
100 
102  std::size_t timestep_counter_ = 0;
103 
105  std::size_t time_averaging_factor_;
106 
108  double time_interval_;
109 
111  std::vector<double> source_channel_upper_edges_;
112 
113  std::shared_ptr<Step> filter_step_;
114  std::shared_ptr<ResultStep> result_step_;
115 };
116 
117 } // namespace steps
118 } // namespace dp3
119 
120 #endif
Buffer holding the data of a timeslot/band.
DP3 step to filter out baselines and channels.
Class to hold code for virtual base class for Flaggers in DP3.
Definition: Fields.h:16
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
This class defines a step in the DP3 pipeline that keeps the result to make it possible to get the re...
Definition: ResultStep.h:16
Abstract base class for a DP3 step.
Definition: Step.h:52
static constexpr dp3::common::Fields kDataField
Definition: Step.h:60
static constexpr dp3::common::Fields kFlagsField
Definition: Step.h:62
DP3 step class to transfer visbility data and flags from a lower to a MS with higher time/freq resolu...
Definition: Transfer.h:34
void show(std::ostream &) const final
Show the step parameters.
void finish() final
Finish the processing of this step and subsequent steps.
Transfer(const common::ParameterSet &parameter_set, const std::string &prefix)
void showTimings(std::ostream &, double duration) const final
common::Fields getProvidedFields() const final
Definition: Transfer.h:45
common::Fields getRequiredFields() const final
Get the fields required by the current step.
Definition: Transfer.h:41
bool process(std::unique_ptr< base::DPBuffer > buffer) final
void updateInfo(const base::DPInfo &) final
Definition: InputStep.h:21
BaseTimer< std::chrono::steady_clock > NSTimer
Definition: Timer.h:129
unsigned int rownr_t
Definition: Types.h:19
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53