Skip to content

Commit db5c3d5

Browse files
committed
Scipy: printing python error when minimization fails
1 parent 29226d4 commit db5c3d5

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

math/scipy/inc/Math/ScipyMinimizer.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ class ScipyMinimizer : public BasicMinimizer {
119119
void SetAlgoExtraOptions();
120120

121121
public:
122-
/// set the function to minimize
123-
// virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func);
124-
125-
/// set the function to minimize
126-
// virtual void SetFunction(const ROOT::Math::IMultiGradFunction &func) { BasicMinimizer::SetFunction(func); }
127122

128123
/// method to perform the minimization
129124
virtual bool Minimize() override;

math/scipy/src/ScipyMinimizer.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ ScipyMinimizer::ScipyMinimizer(const char *type)
7373
void ScipyMinimizer::SetAlgoExtraOptions()
7474
{
7575
std::string type = fOptions.MinimizerAlgorithm();
76-
if (type == "L-BFGS-B") {
77-
fExtraOpts.SetValue("gtol", 1e-8);
78-
fExtraOpts.SetValue("eps", 0.01);
79-
}
8076
SetExtraOptions(fExtraOpts);
8177
}
8278

@@ -197,6 +193,11 @@ bool ScipyMinimizer::Minimize()
197193

198194
//PyPrint(kw);
199195
PyObject *result = PyObject_Call(fMinimize, args, kw);
196+
if(result == NULL)
197+
{
198+
PyErr_Print();
199+
return false;
200+
}
200201
//PyPrint(result);
201202
Py_DECREF(args);
202203
Py_DECREF(kw);

0 commit comments

Comments
 (0)