diff --git a/examples/make_unbinned_analysis.py b/examples/make_unbinned_analysis.py index 16cf581..927d4c0 100755 --- a/examples/make_unbinned_analysis.py +++ b/examples/make_unbinned_analysis.py @@ -255,13 +255,8 @@ def plot_counts(observations): list = obs.events() # Create energy axis - ebounds = GEbounds() - emin = GEnergy() - emax = GEnergy() - emin.TeV(0.1) - emax.TeV(100.0) - ebounds.setlog(emin, emax, 10) - energy = [ebounds.elogmean(i).TeV() for i in range(ebounds.size())] + ebounds = GEbounds(10, GEnergy(0.1, "TeV"), GEnergy(100.0, "TeV")) + energy = [ebounds.elogmean(i).TeV() for i in range(ebounds.size())] # Create spectrum print("Extract data:") diff --git a/scripts/cspull.py b/scripts/cspull.py index db1229e..47a310e 100755 --- a/scripts/cspull.py +++ b/scripts/cspull.py @@ -2,7 +2,7 @@ # ========================================================================== # This script generates the pull distribution for all model parameters. # -# Copyright (C) 2011-2012 Juergen Knoedlseder +# Copyright (C) 2011-2013 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 diff --git a/scripts/cstsdist.py b/scripts/cstsdist.py index 2e631ee..b50da6c 100755 --- a/scripts/cstsdist.py +++ b/scripts/cstsdist.py @@ -313,10 +313,7 @@ class cstsdist(GApplication): location.lb_deg(l, b) # Set source spectrum - spectrum = GModelSpectralPlaw(flux, index) - spectrum["Prefactor"].scale(5.7e-16) - spectrum["PivotEnergy"].value(0.3) - spectrum["PivotEnergy"].scale(1.0e6) + spectrum = GModelSpectralPlaw(flux*5.7e-16, index, 3.0e5) if fitidx: spectrum["Index"].free() else: diff --git a/test/example_survey.py b/test/example_survey.py index dfa6fa4..55edf63 100755 --- a/test/example_survey.py +++ b/test/example_survey.py @@ -3,7 +3,7 @@ # This script simulates CTA surveys. It can be considered as the master # script for CTA science simulations. Please modify as needed. # -# Copyright (C) 2011-2012 Jurgen Knodlseder +# Copyright (C) 2011-2013 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 @@ -192,10 +192,7 @@ def add_background_model(obs): # Define background model bgd_radial = GCTAModelRadialGauss(3.0) - bgd_spectrum = GModelSpectralPlaw(61.8, -1.85) - bgd_spectrum["Prefactor"].scale(1.0e-6) - bgd_spectrum["PivotEnergy"].value(1.0) - bgd_spectrum["PivotEnergy"].scale(1.0e6) + bgd_spectrum = GModelSpectralPlaw(61.8e-6, -1.85, 1.0e6) bgd_model = GCTAModelRadialAcceptance(bgd_radial, bgd_spectrum) bgd_model.name("Background") bgd_model.instruments("CTA") @@ -219,10 +216,7 @@ def crab_spec(): (Albert et al. 2008, ApJ, 674, 1037) """ # Set parameters - spectrum = GModelSpectralPlaw(5.7, -2.48) - spectrum["Prefactor"].scale(1.0e-16) - spectrum["PivotEnergy"].value(0.3) - spectrum["PivotEnergy"].scale(1.0e6) + spectrum = GModelSpectralPlaw(5.7e-16, -2.48, 3.0e5) # Return spectrum return spectrum @@ -248,9 +242,9 @@ def survey_single(): # Define single point source with Crab flux at galactic centre center = GSkyDir() center.lb_deg(0.0, 0.0) - point_spatial = GModelSpatialPtsrc(center) + point_spatial = GModelSpatialPointSource(center) point_spectrum = crab_spec() - point = GModelPointSource(point_spatial, point_spectrum) + point = GModelSky(point_spatial, point_spectrum) point.name('GC source') # Create model container @@ -289,9 +283,9 @@ def survey_gplane(lrange=10, lstep=2): # Define single point source with Crab flux at galactic centre center = GSkyDir() center.lb_deg(0.0, 0.0) - point_spatial = GModelSpatialPtsrc(center) + point_spatial = GModelSpatialPointSource(center) point_spectrum = crab_spec() - point = GModelPointSource(point_spatial, point_spectrum) + point = GModelSky(point_spatial, point_spectrum) point.name('GC source') # Create model container @@ -354,7 +348,7 @@ if __name__ == '__main__': cntmap = obsutils.cntmap(obs) # Fit observations - print("Fit observatins") + print("Fit observations") like = obsutils.fit(obs) #print like.opt() #print like.obs().models()