Commit 5f9ba4354263af78879bd06957ce0b103be0dc3a
1 parent
be837518
Use new response function
Showing
8 changed files
with
44 additions
and
42 deletions
examples/README
| ... | ... | @@ -9,6 +9,12 @@ benchmark_cta_analysis.py |
| 9 | 9 | check_models.py |
| 10 | 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 | 18 | make_pull_at_sensitivity_limit.py |
| 13 | 19 | This script creates pull distributions as function of energy |
| 14 | 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 | 39 | """ |
| 40 | 40 | # Set script parameters |
| 41 | 41 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 42 | - caldb = "dummy" | |
| 43 | - irf = "cta_dummy_irf" | |
| 42 | + caldb = "prod2" | |
| 43 | + irf = "South_50h" | |
| 44 | 44 | ra = 83.63 |
| 45 | 45 | dec = 22.01 |
| 46 | 46 | rad_sim = 10.0 |
| ... | ... | @@ -103,8 +103,8 @@ def binned_pipeline(duration): |
| 103 | 103 | """ |
| 104 | 104 | # Set script parameters |
| 105 | 105 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 106 | - caldb = "dummy" | |
| 107 | - irf = "cta_dummy_irf" | |
| 106 | + caldb = "prod2" | |
| 107 | + irf = "South_50h" | |
| 108 | 108 | ra = 83.63 |
| 109 | 109 | dec = 22.01 |
| 110 | 110 | rad_sim = 10.0 |
| ... | ... | @@ -176,8 +176,8 @@ def cube_pipeline(duration): |
| 176 | 176 | """ |
| 177 | 177 | # Set script parameters |
| 178 | 178 | model_name = "${CTOOLS}/share/models/crab.xml" |
| 179 | - caldb = "dummy" | |
| 180 | - irf = "cta_dummy_irf" | |
| 179 | + caldb = "prod2" | |
| 180 | + irf = "South_50h" | |
| 181 | 181 | ra = 83.63 |
| 182 | 182 | dec = 22.01 |
| 183 | 183 | rad_sim = 10.0 | ... | ... |
examples/make_pointings.py
| 1 | 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 | 5 | # Usage: |
| 6 | 6 | # ./make_pointings.py |
| ... | ... | @@ -124,19 +124,18 @@ def set_patch(lmin=-30.0, lmax=30.0, bmin=-1.5, bmax=+1.5, \ |
| 124 | 124 | obs_site = site |
| 125 | 125 | |
| 126 | 126 | # Set site IRF |
| 127 | + caldb = "prod2" | |
| 127 | 128 | if obs_site == "North": |
| 128 | - caldb = "tenerife" | |
| 129 | 129 | if lst: |
| 130 | - irf = "DESY20140105_50h" | |
| 130 | + irf = "North_50h" | |
| 131 | 131 | else: |
| 132 | - irf = "DESY20140105_50h_noLST" | |
| 132 | + irf = "North_50h" | |
| 133 | 133 | exposure_north += duration |
| 134 | 134 | else: |
| 135 | - caldb = "aar" | |
| 136 | 135 | if lst: |
| 137 | - irf = "DESY20140105_50h" | |
| 136 | + irf = "South_50h" | |
| 138 | 137 | else: |
| 139 | - irf = "DESY20140105_50h_noLST" | |
| 138 | + irf = "South_50h" | |
| 140 | 139 | exposure_south += duration |
| 141 | 140 | |
| 142 | 141 | # Set IRF information |
| ... | ... | @@ -291,7 +290,6 @@ if __name__ == '__main__': |
| 291 | 290 | need_help = False |
| 292 | 291 | |
| 293 | 292 | # Test for command line arguments |
| 294 | - #print(sys.argv[0]) | |
| 295 | 293 | if (len(sys.argv) > 1): |
| 296 | 294 | if sys.argv[1] == "-h": |
| 297 | 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 | 61 | pull.models(models) |
| 62 | 62 | pull["outfile"] = outfile |
| 63 | 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 | 66 | pull["ra"] = 83.6331 |
| 67 | 67 | pull["dec"] = 22.0145 |
| 68 | 68 | pull["emin"] = emin | ... | ... |
examples/make_spectrum.py
examples/make_ts_distributions.py
| ... | ... | @@ -61,21 +61,23 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ |
| 61 | 61 | |
| 62 | 62 | # Setup cstsdist tool |
| 63 | 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 | 82 | # Optionally open the log file |
| 81 | 83 | if log: |
| ... | ... | @@ -139,14 +141,10 @@ if __name__ == '__main__': |
| 139 | 141 | enumbins = pars[1]['value'] |
| 140 | 142 | duration = pars[2]['value'] |
| 141 | 143 | max_threads = pars[3]['value'] |
| 142 | - #print ntrials | |
| 143 | - #print enumbins | |
| 144 | - #print duration | |
| 145 | - #print max_threads | |
| 146 | 144 | |
| 147 | 145 | # Loop over energy bands. The energy bands are those that are also |
| 148 | 146 | # used for sensitivity computation. |
| 149 | - for ieng in range(21): | |
| 147 | + for ieng in range(20): | |
| 150 | 148 | |
| 151 | 149 | # Set energies |
| 152 | 150 | loge = -1.7 + ieng * 0.2 | ... | ... |
examples/simulate_events.py
| ... | ... | @@ -38,7 +38,7 @@ except: |
| 38 | 38 | # ======================== # |
| 39 | 39 | def createobs(ra=86.171648, dec=-1.4774586, rad=5.0, \ |
| 40 | 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 | 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 | 288 | # ===================================== # |
| 289 | 289 | def set(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 290 | 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 | 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 | 309 | # ======================= # |
| 310 | 310 | def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 311 | 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 | 314 | Returns a single CTA observation containing an empty CTA event list. |
| 315 | 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 | 384 | # ============================ # |
| 385 | 385 | def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \ |
| 386 | 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 | 389 | Returns an observation container filled with a list of CTA observations. |
| 390 | 390 | The list is defined by the obsdeflist parameter which is a dictionnary | ... | ... |