Skip to content

Instantly share code, notes, and snippets.

@segasai
Created April 8, 2016 17:23
Show Gist options
  • Save segasai/419b84993642a9ea9ca8c5a9b363283c to your computer and use it in GitHub Desktop.
Save segasai/419b84993642a9ea9ca8c5a9b363283c to your computer and use it in GitHub Desktop.
import numpy as np
cosd = lambda x: np.cos(np.deg2rad(x))
sind = lambda x: np.sin(np.deg2rad(x))
# cosine and sine in degrees
ra0,dec0=210.,-62.
# initial coordinates
X0 = np.r_[cosd(ra0)*cosd(dec0), sind(ra0)*cosd(dec0), sind(dec0)]
#vector pointing towards the star
Vra = np.r_[-sind(ra0) * cosd(dec0), cosd(ra0)*cosd(dec0), 0]
Vra = Vra/(Vra**2).sum()**.5
#tangential unit vector towards increasing RA
Vdec = np.r_[-cosd(ra0)*sind(dec0), -sind(ra0)*sind(dec0), cosd(dec0)]
Vdec = Vdec/(Vdec**2).sum()**.5
#tangential unit vector towards increasing Dec
mura = -3.775 # in arcsec per year
mudec = .768 #
mu = np.deg2rad(mura/3600.) * Vra + np.deg2rad(mudec/3600.)*Vdec
dt = 16 #years
# New 3-D vector
X1 = X0+ mu*dt
# compute new ra,dec from the 3-D vector
dec1 = np.rad2deg(np.arcsin(X1[2]))
ra1 = np.rad2deg(np.arctan2(X1[1], X1[0]))
ra1 = (ra1+360)%360
# compute the ra,dec using just simple linear corrections
ra1_dummy = ra0 + mura/3600./cosd(dec0)*dt
dec1_dummy = dec0 + mudec/3600*dt
print ra1,dec1
print ra1_dummy,dec1_dummy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment