Commit 5f9ba4354263af78879bd06957ce0b103be0dc3a

Authored by Jürgen Knödlseder
1 parent be837518

Use new response function

examples/README
@@ -9,6 +9,12 @@ benchmark_cta_analysis.py @@ -9,6 +9,12 @@ benchmark_cta_analysis.py
9 check_models.py 9 check_models.py
10 Checks a variety of models using an unbinned analysis. 10 Checks a variety of models using an unbinned analysis.
11 11
  12 +make_pointings.py
  13 + This script creates pointings for CTA surveys. For the moment the
  14 + Galactic Plane Survey (gps), the Extragalactic Survey (extgal)
  15 + and the Galactic Centre Survey (gc) are implemented. The script
  16 + outputs and ASCII file that can be used by csobsdef.
  17 +
12 make_pull_at_sensitivity_limit.py 18 make_pull_at_sensitivity_limit.py
13 This script creates pull distributions as function of energy 19 This script creates pull distributions as function of energy
14 for a test source that is at the 5 sigma sensitivity limit for 20 for a test source that is at the 5 sigma sensitivity limit for
examples/benchmark_cta_analysis.py
@@ -39,8 +39,8 @@ def unbinned_pipeline(duration): @@ -39,8 +39,8 @@ def unbinned_pipeline(duration):
39 """ 39 """
40 # Set script parameters 40 # Set script parameters
41 model_name = "${CTOOLS}/share/models/crab.xml" 41 model_name = "${CTOOLS}/share/models/crab.xml"
42 - caldb = "dummy"  
43 - irf = "cta_dummy_irf" 42 + caldb = "prod2"
  43 + irf = "South_50h"
44 ra = 83.63 44 ra = 83.63
45 dec = 22.01 45 dec = 22.01
46 rad_sim = 10.0 46 rad_sim = 10.0
@@ -103,8 +103,8 @@ def binned_pipeline(duration): @@ -103,8 +103,8 @@ def binned_pipeline(duration):
103 """ 103 """
104 # Set script parameters 104 # Set script parameters
105 model_name = "${CTOOLS}/share/models/crab.xml" 105 model_name = "${CTOOLS}/share/models/crab.xml"
106 - caldb = "dummy"  
107 - irf = "cta_dummy_irf" 106 + caldb = "prod2"
  107 + irf = "South_50h"
108 ra = 83.63 108 ra = 83.63
109 dec = 22.01 109 dec = 22.01
110 rad_sim = 10.0 110 rad_sim = 10.0
@@ -176,8 +176,8 @@ def cube_pipeline(duration): @@ -176,8 +176,8 @@ def cube_pipeline(duration):
176 """ 176 """
177 # Set script parameters 177 # Set script parameters
178 model_name = "${CTOOLS}/share/models/crab.xml" 178 model_name = "${CTOOLS}/share/models/crab.xml"
179 - caldb = "dummy"  
180 - irf = "cta_dummy_irf" 179 + caldb = "prod2"
  180 + irf = "South_50h"
181 ra = 83.63 181 ra = 83.63
182 dec = 22.01 182 dec = 22.01
183 rad_sim = 10.0 183 rad_sim = 10.0
examples/make_pointings.py
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # ========================================================================== 2 # ==========================================================================
3 -# This script generated pointing patterns for CTA observations. 3 +# This script generates pointing patterns for CTA observations.
4 # 4 #
5 # Usage: 5 # Usage:
6 # ./make_pointings.py 6 # ./make_pointings.py
@@ -124,19 +124,18 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \ @@ -124,19 +124,18 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \
124 obs_site = site 124 obs_site = site
125 125
126 # Set site IRF 126 # Set site IRF
  127 + caldb = "prod2"
127 if obs_site == "North": 128 if obs_site == "North":
128 - caldb = "tenerife"  
129 if lst: 129 if lst:
130 - irf = "DESY20140105_50h" 130 + irf = "North_50h"
131 else: 131 else:
132 - irf = "DESY20140105_50h_noLST" 132 + irf = "North_50h"
133 exposure_north += duration 133 exposure_north += duration
134 else: 134 else:
135 - caldb = "aar"  
136 if lst: 135 if lst:
137 - irf = "DESY20140105_50h" 136 + irf = "South_50h"
138 else: 137 else:
139 - irf = "DESY20140105_50h_noLST" 138 + irf = "South_50h"
140 exposure_south += duration 139 exposure_south += duration
141 140
142 # Set IRF information 141 # Set IRF information
@@ -291,7 +290,6 @@ if __name__ == '__main__': @@ -291,7 +290,6 @@ if __name__ == '__main__':
291 need_help = False 290 need_help = False
292 291
293 # Test for command line arguments 292 # Test for command line arguments
294 - #print(sys.argv[0])  
295 if (len(sys.argv) > 1): 293 if (len(sys.argv) > 1):
296 if sys.argv[1] == "-h": 294 if sys.argv[1] == "-h":
297 need_help = True 295 need_help = True
examples/make_pull_at_sensitivity_limit.py
@@ -61,8 +61,8 @@ def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0, \ @@ -61,8 +61,8 @@ def create_pull(loge, emin, emax, models, ntrials=100, duration=180000.0, \
61 pull.models(models) 61 pull.models(models)
62 pull["outfile"] = outfile 62 pull["outfile"] = outfile
63 pull["ntrials"] = ntrials 63 pull["ntrials"] = ntrials
64 - pull["caldb"] = "${CALDB}/data/cta/dummy/bcf"  
65 - pull["irf"] = "cta_dummy_irf" 64 + pull["caldb"] = "prod2"
  65 + pull["irf"] = "South_50h"
66 pull["ra"] = 83.6331 66 pull["ra"] = 83.6331
67 pull["dec"] = 22.0145 67 pull["dec"] = 22.0145
68 pull["emin"] = emin 68 pull["emin"] = emin
examples/make_spectrum.py
@@ -36,8 +36,8 @@ def make_spectrum(): @@ -36,8 +36,8 @@ def make_spectrum():
36 """ 36 """
37 # Set script parameters 37 # Set script parameters
38 model_name = "${CTOOLS}/share/models/crab.xml" 38 model_name = "${CTOOLS}/share/models/crab.xml"
39 - caldb = "dummy"  
40 - irf = "cta_dummy_irf" 39 + caldb = "prod2"
  40 + irf = "South_50h"
41 ra = 83.63 41 ra = 83.63
42 dec = 22.01 42 dec = 22.01
43 rad_sim = 3.0 43 rad_sim = 3.0
examples/make_ts_distributions.py
@@ -61,21 +61,23 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ @@ -61,21 +61,23 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \
61 61
62 # Setup cstsdist tool 62 # Setup cstsdist tool
63 tsdist = cstsdist() 63 tsdist = cstsdist()
64 - tsdist["outfile"] = outfile  
65 - tsdist["ntrials"] = ntrials  
66 - tsdist["caldb"] = "${CALDB}/data/cta/dummy/bcf"  
67 - tsdist["irf"] = "cta_dummy_irf"  
68 - tsdist["type"] = "point"  
69 - tsdist["index"] = -2.48  
70 - tsdist["offset"] = 0.0  
71 - tsdist["bkg"] = "${CTOOLS}/share/models/bkg_dummy.txt"  
72 - tsdist["emin"] = float(emin)  
73 - tsdist["emax"] = float(emax)  
74 - tsdist["enumbins"] = int(enumbins)  
75 - tsdist["duration"] = float(duration)  
76 - tsdist["rad"] = 5.0  
77 - tsdist["npix"] = 200  
78 - tsdist["binsz"] = 0.05 64 + tsdist["inmodel"].filename("$CTOOLS/share/models/crab.xml")
  65 + tsdist["srcname"].string("Crab")
  66 + tsdist["outfile"].filename(outfile)
  67 + tsdist["ntrials"].integer(ntrials)
  68 + tsdist["caldb"].string("prod2")
  69 + tsdist["irf"].string("South_50h")
  70 + tsdist["ra"].real(83.63)
  71 + tsdist["dec"].real(22.01)
  72 + tsdist["emin"].real(float(emin))
  73 + tsdist["emax"].real(float(emax))
  74 + tsdist["enumbins"].integer(int(enumbins))
  75 + tsdist["tmin"].real(0.0)
  76 + tsdist["tmax"].real(float(duration))
  77 + tsdist["rad"].real(5.0)
  78 + tsdist["npix"].integer(200)
  79 + tsdist["binsz"].real(0.05)
  80 + #tsdist["debug"].boolean(True)
79 81
80 # Optionally open the log file 82 # Optionally open the log file
81 if log: 83 if log:
@@ -139,14 +141,10 @@ if __name__ == '__main__': @@ -139,14 +141,10 @@ if __name__ == '__main__':
139 enumbins = pars[1]['value'] 141 enumbins = pars[1]['value']
140 duration = pars[2]['value'] 142 duration = pars[2]['value']
141 max_threads = pars[3]['value'] 143 max_threads = pars[3]['value']
142 - #print ntrials  
143 - #print enumbins  
144 - #print duration  
145 - #print max_threads  
146 144
147 # Loop over energy bands. The energy bands are those that are also 145 # Loop over energy bands. The energy bands are those that are also
148 # used for sensitivity computation. 146 # used for sensitivity computation.
149 - for ieng in range(21): 147 + for ieng in range(20):
150 148
151 # Set energies 149 # Set energies
152 loge = -1.7 + ieng * 0.2 150 loge = -1.7 + ieng * 0.2
examples/simulate_events.py
@@ -38,7 +38,7 @@ except: @@ -38,7 +38,7 @@ except:
38 # ======================== # 38 # ======================== #
39 def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \ 39 def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \
40 emin=0.1, emax=100.0, duration=360000.0, deadc=0.95, \ 40 emin=0.1, emax=100.0, duration=360000.0, deadc=0.95, \
41 - irf="cta_dummy_irf", caldb="$CTOOLS/share/caldb/data/cta/dummy"): 41 + irf="South_50h", caldb="prod2"):
42 """ 42 """
43 Create CTA observation. 43 Create CTA observation.
44 """ 44 """
pyext/ctools/obsutils.py
@@ -288,7 +288,7 @@ def modmap(obs, eref=0.1, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \ @@ -288,7 +288,7 @@ def modmap(obs, eref=0.1, proj="TAN", coord="GAL", xval=0.0, yval=0.0, \
288 # ===================================== # 288 # ===================================== #
289 def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ 289 def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
290 emin=0.1, emax=100.0, rad=5.0, \ 290 emin=0.1, emax=100.0, rad=5.0, \
291 - irf="cta_dummy_irf", caldb="dummy"): 291 + irf="South_50h", caldb="prod2"):
292 """ 292 """
293 Obsolete function, use set_obs instead. 293 Obsolete function, use set_obs instead.
294 """ 294 """
@@ -309,7 +309,7 @@ def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ @@ -309,7 +309,7 @@ def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
309 # ======================= # 309 # ======================= #
310 def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ 310 def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
311 emin=0.1, emax=100.0, rad=5.0, \ 311 emin=0.1, emax=100.0, rad=5.0, \
312 - irf="cta_dummy_irf", caldb="dummy", id="000000", instrument="CTA"): 312 + irf="South_50h", caldb="prod2", id="000000", instrument="CTA"):
313 """ 313 """
314 Returns a single CTA observation containing an empty CTA event list. 314 Returns a single CTA observation containing an empty CTA event list.
315 By looping over this function you can add CTA observations to the 315 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, \ @@ -384,7 +384,7 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
384 # ============================ # 384 # ============================ #
385 def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \ 385 def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \
386 emin=0.1, emax=100.0, rad=5.0, \ 386 emin=0.1, emax=100.0, rad=5.0, \
387 - irf="cta_dummy_irf", caldb="dummy"): 387 + irf="South_50h", caldb="prod2"):
388 """ 388 """
389 Returns an observation container filled with a list of CTA observations. 389 Returns an observation container filled with a list of CTA observations.
390 The list is defined by the obsdeflist parameter which is a dictionnary 390 The list is defined by the obsdeflist parameter which is a dictionnary