A test stand records a steady force of 12 newtons. A report reduces the sample rate from 300 Hz to 200 Hz, then checks the lowest and highest values in the exported window. With the default boundary setting in SciPy, the first resampled value drops close to 10 newtons and the last rises above 12.6. The original trace contains neither of those changes.
Compare two assumptions outside the recorded window
SciPy's polyphase resampler applies a low-pass filter while changing the rate by a rational factor. The filter uses samples on both sides of a point, so near the ends it needs a rule for values beyond the supplied array. The default constant padding uses zero. The line option extends the line through the first and last observed samples. For a constant trace that line has zero slope and stays at the measured level.
import numpy as np
from scipy.signal import resample_poly
force_n = np.full(33, 12.0)
zero_padded = resample_poly(force_n, up=2, down=3)
line_padded = resample_poly(
force_n, up=2, down=3, padtype="line",
)
assert len(zero_padded) == len(line_padded) == 22
assert np.allclose(zero_padded[[0, -1]], [10.00373, 12.60224])
assert np.max(np.abs(line_padded - 12.0)) < 0.01
With SciPy 1.18.1 and NumPy 2.5.5, the first and last values under zero padding were approximately 10.00373 and 12.60224 N. Under line padding they were approximately 12.00261 and 11.99739 N. The maximum departure from 12 N with line padding in this fixture was about 0.00261 N. These are results for the selected rate ratio and default filter. A different filter or rate ratio changes the numbers.
Test the report where the record begins and ends
A window cut from the middle of a steady hold and a window that begins during contact can justify different boundary assumptions. With an endpoint ramp, extending a line through both ends can imply motion before or after the recorded window. When neighboring samples are available, include them during filtering and select the intended time interval afterward. For an isolated record, preserve the raw endpoints and document the padding choice. Use a constant trace and a trace with a known real transition as separate tests, then verify that the report can distinguish boundary artifacts from measured events.
Sources
SciPy resample_poly reference for rate conversion and boundary assumptions
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.resample_poly.html
SciPy upfirdn reference for signal extension modes
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.upfirdn.html