1

I've got a .fits file and I want to read the data, unfortunately I'm not at all familiar with this format type. Is there a way to convert it to a table (.txt file?) so that I can work with it using pandas? I just found pyfits and read some of the documentation but it's a bit nebulous to me.

Thanks.

Matt
  • 3,508
  • 6
  • 38
  • 66

1 Answers1

3

The pyfits getdata function returns an ndarray from the file:

from pyfits import getdata
data = getdata(file_name)

then you can decide which slice(s) to put into your DataFrame(s).

(These bnviewer slides [1] [2] seem like quite a nice primer.)

Andy Hayden
  • 359,921
  • 101
  • 625
  • 535