Esempio n. 1
0
 def ExpMap(self):
     "Run gtexpmap for unbinned analysis"
     if (self.clobber == "no" and os.path.isfile(self.Mapname)):
         #print("File exists and clobber is False")
         return (0)
     Nbdecade = log10(self.Emax) - log10(
         self.Emin)  #Compute the number of decade
     expMap['evfile'] = self.mktimefile
     expMap['scfile'] = self.ft2
     expMap['expcube'] = self.Cubename
     expMap['outfile'] = self.Mapname
     if self.irfs != 'CALDB':
         expMap['evtype'] = self.Configuration['event']['evtype']
     else:
         expMap['evtype'] = 'INDEF'
     expMap['irfs'] = self.irfs
     expMap['evtype'] = self.Configuration['event']['evtype']
     expMap['srcrad'] = self.roi + 10
     #The number of bin is the number of decade * the number of bin per decade (given by the users)
     expMap['nenergies'] = max(
         2,
         int(Nbdecade *
             self.Configuration['energy']['enumbins_per_decade'] + 0.5))
     expMap['clobber'] = self.clobber
     expMap.run()
Esempio n. 2
0
def expmap(square):
    '''This is the atomic function that actually runs in the seperate
    threads.  The input is a python list.  The first element is a list
    of two arrays giving the x and y points.  The second through last
    elements are the scfile, evfile, expcube, nlong, nlat, irfs,
    srcrad and nenergies.  This function creates a temporary file for
    the output and returns that file's name.'''

    print "Starting calculation of region {},{} to {},{}".format(
        square[0][0][0], square[0][1][0], square[0][0][1], square[0][1][1])
    osfilehandle, outfilename = tempfile.mkstemp(suffix=".fits")
    expMap['nlongmin'] = "{:,.0f}".format(float(square[0][0][0]))
    expMap['nlongmax'] = "{:,.0f}".format(float(square[0][0][1]))
    expMap['nlatmin'] = "{:,.0f}".format(float(square[0][1][0]))
    expMap['nlatmax'] = "{:,.0f}".format(float(square[0][1][1]))
    expMap['scfile'] = square[1]
    expMap['evfile'] = square[2]
    expMap['expcube'] = square[3]
    expMap['nlong'] = square[4]
    expMap['nlat'] = square[5]
    expMap['irfs'] = square[6]
    expMap['srcrad'] = square[7]
    expMap['nenergies'] = square[8]
    expMap['outfile'] = outfilename
    expMap['submap'] = "yes"
    expMap['chatter'] = 0
    expMap.run(print_command=False)
    print "Completed calculation of region {},{} to {},{}".format(
        square[0][0][0], square[0][1][0], square[0][0][1], square[0][1][1])

    return outfilename
Esempio n. 3
0
 def ExpMap(self):
     "Run gtexpmap for unbinned analysis"
     Nbdecade = log10(self.Emax)-log10(self.Emin)#Compute the number of decade
     expMap['evfile'] = self.eventfile
     expMap['scfile'] = self.ft2
     expMap['expcube'] = self.Cubename
     expMap['outfile'] = self.Mapname
     expMap['irfs'] = self.irfs
     expMap['srcrad'] = self.roi+10
     #The number of bin is the number of decade * the number of bin per decade (given by the users)
     expMap['nenergies'] =  int(Nbdecade*self.Configuration['energy']['enumbins_per_decade'])
     expMap['clobber'] = self.clobber
     expMap.run() 
Esempio n. 4
0
 def ExpMap(self):
     "Run gtexpmap for unbinned analysis"
     Nbdecade = log10(self.Emax) - log10(
         self.Emin)  #Compute the number of decade
     expMap['evfile'] = self.eventfile
     expMap['scfile'] = self.ft2
     expMap['expcube'] = self.Cubename
     expMap['outfile'] = self.Mapname
     expMap['irfs'] = self.irfs
     expMap['srcrad'] = self.roi + 10
     #The number of bin is the number of decade * the number of bin per decade (given by the users)
     expMap['nenergies'] = int(
         Nbdecade * self.Configuration['energy']['enumbins_per_decade'])
     expMap['clobber'] = self.clobber
     expMap.run()
Esempio n. 5
0
 def ExpMap(self):
     "Run gtexpmap for unbinned analysis"
     if (self.clobber == "no" and os.path.isfile(self.Mapname)):
         #print("File exists and clobber is False")
         return(0)
     Nbdecade = log10(self.Emax)-log10(self.Emin)#Compute the number of decade
     expMap['evfile'] = self.eventfile
     expMap['scfile'] = self.ft2
     expMap['expcube'] = self.Cubename
     expMap['outfile'] = self.Mapname
     if  self.Configuration['event']['irfs'] != 'CALDB':
         expMap['evtype']= self.Configuration['event']['evtype']
     else :
         expMap['evtype']= 'INDEF'
     expMap['irfs'] = self.irfs
     expMap['srcrad'] = self.roi+10
     #The number of bin is the number of decade * the number of bin per decade (given by the users)
     expMap['nenergies'] =  int(Nbdecade*self.Configuration['energy']['enumbins_per_decade']+0.5)
     expMap['clobber'] = self.clobber
     expMap.run()
Esempio n. 6
0
def expmap(square):

    '''This is the atomic function that actually runs in the seperate
    threads.  The input is a python list.  The first element is a list
    of two arrays giving the x and y points.  The second through last
    elements are the scfile, evfile, expcube, nlong, nlat, irfs,
    srcrad and nenergies.  This function creates a temporary file for
    the output and returns that file's name.'''

    print "Starting calculation of region {},{} to {},{}".format(square[0][0][0],
                                                                 square[0][1][0],
                                                                 square[0][0][1],
                                                                 square[0][1][1])
    osfilehandle,outfilename = tempfile.mkstemp(suffix=".fits")
    expMap['nlongmin'] = "{:,.0f}".format(float(square[0][0][0]))
    expMap['nlongmax'] = "{:,.0f}".format(float(square[0][0][1]))
    expMap['nlatmin'] = "{:,.0f}".format(float(square[0][1][0]))
    expMap['nlatmax'] = "{:,.0f}".format(float(square[0][1][1]))
    expMap['scfile'] = square[1]
    expMap['evfile'] = square[2]
    expMap['expcube'] = square[3]
    expMap['nlong'] = square[4]
    expMap['nlat'] = square[5]
    expMap['irfs'] = square[6]
    expMap['srcrad'] = square[7]
    expMap['nenergies'] = square[8]
    expMap['outfile'] = outfilename
    expMap['submap'] = "yes"
    expMap['chatter'] = 0
    expMap.run(print_command=False)
    print "Completed calculation of region {},{} to {},{}".format(square[0][0][0],
                                                                  square[0][1][0],
                                                                  square[0][0][1],
                                                                  square[0][1][1])
                
    return outfilename