Access to parameter names and fast erf approx (#298)
Build on RHEL8 / build (push) Successful in 2m44s
Build on RHEL9 / build (push) Successful in 3m3s
Run tests using data on local RHEL8 / build (push) Successful in 3m39s
Build on local RHEL8 / build (push) Successful in 2m23s

- Set parameter starting values, limits or fix through name as well as
index
- Updated parameter names for the scurve
- Fast approximation to erf function (~10% speedup of fitting)

---------

Co-authored-by: Khalil Ferjaoui <khalilferjaoui@yahoo.fr>
This commit is contained in:
Erik Fröjdh
2026-04-02 13:33:37 +02:00
committed by GitHub
parent a6afa45b3b
commit a25f5d2344
4 changed files with 126 additions and 51 deletions
+12 -4
View File
@@ -31,10 +31,18 @@ void bind_fit_model(py::module& m, const char* name) {
py::arg("max_calls") = 100,
py::arg("tolerance") = 0.5,
py::arg("compute_errors") = false)
.def("SetParLimits", &FM::SetParLimits, py::arg("idx"), py::arg("lo"), py::arg("hi"))
.def("FixParameter", &FM::FixParameter, py::arg("idx"), py::arg("val"))
.def("ReleaseParameter", &FM::ReleaseParameter, py::arg("idx"))
.def("SetParameter", &FM::SetParameter, py::arg("idx"), py::arg("val"))
.def("SetParLimits", py::overload_cast<unsigned int, double, double>(&FM::SetParLimits), py::arg("idx"), py::arg("lo"), py::arg("hi"))
.def("SetParLimits", py::overload_cast<const std::string&, double, double>(&FM::SetParLimits), py::arg("idx"), py::arg("lo"), py::arg("hi"))
.def("FixParameter", py::overload_cast<unsigned int, double>(&FM::FixParameter), py::arg("idx"), py::arg("val"))
.def("FixParameter", py::overload_cast<const std::string&, double>(&FM::FixParameter), py::arg("idx"), py::arg("val"))
.def("ReleaseParameter", py::overload_cast<unsigned int>(&FM::ReleaseParameter), py::arg("idx"))
.def("ReleaseParameter", py::overload_cast<const std::string&>(&FM::ReleaseParameter), py::arg("idx"))
.def("SetParameter", py::overload_cast<unsigned int, double>(&FM::SetParameter), py::arg("idx"), py::arg("val"))
.def("SetParameter", py::overload_cast<const std::string&, double>(&FM::SetParameter), py::arg("idx"), py::arg("val"))
.def("GetParName", &FM::GetParName, py::arg("idx"))
.def("GetParNames", &FM::GetParNames)
.def_property_readonly("par_names", &FM::GetParNames)
.def_property_readonly("n_par", [](py::object /*cls*/) { return Model::npar; })
.def_property("max_calls", &FM::max_calls, &FM::SetMaxCalls)
.def_property("tolerance", &FM::tolerance, &FM::SetTolerance)
.def_property("compute_errors", &FM::compute_errors, &FM::SetComputeErrors)