2010-01-12 3 views
1

저는 python2.5를 실행 중이며 astLib 라이브러리를 사용하여 천문학적 이미지에서 WCS 정보를 분석하려고합니다. 나는 시도하고 다음과 같은 골격 코드를 통해 인스턴스 개체 수 : file.fits 유효한 가리키는 문자열 파일을 맞는 것입니다astWCS를 사용하여 WCS 객체를 만들 때 오류가 발생했습니다.

from astLib import astWCS 

w = astWCS.WCS('file.fits') # error here 

합니다.

나는 pyfits 헤더 객체를 전달하는 다른 방법을 사용하여 시도하고이 또한 실패 : 내가 ipython에서 실행하면

Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "/home/astro/phrfbf/build/lib/python2.6/site-packages/astLib/astWCS.py", line 79, in __init__ 
    self.updateFromHeader() 
    File "/home/astro/phrfbf/build/lib/python2.6/site-packages/astLib/astWCS.py", line 119, in updateFromHeader 
    self.WCSStructure=wcs.wcsinit(cardstring) 
    File "/home/astro/phrfbf/build/lib/python2.6/site-packages/PyWCSTools/wcs.py", line 70, in wcsinit 
    return _wcs.wcsinit(*args) 
TypeError: in method 'wcsinit', argument 1 of type 'char *' 

, 내가 얻을 :

import pyfits 
from astLib import astWCS 

f = pyfits.open('file.fits') 
header = f[0].header 
f.close() 

w = astWCS.WCS(header, mode='pyfits') # error here also 

오류이있다 pastebin

나는 astWCS 모듈이 WCStools의 래핑 된 버전이라는 것을 알고 있지만 나머지 코드는 P로 사용하고 싶습니다. ython

누구든지이 문제를 해결할 수 있습니까?

+0

어떤 Python 버전을 사용하고 있습니까? –

+0

첫 줄에 나와있는 @Alok : python2.5. 더 명확하게 2.5.4 –

답변

1

이 라이브러리의 업데이트 된 버전이 문제가 해결되었습니다. 모두의 도움에 감사합니다.

0

오, 죄송합니다. 좀 더 자세하게 pastebin을 보면, 내가 생각할 수있는 유일한 오류는 헤더에 유니 코드가있는 이유이다. char *으로 변환 할 수 없으며 오류가 발생합니다. 나는 머리글에서 무엇인가 검색해 보았지만 모든 것이 괜찮아 보인다. 이 작업을 수행하고 출력물을 다른 pastebin에 게시 할 수 있습니까?

import pyfits 

f = pyfits.open('file.fits') 
header = f[0].header 
f.close() 

for x, i in enumerate(header.iteritems()): 
    if len(str(i[1])) >= 70: 
     print x, str(i[1]) 

cardlist = header.ascardlist() 
cardstring = "" 
for card in cardlist: 
    cardstring = cardstring + str(card) 

print repr(cardstring) 

또는, 당신은, "재미"문자 파일 당신의 적합의 헤더를 확인할 수있는 경우이 문제를 해결해야 그들을 제거하기.

관련 문제