Commit ab3392f497707fa98874b2cf9ff9a970b9e66326

Authored by Jürgen Knödlseder
1 parent 535ced03

Once more trying to fix problem with fixing and not freeing extended sources in first iteration

modules/comscripts/comlixfit.py
@@ -284,16 +284,19 @@ class comlixfit(ctools.cslikelihood): @@ -284,16 +284,19 @@ class comlixfit(ctools.cslikelihood):
284 if iter == 0: 284 if iter == 0:
285 best_obs = self.obs().copy() 285 best_obs = self.obs().copy()
286 286
287 - # Optionally fix or free fixed spatial extension parameters  
288 - if self['fix_ext_for_initial'].boolean():  
289 - if iter == 0:  
290 - self._fix_ext_pars()  
291 - else:  
292 - self._free_fixed_ext_pars() 287 + # Optionally fix spatial extension parameters for first
  288 + # iteration
  289 + if iter == 0 and self['fix_ext_for_initial'].boolean():
  290 + self._fix_ext_pars()
293 291
294 # Fit model 292 # Fit model
295 self.obs().optimize(self.opt()) 293 self.obs().optimize(self.opt())
296 294
  295 + # Optionally free fixed spatial extension parameters for first
  296 + # iteration
  297 + if iter == 0 and self['fix_ext_for_initial'].boolean():
  298 + self._free_fixed_ext_pars()
  299 +
297 # Compute logL difference 300 # Compute logL difference
298 if iter > 0: 301 if iter > 0:
299 delta = logL - self.opt().value() 302 delta = logL - self.opt().value()
@@ -334,9 +337,6 @@ class comlixfit(ctools.cslikelihood): @@ -334,9 +337,6 @@ class comlixfit(ctools.cslikelihood):
334 # value are used for final model fitting. 337 # value are used for final model fitting.
335 self.obs(best_obs) 338 self.obs(best_obs)
336 339
337 - # Make sure that any fixed extension parameter is free'd  
338 - self._free_fixed_ext_pars()  
339 -  
340 # Do final model fit 340 # Do final model fit
341 self._final_model_fit() 341 self._final_model_fit()
342 342