functions.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Orbit-Fitting 作者: jacob-i-skinner 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号