#!/usr/bin/env python """ Create counts maps. 1. make mapcube with gtbin of the source region 2. run gtsrcmaps,then gtmodel to make a irf-convolved map using fit source model xml file 3. use farith to subtract the maps @author R. Dubois """ # ##from setPaths import * from gt_apps import evtbin from optparse import OptionParser from GtApp import GtApp #import pyfits import os srcmaps = GtApp('gtsrcmaps','Likelihood') model = GtApp('gtmodel','Likelihood') farith = GtApp('farith') def run(clean=False): exposure = GtApp('gtexposure','pyExposure') ## ## Define command line arguments ## parser = OptionParser(version="%prog $Revision 0.1", description="run gtbin") parser.add_option("-s","--scfile",action="store",type="string",dest="scfile", default="",help="Filespec of spacecraft file") parser.add_option("-e","--evfile",action="store",type="string",dest="evfile", default="",help="Filespec of events file") parser.add_option("--alg",action="store",type="string",dest="algorithm", default="CMAP",help="choice of algorithm") parser.add_option("--obfile",action="store",type="string",dest="obfile", default="outBin.fits",help="gtbin output file name") parser.add_option("--ebinalg",action="store",type="string",dest="ebinalg", default="LOG",help="energy binning algorithm") parser.add_option("--enumbins",action="store",type="int",dest="enumbins", default=10,help="number of energy bins") parser.add_option("--emin",action="store",type="float",dest="emin", default=100.,help="minimum energy") parser.add_option("--emax",action="store",type="float",dest="emax", default=300000.,help="minimum energy") parser.add_option("--binsz",action="store",type="float",dest="binsz", default=0.2,help="angular bin size in image center (deg)") parser.add_option("--nxpix",action="store",type="int",dest="nxpix", default=50,help="number x pixels") parser.add_option("--nypix",action="store",type="int",dest="nypix", default=50,help="number y pixels") parser.add_option("-c","--coord",action="store",type="string",dest="coord", default="CEL",help="coordinate system") parser.add_option("--proj",action="store",type="string",dest="proj", default="CAR",help="coordinate projection") parser.add_option("--ra",action="store",type="float",dest="ra", default=0.,help="right ascension") parser.add_option("--dec",action="store",type="float",dest="dec", default=0.,help="declination") (options, args) = parser.parse_args() # x = pyfits.open(options.evfile); evtbin['evfile'] = options.evfile evtbin['outfile'] = options.obfile evtbin['scfile'] = options.scfile evtbin['ebinalg'] = options.ebinalg evtbin['nxpix'] = options.nxpix evtbin['nypix'] = options.nypix evtbin['binsz'] = options.binsz evtbin['coordsys'] = options.coord evtbin['xref'] = options.ra evtbin['yref'] = options.dec evtbin['axisrot'] = 0.0 evtbin['emin'] = options.emin evtbin['emax'] = options.emax evtbin['enumbins'] = options.enumbins evtbin['denergy'] = 0.0 evtbin['proj'] = options.proj evtbin['algorithm'] = 'CMAP' evtbin.run() if __name__ == "__main__": run()