Example #1
0
def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
			  enumbins=0, log=False):
	"""
	Create TS distribution.
	
	Parameters:
	 loge - Logarithm of mean energy in TeV
	 emin - Minimum energy (TeV)
	 emax - Maximum energy (TeV)
	Keywords:
	 log  - Create log file(s)
	"""
	# Generate output filename
	outfile = "ts_"+str(loge)+".dat"
	
	# Setup cstsdist tool
	tsdist = cstsdist()
	tsdist["inmodel"].filename("$CTOOLS/share/models/crab.xml")
	tsdist["srcname"].string("Crab")
	tsdist["outfile"].filename(outfile)
	tsdist["ntrials"].integer(ntrials)
	tsdist["caldb"].string("prod2")
	tsdist["irf"].string("South_50h")
	tsdist["ra"].real(83.63)
	tsdist["dec"].real(22.01)
	tsdist["emin"].real(float(emin))
	tsdist["emax"].real(float(emax))
	tsdist["enumbins"].integer(int(enumbins))
	tsdist["tmin"].real(0.0)
	tsdist["tmax"].real(float(duration))
	tsdist["rad"].real(5.0)
	tsdist["npix"].integer(200)
	tsdist["binsz"].real(0.05)
	#tsdist["debug"].boolean(True)
		
	# Optionally open the log file
	if log:
		tsdist.logFileOpen()
	
	# Run tool
	tsdist.run()
	
	# Return
	return
Example #2
0
def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
     enumbins=0, log=False):
    """
	Create TS distribution.
	
	Parameters:
	 loge - Logarithm of mean energy in TeV
	 emin - Minimum energy (TeV)
	 emax - Maximum energy (TeV)
	Keywords:
	 log  - Create log file(s)
	"""
    # Generate output filename
    outfile = "ts_" + str(loge) + ".dat"

    # Setup cstsdist tool
    tsdist = cstsdist()
    tsdist["outfile"] = outfile
    tsdist["ntrials"] = ntrials
    tsdist["caldb"] = "$GAMMALIB/share/caldb/cta"
    tsdist["irf"] = "kb_E_50h_v3"
    tsdist["type"] = "point"
    tsdist["index"] = -2.48
    tsdist["offset"] = 0.0
    tsdist["bkg"] = "$GAMMALIB/share/models/bkg_kb_E_50h_v3.txt"
    tsdist["emin"] = float(emin)
    tsdist["emax"] = float(emax)
    tsdist["enumbins"] = int(enumbins)
    tsdist["duration"] = float(duration)
    tsdist["rad"] = 5.0
    tsdist["npix"] = 200
    tsdist["binsz"] = 0.05

    # Optionally open the log file
    if log:
        tsdist.logFileOpen()

    # Run tool
    tsdist.run()

    # Return
    return
def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
			  enumbins=0, log=False):
	"""
	Create TS distribution.
	
	Parameters:
	 loge - Logarithm of mean energy in TeV
	 emin - Minimum energy (TeV)
	 emax - Maximum energy (TeV)
	Keywords:
	 log  - Create log file(s)
	"""
	# Generate output filename
	outfile = "ts_"+str(loge)+".dat"
	
	# Setup cstsdist tool
	tsdist = cstsdist()
	tsdist["outfile"]  = outfile
	tsdist["ntrials"]  = ntrials
	tsdist["caldb"]    = "$GAMMALIB/share/caldb/cta"
	tsdist["irf"]      = "cta_dummy_irf"
	tsdist["type"]     = "point"
	tsdist["index"]    = -2.48
	tsdist["offset"]   = 0.0
	tsdist["bkg"]      = "$GAMMALIB/share/models/bkg_dummy.txt"
	tsdist["emin"]     = float(emin)
	tsdist["emax"]     = float(emax)
	tsdist["enumbins"] = int(enumbins)
	tsdist["duration"] = float(duration)
	tsdist["rad"]      = 5.0
	tsdist["npix"]     = 200
	tsdist["binsz"]    = 0.05
		
	# Optionally open the log file
	if log:
		tsdist.logFileOpen()
	
	# Run tool
	tsdist.run()
	
	# Return
	return