DP3
DynSpec.h
Go to the documentation of this file.
1 // Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
7 
8 #ifndef DP3_STEPS_DYNSPEC_H_
9 #define DP3_STEPS_DYNSPEC_H_
10 
11 #include "steps/Step.h"
12 
13 #include "common/ParameterSet.h"
14 #include "common/Timer.h"
16 
17 #include "model/Patch.h"
18 
19 #include "ResultStep.h"
20 
21 namespace dp3::steps {
22 
26 class DynSpec : public Step {
27  public:
32  xt::xtensor<float, 4, xt::layout_type::column_major>;
33 
34  DynSpec(const common::ParameterSet&, const std::string& prefix);
35 
38  }
39 
40  common::Fields getProvidedFields() const final { return {}; }
41 
42  bool process(std::unique_ptr<base::DPBuffer> buffer) final;
43 
44  void finish() final;
45 
46  void updateInfo(const base::DPInfo&) final;
47 
48  void show(std::ostream&) const final;
49 
50  void showTimings(std::ostream&, double duration) const final;
51 
52  private:
54  xt::xtensor<float, 2> ComputeAbsoluteStokesParameters(
55  xt::xtensor<std::complex<float>, 2>& baseline_averaged_data) const;
56 
58  void WriteSpectraToDisk();
59 
60  size_t time_index_{0};
61 
62  std::string name_;
63 
65  std::string source_file_name_;
66 
68  std::string fits_prefix_;
69 
71  std::string model_column_;
72 
74  std::vector<std::shared_ptr<model::Patch>> source_list_;
75 
78  bool subtract_sources_{false};
79  bool subtract_with_h5parmpredict_{false};
80  bool subtract_model_column_{false};
81 
84  bool apply_calibration_solutions_{false};
85 
88  bool apply_beam_correction_{false};
89  bool apply_beam_reweighted_{false};
90 
93  DynamicSpectrumTensor dynamic_spectra_;
94 
98  std::vector<std::shared_ptr<Step>> first_substeps_;
99  std::vector<std::shared_ptr<ResultStep>> results_;
100  std::shared_ptr<Step> model_step_;
101  std::shared_ptr<ResultStep> model_result_;
103 
104  common::NSTimer total_timer_;
105  common::NSTimer substep_timer_;
106  common::NSTimer computation_timer_;
107  common::NSTimer write_timer_;
108 };
109 
110 } // namespace dp3::steps
111 
112 #endif
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
DP3 step class that creates visibility averaged dynamic spectra. TODO: (1) Output the weights for eac...
Definition: DynSpec.h:26
DynSpec(const common::ParameterSet &, const std::string &prefix)
void showTimings(std::ostream &, double duration) const final
void finish() final
Finish the processing of this step and subsequent steps.
void show(std::ostream &) const final
Show the step parameters.
bool process(std::unique_ptr< base::DPBuffer > buffer) final
xt::xtensor< float, 4, xt::layout_type::column_major > DynamicSpectrumTensor
Definition: DynSpec.h:32
common::Fields getRequiredFields() const final
Get the fields required by the current step.
Definition: DynSpec.h:36
void updateInfo(const base::DPInfo &) final
common::Fields getProvidedFields() const final
Definition: DynSpec.h:40
Abstract base class for a DP3 step.
Definition: Step.h:52
static constexpr dp3::common::Fields kWeightsField
Definition: Step.h:64
static constexpr dp3::common::Fields kUvwField
Definition: Step.h:66
static constexpr dp3::common::Fields kDataField
Definition: Step.h:60
static constexpr dp3::common::Fields kFlagsField
Definition: Step.h:62
BaseTimer< std::chrono::steady_clock > NSTimer
Definition: Timer.h:129
std::complex< float > complex
Definition: QRSolver.h:16
Definition: AntennaFlagger.h:17