DP3
ScaleData.h
Go to the documentation of this file.
1 // ScaleData.h: DPPP step class for freq-dependent scaling of the data
2 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 
8 
9 #ifndef DPPP_SCALEDATA_H
10 #define DPPP_SCALEDATA_H
11 
12 #include "InputStep.h"
13 
14 #include <xtensor/containers/xtensor.hpp>
15 
16 #include "base/DPBuffer.h"
17 #include "base/BdaBuffer.h"
18 
19 #include <casacore/casa/Arrays/Cube.h>
20 
21 namespace dp3 {
22 namespace common {
23 class ParameterSet;
24 }
25 
26 namespace steps {
28 
43 
44 class ScaleData : public Step {
45  public:
48  ScaleData(const common::ParameterSet&, const std::string& prefix,
49  MsType input_type);
50 
51  ~ScaleData() override;
52 
53  common::Fields getRequiredFields() const override { return kDataField; }
54 
55  common::Fields getProvidedFields() const override { return kDataField; }
56 
60  bool process(std::unique_ptr<base::DPBuffer>) override;
61 
65  bool process(std::unique_ptr<base::BdaBuffer>) override;
66 
68  void finish() override;
69 
71  void updateInfo(const base::DPInfo&) override;
72 
74  void show(std::ostream&) const override;
75 
77  void showTimings(std::ostream&, double duration) const override;
78 
79  bool accepts(MsType dt) const override { return dt == itsInputType; }
80 
81  MsType outputs() const override { return itsInputType; }
82 
83  private:
85  void fillSizeScaleFactors(unsigned int nNominal, std::vector<float>& fact);
86 
87  std::string itsName;
88  const MsType itsInputType;
89  bool itsScaleSizeGiven;
90  bool itsScaleSize;
91  std::vector<std::string> itsStationExp;
92  std::vector<std::string> itsCoeffStr;
93  std::vector<std::vector<float>>
94  itsStationFactors;
95  xt::xtensor<float, 3> itsFactors;
96  common::NSTimer itsTimer;
97 };
98 
99 } // namespace steps
100 } // namespace dp3
101 
102 #endif
Buffer holding baseline-dependently averaged (BDA) data.
Buffer holding the data of a timeslot/band.
Abstract base class for a Step generating input.
General info about DP3 data processing attributes like averaging.
Definition: DPInfo.h:35
Definition: Fields.h:16
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
DPPP step class for freq-dependent scaling of the data.
Definition: ScaleData.h:44
void updateInfo(const base::DPInfo &) override
Update the general info.
common::Fields getProvidedFields() const override
Definition: ScaleData.h:55
void finish() override
Finish the processing of this step and subsequent steps.
MsType outputs() const override
Return which datatype this step outputs.
Definition: ScaleData.h:81
bool process(std::unique_ptr< base::DPBuffer >) override
ScaleData(const common::ParameterSet &, const std::string &prefix, MsType input_type)
void show(std::ostream &) const override
Show the step parameters.
bool accepts(MsType dt) const override
Boolean if this step can process this type of data.
Definition: ScaleData.h:79
bool process(std::unique_ptr< base::BdaBuffer >) override
common::Fields getRequiredFields() const override
Get the fields required by the current step.
Definition: ScaleData.h:53
void showTimings(std::ostream &, double duration) const override
Show the timings.
Abstract base class for a DP3 step.
Definition: Step.h:52
MsType
To check compatibility between steps before running.
Definition: Step.h:57
static constexpr dp3::common::Fields kDataField
Definition: Step.h:60
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53