Support #3476

[Plot spectrum for different version of CTools]

Added by Diaz-Bahamondes Christian almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:12/04/2020
Priority:NormalDue date:
Assigned To:Tibaldo Luigi% Done:

100%

Category:-
Target version:-
Duration:

Description

Hi, I am Christian Diaz and I have a problem with the last update of CTools, this is: when I use the console to plot the spectrums by different simulations (with a different version of ctools), doesn’t work and show me this bug:
---------------
"(chirri) Christians-MacBook-Pro:Graphs chirri$ python show_spectrum.py SpecedispWoALPs1.fits

Traceback (most recent call last):

File "show_spectrum.py", line 296, in <module>
show_spectrum()
File "show_spectrum.py", line 284, in show_spectrum
plot_spectrum(args[0], plotfile)
File "show_spectrum.py", line 230, in plot_spectrum
spec = get_spectrum_file(filename)
File "show_spectrum.py", line 59, in get_spectrum_file
return get_spectrum_fits(fits)
File "show_spectrum.py", line 81, in get_spectrum_fits
c_energy = table['e_ref']
File "/Users/chirri/opt/anaconda3/envs/chirri/lib/python3.5/site-packages/gammalib/fits.py", line 2279, in getitem
return fits.GFitsTable__getitem__(self, *args)

RuntimeError: *** ERROR in GFitsTable::operator[](std::string&): Column “e_ref” not found in table”


I saw the file show_spectrum.py and I realized that is very different than the old version of the file show_spectrum.py, so you have some advice for that or some solution?

Best regards.

show_spectrum_old.py Magnifier (3.99 KB) Diaz-Bahamondes Christian , 12/04/2020 12:07 PM

show_spectrum_last.py Magnifier (8.26 KB) Diaz-Bahamondes Christian , 12/04/2020 12:07 PM


Recurrence

No recurrence.

History

#1 Updated by Tibaldo Luigi almost 4 years ago

Hi Christian,
could you please specify which are the two versions of ctools used to generate the spectral files and to plot?

#2 Updated by Diaz-Bahamondes Christian almost 4 years ago

Tibaldo Luigi wrote:

Hi Christian,
could you please specify which are the two versions of ctools used to generate the spectral files and to plot?

Yes, when I used the old version of 'show_spectrum.py’ (v. 2015-2019) and I tried to make a graph with a new file for 'spectrum.fits’ (last update of ctools) doesn’t work and this is the bug I show you. Viceversa is the same, I mean when I used the new version of 'show_spectrum.py’ with last version of 'spectrum.fits’ doesn’t work too. I attached the last version and new version of show_spectrum.py

Best regards

#3 Updated by Tibaldo Luigi almost 4 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Hi Christian,
this is not a bug. In version 1.7 the format of the spectrum files was changed to support the storage of likelihood profiles, aka Castro plots, see #2938, and also to make it more compliant with the community-defined format for interoperability reasons (https://gamma-astro-data-formats.readthedocs.io/en/latest/spectra/flux_points/index.html#flux-points).
Unfortunately this means that spectrum files produced with ctools < 1.7.0 will not be readable with the example scripts shipped with ctools > 1.7.0. If you need to read/plot old files please use the old version of the example plotting script.

#4 Updated by Knödlseder Jürgen almost 4 years ago

  • Status changed from Resolved to Closed
  • Assigned To set to Tibaldo Luigi

Also available in: Atom PDF