diff --git a/phys2denoise/metrics/cardiac.py b/phys2denoise/metrics/cardiac.py index f52d7b2..b8b2dcc 100644 --- a/phys2denoise/metrics/cardiac.py +++ b/phys2denoise/metrics/cardiac.py @@ -53,7 +53,7 @@ def _crf(t): dt = tr / oversampling time_stamps = np.linspace( - 0, time_length, np.rint(float(time_length) / dt).astype(np.int) + 0, time_length, np.rint(float(time_length) / dt).astype(int) ) time_stamps -= onset crf_arr = _crf(time_stamps) diff --git a/phys2denoise/metrics/chest_belt.py b/phys2denoise/metrics/chest_belt.py index 85be77c..9417e67 100644 --- a/phys2denoise/metrics/chest_belt.py +++ b/phys2denoise/metrics/chest_belt.py @@ -162,7 +162,7 @@ def env(resp, samplerate, window=10): @due.dcite(references.CHANG_GLOVER_2009) -def rv(resp, samplerate, window=6, lags=(0,)): +def rv(resp, samplerate, window=6): """Calculate respiratory variance. Parameters @@ -260,7 +260,7 @@ def _rrf(t): dt = tr / oversampling time_stamps = np.linspace( - 0, time_length, np.rint(float(time_length) / dt).astype(np.int) + 0, time_length, np.rint(float(time_length) / dt).astype(int) ) time_stamps -= onset rrf_arr = _rrf(time_stamps) diff --git a/phys2denoise/metrics/utils.py b/phys2denoise/metrics/utils.py index 7426a5c..9d41e77 100644 --- a/phys2denoise/metrics/utils.py +++ b/phys2denoise/metrics/utils.py @@ -116,9 +116,9 @@ def apply_lags(arr1d, lags): arr_with_lags = np.zeros((arr1d.shape[0], len(lags))) for i_lag, lag in enumerate(lags): if lag < 0: - arr_delayed = np.hstack((arr1d[lag:], np.zeros(lag))) + arr_delayed = np.hstack((arr1d[abs(lag):], np.zeros(abs(lag)))) elif lag > 0: - arr_delayed = np.hstack((np.zeros(lag), arr1d[lag:])) + arr_delayed = np.hstack((np.zeros(lag), arr1d[:-lag])) else: arr_delayed = arr1d.copy() arr_with_lags[:, i_lag] = arr_delayed