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 284 if iter == 0:
285 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 292 # Fit model
295 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 300 # Compute logL difference
298 301 if iter > 0:
299 302 delta = logL - self.opt().value()
... ... @@ -334,9 +337,6 @@ class comlixfit(ctools.cslikelihood):
334 337 # value are used for final model fitting.
335 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 340 # Do final model fit
341 341 self._final_model_fit()
342 342  
... ...