suboptimumg.log_analysis.utils#
- suboptimumg.log_analysis.utils.estimate_fs(t_s)[source]#
Median-step sample-rate estimate (Hz) from a seconds time vector.
- Parameters:
t_s (NDArray[float64])
- Return type:
float
- suboptimumg.log_analysis.utils.safe_gradient(signal, dt)[source]#
Compute a time derivative that is robust to zero-width time steps, so that duplicate timestamps do not produce inf or NaN values.
- Parameters:
signal (NDArray[np.float64]) – The signal to differentiate.
dt (NDArray[np.float64]) – Time step array. Must be the same length as
signal.
- Returns:
d(signal)/dtwith NaNs from zero-width steps filled by linear interpolation between the nearest valid neighbours.- Return type:
NDArray[np.float64]