Reading fits file in python. Ask Question -1. I have a problem reading data from a fits file. I know that I should get these values because a package in IDL called mrdfits can be used to retrieve the values. I have tried looking into which data type the fits file contain and which formats, my code looks something like this. Reading BEFS FITS files in IDL. BEFS FITS arrays may be read into IDL using the IUEDAC routine IFITSRD, or the FITS binary table routines of the IDL Astronomy User's.
Active4 years, 10 months ago
I have a problem reading data from a fits file. Usually i can read data from a fits file just fine but now I have some data files which gives me some problems.When I try to read the file, which should contain three columns and a header, all i get is a table of numbers looking something like this:
[[ 64 195 45 .., 0 0 0]]
Now this is integers and the data file really should contain three columns containing double and floats in three columns like this:
[9819.3801, 0.00000, 0.00000 ]
[9820.0025, 5.50764e-16, 1.62396e-16 ] Descargar test de raven.
[820.6248, -3.75781e-17, 1.51864e-16]
I know that I should get these values because a package in IDL called mrdfits can be used to retrieve the values. I have tried looking into which data type the fits file contain and which formats, my code looks something like this:
Viewing Fits Files
My question is basically; is there another way I can read in the data so that it gives me the three columns of non-integer data? I am wondering if it is because the file is a BINTABLE that it is read in a different way than normally? Is there another way I can load the three columns than what I do at the moment?If you need me to clarify some points please ask, as I have tried out a number of things at the moment I am not sure which direction to take it.Any help would be much appreciated!
Quasar
QuasarQuasar
1 Answer
Once you have PyFITS downloaded, you are ready to go! To use PyFITS and obtain the information form the FITS file, here is a small example that uses three columns.
Now the above example has three columns, with headers
J,H,K . You can now call them by saying J,H,K respectively.
What you are doing in your code is that you are printing
f.info which will only give you the information of the headers and other stuff of your FITS file. It will not print the columns and the information.
The Dunmore DMV center Phone Number is (570) 963-4246 Type: Dunmore PennDOT Photo & Exam Center Facility: PennDOT Dunmore DMV Photo & Exam Center Address: 81 Keystone Industrial Park Dunmore, PA 18512 County: Lackawanna County, Pennsylvania Hours: Mon Tues Wed Thurs Fri Sat Photo License Center Closed 8:30am – 4:15pm 12:00pm – 7:45pm 8:30am – 4:15pm 8:30am – 4:15pm 8:30am – 4:15pm Driver License Center Closed Closed 12:00pm – 7:45pm Comm. Directions: Interstate 81 to Exit 188. Follow the blue and white signs for the State Police barracks. The Dunmore DMV location is located at 81 Keystone Industrial Park in Dunmore Pennsylvania. Knowledge Test till 6:00 * Closed * 8:30am – 4:15pm * 8:30am – 4:15pm * Best Times To Visit Closed Driver Exam Closed; Photo License Open Continuous Customer Flow Driver Exam Closed; Photo License Open 11:00 am – 12:00 pm Continuous Customer Flow * Commercial Knowledge test only given until 2:00pm because of length of test. Pa photo driver's license center locations.
ThePredator
![]()
5,39155 gold badges3636 silver badges5757 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged pythonfitspyfits or ask your own question.
Active6 years ago
I have an IDL routine that reads a binary data file. However, on this occasion, i'm getting 'READU: End of file encountered. Unit 2, File: data.dat'.
Instead of destroying the binary file and re-creating it. Is this problem surmountable? What IDL code could I use to allow me to read the binary file? The binary file was created by a C function.
Thanks in advance.
jpw
41.1k66 gold badges4949 silver badges7070 bronze badges
stars83cloudsstars83clouds
40911 gold badge44 silver badges2121 bronze badges
1 Answer
Based on the question, I'm assuming the binary file has a defined structure. You can probably use
fstat() and eof() to get around this. For example:
If you don't know the size of your data structures or if you want to check that there's a sufficient number of bytes before a read, you can use
fs.cur_ptr (after a call to fstat() , of course) or eof(lun) .
sappjwsappjw
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged cidl-programming-language or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |