19 lines
620 B
Python
19 lines
620 B
Python
|
"""
|
|||
|
@Author: cys
|
|||
|
@Email: 2022024904@m.scnu.edu.cn
|
|||
|
@FileName: resample_1000hz.py
|
|||
|
@Function: 将预处理后的数据(100Hz)重采样至1000Hz
|
|||
|
@DateTime: 2023/11/27 9:59
|
|||
|
@SoftWare: PyCharm
|
|||
|
"""
|
|||
|
|
|||
|
from scipy.signal import resample
|
|||
|
|
|||
|
def upsample(original_signal, original_sampling_rate, target_sampling_rate):
|
|||
|
""""""
|
|||
|
# 计算重采样后的数据点数量
|
|||
|
num_samples_target = int(len(original_signal) * (target_sampling_rate / original_sampling_rate))
|
|||
|
# 使用 scipy 的 resample 函数进行重采样
|
|||
|
resampled_signal = resample(original_signal, num_samples_target)
|
|||
|
|
|||
|
return resampled_signal
|