Commit d0a5deb4 authored by xin's avatar xin
Browse files

PA bug input pointing

parent a626ceb8
......@@ -102,7 +102,29 @@ class Chip(object):
return galsim.PositionD(xcen, ycen)
def transRaDec2D(ra, dec):
x1 = np.cos(dec / 57.2957795) * np.cos(ra / 57.2957795);
y1 = np.cos(dec / 57.2957795) * np.sin(ra / 57.2957795);
z1 = np.sin(dec / 57.2957795);
return np.array([x1, y1, z1])
def getobsPA(ra, dec):
l1 = np.array([0,0,1])
l2 = transRaDec2D(ra, dec)
polar_ec = coord.SkyCoord(0*u.degree, 90*u.degree,frame='barycentrictrueecliptic')
polar_eq = polar_ec.transform_to('icrs')
# print(polar_eq.ra.value,polar_eq.dec.value)
polar_d = transRaDec2D(polar_eq.ra.value, polar_eq.dec.value)
l1l2cross = np.cross(l2,l1)
pdl2cross = np.cross(l2,polar_d)
angle = math.acos(np.dot(l1l2cross,pdl2cross)/(np.linalg.norm(l1l2cross)*np.linalg.norm(pdl2cross)))
angle = (angle)/math.pi*180
# if (ra>90 and ra< 270):
# angle=-angle
return angle
# @jit()
......@@ -165,7 +187,7 @@ def getSelectPointingList(center = [60,-40], radius = 2):
p_result[i,1] = dec
p_result[i,2] = lon
p_result[i,3] = lat
p_result[i,4] = -113.4333
p_result[i,4] = getobsPA(ra, dec) + 90
i = i + 1
return p_result
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment