def test_interpolated_phase_consistent(): """ Confirm consistency in beta bandpass filter results on a neural signal """ # Load data data_idx = 1 x = _load_example_data(data_idx=data_idx) Fs = 1000 f_range = (13, 30) # Load ground truth phase time series phaPTRD_true = np.load( os.path.dirname(neurodsp.__file__) + '/tests/data/sample_data_' + str(data_idx) + '_phaPTRD.npy') # Compute phase time series Ps, Ts = shape.find_extrema(x, Fs, f_range) zeroxR, zeroxD = shape.find_zerox(x, Ps, Ts) phaPTRD = shape.extrema_interpolated_phase(x, Ps, Ts, zeroxR=zeroxR, zeroxD=zeroxD) # Compute difference between current and past filtered signals signal_diff = phaPTRD - phaPTRD_true assert np.allclose(np.sum(np.abs(signal_diff)), 0, atol=10**-5)
def test_Ps_consistent(): """ Confirm consistency in peak finding """ # Load data data_idx = 1 x = _load_example_data(data_idx=data_idx) Fs = 1000 f_range = (13, 30) # Load ground truth lagged coherence Ps_true = np.load( os.path.dirname(neurodsp.__file__) + '/tests/data/sample_data_' + str(data_idx) + '_Ps.npy') # Compute lagged coherence Ps, Ts = shape.find_extrema(x, Fs, f_range) # Compute difference between current and past signals signal_diff = Ps - Ps_true assert np.allclose(np.sum(np.abs(signal_diff)), 0, atol=10**-5)