Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to reuse livetime cubes #83

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions enrico/fitmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class FitMaker(Loggin.Message):
"""Collection of functions to prepare/run the GTLIKE fit
and compute an upper limit is needed"""
and compute an upper limit if needed"""
def __init__(self, obs, config):
super(FitMaker,self).__init__()
Loggin.Message.__init__(self)
Expand All @@ -42,7 +42,7 @@ def GenerateFits(self):
"""Run the different ST tools and compute the fits files
First it runs the tools that are common to the binned
and unbinned analysis chain then it run the specific
tools following the choise of the user"""
tools following the choice of the user"""

#Run the tools common to binned and unbinned chain
self._log('gtselect', 'Select data from library')#run gtselect
Expand All @@ -54,8 +54,19 @@ def GenerateFits(self):
self.obs.DiffResps()#run gtdiffresp
self._log('gtbin', 'Create a count map')
self.obs.Gtbin()
self._log('gtltcube', 'Make live time cube')#run gtexpcube
self.obs.ExpCube()
# Produces ltcube depending on whether the variable below is empty
# otherwise uses the one provided in the string (i.e. gtltcube
# will not even be called)
if self.config['file']['ltcube'] == "":
self._log('gtltcube', 'Make live time cube')#run gtexpcube
self.obs.ExpCube()
else:
self._log('gtltcube', 'Make live time cube')
print "Skipping creation of live time cube: it was generated before"
print self.config['file']['ltcube']




#Choose between the binned of the unbinned analysis
if self.config['analysis']['likelihood'] == 'binned': #binned analysis chain
Expand Down
12 changes: 8 additions & 4 deletions enrico/gtfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
class Observation:
# init function of the Observation class.
# folder : folder where the produced fits files will be stored.
# configuration is the confi of enrico (contains the variable)
# configuration is the config of enrico (contains the variables)

def __init__(self,folder,Configuration,tag=""):

#Read the configuration object and init all the variable
#Read the configuration object and init all variables
self.Configuration = Configuration
inttag = "_"+Configuration['file']['tag']
if not(tag==""):
Expand All @@ -32,7 +32,11 @@ def __init__(self,folder,Configuration,tag=""):

#Fits files
self.eventfile = folder+'/'+self.srcname+inttag+"_Evt.fits"
self.Cubename = folder+'/'+self.srcname+inttag+"_ltCube.fits"
if Configuration['file']['ltcube'] == "":
self.Cubename = folder+'/'+self.srcname+inttag+"_ltCube.fits"
else:
self.Cubename = Configuration['file']['ltcube']

self.Mapname = folder+'/'+self.srcname+inttag+"_ExpMap.fits"
self.BinnedMapfile = folder+'/'+self.srcname+inttag+"_BinnedMap.fits"
self.cmapfile = folder+'/'+self.srcname+inttag+"_CountMap.fits"
Expand Down Expand Up @@ -279,7 +283,7 @@ def ExpCube(self):
expCube['zmax']=self.Configuration['analysis']['zmax']
expCube['phibins']=self.Configuration['space']['phibins']
expCube['clobber'] = self.clobber
expCube.run()
expCube.run()

def ExpMap(self):
"Run gtexpmap for unbinned analysis"
Expand Down