def _MakeLC(self, Path=LightcurvePath): """Main function of the Lightcurve script. Read the config file and run the gtlike analysis""" enricodir = environ.DIRS.get("ENRICO_DIR") fermidir = environ.DIRS.get("FERMI_DIR") self.PrepareLC(self.config["LightCurve"]["MakeConfFile"]) # Get the config file for i in xrange(self.Nbin): if self.submit == "yes": cmd = "enrico_sed " + self.configfile[i] scriptname = self.LCfolder + "LC_Script_" + str(i) + ".sh" JobLog = self.LCfolder + "LC_Job_" + str(i) + ".log" JobName = ( ( self.config["target"]["name"] + "_" + self.config["analysis"]["likelihood"] + "_LC_" + self.config["file"]["tag"] ) + "_" + str(i) + ".log" ) call(cmd, enricodir, fermidir, scriptname, JobLog, JobName) # Submit the job else: run(self.configfile[i]) # run in command line
def _MakeLC(self, Path=LightcurvePath): #import gc import os #gc.enable() '''Main function of the Lightcurve script. Read the config file and run the gtlike analysis''' enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') self.PrepareLC(self.config['BayesianBlocks'] ['MakeConfFile']) #Get the config file for i in xrange(self.Nbin): #gc.collect() cmd = str("enrico_sed %s && enrico_plot_bayesianblocks %s" % (self.configfile[i], self.parent_filename)) if self.submit == 'yes': scriptname = self.LCfolder + "LC_Script_" + str(i) + ".sh" JobLog = self.LCfolder + "LC_Job_" + str(i) + ".log" JobName = (self.config['target']['name'] + "_" + self.config['analysis']['likelihood'] + "_LC_" + self.config['file']['tag']) + "_" + str(i) + ".log" call(cmd, enricodir, fermidir, scriptname, JobLog, JobName) #Submit the job else: os.system(cmd)
def run_analysis(self): import shutil from enrico import environ from enrico.config import get_config from enrico.appertureLC import AppLC from enrico.submit import call from enrico.constants import AppLCPath infile = self.configfile config = get_config(infile) self.remove_prev_dir() verbose("-> Running the analysis for %s" %(analysis.name)) # We will always try to run it in parallel, # either with python multiproc or with external torque pbs. if config['Submit'] == 'no': global fqueue fqueue.put(infile) else: enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') cmd = enricodir+"/enrico/appertureLC.py %s" %infile LCoutfolder = config['out']+"/"+AppLCPath os.system("mkdir -p "+LCoutfolder) prefix = LCoutfolder +"/"+ config['target']['name'] + "_AppertureLightCurve" scriptname = prefix+"_Script.sh" JobLog = prefix + "_Job.log" JobName = "LC_%s" %self.name call(cmd, enricodir, fermidir, scriptname, JobLog, JobName) verbose("--> Job sent successfully")
def _launch(self,ra,dec,i,j): """ Launch a job (either pixel evaluation or row evaluation). Can be the submittion of a job to a cluster """ enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') cmd = enricodir+"/enrico/tsmap.py "+os.getcwd()+"/"+self.infile +" "+ str(ra) +" "+ str(dec) +" "+ str(i) +" "+ str(j) #cmd line to send if self.config['Submit'] == 'yes': prefix = self.tsfolder + "/"+TSMapPath+"_" + str(i) +"_"+ str(j) scriptname = prefix + "_Script.sh" JobLog = prefix + "_Job.log" JobName = (self.config['target']['name'] + "_TSMap_" + str(i) +"_"+ str(j)) call(cmd, enricodir, fermidir, scriptname, JobLog, JobName) #submition else : os.system(cmd) #run directly
def _MakeLC(self,Path=LightcurvePath) : '''Main function of the Lightcurve script. Read the config file and run the gtlike analysis''' enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') self.PrepareLC(self.config['LightCurve']['MakeConfFile'])#Get the config file for i in xrange(self.Nbin): if self.submit == 'yes': cmd = "enrico_sed "+self.configfile[i] scriptname = self.LCfolder+"LC_Script_"+str(i)+".sh" JobLog = self.LCfolder+"LC_Job_"+str(i)+".log" JobName = (self.config['target']['name'] + "_" + self.config['analysis']['likelihood'] + "_LC_" + self.config['file']['tag'])+"_"+str(i)+".log" call(cmd,enricodir,fermidir,scriptname,JobLog,JobName)#Submit the job else : run(self.configfile[i])#run in command line
def RunEbin(folder,Nbin,Fit,FitRunner): if int(Nbin) > 0: configfiles = PrepareEbin(Fit, FitRunner) ind = 0 enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') for conf in configfiles: pathconf = folder + "/"+ EbinPath + str(Nbin) +"/" + conf Newconfig = get_config(pathconf) cmd = enricodir+"/enrico/RunGTlike.py "+pathconf if Newconfig['Submit'] == 'no' : #run directly os.system(cmd) else : #submit a job to a cluster prefix = Newconfig['out'] + "/"+ EbinPath + str(ind) scriptname = prefix + "_Script.sh" JobLog = prefix + "_Job.log" JobName = (Newconfig['target']['name'] + "_" + Newconfig['analysis']['likelihood'] + "_Ebin_" + str(ind) + "_" + Newconfig['file']['tag']) call(cmd, enricodir, fermidir, scriptname, JobLog, JobName)# submition ind+=1
def _MakeLC(self, Path=LightcurvePath): '''Main function of the Lightcurve script. Read the config file and run the gtlike analysis''' enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') self.PrepareLC( self.config['LightCurve']['MakeConfFile']) #Get the config file for i in xrange(self.Nbin): if self.submit == 'yes': cmd = "enrico_sed " + self.configfile[i] scriptname = self.LCfolder + "LC_Script_" + str(i) + ".sh" JobLog = self.LCfolder + "LC_Job_" + str(i) + ".log" JobName = (self.config['target']['name'] + "_" + self.config['analysis']['likelihood'] + "_LC_" + self.config['file']['tag']) + "_" + str(i) + ".log" call(cmd, enricodir, fermidir, scriptname, JobLog, JobName) #Submit the job else: run(self.configfile[i]) #run in command line
def _MakeLC(self,Path=LightcurvePath) : #import gc import os #gc.enable() '''Main function of the Lightcurve script. Read the config file and run the gtlike analysis''' enricodir = environ.DIRS.get('ENRICO_DIR') fermidir = environ.DIRS.get('FERMI_DIR') self.PrepareLC(self.config['LightCurve']['MakeConfFile'])#Get the config file for i in xrange(self.Nbin): #gc.collect() cmd = str("enrico_sed %s && enrico_plot_lc %s" %(self.configfile[i], self.parent_filename)) if self.submit == 'yes': scriptname = self.LCfolder+"LC_Script_"+str(i)+".sh" JobLog = self.LCfolder+"LC_Job_"+str(i)+".log" JobName = (self.config['target']['name'] + "_" + self.config['analysis']['likelihood'] + "_LC_" + self.config['file']['tag'])+"_"+str(i)+".log" call(cmd,enricodir,fermidir,scriptname,JobLog,JobName)#Submit the job else : os.system(cmd)