Commit b88ee4d54386df3e72ba735de521c15aca719b70
1 parent
731fccaf
(#2938) Rename fits column names to be consistent with gamma-astro data-format
Showing
2 changed files
with
19 additions
and
18 deletions
cscripts/csspec.py
| ... | ... | @@ -1058,14 +1058,14 @@ class csspec(ctools.csobservation): |
| 1058 | 1058 | # Create FITS table columns |
| 1059 | 1059 | nrows = self._ebounds.size() |
| 1060 | 1060 | ncols = len(results[0]['norm_scan']) |
| 1061 | - energy = gammalib.GFitsTableDoubleCol('Energy', nrows) | |
| 1062 | - energy_low = gammalib.GFitsTableDoubleCol('ed_Energy', nrows) | |
| 1063 | - energy_high = gammalib.GFitsTableDoubleCol('eu_Energy', nrows) | |
| 1064 | - flux = gammalib.GFitsTableDoubleCol('Flux', nrows) | |
| 1065 | - flux_err = gammalib.GFitsTableDoubleCol('e_Flux', nrows) | |
| 1066 | - TSvalues = gammalib.GFitsTableDoubleCol('TS', nrows) | |
| 1067 | - ulim_values = gammalib.GFitsTableDoubleCol('UpperLimit', nrows) | |
| 1068 | - Npred_values = gammalib.GFitsTableDoubleCol('Npred', nrows) | |
| 1061 | + energy = gammalib.GFitsTableDoubleCol('e_ref', nrows) | |
| 1062 | + energy_low = gammalib.GFitsTableDoubleCol('e_min', nrows) | |
| 1063 | + energy_high = gammalib.GFitsTableDoubleCol('e_max', nrows) | |
| 1064 | + flux = gammalib.GFitsTableDoubleCol('e2dnde', nrows) | |
| 1065 | + flux_err = gammalib.GFitsTableDoubleCol('e2dnde_err', nrows) | |
| 1066 | + TSvalues = gammalib.GFitsTableDoubleCol('ts', nrows) | |
| 1067 | + ulim_values = gammalib.GFitsTableDoubleCol('e2dnde_ul', nrows) | |
| 1068 | + Npred_values = gammalib.GFitsTableDoubleCol('npred', nrows) | |
| 1069 | 1069 | loglike = gammalib.GFitsTableDoubleCol('loglike', nrows) |
| 1070 | 1070 | norm_scan = gammalib.GFitsTableDoubleCol('norm_scan', nrows, ncols) |
| 1071 | 1071 | dloglike_scan= gammalib.GFitsTableDoubleCol('dloglike_scan', nrows, ncols) | ... | ... |
examples/show_spectrum.py
| ... | ... | @@ -79,13 +79,13 @@ def get_spectrum_fits(fits): |
| 79 | 79 | """ |
| 80 | 80 | # Read spectrum objects |
| 81 | 81 | table = fits.table(1) |
| 82 | - c_energy = table['Energy'] | |
| 83 | - c_ed = table['ed_Energy'] | |
| 84 | - c_eu = table['eu_Energy'] | |
| 85 | - c_flux = table['Flux'] | |
| 86 | - c_eflux = table['e_Flux'] | |
| 87 | - c_ts = table['TS'] | |
| 88 | - c_upper = table['UpperLimit'] | |
| 82 | + c_energy = table['e_ref'] | |
| 83 | + c_ed = table['e_min'] | |
| 84 | + c_eu = table['e_max'] | |
| 85 | + c_flux = table['e2dnde'] | |
| 86 | + c_eflux = table['e2dnde_err'] | |
| 87 | + c_ts = table['ts'] | |
| 88 | + c_upper = table['e2dnde_ul'] | |
| 89 | 89 | |
| 90 | 90 | # Initialise arrays to be filled |
| 91 | 91 | spec = { |
| ... | ... | @@ -105,13 +105,14 @@ def get_spectrum_fits(fits): |
| 105 | 105 | 'dll_scan' : [] |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - try: | |
| 108 | + # Determine if we can load the delta-log-likelihood profiles | |
| 109 | + load_dll = False | |
| 110 | + if (fits.table(1).has_card('SED_TYPE') and | |
| 111 | + fits.table(1).card('SED_TYPE').string() == 'likelihood'): | |
| 109 | 112 | c_loglike = table['loglike'] |
| 110 | 113 | c_norm_scan = table['norm_scan'] |
| 111 | 114 | c_dll_scan = table['dloglike_scan'] |
| 112 | 115 | load_dll = True |
| 113 | - except: | |
| 114 | - load_dll = False | |
| 115 | 116 | |
| 116 | 117 | # Loop over rows of the file |
| 117 | 118 | nrows = table.nrows() | ... | ... |