9 #ifndef DP3_STEPS_ONEPREDICT_H_
10 #define DP3_STEPS_ONEPREDICT_H_
14 #include <xtensor/containers/xtensor.hpp>
48 const std::vector<std::string>& source_patterns);
54 if (operation_ == Operation::kAdd || operation_ == Operation::kSubtract) {
57 if (apply_cal_step_) {
69 if (output_data_name_.empty()) {
76 if (operation_ == Operation::kReplace && apply_cal_step_) {
77 std::shared_ptr<Step> step = apply_cal_step_;
79 fields |= step->getProvidedFields();
80 step = step->getNextStep();
98 measures_mutex_ = measures_mutex;
104 bool process(std::unique_ptr<base::DPBuffer>)
override;
113 void show(std::ostream&)
const override;
119 void setSources(
const std::vector<std::string>& sourcePatterns);
125 enum class Operation { kReplace, kAdd, kSubtract };
129 const std::vector<std::string>& sourcePatterns);
131 void initializeThreadData();
132 everybeam::vector3r_t dir2Itrf(
const casacore::MDirection& dir,
133 casacore::MDirection::Convert& measConverter);
135 void addBeamToData(
const model::Patch& patch,
size_t buffer_index,
136 aocommon::xt::UTensor<std::complex<double>, 3>& model_data,
137 double time,
bool update_beam,
size_t thread,
138 aocommon::xt::UTensor<std::complex<double>, 3>& data0,
141 void addBeamToDataRange(
143 aocommon::xt::UTensor<std::complex<double>, 3>& model_data,
double time,
144 size_t thread, aocommon::xt::UTensor<std::complex<double>, 3>& data0,
145 const std::pair<size_t, size_t>& baseline_range,
146 const std::pair<size_t, size_t>& station_range, std::barrier<>& barrier,
151 void PredictSourceRange(
152 aocommon::xt::UTensor<std::complex<double>, 3>& result,
size_t start,
153 size_t end,
size_t thread_index, std::mutex& mutex,
double time,
158 void CopyPredictBufferToData(
160 const aocommon::xt::UTensor<std::complex<double>, 3>& buffer);
166 xt::xtensor<std::complex<float>, 3> input_data_;
167 std::string source_db_name_;
168 bool correct_time_smearing_ =
false;
169 bool correct_freq_smearing_ =
false;
170 Operation operation_;
171 std::string output_data_name_;
172 bool apply_beam_ =
false;
173 std::string coefficients_path_;
174 bool use_channel_freq_ =
false;
175 bool one_beam_per_patch_ =
false;
176 bool thread_over_baselines_ =
false;
180 double beam_proximity_limit_ = 0.0;
181 double beam_evaluation_interval_ = 0.0;
182 double previous_beam_time_ = 0.0;
183 bool stokes_i_only_ =
false;
184 bool any_orientation_is_absolute_ =
false;
187 bool moving_phase_ref_ =
false;
189 std::shared_ptr<ApplyCal> apply_cal_step_;
190 std::shared_ptr<ResultStep> result_step_;
192 unsigned int debug_level_ = 0;
194 std::vector<double> scaled_ncp_uvw_;
196 std::vector<std::pair<size_t, size_t>> baselines_;
199 std::vector<int> uvw_split_index_;
202 xt::xtensor<double, 2> station_uvw_;
205 std::shared_ptr<std::vector<base::PredictBuffer>> predict_buffers_;
206 everybeam::BeamMode beam_mode_ = everybeam::BeamMode::kNone;
207 everybeam::ElementResponseModel element_response_model_ =
208 everybeam::ElementResponseModel::kDefault;
209 std::vector<casacore::MeasFrame> meas_frame_;
210 std::vector<casacore::MDirection::Convert> meas_convertors_;
211 std::shared_ptr<everybeam::telescope::Telescope> telescope_;
213 std::string direction_str_;
214 std::vector<std::shared_ptr<model::Patch>> patch_list_;
216 std::vector<std::pair<std::shared_ptr<base::ModelComponent>,
217 std::shared_ptr<model::Patch>>>
233 std::atomic<int64_t> predict_time_ = 0;
239 std::atomic<int64_t> apply_beam_time_ = 0;
241 std::mutex* measures_mutex_;
DP3 step class to apply the beam model (optionally inverted)
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
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
A set of sources for which direction dependent effects are assumed to be equal.
Definition: Patch.h:19
Common interface for steps that produce model data.
Definition: Step.h:172
Step class that predicts visibilities with optionally beam. The Predict class uses one or more instan...
Definition: OnePredict.h:39
void finish() override
Finish the processing of this step and subsequent steps.
void SetOperation(const std::string &type)
Set the operation type.
common::Fields getRequiredFields() const override
Get the fields required by the current step.
Definition: OnePredict.h:52
void show(std::ostream &) const override
Show the step parameters.
void SetThreadData(std::mutex *measures_mutex)
Definition: OnePredict.h:97
bool process(std::unique_ptr< base::DPBuffer >) override
void showTimings(std::ostream &, double duration) const override
Show the timings.
OnePredict(const common::ParameterSet &, const std::string &prefix, const std::vector< std::string > &source_patterns)
common::Fields getProvidedFields() const override
Definition: OnePredict.h:63
void setSources(const std::vector< std::string > &sourcePatterns)
Prepare the sources.
base::Direction GetFirstDirection() const override
Return the direction of the first patch.
void SetApplyCal(const common::ParameterSet &, const std::string &prefix)
Set the ApplyCal substep and connect it to a ResultStep.
void updateInfo(const base::DPInfo &) override
Update the general info.
static constexpr dp3::common::Fields kUvwField
Definition: Step.h:66
static constexpr dp3::common::Fields kDataField
Definition: Step.h:60
dp3::common::Fields GetChainRequiredFields(std::shared_ptr< steps::Step > first_step)
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53
A direction on the celestial sphere.
Definition: Direction.h:15