def sanity_baryCorrAltair(self): """ Checking barycentric correction for Altair (IDL example) """ from PyAstronomy import pyasl vh, vb = pyasl.baryCorr(2449398.5000000000, 297.69488, 8.8676389, deq=2000) self.assertAlmostEqual(vb, 10.583091, delta=1e-5)
def sanity_example(self): """ Sanity of "baryvel" example """ from PyAstronomy import pyasl jd = 2.476468576e6 heli, bary = pyasl.baryvel(jd, deq=2000.0) print "Earth's velocity at JD: ", jd print "Heliocentric velocity [km/s]: ", heli print "Barycentric velocity [km/s] : ", bary # Coordinates of Sirius ra = 101.28715535 dec = -16.71611587 vh, vb = pyasl.baryCorr(jd, ra, dec, deq=2000.0) print "Barycentric velocity of Earth toward Sirius: ", vb
def baryTest2(baryVels, JDs): for i,jd in enumerate((JDs+2400000.5)[:]): heli, bary = pyasl.baryvel(jd, deq=2000.0) # print "Earth's velocity at JD: ", jd # print "Heliocentric velocity [km/s]: ", heli # print "Barycentric velocity [km/s] : ", bary # Coordinates of Sirius ra = 101.28715535 dec = -16.71611587 #thisStar coords ra = np.rad2deg(thisStar.RA_dec) dec = np.rad2deg(thisStar.Dec_dec) print np.rad2deg(thisStar.RA_dec), np.rad2deg(thisStar.Dec_dec), thisStar.name, thisStar.exposures.abs_baryVels[i] vh, vb = pyasl.baryCorr(jd, ra, dec, deq=2000.0) print "Barycentric velocity of Earth toward",thisStar.name,'[m/s]', vb*1000 print vb*1000-thisStar.exposures.abs_baryVels[i] print ''
Dec = tb.deg2rad(-tb.sex2dec(72,4,52.6)) #47Tuc in rad # <codecell> RA, Dec # <codecell> MJDs = [] RVs = [] RV2s = [] RV3s = [] for i in np.arange(MJD-200, MJD+200): vh, vb = tb.baryvel(i+2400000+0.5) vh2, vb2 = pyasl.baryvel(i+2400000+0.5, deq = 0.0) __, RV3 = pyasl.baryCorr(i+2400000+0.5,tb.rad2deg(RA), tb.rad2deg(Dec)) RV = (vb[0]*np.cos(Dec)*np.cos(RA) + vb[1]*np.cos(Dec)*np.sin(RA) + vb[2]*np.sin(Dec))*1000 RV2 = (vb2[0]*np.cos(Dec)*np.cos(RA) + vb2[1]*np.cos(Dec)*np.sin(RA) + vb2[2]*np.sin(Dec))*1000 MJDs.append(i) RVs.append(RV) RV2s.append(RV2) RV3s.append(RV3*1000) RVs = np.array(RVs) RV2s = np.array(RV2s) RV3s = np.array(RV3s) # <codecell> plt.plot(MJDs, RVs) plt.plot(MJDs, RV2s)