diff --git a/cd_network/coincidence_integral.py b/cd_network/coincidence_integral.py index 2f2ea65..47433dc 100644 --- a/cd_network/coincidence_integral.py +++ b/cd_network/coincidence_integral.py @@ -2,7 +2,7 @@ from typing import Callable import numpy as np -from scipy import integrate, signal +from scipy import signal from .utils import hashable_input @@ -66,17 +66,7 @@ def coincidence_integral( if method in filter_methods: return filter_methods[method](x) - num_inputs, num_samples = x.shape - output = np.zeros((num_inputs, num_samples)) - - for i in range(num_inputs): - if method == "cumtrapz": - output[i, :] = integrate.cumtrapz(y=x[i, :], dx=dt, initial=0) - output[i, samples_integral:] -= output[i, :-samples_integral] - else: - raise ValueError(f'method {method} is not supported.') - - return output + raise ValueError(f'method {method} is not supported.') @lru_cache(maxsize=None) diff --git a/tests/test_cd_integral.py b/tests/test_cd_integral.py index 92add80..2182721 100644 --- a/tests/test_cd_integral.py +++ b/tests/test_cd_integral.py @@ -34,12 +34,8 @@ def test_coincidence_integral(self): x = np.random.randn(3, 100) integration_duration = 1 fs = 5 # sample frequency - methods = ["filtfilt", "lfilter", "cumtrapz", "trapz", "simps", "romb"] + methods = ["filtfilt", "lfilter"] for method in methods: - if ( - method in ["romb"] and x.shape[1] % 2 == 0 - ): # Romb requires 2^n + 1 samples - continue result = coincidence_integral(x, integration_duration, fs, method) self.assertEqual(result.shape, x.shape)