ride.py 文件源码

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

项目:scikit-cycling 作者: scikit-cycling 项目源码 文件源码
def training_stress_pma_grappe_score(X, pma):
    """Compute the training stress score using the MAP.

    Parameters
    ----------
    X : array-like, shape (n_samples, )
        Array containing the power intensities for a ride.

    pma : float
        Maximum Anaerobic Power.

    Returns
    -------
    tss_score: float
        Return the training stress score.

    """
    # Check the consistency of X and pma
    if len(X.shape) != 1:
        raise ValueError('X should have 1 dimension. Got {}, instead'.format(
            len(X.shape)))

    # Compute the stress for each item of the ESIE
    tss_grappe = 0.
    for key_sc in TS_SCALE_GRAPPE.keys():

        # Count the number of elements which corresponds to as sec
        # We need to convert it to minutes
        curr_stress = np.count_nonzero(
            np.bitwise_and(X >= ESIE_SCALE_GRAPPE[key_sc][0] * pma,
                           X < ESIE_SCALE_GRAPPE[key_sc][1] * pma)) / 60

        # Compute the cumulative stress
        tss_grappe += curr_stress * TS_SCALE_GRAPPE[key_sc]

    return tss_grappe
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号