1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 10:18:50 -05:00

Merge pull request #87 from hrosiak/py

repr
This commit is contained in:
Andrej Prochazka 2021-06-20 12:29:06 +02:00 committed by GitHub
commit dd1289e934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,10 @@ PYBIND11_MODULE(pycatima,m){
.def_readwrite("sigma_x", &Result::sigma_x)
.def_readwrite("tof", &Result::tof)
.def_readwrite("sp", &Result::sp)
.def("get_dict",&get_result_dict);
.def("get_dict",&get_result_dict)
.def("__repr__",[](const Result &self){
return py::str(get_result_dict(self));
});
py::class_<MultiResult>(m,"MultiResult")
.def(py::init<>(),"constructor")
@ -211,7 +214,17 @@ PYBIND11_MODULE(pycatima,m){
}
d["partial"] = p;
return d;
});
})
.def("__repr__",[](const MultiResult &r){
py::dict d;
py::list p;
d["result"] = get_result_dict(r.total_result);
for(auto& entry:r.results){
p.append(get_result_dict(entry));
}
d["partial"] = p;
return py::str(d);
});
py::enum_<z_eff_type>(m,"z_eff_type")
.value("none", z_eff_type::none)