gastropy.resample_signal#
- gastropy.resample_signal(data, sfreq_orig, sfreq_target)[source]#
Resample a signal to a new sampling frequency.
Uses
scipy.signal.resamplefor polyphase resampling.- Parameters:
- Returns:
resampled (np.ndarray) – Resampled signal.
sfreq_actual (float) – Actual achieved sampling frequency (may differ slightly from target due to integer sample count rounding).
- Raises:
ValueError – If the resampled signal would have fewer than 2 samples.
Examples
>>> import numpy as np >>> from gastropy.signal import resample_signal >>> sig = np.sin(2 * np.pi * 0.05 * np.arange(0, 300, 0.1)) # 10 Hz >>> resampled, actual_rate = resample_signal(sig, 10.0, 2.0)