def moon_asteroid(pos): moon_RA_deg = od.HMStoDeg(pos[0]) ast_RA_deg = od.HMStoDeg(pos[1]) moon_dec_deg = od.DMStoDeg(pos[2]) ast_dec_deg = od.DMStoDeg(pos[3]) angle = 0 m_RA = moon_RA_deg * pi / 180 a_RA = ast_RA_deg * pi / 180 m_dec = moon_dec_deg * pi / 180 a_dec = ast_dec_deg * pi / 180 RA_dif = abs(m_RA - a_RA) angle = acos( sin(m_dec) * sin(a_dec) + cos(m_dec) * cos(a_dec) * cos(RA_dif)) ang_sep_deg = angle / pi * 180 deg = int(ang_sep_deg) minute = int((ang_sep_deg - int(ang_sep_deg)) * 60) sec = ang_sep_deg % 15 / 1000 * 60 ang_sep = str(deg) + ':' + str(minute) + ':' + str(sec) print('Date and time: July 7 05:00 to 08:00 UTC') print('RA and Dec for 99795: 17:37:59.80, -24:55:30.8') print('RA and Dec for moon: 11:07:22.52, +09:31:09.1') print('Angular separation between the Moon and 99795: ', ang_sep)
def getRhoHat(rah, ram, ras, dech, decm, decs): raRad = odlib.degreesToRadians(odlib.HMStoDeg(rah, ram, ras)) decRad = odlib.degreesToRadians(odlib.DMStoDeg(dech, decm, decs)) rhox = cos(raRad) * cos(decRad) rhoy = sin(raRad) * cos(decRad) rhoz = sin(decRad) return [rhox, rhoy, rhoz]
def find_vector(): RA = [[18, 41, 48.08], [18, 14, 30.53], [17, 54, 29.36]] DEC = [[36, 15, 14.1], [36, 9, 46.0], [34, 29, 32.2]] for i in range(3): RA[i] = od.HMStoDeg(RA[i]) * pi / 180 DEC[i] = od.DMStoDeg(DEC[i]) * pi / 180 rho_hat1 = [ cos(RA[0]) * cos(DEC[0]), sin(RA[0]) * cos(DEC[0]), sin(DEC[0]) ] # calculating rho from RA and Dec rho_hat2 = [ cos(RA[1]) * cos(DEC[1]), sin(RA[1]) * cos(DEC[1]), sin(DEC[1]) ] rho_hat3 = [ cos(RA[2]) * cos(DEC[2]), sin(RA[2]) * cos(DEC[2]), sin(DEC[2]) ] rho1 = [0.07410335127715940, -.4015611046271995, 0.2994573000142365] # exact rho values rho2 = [0.02816887198319436, -0.4437310883473226, 0.3249882273840305] rho3 = [-0.01187334735101580, -0.4953819999141603, 0.3404906007681184] rho_hat_1_ex = [ rho1[0] / od.mag(rho1), rho1[1] / od.mag(rho1), rho1[2] / od.mag(rho1) ] # rho hat calculation from exact values rho_hat_2_ex = [ rho2[0] / od.mag(rho2), rho2[1] / od.mag(rho2), rho2[2] / od.mag(rho2) ] rho_hat_3_ex = [ rho3[0] / od.mag(rho3), rho3[1] / od.mag(rho3), rho3[2] / od.mag(rho3) ] error_1x = (rho_hat1[0] - rho_hat_1_ex[0])**2 # error by component error_1y = (rho_hat1[1] - rho_hat_1_ex[1])**2 error_1z = (rho_hat1[2] - rho_hat_1_ex[2])**2 error_2x = (rho_hat2[0] - rho_hat_2_ex[0])**2 error_2y = (rho_hat2[1] - rho_hat_2_ex[1])**2 error_2z = (rho_hat2[1] - rho_hat_2_ex[1])**2 error_3x = (rho_hat3[0] - rho_hat_3_ex[0])**2 error_3y = (rho_hat3[1] - rho_hat_3_ex[1])**2 error_3z = (rho_hat3[2] - rho_hat_3_ex[2])**2 error_1 = error_1x - error_1y - error_1z # cummulative error error_2 = error_2x - error_2y - error_2z error_3 = error_3x - error_3y - error_3z print('Error for rho 1: ', error_1) print('Error for rho 2: ', error_2) print('Error for rho 3: ', error_3)
def __init__(self, x, y, rah, ram, ras, decd, decam, decas, m): self.x = x self.y = y self.RAhr = rah self.RAmin = ram self.RAsec = ras self.RA = odlib.HMStoDeg(rah, ram, ras) self.DECdeg = decd self.DECamin = decam self.DECasec = decas self.DEC = odlib.DMStoDeg(decd, decam, decas) self.mag = m
def getRhoHat(rah, ram, ras=0, dech=0, decm=0, decs=0): # First two elements will be RA (hr) and DEC (deg) if radecAsDecimal if radecAsDecimal: raRad = odlib.degreesToRadians(rah * 15) decRad = odlib.degreesToRadians(ram) else: raRad = odlib.degreesToRadians(odlib.HMStoDeg(rah, ram, ras)) decRad = odlib.degreesToRadians(odlib.DMStoDeg(dech, decm, decs)) rhox = cos(raRad) * cos(decRad) rhoy = sin(raRad) * cos(decRad) rhoz = sin(decRad) return np.array([rhox, rhoy, rhoz])
import copy as cp # defining input values! RA = [[18, 41, 48.08], [18, 14, 30.53], [17, 54, 29.36]] DEC = [[36, 15, 14.1], [36, 9, 46.0], [34, 29, 32.2]] R = [[-0.2069177625542078, 0.9132792377095497, 0.3959074080096284], [-0.3689266994628273, 0.8690904003976556, 0.3767540914983889], [-0.5205074019556455, 0.8003914633545058, 0.3469760777959491]] k = 0.01720209847 t1 = 2458303.5 t2 = 2458313.5 t3 = 2458323.5 for i in range(3): RA[i] = od.HMStoDeg(RA[i]) * pi / 180 DEC[i] = od.DMStoDeg(DEC[i]) * pi / 180 rho_hat1 = [cos(RA[0]) * cos(DEC[0]), sin(RA[0]) * cos(DEC[0]), sin(DEC[0])] # calculating rho from RA and Dec rho_hat2 = [cos(RA[1]) * cos(DEC[1]), sin(RA[1]) * cos(DEC[1]), sin(DEC[1])] rho_hat3 = [cos(RA[2]) * cos(DEC[2]), sin(RA[2]) * cos(DEC[2]), sin(DEC[2])] T0 = k * (t3 - t1) T1 = k * (t1 - t2) T3 = k * (t3 - t2) a1 = T3 / T0 a2 = -1 a3 = -T1 / T0 a = [a1, a2, a3] D0 = od.dot(rho_hat1, od.cross(rho_hat2, rho_hat3))