Skip to content
Snippets Groups Projects
Commit fd1b9641 authored by Alexander Heidelbach's avatar Alexander Heidelbach
Browse files

Correct shuffling and add fit result to hepstats objects

parent ca944569
Branches
No related tags found
No related merge requests found
......@@ -130,12 +130,11 @@ class BaseFitter(ABC):
def _randomize_parameters(self, model: Model) -> None:
for param in model.parameters.values():
modelparameter = model.get_modelparameter(param.name)
if modelparameter.floating and param.shuffle:
if param.floating and param.shuffle:
modelparameter.randomize(
minval=param.lower, maxval=param.upper, sampler=np.random.uniform
)
elif modelparameter.floating and param.shuffle and param.extended:
elif param.floating and param.shuffle and param.extended:
modelparameter.set_value(param.value)
def _single_fit(self) -> None:
......@@ -158,8 +157,8 @@ class BaseFitter(ABC):
nll = result_global.loss
minimizer_local = self.minimizer
result = minimizer_local.minimize(nll).update_params()
result = minimizer_local.minimize(nll)
result = result.update_params()
# calculate errors
result.errors()
try:
......@@ -229,6 +228,7 @@ class BaseFitter(ABC):
calculator = self.get_calculator(
calculator=calculator, calculator_kwargs=calculator_kwargs
)
calculator.bestfit = self.zfitresult
poinull = POIarray(parameter, parameter_range)
discovery_test = Discovery(calculator, poinull)
pnull, significance = discovery_test.result()
......@@ -250,6 +250,7 @@ class BaseFitter(ABC):
calculator = self.get_calculator(
calculator=calculator, calculator_kwargs=calculator_kwargs
)
calculator.bestfit = self.zfitresult
poinull = POIarray(parameter, parameter_range)
poialt = POI(parameter, alt_value)
ul = UpperLimit(calculator, poinull, poialt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment