Skip to content

Commit

Permalink
ignore warnings in pyhf
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Oct 31, 2024
1 parent a1be7bc commit 625a6b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions smodels/statistics/pyhfInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ def lmax( self, workspace_index=None, return_nll=False, expected=False,
else:
sigma_mu_temp = 1.
try:
warnings.filterwarnings( "ignore", category=RuntimeWarning )
_1, _2, o = pyhf.infer.mle.fit(workspace.data(model), model,
return_fitted_val=True, return_result_obj = True, init_pars = list(muhat), method="BFGS" )
sigma_mu_temp = float ( np.sqrt ( o.hess_inv[model.config.poi_index][model.config.poi_index] ) )
Expand All @@ -913,6 +914,7 @@ def lmax( self, workspace_index=None, return_nll=False, expected=False,
if abs ( sigma_mu_temp - 1.0 ) > 1e-5:
sigma_mu = sigma_mu_temp * self.scale
else:
warnings.filterwarnings( "ignore", category=RuntimeWarning )
_, _, o = pyhf.infer.mle.fit(workspace.data(model), model,
return_fitted_val=True, return_result_obj = True, method="L-BFGS-B" )
sigma_mu_temp = float ( np.sqrt ( o.hess_inv.todense()[model.config.poi_index][model.config.poi_index] ) )
Expand Down

0 comments on commit 625a6b4

Please sign in to comment.