def v_rad(K, tau, e, long, T0, v0, times): """ Calculate the radial (line-of-sight) velocity for a Keplerian orbit as a function of orbital parameters, COM velocity, and time. The parameters are: K = velocity amplitude tau = period e = eccentricity long = longitude of periastron (radians) T0 = time of periastron crossing v0 = COM velocity The times argument can be either a single float (with the velocity returned as a float) or an array of floats (with the velocity returned as a corresponding array). tau, T0 and times should be in the same units (typically days). K can use a different unit of time (typically m/s). """ fkepler.setup_Tp(tau, e, T0) if type(times)==float: c, s = fkepler.t2TA(times) # Get cos, sin of true anomaly else: c, s = fkepler.vt2TA(times) return v0 + K*cos(long)*(e+c) + K*sin(long)*s
def v_rad(K, tau, e, long, T0, v0, times): """ Calculate the radial (line-of-sight) velocity for a Keplerian orbit as a function of orbital parameters, COM velocity, and time. The parameters are: K = velocity amplitude tau = period e = eccentricity long = longitude of periastron (radians) T0 = time of periastron crossing v0 = COM velocity The times argument can be either a single float (with the velocity returned as a float) or an array of floats (with the velocity returned as a corresponding array). tau, T0 and times should be in the same units (typically days). K can use a different unit of time (typically m/s). """ fkepler.setup_Tp(tau, e, T0) if type(times) == float: c, s = fkepler.t2TA(times) # Get cos, sin of true anomaly else: c, s = fkepler.vt2TA(times) return v0 + K * cos(long) * (e + c) + K * sin(long) * s
def Kepler_setup(tau, e, T0, t): global Kepler_c, Kepler_s fkepler.setup(tau, e, T0) Kepler_c, Kepler_s = fkepler.t2TA(t)