Пример #1
0
 def ExpCube(self):
     "Run gtltcube tool to produce livetime cube"
     expCube['evfile'] = self.eventfile
     expCube['scfile'] = self.ft2
     expCube['outfile'] = self.Cubename
     expCube['dcostheta'] = 0.025
     expCube['binsz'] = 1
     expCube['phibins'] = self.Configuration['space']['phibins']
     expCube['clobber'] = self.clobber
     expCube.run()
Пример #2
0
 def ExpCube(self): 
     "Run gtltcube tool to produce livetime cube"
     expCube['evfile']=self.eventfile
     expCube['scfile']=self.ft2
     expCube['outfile']=self.Cubename
     expCube['dcostheta']=0.025
     expCube['binsz']=1
     expCube['phibins']=self.Configuration['space']['phibins']
     expCube['clobber'] = self.clobber
     expCube.run()
Пример #3
0
def ltcube(times):
    '''This is the atomic function that actually runs in the seperate
    threads.  It takes a list as input where the first element is
    tmin, second is tmax, third is spacecraft file, fourth is the
    event file and fifth is the zmax parameter.  It first uses
    gtselect with wide open cuts to divide up the event file then it
    runs gtltcube on that event file.  The temporary event file is
    deleted automatically.  The function returns the name of the
    created ltcube file which can be combined with other files and/or
    deleted later.'''

    print "Starting calculation on interval {} to {}".format(
        times[0], times[1])
    if times[3] != '':
        evfile = tempfile.NamedTemporaryFile(suffix=".fits")
        filter['ra'] = "INDEF"
        filter['dec'] = "INDEF"
        filter['rad'] = "INDEF"
        filter['evclass'] = 0
        filter['evtype'] = "INDEF"
        filter['infile'] = times[3]
        filter['outfile'] = evfile.name
        filter['ra'] = "INDEF"
        filter['dec'] = "INDEF"
        filter['tmin'] = times[0]
        filter['tmax'] = times[1]
        filter['emin'] = 0.0
        filter['emax'] = 1000000.0
        filter['zmin'] = 0
        filter['zmax'] = 180
        filter['convtype'] = -1
        filter['chatter'] = 0
        filter.run(print_command=True)

    osfilehandle, outfilename = tempfile.mkstemp(suffix=".fits")
    if times[3] != '':
        expCube['evfile'] = evfile.name
    else:
        expCube['evfile'] = ""
    expCube['scfile'] = times[2]
    expCube['outfile'] = outfilename
    expCube['tmin'] = times[0]
    expCube['tmax'] = times[1]
    expCube['dcostheta'] = 0.025
    expCube['binsz'] = 1
    expCube['phibins'] = 0
    expCube['zmax'] = times[4]
    expCube['chatter'] = 0
    expCube.run(print_command=True)
    print "Completed calculation on interval {} to {}".format(
        times[0], times[1])
    return outfilename
Пример #4
0
def ltcube(times):

    '''This is the atomic function that actually runs in the seperate
    threads.  It takes a list as input where the first element is
    tmin, second is tmax, third is spacecraft file, fourth is the
    event file and fifth is the zmax parameter.  It first uses
    gtselect with wide open cuts to divide up the event file then it
    runs gtltcube on that event file.  The temporary event file is
    deleted automatically.  The function returns the name of the
    created ltcube file which can be combined with other files and/or
    deleted later.'''

    print "Starting calculation on interval {} to {}".format(times[0],times[1])
    if times[3] != '':
        evfile = tempfile.NamedTemporaryFile(suffix=".fits")
        filter['ra']="INDEF" 
        filter['dec']="INDEF"
        filter['rad'] = "INDEF"
        filter['evclass'] = 0
        filter['evtype'] = "INDEF"
        filter['infile'] = times[3]
        filter['outfile'] = evfile.name
        filter['ra'] = "INDEF"
        filter['dec'] = "INDEF"
        filter['tmin'] = times[0]
        filter['tmax'] = times[1]
        filter['emin'] = 0.0 
        filter['emax'] = 1000000.0
        filter['zmin'] = 0
        filter['zmax'] = 180
        filter['convtype'] = -1
        filter['chatter'] = 0
        filter.run(print_command=True)

    osfilehandle,outfilename = tempfile.mkstemp(suffix=".fits")
    if times[3] != '':
        expCube['evfile'] = evfile.name
    else:
        expCube['evfile'] = ""
    expCube['scfile'] =  times[2]
    expCube['outfile'] = outfilename
    expCube['tmin'] = times[0]
    expCube['tmax'] = times[1]
    expCube['dcostheta'] = 0.025
    expCube['binsz'] = 1
    expCube['phibins'] = 0
    expCube['zmax'] = times[4]
    expCube['chatter'] = 0
    expCube.run(print_command=True)
    print "Completed calculation on interval {} to {}".format(times[0],times[1])
    return outfilename
Пример #5
0
 def ExpCube(self):
     "Run gtltcube tool to produce livetime cube"
     if (self.clobber == "no" and os.path.isfile(self.Cubename)):
         #print("File exists and clobber is False")
         return (0)
     expCube['evfile'] = self.mktimefile
     expCube['scfile'] = self.ft2
     expCube['outfile'] = self.Cubename
     expCube['dcostheta'] = 0.025
     expCube['binsz'] = 1
     expCube['zmax'] = self.Configuration['analysis']['zmax']
     expCube['phibins'] = self.Configuration['space']['phibins']
     expCube['clobber'] = self.clobber
     expCube.run()
Пример #6
0
 def ExpCube(self):
     "Run gtltcube tool to produce livetime cube"
     if (self.clobber=="no" and os.path.isfile(self.Cubename)):
         #print("File exists and clobber is False")
         return(0)
     expCube['evfile']=self.mktimefile
     expCube['scfile']=self.ft2.lstrip('@') # @ allows for weekly SC files
     expCube['outfile']=self.Cubename
     expCube['dcostheta']=0.025
     expCube['binsz']=1
     expCube['zmax']=self.Configuration['analysis']['zmax']
     expCube['phibins']=self.Configuration['space']['phibins']
     expCube['clobber'] = self.clobber
     expCube.run()
     evtbin['proj'] = 'AIT'
     evtbin['ebinalg'] = 'LOG'
     evtbin['emin'] = emin
     evtbin['emax'] = emax
     evtbin['enumbins'] = num_bins
     evtbin.run()
     
     #livetime cube
     expCube['evfile'] = mktime_file
     expCube['scfile'] = sc_file
     ltCube_file = 'Sun_ltCube_' + str(val) + '.fits'
     expCube['outfile'] = ltCube_file
     expCube['zmax'] = zmax
     expCube['dcostheta'] = 0.025
     expCube['binsz'] = 1.0
     expCube.run()


     """#exposure map
     expMap['evfile'] = mktime_file 
     expMap['scfile'] = sc_file
     expMap['expcube'] = ltCube_file
     expMap_file = 'Sun_expmap_' + str(val) + '.fits'
     expMap['outfile'] = expMap_file
     expMap['irfs'] = 'CALDB'
     expMap['srcrad'] = roi
     expMap['nlong'] = 120
     expMap['nlat'] = 120
     expMap['nenergies'] = 20
     expMap.run()"""