Commit f674e8e7952ab0ed99054efaf7120f7c85890608
1 parent
725afee3
Adapt to GammaLib 1.0.0
Showing
2 changed files
with
22 additions
and
21 deletions
examples/benchmark_cta_analysis.py
| @@ -55,7 +55,7 @@ def unbinned_pipeline(duration): | @@ -55,7 +55,7 @@ def unbinned_pipeline(duration): | ||
| 55 | 55 | ||
| 56 | # Simulate events | 56 | # Simulate events |
| 57 | sim = ctools.ctobssim() | 57 | sim = ctools.ctobssim() |
| 58 | - sim["infile"].filename(model_name) | 58 | + sim["inmodel"].filename(model_name) |
| 59 | sim["caldb"].string(caldb) | 59 | sim["caldb"].string(caldb) |
| 60 | sim["irf"].string(irf) | 60 | sim["irf"].string(irf) |
| 61 | sim["ra"].real(ra) | 61 | sim["ra"].real(ra) |
| @@ -124,7 +124,7 @@ def binned_pipeline(duration): | @@ -124,7 +124,7 @@ def binned_pipeline(duration): | ||
| 124 | 124 | ||
| 125 | # Simulate events | 125 | # Simulate events |
| 126 | sim = ctools.ctobssim() | 126 | sim = ctools.ctobssim() |
| 127 | - sim["infile"].filename(model_name) | 127 | + sim["inmodel"].filename(model_name) |
| 128 | sim["caldb"].string(caldb) | 128 | sim["caldb"].string(caldb) |
| 129 | sim["irf"].string(irf) | 129 | sim["irf"].string(irf) |
| 130 | sim["ra"].real(ra) | 130 | sim["ra"].real(ra) |
| @@ -197,7 +197,7 @@ def cube_pipeline(duration): | @@ -197,7 +197,7 @@ def cube_pipeline(duration): | ||
| 197 | 197 | ||
| 198 | # Simulate events | 198 | # Simulate events |
| 199 | sim = ctools.ctobssim() | 199 | sim = ctools.ctobssim() |
| 200 | - sim["infile"].filename(model_name) | 200 | + sim["inmodel"].filename(model_name) |
| 201 | sim["caldb"].string(caldb) | 201 | sim["caldb"].string(caldb) |
| 202 | sim["irf"].string(irf) | 202 | sim["irf"].string(irf) |
| 203 | sim["ra"].real(ra) | 203 | sim["ra"].real(ra) |
| @@ -225,8 +225,8 @@ def cube_pipeline(duration): | @@ -225,8 +225,8 @@ def cube_pipeline(duration): | ||
| 225 | bin.run() | 225 | bin.run() |
| 226 | 226 | ||
| 227 | # Create exposure cube | 227 | # Create exposure cube |
| 228 | - expcube = ctools.ctexpcube(bin.obs()) | ||
| 229 | - expcube["cntmap"].filename("NONE") | 228 | + expcube = ctools.ctexpcube(sim.obs()) |
| 229 | + expcube["incube"].filename("NONE") | ||
| 230 | expcube["caldb"].string(caldb) | 230 | expcube["caldb"].string(caldb) |
| 231 | expcube["irf"].string(irf) | 231 | expcube["irf"].string(irf) |
| 232 | expcube["ebinalg"].string("LOG") | 232 | expcube["ebinalg"].string("LOG") |
| @@ -243,8 +243,8 @@ def cube_pipeline(duration): | @@ -243,8 +243,8 @@ def cube_pipeline(duration): | ||
| 243 | expcube.run() | 243 | expcube.run() |
| 244 | 244 | ||
| 245 | # Create PSF cube | 245 | # Create PSF cube |
| 246 | - psfcube = ctools.ctpsfcube(bin.obs()) | ||
| 247 | - psfcube["cntmap"].filename("NONE") | 246 | + psfcube = ctools.ctpsfcube(sim.obs()) |
| 247 | + psfcube["incube"].filename("NONE") | ||
| 248 | psfcube["caldb"].string(caldb) | 248 | psfcube["caldb"].string(caldb) |
| 249 | psfcube["irf"].string(irf) | 249 | psfcube["irf"].string(irf) |
| 250 | psfcube["ebinalg"].string("LOG") | 250 | psfcube["ebinalg"].string("LOG") |
examples/pipeline_stacked_mem.py
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | # ========================================================================== | 24 | # ========================================================================== |
| 25 | import gammalib | 25 | import gammalib |
| 26 | import ctools | 26 | import ctools |
| 27 | +from ctools import obsutils | ||
| 27 | 28 | ||
| 28 | 29 | ||
| 29 | # ================== # | 30 | # ================== # |
| @@ -50,19 +51,19 @@ def setup_observations(pattern="four", ra=83.6331, dec=22.0145, offset=1.5, \ | @@ -50,19 +51,19 @@ def setup_observations(pattern="four", ra=83.6331, dec=22.0145, offset=1.5, \ | ||
| 50 | irf - Instrument response function (default: cta_dummy_irf) | 51 | irf - Instrument response function (default: cta_dummy_irf) |
| 51 | """ | 52 | """ |
| 52 | # Set list of observations | 53 | # Set list of observations |
| 53 | - obs_def_list = ctools.obsutils.set_obs_patterns(pattern, \ | ||
| 54 | - ra=ra, \ | ||
| 55 | - dec=dec, \ | ||
| 56 | - offset=offset) | 54 | + obs_def_list = obsutils.set_obs_patterns(pattern, \ |
| 55 | + ra=ra, \ | ||
| 56 | + dec=dec, \ | ||
| 57 | + offset=offset) | ||
| 57 | 58 | ||
| 58 | # Get observation container | 59 | # Get observation container |
| 59 | - obs = ctools.obsutils.set_obs_list(obs_def_list, \ | ||
| 60 | - duration=duration, \ | ||
| 61 | - emin=emin, \ | ||
| 62 | - emax=emax, \ | ||
| 63 | - rad=rad, \ | ||
| 64 | - caldb=caldb, \ | ||
| 65 | - irf=irf) | 60 | + obs = obsutils.set_obs_list(obs_def_list, \ |
| 61 | + duration=duration, \ | ||
| 62 | + emin=emin, \ | ||
| 63 | + emax=emax, \ | ||
| 64 | + rad=rad, \ | ||
| 65 | + caldb=caldb, \ | ||
| 66 | + irf=irf) | ||
| 66 | 67 | ||
| 67 | # Return observation container | 68 | # Return observation container |
| 68 | return obs | 69 | return obs |
| @@ -129,7 +130,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | @@ -129,7 +130,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | ||
| 129 | 130 | ||
| 130 | # Create exposure cube | 131 | # Create exposure cube |
| 131 | expcube = ctools.ctexpcube(sim.obs()) | 132 | expcube = ctools.ctexpcube(sim.obs()) |
| 132 | - expcube["cntmap"].filename("NONE") | 133 | + expcube["incube"].filename("NONE") |
| 133 | expcube["ebinalg"].string("LOG") | 134 | expcube["ebinalg"].string("LOG") |
| 134 | expcube["emin"].real(emin) | 135 | expcube["emin"].real(emin) |
| 135 | expcube["emax"].real(emax) | 136 | expcube["emax"].real(emax) |
| @@ -146,7 +147,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | @@ -146,7 +147,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | ||
| 146 | 147 | ||
| 147 | # Create PSF cube | 148 | # Create PSF cube |
| 148 | psfcube = ctools.ctpsfcube(sim.obs()) | 149 | psfcube = ctools.ctpsfcube(sim.obs()) |
| 149 | - psfcube["cntmap"].filename("NONE") | 150 | + psfcube["incube"].filename("NONE") |
| 150 | psfcube["ebinalg"].string("LOG") | 151 | psfcube["ebinalg"].string("LOG") |
| 151 | psfcube["emin"].real(emin) | 152 | psfcube["emin"].real(emin) |
| 152 | psfcube["emax"].real(emax) | 153 | psfcube["emax"].real(emax) |
| @@ -163,7 +164,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | @@ -163,7 +164,7 @@ def run_pipeline(obs, ra=83.6331, dec=22.0145, emin=0.1, emax=100.0, \ | ||
| 163 | 164 | ||
| 164 | # Create background cube | 165 | # Create background cube |
| 165 | bkgcube = ctools.ctbkgcube(sim.obs()) | 166 | bkgcube = ctools.ctbkgcube(sim.obs()) |
| 166 | - bkgcube["cntmap"].filename("NONE") | 167 | + bkgcube["incube"].filename("NONE") |
| 167 | bkgcube["ebinalg"].string("LOG") | 168 | bkgcube["ebinalg"].string("LOG") |
| 168 | bkgcube["emin"].real(emin) | 169 | bkgcube["emin"].real(emin) |
| 169 | bkgcube["emax"].real(emax) | 170 | bkgcube["emax"].real(emax) |