segment.py 文件源码

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

项目:kaggle-seizure-prediction 作者: sics-lm 项目源码 文件源码
def load_segment(segment_path, old_segment_format=True, normalize_signal=False, resample_frequency=None):
    """
    Convienience function for loading segments
    :param segment_path: Path to the segment file to load.
    :param old_segment_format: If True, the old format will be used. If False, the format backed by a pandas
                               dataframe will be used.
    :param normalize_signal: If True, the signal will be normalized using the subject median and median absolute
                             deviation.
    :param resample_frequency: If this is set to a number, the signal will be resampled to that frequency.
    :return: A Segment or DFSegment object with the data from the segment in *segment_path*.
    """
    if normalize_signal:
        return load_and_standardize(segment_path, old_segment_format=old_segment_format)
    else:
        if old_segment_format:
            segment = Segment(segment_path)
        else:
            segment = DFSegment.from_mat_file(segment_path)
        if resample_frequency is not None:
            segment.resample_frequency(resample_frequency, inplace=True)
        return segment
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号