HOPS
HOPS class reference
MHO_FringePass.hh
Go to the documentation of this file.
1 #ifndef MHO_FringePass_HH__
2 #define MHO_FringePass_HH__
3 
4 #include <functional>
5 #include <memory>
6 #include <string>
7 #include <vector>
8 
9 #include "MHO_Profiler.hh"
10 
12 #include "MHO_FringeData.hh"
14 #include "MHO_FringeFitter.hh"
16 #include "MHO_FringePlotVisitor.hh"
17 #include "MHO_ParameterStore.hh"
18 
19 namespace hops
20 {
21 
57 {
58  public:
64  using ControlEvaluatorFn = std::function< bool(MHO_ParameterStore*, const mho_json&, mho_json&) >;
65 
67  virtual ~MHO_FringePass() = default;
68 
69  // -----------------------------------------------------------------------
70  // Input setters
71  // Call these before Initialize().
72  // -----------------------------------------------------------------------
73 
79  void CopyCommandLineParams(const MHO_ParameterStore& cmdline_params);
80 
81  void SetScanDirectory(const std::string& dir);
82  void SetBaseline(const std::string& baseline);
83  void SetPolProduct(const std::string& polprod);
84  void SetFrequencyGroup(const std::string& fgroup);
85  void SetScanName(const std::string& scan);
86  void SetRootFile(const std::string& root_file);
87  void SetBuildTimestamp(const std::string& ts);
88 
93  void SetControlFile(const std::string& path);
94 
101 
102  // -----------------------------------------------------------------------
103  // Lifecycle
104  // -----------------------------------------------------------------------
105 
111  bool Initialize();
112 
119  bool Configure();
120 
134  bool Run(const std::vector< MHO_FringeFitterVisitor* >& plugin_visitors = {},
135  const std::vector< MHO_FringeFitterVisitor* >& output_visitors = {},
136  const std::vector< MHO_FringePlotVisitor* >& plot_visitors = {});
137 
138  // -----------------------------------------------------------------------
139  // Status and results
140  // -----------------------------------------------------------------------
141 
142  bool IsSkipped();
143 
148  void FlushProfileEvents();
149 
150  MHO_FringeData* GetFringeData() { return &fData; }
151 
152  private:
153  MHO_FringeData fData;
154  std::unique_ptr< MHO_FringeFitterFactory > fFactory; // owns the fitter
155 
156  std::string fControlFileOverride; // empty -> use /cmdline/control_file
157  ControlEvaluatorFn fPythonEvaluator;
158 };
159 
160 } // namespace hops
161 
162 #endif
nlohmann::json mho_json
Definition: MHO_JSONHeaderWrapper.hh:5
Class MHO_FringeData.
Definition: MHO_FringeData.hh:30
Encapsulates a single-baseline, single-pol-product fringe-fitting pass/run.
Definition: MHO_FringePass.hh:57
void FlushProfileEvents()
Collect profiler events and store them at /profile/events in the pass parameter store....
Definition: MHO_FringePass.cc:218
bool Initialize()
Open the scan directory, load vex data, and populate the parameter store.
Definition: MHO_FringePass.cc:78
void CopyCommandLineParams(const MHO_ParameterStore &cmdline_params)
Bulk-copy a command-line parameter store. Populates the /cmdline/* keys consumed by downstream helper...
Definition: MHO_FringePass.cc:24
bool Configure()
Evaluate the control file and apply the resulting statements. Detects .py vs DSL extension automatica...
Definition: MHO_FringePass.cc:99
void SetFrequencyGroup(const std::string &fgroup)
Definition: MHO_FringePass.cc:44
void SetPolProduct(const std::string &polprod)
Definition: MHO_FringePass.cc:39
std::function< bool(MHO_ParameterStore *, const mho_json &, mho_json &) > ControlEvaluatorFn
Signature of a Python control-file evaluator, matching MHO_PyControlEvaluator::Evaluate....
Definition: MHO_FringePass.hh:64
void SetScanDirectory(const std::string &dir)
Definition: MHO_FringePass.cc:29
void SetRootFile(const std::string &root_file)
Definition: MHO_FringePass.cc:54
MHO_FringePass()
Definition: MHO_FringePass.cc:17
MHO_FringeData * GetFringeData()
Definition: MHO_FringePass.hh:150
void SetBuildTimestamp(const std::string &ts)
Definition: MHO_FringePass.cc:59
bool IsSkipped()
Definition: MHO_FringePass.cc:211
void SetBaseline(const std::string &baseline)
Definition: MHO_FringePass.cc:34
void SetScanName(const std::string &scan)
Definition: MHO_FringePass.cc:49
void SetPythonControlEvaluator(ControlEvaluatorFn fn)
Inject a Python control evaluator so that MHO_Fringe itself does not need to link against pybind11....
Definition: MHO_FringePass.cc:69
bool Run(const std::vector< MHO_FringeFitterVisitor * > &plugin_visitors={}, const std::vector< MHO_FringeFitterVisitor * > &output_visitors={}, const std::vector< MHO_FringePlotVisitor * > &plot_visitors={})
Construct the fringe fitter, register plugin visitors, run the fit loop, finalize,...
Definition: MHO_FringePass.cc:149
void SetControlFile(const std::string &path)
Override the control-file path. If not set, the path from /cmdline/control_file (populated by CopyCom...
Definition: MHO_FringePass.cc:64
virtual ~MHO_FringePass()=default
Class MHO_ParameterStore.
Definition: MHO_ParameterStore.hh:52
int baseline
Definition: fourfit3.c:62
Definition: MHO_AdhocFlagging.hh:18
Definition: vex.h:103