Bug #1443
GCTAResponseTable::write() destroys array structure and changes values
Status: | Closed | Start date: | 03/12/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.0.0 | |||
Duration: |
Description
Starting to implement #1435, I realised that saving a GCTAResponseTable
to Fits results in a different format than what is read in.
In particular, the fits viewer (fv) does not recognise the array as image or movie anymore. In addition the values change when reading and writing (probably a unit conversion problem).
You can reproduce both errors via python:
$ python >>> import gammalib >>> aeff = gammalib.GCTAAeff2D("$GAMMALIB/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits") >>> aeff.save("test_aeff.fits") >>> new_aeff = gammalib.GCTAAeff2D("test_aeff.fits") >>> print aeff(0,0), new_aeff(0,0) >>> exit() $ fv test_aeff.fits
Note that EFFAREA is no longer displayed as image in fv. This might originate from the missing TDIM keyword.
Another thing I noticed is the data type: we write all values out via GFitsTableDoubleCol
, which might be an overkill. As input, we are using floats for IRFs which should be sufficient. Using doubles for all IRFs in every run while bundling the events and IRFs would lead to a strong increase in storage. Therefore, I propose to use floats in GCTAResponseTable::write()
.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen over 9 years ago
- Status changed from New to Closed
- Assigned To set to Knödlseder Jürgen
- Target version set to 1.0.0
- % Done changed from 0 to 100
I corrected the problems.
The TDIM keyword is now written properly using the dim()
method for FITS columns.
The 2D effective area (as well as the PSF) is internally scaled, hence now a copy is created before writing and the parameters are unscaled properly so that the result written to the FITS file corresponds to the original format.
Finally, I changed everything to single precision.
Changes are in devel
.