HOPS
HOPS class reference
MHO_PyFringeDataInterface.hh
Go to the documentation of this file.
1 #ifndef MHO_PyFringeDataInterface_HH__
2 #define MHO_PyFringeDataInterface_HH__
3 
6 #include "MHO_ContainerStore.hh"
7 #include "MHO_FringeData.hh"
8 
12 #include "MHO_PyTableContainer.hh"
13 
14 //need these extras to be able to translate between nl:json and py:dict or py::object
15 #include "pybind11_json/pybind11_json.hpp"
16 #include <pybind11/embed.h>
17 #include <pybind11/pybind11.h>
18 namespace py = pybind11;
19 namespace nl = nlohmann;
20 using namespace pybind11::literals;
21 
22 namespace hops
23 {
24 
34 {
35  public:
37  : fFringeData(fdata), fScanInterface(fdata->GetScanDataStore()), fContainerInterface(fdata->GetContainerStore()),
38  fParameterInterface(fdata->GetParameterStore()){
39 
40  };
41 
43 
44  MHO_PyParameterStoreInterface& GetParameterStore() { return fParameterInterface; }
45 
46  MHO_PyContainerStoreInterface& GetContainerStore() { return fContainerInterface; }
47 
48  MHO_PyScanStoreInterface& GetScanStore() { return fScanInterface; }
49 
50  //return copy of vex data converted to py::dict
51  py::dict GetVex() const { return fFringeData->GetVex(); }
52 
53  py::dict GetPlotData() const { return fFringeData->GetPlotData(); }
54 
55  //for now we do not expose these to python
56  //access to the control format and parsed control statements as py::dict
57  // py::dict GetControlFormat() const {return fFringeData->GetControlFormat();}
58  // py::dict GetControlStatements() const {return fFringeData->GetControlStatements();}
59 
60  private:
61  MHO_FringeData* fFringeData;
62 
63  //pointer to the parameter store
64  MHO_PyScanStoreInterface fScanInterface;
65  MHO_PyContainerStoreInterface fContainerInterface;
66  MHO_PyParameterStoreInterface fParameterInterface;
67 };
68 
69 inline void DeclarePyFringeDataInterface(py::module& m, std::string pyclass_name)
70 {
71  py::class_< MHO_PyFringeDataInterface >(m, pyclass_name.c_str())
72  //no __init__ def here, as this class is not meant to be constructable on the python side
73  .def("get_parameter_store", &hops::MHO_PyFringeDataInterface::GetParameterStore, py::return_value_policy::reference,
74  "get the current parameter set object")
75  .def("get_container_store", &hops::MHO_PyFringeDataInterface::GetContainerStore, py::return_value_policy::reference,
76  "get the current container store object")
77  .def("get_scan_store", &hops::MHO_PyFringeDataInterface::GetScanStore, py::return_value_policy::reference,
78  "get the current scan data store object")
79  .def("get_vex", &hops::MHO_PyFringeDataInterface::GetVex, py::return_value_policy::copy,
80  "get the current scan ovex/root data as a python dictionary")
81  .def("get_plot_data", &hops::MHO_PyFringeDataInterface::GetPlotData, py::return_value_policy::copy,
82  "get the current plot data as a python dictionary");
83 }
84 
85 } // namespace hops
86 
87 #endif
Class MHO_FringeData.
Definition: MHO_FringeData.hh:30
python binding to the MHO_ContainerStore
Definition: MHO_PyContainerStoreInterface.hh:30
python bindings for the MHO_FringeData class
Definition: MHO_PyFringeDataInterface.hh:34
MHO_PyScanStoreInterface & GetScanStore()
Definition: MHO_PyFringeDataInterface.hh:48
MHO_PyParameterStoreInterface & GetParameterStore()
Definition: MHO_PyFringeDataInterface.hh:44
py::dict GetVex() const
Definition: MHO_PyFringeDataInterface.hh:51
MHO_PyFringeDataInterface(MHO_FringeData *fdata)
Definition: MHO_PyFringeDataInterface.hh:36
MHO_PyContainerStoreInterface & GetContainerStore()
Definition: MHO_PyFringeDataInterface.hh:46
py::dict GetPlotData() const
Definition: MHO_PyFringeDataInterface.hh:53
virtual ~MHO_PyFringeDataInterface()
Definition: MHO_PyFringeDataInterface.hh:42
python bindings for the MHO_ParameterStore
Definition: MHO_PyParameterStoreInterface.hh:26
python bindings for the MHO_ScanDataStore
Definition: MHO_PyScanStoreInterface.hh:31
Definition: MHO_ChannelLabeler.hh:17
void DeclarePyFringeDataInterface(py::module &m, std::string pyclass_name)
Definition: MHO_PyFringeDataInterface.hh:69