2013-06-27 2 views
2

나는 카메라로 삼각대로 찍은 많은 천체 사진을 얻었습니다. 버블 레벨을 사용하여 프레임의 긴 쪽이 수평선에 평행하도록 만들고, 나는 각 사진의 중앙의 alt/az (그리고 적도) 좌표를 알고 있습니다.pyephem을 사용하여 주어진 altaz 좌표에 대해 북쪽과 수평선 사이의 각도를 찾는 방법은 무엇입니까?

이제 북쪽 방향을 표시하기 위해 각 이미지 위에 표시기를 중첩시키는 파이썬 코드를 작성했습니다. pyehem을 사용하여 North Celestial Pole 방향과 주어진 alt/az 좌표의 수평 방향 사이의 각도를 구할 수 있습니까? 어떤 단서?

답변

2

각 이미지에 대해 WCS (World Coordinate System)를 만들려고합니다. 이것은 기본적으로 픽셀 좌표와 하늘 좌표 (RA 및 Dec) 간의 매핑입니다. http://astrometry.net과 같은 도구를 사용하여 이미지에 표시되는 별 모양을 기반으로 이미지를 자동으로 해결할 수 있습니다. 이렇게하면 이미지에 대한 WCS가 생성됩니다.

astrometry.net 솔버 (적합한 종속성을 설치 한 경우)는 알려진 천체가 표시된 이미지의 png 버전을 생성 할 수 있습니다. 이것은 당신의 목적에 충분할 수도 있지만 그렇지 않다면 astropy.wcs 패키지를 사용하여 파이썬에 이미지 WCS를 읽어 이미지의 방향을 결정한 다음 원하는대로 이미지를 마크 업할 수 있습니다.

import math 
import subprocess 
import astropy.units as u 
import astropy.fits as fits 

## Solve the image using the astrometry.net solve-field tool. 
## You'll want to look over the options for solve-field and adapt this call 
## to your images. 
output = subprocess.check_output(['solve-field', filename]) 

## Read Header of Image (assumes you are working off a fits file with a WCS) 
## If not, you can probably read the text header output my astrometry.net in 
## a similar fashion. 
hdulist = fits.open(solvedFilename) 
header = hdulist[0].header 
hdulist.close() 
CD11 = float(header['CD1_1']) 
CD12 = float(header['CD1_2']) 
CD21 = float(header['CD2_1']) 
CD22 = float(header['CD2_2']) 

## This is my code to interpet the CD matrix in the WCS and determine the 
## image orientation (position angle) and flip status. I've used it and it 
## seems to work, but there are some edge cases which are untested, so it 
## might fail in those cases. 
## Note: I'm using astropy units below, you can strip those out if you keep 
## track of degrees and radians manually. 
if (abs(CD21) > abs(CD22)) and (CD21 >= 0): 
    North = "Right" 
    positionAngle = 270.*u.deg + math.degrees(math.atan(CD22/CD21))*u.deg 
elif (abs(CD21) > abs(CD22)) and (CD21 < 0): 
    North = "Left" 
    positionAngle = 90.*u.deg + math.degrees(math.atan(CD22/CD21))*u.deg 
elif (abs(CD21) < abs(CD22)) and (CD22 >= 0): 
    North = "Up" 
    positionAngle = 0.*u.deg + math.degrees(math.atan(CD21/CD22))*u.deg 
elif (abs(CD21) < abs(CD22)) and (CD22 < 0): 
    North = "Down" 
    positionAngle = 180.*u.deg + math.degrees(math.atan(CD21/CD22))*u.deg 
if (abs(CD11) > abs(CD12)) and (CD11 > 0): East = "Right" 
if (abs(CD11) > abs(CD12)) and (CD11 < 0): East = "Left" 
if (abs(CD11) < abs(CD12)) and (CD12 > 0): East = "Up" 
if (abs(CD11) < abs(CD12)) and (CD12 < 0): East = "Down" 
if North == "Up" and East == "Left": imageFlipped = False 
if North == "Up" and East == "Right": imageFlipped = True 
if North == "Down" and East == "Left": imageFlipped = True 
if North == "Down" and East == "Right": imageFlipped = False 
if North == "Right" and East == "Up": imageFlipped = False 
if North == "Right" and East == "Down": imageFlipped = True 
if North == "Left" and East == "Up": imageFlipped = True 
if North == "Left" and East == "Down": imageFlipped = False 
print("Position angle of WCS is {0:.1f} degrees.".format(positionAngle.to(u.deg).value)) 
print("Image orientation is North {0}, East {1}.".format(North, East)) 
if imageFlipped: 
    print("Image is mirrored.") 

## Now you have position angle and flip status and can mark up your image 
:

다음은 목적에 적응하려고 할 수있는 몇 가지 신속하고 더러운 코드입니다

1

노스 천체의 극점을 십자 표시 또는 점으로 찍거나 지평선의 북쪽 지점에 표시하고자하는지 여부는 카메라 렌즈에 관한 질문 인 질문을하는 것입니다. 렌즈, 사진을 찍을 때 사용했던 정확한 초점 거리에서 카메라의 평평한 표면에 하늘의 곡선 모양의 넓은 영역을 매핑하십시오.

이것은 천문학뿐만 아니라 사진을 찍은 다음 나중에 측량 또는 공간 계산을 위해 이미지를 사용하려는 모든 사람이 직면 한 문제입니다.

저는 전문 천문학 자들이 FITS라는 라이브러리를 사용한다고 들었습니다. 제 생각에 카메라에 어떤 종류의 렌즈가 있고 어떤 종류의 왜곡이 생성되는지를 라이브러리에 설명하면 각 픽셀의 좌표를 알려줄 수 있습니다 - 천체 북쪽의 점을 찾을 수 있어야합니다 :

http://fits.gsfc.nasa.gov/fits_libraries.html