From 5f9ba4354263af78879bd06957ce0b103be0dc3a Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sun, 24 May 2015 00:24:44 +0200 Subject: [PATCH] Use new response function --- examples/README | 6 ++++++ examples/benchmark_cta_analysis.py | 12 ++++++------ examples/make_pointings.py | 14 ++++++-------- examples/make_pull_at_sensitivity_limit.py | 4 ++-- examples/make_spectrum.py | 4 ++-- examples/make_ts_distributions.py | 38 ++++++++++++++++++-------------------- examples/simulate_events.py | 2 +- pyext/ctools/obsutils.py | 6 +++--- 8 files changed, 44 insertions(+), 42 deletions(-) diff --git a/examples/README b/examples/README index 6cea825..d6b7dfb 100644 --- a/examples/README +++ b/examples/README @@ -9,6 +9,12 @@ benchmark_cta_analysis.py check_models.py Checks a variety of models using an unbinned analysis. +make_pointings.py + This script creates pointings for CTA surveys. For the moment the + Galactic Plane Survey (gps), the Extragalactic Survey (extgal) + and the Galactic Centre Survey (gc) are implemented. The script + outputs and ASCII file that can be used by csobsdef. + make_pull_at_sensitivity_limit.py This script creates pull distributions as function of energy for a test source that is at the 5 sigma sensitivity limit for diff --git a/examples/benchmark_cta_analysis.py b/examples/benchmark_cta_analysis.py index c073a84..62b6d4d 100755 --- a/examples/benchmark_cta_analysis.py +++ b/examples/benchmark_cta_analysis.py @@ -39,8 +39,8 @@ def unbinned_pipeline(duration): """ # Set script parameters model_name = "${CTOOLS}/share/models/crab.xml" - caldb = "dummy" - irf = "cta_dummy_irf" + caldb = "prod2" + irf = "South_50h" ra = 83.63 dec = 22.01 rad_sim = 10.0 @@ -103,8 +103,8 @@ def binned_pipeline(duration): """ # Set script parameters model_name = "${CTOOLS}/share/models/crab.xml" - caldb = "dummy" - irf = "cta_dummy_irf" + caldb = "prod2" + irf = "South_50h" ra = 83.63 dec = 22.01 rad_sim = 10.0 @@ -176,8 +176,8 @@ def cube_pipeline(duration): """ # Set script parameters model_name = "${CTOOLS}/share/models/crab.xml" - caldb = "dummy" - irf = "cta_dummy_irf" + caldb = "prod2" + irf = "South_50h" ra = 83.63 dec = 22.01 rad_sim = 10.0 diff --git a/examples/make_pointings.py b/examples/make_pointings.py index 023959c..3f8a672 100755 --- a/examples/make_pointings.py +++ b/examples/make_pointings.py @@ -1,6 +1,6 @@ #! /usr/bin/env python # ========================================================================== -# This script generated pointing patterns for CTA observations. +# This script generates pointing patterns for CTA observations. # # Usage: # ./make_pointings.py @@ -124,19 +124,18 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \ obs_site = site # Set site IRF + caldb = "prod2" if obs_site == "North": - caldb = "tenerife" if lst: - irf = "DESY20140105_50h" + irf = "North_50h" else: - irf = "DESY20140105_50h_noLST" + irf = "North_50h" exposure_north += duration else: - caldb = "aar" if lst: - irf = "DESY20140105_50h" + irf = "South_50h" else: - irf = "DESY20140105_50h_noLST" + irf = "South_50h" exposure_south += duration # Set IRF information @@ -291,7 +290,6 @@ if __name__ == '__main__': need_help = False # Test for command line arguments - #print(sys.argv[0]) if (len(sys.argv) > 1): if sys.argv[1] == "-h": need_help = True diff --git a/examples/make_pull_at_sensitivity_limit.py b/examples/make_pull_at_sensitivity_limit.py index e058379..fda1105 100755 --- a/examples/make_pull_at_sensitivity_limit.py +++ b/examples/make_pull_at_sensitivity_limit.py @@ -61,8 +61,8 @@ def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0, \ pull.models(models) pull["outfile"] = outfile pull["ntrials"] = ntrials - pull["caldb"] = "${CALDB}/data/cta/dummy/bcf" - pull["irf"] = "cta_dummy_irf" + pull["caldb"] = "prod2" + pull["irf"] = "South_50h" pull["ra"] = 83.6331 pull["dec"] = 22.0145 pull["emin"] = emin diff --git a/examples/make_spectrum.py b/examples/make_spectrum.py index e18bc9e..5e64ef5 100755 --- a/examples/make_spectrum.py +++ b/examples/make_spectrum.py @@ -36,8 +36,8 @@ def make_spectrum(): """ # Set script parameters model_name = "${CTOOLS}/share/models/crab.xml" - caldb = "dummy" - irf = "cta_dummy_irf" + caldb = "prod2" + irf = "South_50h" ra = 83.63 dec = 22.01 rad_sim = 3.0 diff --git a/examples/make_ts_distributions.py b/examples/make_ts_distributions.py index ceb6893..85c5338 100755 --- a/examples/make_ts_distributions.py +++ b/examples/make_ts_distributions.py @@ -61,21 +61,23 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ # Setup cstsdist tool tsdist = cstsdist() - tsdist["outfile"] = outfile - tsdist["ntrials"] = ntrials - tsdist["caldb"] = "${CALDB}/data/cta/dummy/bcf" - tsdist["irf"] = "cta_dummy_irf" - tsdist["type"] = "point" - tsdist["index"] = -2.48 - tsdist["offset"] = 0.0 - tsdist["bkg"] = "${CTOOLS}/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 + 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: @@ -139,14 +141,10 @@ if __name__ == '__main__': enumbins = pars[1]['value'] duration = pars[2]['value'] max_threads = pars[3]['value'] - #print ntrials - #print enumbins - #print duration - #print max_threads # Loop over energy bands. The energy bands are those that are also # used for sensitivity computation. - for ieng in range(21): + for ieng in range(20): # Set energies loge = -1.7 + ieng * 0.2 diff --git a/examples/simulate_events.py b/examples/simulate_events.py index 2f5b919..ff8801d 100755 --- a/examples/simulate_events.py +++ b/examples/simulate_events.py @@ -38,7 +38,7 @@ except: # ======================== # def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \ emin=0.1, emax=100.0, duration=360000.0, deadc=0.95, \ - irf="cta_dummy_irf", caldb="$CTOOLS/share/caldb/data/cta/dummy"): + irf="South_50h", caldb="prod2"): """ Create CTA observation. """ diff --git a/pyext/ctools/obsutils.py b/pyext/ctools/obsutils.py index 3224907..1cc6d03 100755 --- a/pyext/ctools/obsutils.py +++ b/pyext/ctools/obsutils.py @@ -288,7 +288,7 @@ def modmap(obs, eref=0.1, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ # ===================================== # def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ emin=0.1, emax=100.0, rad=5.0, \ - irf="cta_dummy_irf", caldb="dummy"): + irf="South_50h", caldb="prod2"): """ Obsolete function, use set_obs instead. """ @@ -309,7 +309,7 @@ def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ # ======================= # def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ emin=0.1, emax=100.0, rad=5.0, \ - irf="cta_dummy_irf", caldb="dummy", id="000000", instrument="CTA"): + irf="South_50h", caldb="prod2", id="000000", instrument="CTA"): """ Returns a single CTA observation containing an empty CTA event list. By looping over this function you can add CTA observations to the @@ -384,7 +384,7 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ # ============================ # def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \ emin=0.1, emax=100.0, rad=5.0, \ - irf="cta_dummy_irf", caldb="dummy"): + irf="South_50h", caldb="prod2"): """ Returns an observation container filled with a list of CTA observations. The list is defined by the obsdeflist parameter which is a dictionnary -- libgit2 0.21.4