Exposing vector of strings for loading parameters (#147)

This commit is contained in:
Erik Fröjdh
2020-08-27 16:17:56 +02:00
committed by GitHub
parent a1e06ca7a9
commit 7eafceb0f9
4 changed files with 29 additions and 20 deletions

View File

@@ -119,9 +119,10 @@ class Detector(CppDetectorApi):
return NotImplementedError("parameters is set only")
@parameters.setter
def parameters(self, fname):
fname = ut.make_string_path(fname)
self.loadParameters(fname)
def parameters(self, value):
if isinstance(value, str):
value = ut.make_string_path(value)
self.loadParameters(value)
@property
def hostname(self):

View File

@@ -36,6 +36,10 @@ void init_det(py::module &m) {
(void (Detector::*)(const std::string &)) &
Detector::loadParameters,
py::arg())
.def("loadParameters",
(void (Detector::*)(const std::vector<std::string> &)) &
Detector::loadParameters,
py::arg())
.def("getHostname",
(Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getHostname,