def wilson(data):
'''
Calculate useful things like mass ratio and systemic velocity.
Parameters
----------
data : list
Radial velocity pairs in a 2D list.
Returns
-------
-slope : float
Mass Ratio of the system. The ratio of the secondary
component mass to the primary.
intercept : float
y-intercept of the line which fits data.
stderr : float
Standard error of the estimated gradient.
'''
from scipy.stats import linregress
# Primary RVs on y.
y = [datum[1] for datum in data if not np.isnan(datum[1]+datum[2])]
# Secondary RVs on x.
x = [datum[2] for datum in data if not np.isnan(datum[1]+datum[2])]
slope, intercept, rvalue, pvalue, stderr = linregress(x,y)
return -slope, intercept, stderr
评论列表
文章目录