1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | #arg 1 RA of IHMP center |
---|
4 | #arg 2 Dec of IHMP center |
---|
5 | #arg 3 angle of IHMP (all from remedy) |
---|
6 | #arg 4 correction for differential atmospheric dispersion |
---|
7 | #arg 5 RA of target star |
---|
8 | #arg 6 Dec of target star |
---|
9 | |
---|
10 | from astropy import wcs |
---|
11 | import numpy as np |
---|
12 | |
---|
13 | import sys |
---|
14 | |
---|
15 | ARCSECPERDEG = 1.0/3600.0 |
---|
16 | |
---|
17 | # make a WCS object with appropriate FITS headers |
---|
18 | tp = wcs.WCS(naxis=2) |
---|
19 | tp.wcs.crpix = [0., 0.] # central "pixel" |
---|
20 | tp.wcs.crval = [np.float(sys.argv[1]), |
---|
21 | np.float(sys.argv[2])] # tangent point |
---|
22 | tp.wcs.ctype = ['RA---TAN', 'DEC--TAN'] |
---|
23 | # pixel scale in arcsecond |
---|
24 | |
---|
25 | x_scale=-1. |
---|
26 | |
---|
27 | y_scale=1. |
---|
28 | |
---|
29 | tp.wcs.cdelt = [ARCSECPERDEG * x_scale, |
---|
30 | ARCSECPERDEG * y_scale] |
---|
31 | |
---|
32 | # Put rotation into radians |
---|
33 | rrot = np.deg2rad(np.float(sys.argv[3])) |
---|
34 | # clockwise rotation matrix |
---|
35 | tp.wcs.pc = [[np.cos(rrot), np.sin(rrot)], [-1.0*np.sin(rrot), np.cos(rrot)]] |
---|
36 | |
---|
37 | FPLANE_Y, FPLANE_X = tp.wcs_world2pix(np.float(sys.argv[5]), |
---|
38 | np.float(sys.argv[6]), 1) |
---|
39 | |
---|
40 | #apply atmospheric dispersion correction |
---|
41 | FPLANE_Y += np.float(sys.argv[4]) |
---|
42 | |
---|
43 | print('fplane x,y='+str(FPLANE_X)+','+str(FPLANE_Y)) |
---|
44 | |
---|