Dear ROOTers,
I am trying to use the TFITSHDU
class to read the Table in the Header Data Unit (HDU) of a FITS
file.
The TFITSHDU
class works fine for images and plain table, but it appears unable to support a table
whose columns contain arrays rather than simple floats.
A bit of background: the data I am trying to read (a picture follows) represent a 2-dimensional PDF of an energy estimator. Since it is mostly 0, a sparse matrix is stored, with the columns F_CHAN
and N_CHAN
declaring the non empty bins and the MATRIX
column stating the PDF values in them.
If you want to repeat the test, you can find the file here
Already when I open it I get a warning
root [0] TFITSHDU *hdu = new TFITSHDU("rmf_obs5029747.fits[1]")
Warning in <TFITSHDU::LoadHDU>: error opening FITS file. Column type -21 is currently not supported
Warning in <TFITSHDU::LoadHDU>: error opening FITS file. Column type -21 is currently not supported
Warning in <TFITSHDU::LoadHDU>: error opening FITS file. Column type -42 is currently not supported
(TFITSHDU *) 0x7fe222c607b0
There are no problems in reading plain columns, e.g. the ENERG_LO
one
root [1] hdu->GetTabRealVectorColumn("ENERG_LO")->Print()
Vector (80) is as follows
| 1 |
------------------
0 |1e+07
1 |1.12202e+07
2 |1.25893e+07
3 |1.41254e+07
4 |1.58489e+07
5 |1.77828e+07
The problem is the TVectorD
returned by GetTabRealVectorColumn
cannot handle the arrays stored in the entries of the, for example, F_CHAN
column
root [2] hdu->GetTabRealVectorColumn("F_CHAN")->Print()
Vector (80) is as follows
| 1 |
------------------
0 |0
1 |0
2 |0
3 |0
4 |0
5 |0
as you can see the array nature of each value of the F_CHAN
column is completely ignored.
I would like to use TFITSHDU
as much as possible, but I am afraid that for this problem I need to go back to the CFITSIO
libraries.
Is it correct to say that reading such files with the current TFITS
implementation is not possible?
NOTE: I cannot change the input file as this is an established data format used by X-ray and Gamma-ray astronomical instruments.
Thank you,
Cosimo
ROOT Version: any version > 6
Platform: platform-independent
Compiler: compiler-independent