diff --git a/inst/cta/test/example_binned_ml_fit.py b/inst/cta/test/example_binned_ml_fit.py index 6f1f33d..4e41956 100755 --- a/inst/cta/test/example_binned_ml_fit.py +++ b/inst/cta/test/example_binned_ml_fit.py @@ -2,7 +2,7 @@ # ========================================================================== # This script performs a binned maximum likelihood analysis of CTA data. # -# Copyright (C) 2012 Juergen Knoedlseder +# Copyright (C) 2012-2014 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -109,13 +109,13 @@ if __name__ == '__main__': print("... please wait for a few seconds") # Set parameters - irf = "kb_E_50h_v3" + irf = "cta_dummy_irf" caldb = "../caldb" model = "data/crab.xml" cntmap = "data/crab_cntmap.fits" # Perform binned analysis - result = binned_analysis(model, cntmap, irf, caldb) + result = binned_analysis(model, cntmap, irf, GCaldb(caldb)) # Print model results print(result) diff --git a/inst/cta/test/example_sim_psf.py b/inst/cta/test/example_sim_psf.py index cb0a96e..866ac9b 100755 --- a/inst/cta/test/example_sim_psf.py +++ b/inst/cta/test/example_sim_psf.py @@ -1,15 +1,12 @@ #! /usr/bin/env python # ========================================================================== -# This script simulated the PSF distribution. +# This script simulates the PSF distribution. # -# Based on the MAGIC spectrum of the Crab nebula, and by assuming a powerlaw, -# it will create a Monte Carlo sample of photons. -# -# If matplotlib is installed, the spectrum will be displayed on the screen. +# If matplotlib is installed, the PSF will be displayed on the screen. # # -------------------------------------------------------------------------- # -# Copyright (C) 2013 Juergen Knoedlseder +# Copyright (C) 2013-2014 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,47 +26,9 @@ from gammalib import * from math import * -# ======================== # -# Simulate CTA observation # -# ======================== # -def simulate(xmlname, e_min, e_max, area, duration): - """ - Simulate CTA observation. - """ - # Allocate MC parameters - dir = GSkyDir() - emin = GEnergy() - emax = GEnergy() - tmin = GTime(0.0) - tmax = GTime(duration) - - # Define MC parameters - dir.radec_deg(83.6331, 22.0145) - radius = 10.0 - emin.TeV(e_min) - emax.TeV(e_max) - - # Allocate random number generator - ran = GRan() - - # Load models and extract first model - models = GModels(xmlname) - model = models[0] - print(model) - - # Simulate photons - photons = model.mc(area, dir, radius, emin, emax, tmin, tmax, ran) - - # Print photons - print(str(len(photons)) + " photons simulated.") - - # Return photons - return photons - - -# ======== # -# Show PSF # -# ======== # +# ============ # +# Simulate PSF # +# ============ # def sim_psf(response, energy, r_max=0.8, rbins=1000, nmc=1000000): """ Simulate PSF and show results using matplotlib (if available). @@ -160,8 +119,8 @@ if __name__ == '__main__': print("****************") # Load response - rsp = GCTAResponse("irf_test.fits", - "../caldb/data/cta/e/bcf/000002") + rsp = GCTAResponse("irf_file.fits", + GCaldb("../caldb/data/cta/e/bcf/IFAE20120510_50h_King")) # Simulate PSF sim_psf(rsp, 1.0) diff --git a/inst/cta/test/test_model.py b/inst/cta/test/test_model.py index ea27f78..3932d9d 100755 --- a/inst/cta/test/test_model.py +++ b/inst/cta/test/test_model.py @@ -2,7 +2,7 @@ # ========================================================================== # This script tests the model computations using the CTA response function. # -# Copyright (C) 2011-2013 Jurgen Knodlseder +# Copyright (C) 2011-2014 Jurgen Knodlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -150,7 +150,7 @@ def observation(ra=0.0, dec=0.0, emin=0.1, emax=100.0, obs = GCTAObservation() # Set response - obs.response("kb_E_50h_v3", "../caldb") + obs.response("cta_dummy_irf", GCaldb("../caldb")) # Set pointing dir = GSkyDir()