Esempio n. 1
0
 def FindSource(self):
     """Run the gtfindsrc tool"""
     outfile = utils._dump_findsrcout(self.Configuration)
     if (self.clobber == "no" and os.path.isfile(outfile)):
         #print("File exists and clobber is False")
         return (0)
     findsrc = GtApp('gtfindsrc', 'Likelihood')
     findsrc['evfile'] = self.mktimefile
     findsrc['scfile'] = self.ft2
     if self.irfs != 'CALDB':
         findsrc['evtype'] = self.Configuration['event']['evtype']
     else:
         findsrc['evtype'] = 'INDEF'
     findsrc['irfs'] = self.irfs
     findsrc['expcube'] = self.Cubename
     findsrc['expmap'] = self.Mapname
     findsrc['srcmdl'] = utils._dump_xml(self.Configuration)
     findsrc['coordsys'] = self.Configuration['space']['coordsys']
     findsrc['target'] = self.srcname
     findsrc['optimizer'] = self.Configuration["fitting"]["optimizer"]
     findsrc['ftol'] = self.Configuration["fitting"]["ftol"]
     findsrc['clobber'] = self.clobber
     findsrc['reopt'] = self.Configuration["findsrc"]["Refit"]
     findsrc['outfile'] = outfile
     findsrc.run()
Esempio n. 2
0
 def FindSource(self):
     """Run the gtfindsrc tool"""
     outfile = utils._dump_findsrcout(self.Configuration)
     if (self.clobber=="no" and os.path.isfile(outfile)):
         #print("File exists and clobber is False")
         return(0)
     findsrc = GtApp('gtfindsrc', 'Likelihood')
     findsrc['evfile'] = self.mktimefile
     findsrc['scfile'] = self.ft2
     if  self.irfs != 'CALDB':
         findsrc['evtype']= self.Configuration['event']['evtype']
     else :
         findsrc['evtype']= 'INDEF'
     findsrc['irfs'] = self.irfs
     findsrc['expcube'] = self.Cubename
     findsrc['expmap'] = self.Mapname
     findsrc['srcmdl'] = utils._dump_xml( self.Configuration)
     findsrc['coordsys'] = self.Configuration['space']['coordsys']
     findsrc['target'] = self.srcname
     findsrc['optimizer'] = self.Configuration["fitting"]["optimizer"]
     findsrc['ftol'] = self.Configuration["fitting"]["ftol"]
     findsrc['clobber'] = self.clobber
     findsrc['reopt'] = self.Configuration["findsrc"]["Refit"]
     findsrc['outfile'] = outfile
     findsrc.run()
Esempio n. 3
0
def update_reg(config):
    lines=open(utils._dump_findsrcout(config),"r").readlines()[-4]
    word = string.split(lines)
    text = "\ncircle("+word[0]+","+word[1]+","+word[3]+")  # color=red text={Best Fit Position}"
    lines = open(utils._dump_reg(config),"r").readlines()
    lines.append(text)
    file_out = open(utils._dump_reg(config),"w")
    file_out.write(lines)
    file_out.close()
Esempio n. 4
0
 def FindSource(self):
     """Run the gtfindsrc tool"""
     findsrc = GtApp('gtfindsrc', 'Likelihood')
     findsrc['evfile'] = self.eventfile
     findsrc['scfile'] = self.ft2
     findsrc['irfs'] = self.irfs
     findsrc['expcube'] = self.Cubename
     findsrc['expmap'] = self.Mapname
     findsrc['srcmdl'] = utils._dump_xml( self.Configuration)
     findsrc['coordsys'] = self.Configuration['space']['coordsys']
     findsrc['target'] = self.srcname
     findsrc['optimizer'] = self.Configuration["fitting"]["optimizer"]
     findsrc['ftol'] = self.Configuration["fitting"]["ftol"]
     findsrc['clobber'] = self.clobber
     findsrc['reopt'] = self.Configuration["findsrc"]["Refit"]
     findsrc['outfile'] = utils._dump_findsrcout(self.Configuration)
     findsrc.run()
Esempio n. 5
0
def FindSrc(infile):
    config = get_config(infile)
    folder = config['out']

    Obs = Observation(folder, config)
    utils._log('SUMMARY: ')
    Obs.printSum()

    FitRunner = FitMaker(Obs, config)

    if config["findsrc"]["FitsGeneration"]== "yes":
        config['analysis']['likelihood'] = 'unbinned'
        FitRunner.GenerateFits()

    FitRunner._log('gtfindsrc', 'Optimize source position')
    os.system("rm "+utils._dump_findsrcout(config))
    Obs.FindSource()
    try:
      update_reg(config)
    except:
      pass
Esempio n. 6
0
 def FindSource(self):
     """Run the gtfindsrc tool"""
     findsrc = GtApp('gtfindsrc', 'Likelihood')
     findsrc['evfile'] = self.eventfile
     findsrc['scfile'] = self.ft2
     if self.Configuration['event']['irfs'] != 'CALDB':
         findsrc['evtype'] = self.Configuration['event']['evtype']
     else:
         findsrc['evtype'] = 'INDEF'
     findsrc['irfs'] = self.irfs
     findsrc['expcube'] = self.Cubename
     findsrc['expmap'] = self.Mapname
     findsrc['srcmdl'] = utils._dump_xml(self.Configuration)
     findsrc['coordsys'] = self.Configuration['space']['coordsys']
     findsrc['target'] = self.srcname
     findsrc['optimizer'] = self.Configuration["fitting"]["optimizer"]
     findsrc['ftol'] = self.Configuration["fitting"]["ftol"]
     findsrc['clobber'] = self.clobber
     findsrc['reopt'] = self.Configuration["findsrc"]["Refit"]
     findsrc['outfile'] = utils._dump_findsrcout(self.Configuration)
     findsrc.run()