2017-04-21 10 views
2

저는 고정 된 하늘 카메라가 있고 WCS 솔루션 (픽셀 x, y를 alt, az로 매핑)에 적합하고 싶습니다. 나는 몇 가지 별을 식별하는 경우, 나는 복합 모델을 그냥 proj_aff = Sky2Pix_ZEA + AffineTransformation2D 말을 한 후 astropy.modeling.fitting에 그를 공급하는 astropy의 능력을 사용하고 싶습니다 thusly 히천체와 식별 된 별을 사용한 WCS 좌표 솔루션

import numpy as np 
from astropy.modeling import models, fitting 
from astropy.modeling.projections import Sky2Pix_ZEA, AffineTransformation2D 
from scipy.optimize import minimize  

# Stars of known x,y on chip and alt,az in sky. 
star_obs = np.array([('Achernar', 3441.0, 2918.0, 49.947050461141515, 215.1280625253878), 
        ('Achernar', 3576.0, 3018.0, 43.715460044327585, 217.98734214492922), 
        ('Betelgeuse', 2123.0, 971.0, 43.319872170968644, 40.984431336638984), 
        ('Betelgeuse', 2330.0, 956.0, 47.122656796538564, 32.091831385823845), 
        ('Betelgeuse', 2677.0, 949.0, 51.30177229534061, 14.886238412655885), 
        ('Canopus', 2221.0, 2671.0, 55.59320568854928, 141.12216403321605)], 
        dtype=[('star_name', 'S10'), ('x', '<f8'), ('y', '<f8'), 
        ('alt', '<f8'), ('az', '<f8')])  

class sky2pix(object): 
    def __init__(self, x, y, alt, az): 
     projection = Sky2Pix_ZEA() 
     self.affine = AffineTransformation2D() 
     self.x = x 
     self.y = y 
     self.projx, self.projy = projection(az, alt) 

    def __call__(self, x0): 
     self.affine.translation.value = x0[0:2] 
     self.affine.matrix.value = x0[2:] 
     newx, newy = self.affine(self.projx, self.projy) 
     residuals = np.sum((newx - self.x)**2 + (newy-self.y)**2) 
     return residuals 

fun = sky2pix(star_obs['x'], star_obs['y'], star_obs['alt'], star_obs['az']) 
x0 = np.array([np.median(star_obs['x']), np.median(star_obs['y']), 1., 0., 0., 1.]) 
fit_result = minimize(fun, x0) 

초기 솔루션을 얻을 수 있습니다 루틴,하지만 난 2 개의 출력을 반환 AffineTransformation2D 다루는 방법을 말할 수 없습니다.

+0

[astrometry.net] (http://astrometry.net)을 사용해 보셨나요? 이 질문에 직접 대답하지는 않지만 그럼에도 문제를 해결할 수 있습니다. – Thucydides411

+0

예. Astrometry.net은 어안 렌즈에 적합하지 않으므로 천정 근처의 작은 컷 아웃을 제공하면 수렴 할 수 있습니다. –

답변

0

현재 astropy.modeling의 피터는 둘 이상의 출력 (내가 마주 쳤던 제한 사항)을 처리 할 수는 없지만 문서에서 명확하지 않았습니다. 또한 모델 Sky2Pix_ZEAAffineTransformation2D은 현재 어떤 이유로 든 fittable=False 속성을 가지고 있습니다.

여러 출력을 지원하기 위해 issue을 열고 그 사이에 documented the limitation을 열었지 만, 곧 누군가가 (곧 출시 될 v2.0 릴리스에는 맞지 않을 것입니다) .

Fitter을 하위 분류로 작성하는 것이 가능합니다 (해당되는 경우 here). 동료는 통계 함수 및 최적화 프로그램과 인터페이스하는 몇 개의 계층 (기존 코드에서 이해할 수 있음)이 있지만 수십 줄의 전문화 된 기술을 작성했습니다.