Commit 5e03ca0d01e54b76ab31dbcc31aebbf220dfe6ca
1 parent
ed0d4b4b
Set upper limits error bars in show_spectrum.py to fraction of flux
Showing
1 changed file
with
5 additions
and
2 deletions
examples/show_spectrum.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Display spectrum generated by csspec |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2015-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2015-2017 Juergen Knoedlseder | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -91,6 +91,9 @@ def plot_spectrum(filename, plotfile): |
| 91 | 91 | ul_ed_engs.append(c_ed.real(row)) |
| 92 | 92 | ul_eu_engs.append(c_eu.real(row)) |
| 93 | 93 | |
| 94 | + # Set upper limit errors | |
| 95 | + yerr = [0.6 * x for x in ul_flux] | |
| 96 | + | |
| 94 | 97 | # Plot the spectrum |
| 95 | 98 | plt.figure() |
| 96 | 99 | plt.loglog() |
| ... | ... | @@ -98,7 +101,7 @@ def plot_spectrum(filename, plotfile): |
| 98 | 101 | plt.errorbar(energies, flux, yerr=e_flux, xerr=[ed_engs, eu_engs], |
| 99 | 102 | fmt='ro') |
| 100 | 103 | plt.errorbar(ul_energies, ul_flux, xerr=[ul_ed_engs, ul_eu_engs], |
| 101 | - yerr=1.0e-11, uplims=True, fmt='ro') | |
| 104 | + yerr=yerr, uplims=True, fmt='ro') | |
| 102 | 105 | plt.xlabel('Energy (TeV)') |
| 103 | 106 | plt.ylabel(r'E $\times$ dN/dE (erg cm$^{-2}$ s$^{-1}$)') |
| 104 | 107 | ... | ... |