[Plot spectrum for different version of CTools]
|Assigned To:||Tibaldo Luigi||% Done:|
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>
File "show_spectrum.py", line 284, in show_spectrum
File "show_spectrum.py", line 230, in plot_spectrum
spec = get_spectrum_file(filename)
File "show_spectrum.py", line 59, in get_spectrum_file
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?
#2 Updated by Diaz-Bahamondes Christian 3 months ago
Tibaldo Luigi wrote:
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
#3 Updated by Tibaldo Luigi 3 months ago
- Tracker changed from Bug to Support
- Status changed from New to Resolved
- % Done changed from 0 to 100
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.