Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsanchez committed Mar 8, 2018
1 parent 90dbeb2 commit 96d6d3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion enrico/fitmaker.py
Expand Up @@ -105,7 +105,7 @@ def CreateLikeObject(self):
Fit = UnbinnedAnalysis(Obs, self.obs.xmlfile,
optimizer=self.config['fitting']['optimizer'])

if float(self.config['Spectrum']['FrozenSpectralIndex'] and self.config['target']['spectrum']) == "PowerLaw":
if float(self.config['Spectrum']['FrozenSpectralIndex']>0) and self.config['target']['spectrum'] == "PowerLaw":
parameters = dict()
parameters['Index'] = -float(self.config['Spectrum']['FrozenSpectralIndex'])
# parameters['alpha'] = +float(self.config['Spectrum']['FrozenSpectralIndex'])
Expand Down
10 changes: 6 additions & 4 deletions enrico/tsmap.py
Expand Up @@ -75,15 +75,17 @@ def FitOnePixel(self,ra,dec,i,j) :
src = GetSrc(Fit,ra,dec) # get the Source object at postion ra dec

if self.config['TSMap']['RemoveTarget'] : # remove the target is asked
Fit.deleteSource(self.config['target']['name'])
for comp in Fit.components:
comp.deleteSource(self.config['target']['name'])

if self.config['TSMap']['Re-Fit']: # reoptimze before is asked
Fit.fit(0,optimizer=self.config['fitting']['optimizer'])

for par in xrange(Fit.logLike.getNumParams()): # freeze all the source parameters
Fit[par].setFree(0)
for comp in Fit.components:
for par in xrange(comp.logLike.getNumParams()): # freeze all the source parameters
comp[par].setFree(0)
comp.addSource(src)# add a spurious source

Fit.addSource(src)# add a spurious source
# dump the *new* xml file
Fit.writeXml(self.tsfolder+"/model_"+str(ra)+"_"+str(dec)+".xml")

Expand Down

0 comments on commit 96d6d3d

Please sign in to comment.