2013-08-15 8 views
1

CCD 카메라의 이미지가있는 .fit 파일이 있는데 PyFITS를 사용하여 파일을 열 수 없습니다. 나는 PyFITS를 완벽하게 다루는 초보자이므로 어떤 옵션이 있는지는 알지 못한다. 여기에 내가 노력하고있어입니다 : 오류 반환PyFITS로 파일을 열 수 없습니다.

import pyfits 

hdulist = pyfits.open('apex5_1_90s.fit') 

:

Traceback (most recent call last): 
    File "\\uol.le.ac.uk\root\staff\home\l\lvh8\Desktop Files\Prototype Data\spextract.py", line 3, in <module> 
    hdulist = pyfits.open('apex5_1_90s.fit')#, ignore_missing_end=True) 
    File "C:\Python27\lib\site-packages\pyfits\hdu\hdulist.py", line 118, in fitsopen 
    return HDUList.fromfile(name, mode, memmap, save_backup, **kwargs) 
    File "C:\Python27\lib\site-packages\pyfits\hdu\hdulist.py", line 250, in fromfile 
    save_backup=save_backup, **kwargs) 
    File "C:\Python27\lib\site-packages\pyfits\hdu\hdulist.py", line 803, in _readfrom 
    hdu = _BaseHDU.readfrom(ffo, **kwargs) 
    File "C:\Python27\lib\site-packages\pyfits\hdu\base.py", line 299, in readfrom 
    hdr = Header.fromfile(fileobj, endcard=not ignore_missing_end) 
    File "C:\Python27\lib\site-packages\pyfits\header.py", line 476, in fromfile 
    raise IOError('Header missing END card.') 
IOError: Header missing END card. 

는 반면에 나는 시도하는 경우 : 내가 말한받을

import pyfits 

hdulist = pyfits.open('apex5_1_90s.fit', ignore_missing_end=True) 

:

Error validating header for HDU #1 (note: PyFITS uses zero-based indexing). 
    Header size is not multiple of 2880: 1920 
There may be extra bytes after the last HDU or the file is corrupted. 

나는이게 무슨 뜻인지 정말 모르겠다. 나는 아무도 모른다. 내가 그것에 대해 할 수있는 일, 그래서 어떤 도움을 크게 주시면 감사하겠습니다!

답변

1

파일이 손상되었거나 헤더에 문제가있는 것으로 보입니다. 유효한 FITS 파일을 가지고 있습니까? PyFITS 문서를 기반으로 :

Problem with the FITS format is that, as old as it is, there are many conventions that appear in files from certain sources that do not meet the FITS standard. And yet they are so common-place that it is necessary to support them in any FITS readers. CONTINUE cards are one such example.

(...) If PyFITS is having trouble opening a file, a good way to rule out whether not the problem is with PyFITS is to run the file through the fitsverify . If the file is malformatted, fitsverify will output errors and warnings. If fitsverify confirms no problems with a file, and PyFITS is still having trouble opening it (...) then it’s likely there is a bug in PyFITS.

+0

파일이 확실히 손상되었습니다. 이 상황에서 생각할 수있는 유일한 방법은 파일이 1920 바이트로 잘리는 것입니다. FITS 파일은 최소 2880 바이트 여야하며 최소 END 카드로 끝나는 헤더를 포함해야합니다. – Iguananaut