Closed matteobachetti closed 3 months ago
Could you provide a web link to the file so I can run some tests?
That has access restrictions, I sent a request for access from my gmail address
I've got a PR to fix this: #409
Would you like to see if it works for you?
It works! Thanks @esheldon for the super quick help!
In [5]: import fitsio
...: fname = "ixpe02001099_det1_evt2_v02_bary_de200.fits"
...: fits = fitsio.FITS(fname)["EVENTS"]
...: print("First three single lines")
...: print(fits[0])
...: print(fits[1])
...: print(fits[2])
...: print("Now the three lines as a slice:")
...: print(fits[:3])
...:
...:
First three single lines
(7719, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 67, 0.14893726, 294.65622, 287.81873, -1.19643081, -1.5426033)
(7720, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 126, 0.7080227, 309.22623, 296.74072, -0.17053956, -1.92101329)
(7721, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 63, 0.32745385, 301.56723, 302.6787, 1.39725891, 1.42983813)
Now the three lines as a slice:
[(7719, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 67, 0.14893726, 294.65622, 287.81873, -1.19643081, -1.5426033 )
(7720, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 126, 0.7080227 , 309.22623, 296.74072, -0.17053956, -1.92101329)
(7721, 1.93797604e+08, [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False], 63, 0.32745385, 301.56723, 302.6787 , 1.39725891, 1.42983813)]
Hello, thanks for this great library! For an application I'm doing, I need to quickly access slices of data from large FITS files, and I'm testing
fitsio
againstastropy.io.fits
. However, I'm having a problem when doing that, as follows. In the MWE below, when I select a single row of the file, data are loaded correctly. If I use a slice, however, data get mangled in a strange way. I guess this might have something to do with the data types? Any help is appreciatedIf I
print(fits)
, it gives the following information and data types:EDIT: a workaround for me is using
read(rows=list_of_rows, columns=["TIME", "PI"])