8 #ifndef DP3_STEPS_FASTPREDICT_H_
9 #define DP3_STEPS_FASTPREDICT_H_
11 #ifdef USE_FAST_PREDICT
15 #include <xtensor/containers/xtensor.hpp>
27 #include <predict/PredictPlan.h>
28 #include <predict/PredictPlanExecCPU.h>
29 #include <predict/Predict.h>
41 class FastPredict :
public ModelDataStep {
46 FastPredict(
const common::ParameterSet&,
const std::string& prefix,
47 const std::vector<std::string>& source_patterns);
49 ~FastPredict()
override;
51 common::Fields getRequiredFields()
const override {
52 common::Fields fields = kUvwField;
53 if (operation_ == Operation::kAdd || operation_ == Operation::kSubtract) {
56 if (apply_cal_step_) {
62 common::Fields getProvidedFields()
const override {
66 common::Fields fields;
68 if (output_data_name_.empty()) {
75 if (operation_ == Operation::kReplace && apply_cal_step_) {
76 std::shared_ptr<Step> step = apply_cal_step_;
78 fields |= step->getProvidedFields();
79 step = step->getNextStep();
86 void SetApplyCal(
const common::ParameterSet&,
const std::string& prefix);
89 void SetOperation(
const std::string& type);
91 void SetThreadData(std::mutex*) {
100 bool process(std::unique_ptr<base::DPBuffer>)
override;
103 void finish()
override;
106 void updateInfo(
const base::DPInfo&)
override;
109 void show(std::ostream&)
const override;
112 void showTimings(std::ostream&,
double duration)
const override;
115 void setSources(
const std::vector<std::string>& sourcePatterns);
118 base::Direction GetFirstDirection()
const override;
121 enum class Operation { kReplace, kAdd, kSubtract };
124 void Init(
const common::ParameterSet&,
const std::string& prefix,
125 const std::vector<std::string>& sourcePatterns);
127 void InitializePlan();
131 void CopyPredictBufferToData(
133 const xt::xtensor<double, 4, xt::layout_type::row_major>& buffer);
139 xt::xtensor<std::complex<float>, 3> input_data_;
140 std::string source_db_name_;
141 bool correct_time_smearing_ =
false;
142 bool correct_freq_smearing_ =
false;
143 Operation operation_;
144 std::string output_data_name_;
145 bool apply_beam_ =
false;
146 std::string coefficients_path_;
147 bool use_channel_freq_ =
false;
148 bool one_beam_per_patch_ =
false;
149 bool thread_over_baselines_ =
false;
153 double beam_proximity_limit_ = 0.0;
154 double beam_evaluation_interval_ = 0.0;
155 double previous_beam_time_ = 0.0;
156 bool stokes_i_only_ =
false;
157 bool any_orientation_is_absolute_ =
false;
159 base::Direction phase_ref_;
160 bool moving_phase_ref_ =
false;
162 std::shared_ptr<ApplyCal> apply_cal_step_;
163 std::shared_ptr<ResultStep> result_step_;
165 unsigned int debug_level_ = 0;
167 std::vector<double> scaled_ncp_uvw_;
169 std::vector<std::pair<size_t, size_t>> baselines_;
172 std::vector<int> uvw_split_index_;
175 xt::xtensor<double, 2> station_uvw_;
178 everybeam::BeamMode beam_mode_ = everybeam::BeamMode::kNone;
179 everybeam::ElementResponseModel element_response_model_ =
180 everybeam::ElementResponseModel::kDefault;
181 casacore::MeasFrame meas_frame_;
182 casacore::MDirection::Convert meas_converter_;
183 std::shared_ptr<everybeam::telescope::Telescope> telescope_;
184 predict::PredictPlan predict_plan_;
185 predict::Predict predict_;
186 std::unique_ptr<predict::PredictPlanExecCPU> predict_plan_exec_;
188 std::string direction_str_;
189 std::vector<std::shared_ptr<model::Patch>> patch_list_;
191 std::vector<std::pair<std::shared_ptr<base::ModelComponent>,
192 std::shared_ptr<model::Patch>>>
208 std::atomic<int64_t> predict_time_ = 0;
210 std::mutex* measures_mutex_;
DP3 step class to apply multiple calibration solutions.
Buffer holding the data of a timeslot/band.
aocommon::xt::UTensor< std::complex< float >, 3 > DataType
Definition: DPBuffer.h:95
dp3::common::Fields GetChainRequiredFields(std::shared_ptr< steps::Step > first_step)
BaseTimer< std::chrono::steady_clock > NSTimer
Definition: Timer.h:129
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53