diff --git a/release_notes.md b/release_notes.md index 8f0aeb2..0253a63 100644 --- a/release_notes.md +++ b/release_notes.md @@ -1,4 +1,6 @@ # 0.10.0 +## 0.10.1 2024-03-19 +- ensure compatibility with spikeglx 202309 metadata coordinates ## 0.10.0 2024-03-14 - add support for online spikeglx reader diff --git a/setup.py b/setup.py index b42c42e..9f1667a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="ibl-neuropixel", - version="0.10.0", + version="0.10.1", author="The International Brain Laboratory", description="Collection of tools for Neuropixel 1.0 and 2.0 probes data", long_description=long_description, diff --git a/src/ibldsp/cadzow.py b/src/ibldsp/cadzow.py index f2184cd..35e58fa 100644 --- a/src/ibldsp/cadzow.py +++ b/src/ibldsp/cadzow.py @@ -135,17 +135,15 @@ def cadzow_np1( WAV = scipy.fft.rfft(wav[:, :]) padgain = scipy.signal.windows.hann(npad * 2)[:npad] WAV = np.r_[ - np.flipud(WAV[1 : npad + 1, :]) * padgain[:, np.newaxis], + np.flipud(WAV[1: npad + 1, :]) * padgain[:, np.newaxis], WAV, - np.flipud(WAV[-npad - 2 : -1, :]) * np.flipud(np.r_[padgain, 1])[:, np.newaxis], + np.flipud(WAV[-npad - 2: -1, :]) * np.flipud(np.r_[padgain, 1])[:, np.newaxis], ] # apply padding - x = np.r_[ - np.flipud(h["x"][1 : npad + 1]), h["x"], np.flipud(h["x"][-npad - 2 : -1]) - ] + x = np.r_[np.flipud(h["x"][1: npad + 1]), h["x"], np.flipud(h["x"][-npad - 2: -1])] y = np.r_[ - np.flipud(h["y"][1 : npad + 1]) - 120, + np.flipud(h["y"][1: npad + 1]) - 120, h["y"], - np.flipud(h["y"][-npad - 2 : -1]) + 120, + np.flipud(h["y"][-npad - 2: -1]) + 120, ] WAV_ = np.zeros_like(WAV) gain = np.zeros(ntr + npad * 2 + 1) @@ -167,6 +165,6 @@ def cadzow_np1( ) WAV_[firstx:lastx, :] += array * gw[:, np.newaxis] - WAV_ = WAV_[npad : -npad - 1] # remove padding + WAV_ = WAV_[npad: -npad - 1] # remove padding wav_ = scipy.fft.irfft(WAV_) return wav_ diff --git a/src/ibldsp/smooth.py b/src/ibldsp/smooth.py index 8dd698f..6db4e16 100644 --- a/src/ibldsp/smooth.py +++ b/src/ibldsp/smooth.py @@ -68,7 +68,7 @@ def rolling_window(x, window_len=11, window="blackman"): 'bartlett', 'blackman'" ) - s = np.r_[x[window_len - 1 : 0 : -1], x, x[-1:-window_len:-1]] + s = np.r_[x[window_len - 1: 0: -1], x, x[-1:-window_len:-1]] # print(len(s)) if window == "flat": # moving average w = np.ones(window_len, "d") @@ -76,7 +76,7 @@ def rolling_window(x, window_len=11, window="blackman"): w = eval("np." + window + "(window_len)") y = np.convolve(w / w.sum(), s, mode="valid") - return y[round((window_len / 2 - 1)) : round(-(window_len / 2))] + return y[round((window_len / 2 - 1)): round(-(window_len / 2))] def non_uniform_savgol(x, y, window, polynom): diff --git a/src/neuropixel.py b/src/neuropixel.py index 18fe10b..1d8c7a0 100644 --- a/src/neuropixel.py +++ b/src/neuropixel.py @@ -357,10 +357,10 @@ def _process_NP24(self, overwrite=False): for first, last in wg.firstlast: chunk_ap = self.sr[first:last, : self.napch].T - chunk_ap_sync = self.sr[first:last, self.idxsyncch :].T + chunk_ap_sync = self.sr[first:last, self.idxsyncch:].T chunk_lf = self.extract_lfp(self.sr[first:last, : self.napch].T) chunk_lf_sync = self.extract_lfp_sync( - self.sr[first:last, self.idxsyncch :].T + self.sr[first:last, self.idxsyncch:].T ) chunk_ap2save = self._ind2save( @@ -466,7 +466,7 @@ def _process_NP21(self, overwrite=False, offset=0, **kwargs): chunk_lf = self.extract_lfp(self.sr[first:last, : self.napch].T) chunk_lf_sync = self.extract_lfp_sync( - self.sr[first:last, self.idxsyncch :].T + self.sr[first:last, self.idxsyncch:].T ) chunk_lf2save = self._ind2save( @@ -670,7 +670,7 @@ def _ind2save(self, chunk, chunk_sync, wg, ratio=1, etype="ap"): chunk[:, slice(*ind2save)].T / self.sr.channel_conversion_sample2v[etype][: self.napch], chunk_sync[:, slice(*ind2save)].T - / self.sr.channel_conversion_sample2v[etype][self.idxsyncch :], + / self.sr.channel_conversion_sample2v[etype][self.idxsyncch:], ] ).astype(np.int16) @@ -686,7 +686,7 @@ def extract_lfp(self, chunk): """ chunk[:, : self.samples_taper] *= self.taper[: self.samples_taper] - chunk[:, -self.samples_taper :] *= self.taper[self.samples_taper :] + chunk[:, -self.samples_taper:] *= self.taper[self.samples_taper:] chunk = scipy.signal.sosfiltfilt(self.sos_lp, chunk) chunk = chunk[:, :: self.ratio] return chunk diff --git a/src/tests/integration/cpu/test_destripe.py b/src/tests/integration/cpu/test_destripe.py index 5a51f3f..82e7337 100644 --- a/src/tests/integration/cpu/test_destripe.py +++ b/src/tests/integration/cpu/test_destripe.py @@ -126,7 +126,7 @@ def test_parallel_computation(self): self.sglx_instances.append(sr_four_append) assert sr_four_append.ns == 2 * sr_four.ns assert np.array_equal( - sr_four_append[sr_four.ns :, :], sr_four_append[: sr_four.ns, :] + sr_four_append[sr_four.ns:, :], sr_four_append[: sr_four.ns, :] ) assert np.array_equal(sr_four_append[: sr_four.ns, :], sr_four[:, :]) - assert np.array_equal(sr_four_append[sr_four.ns :, :], sr_four[:, :]) + assert np.array_equal(sr_four_append[sr_four.ns:, :], sr_four[:, :]) diff --git a/src/tests/unit/cpu/test_waveforms.py b/src/tests/unit/cpu/test_waveforms.py index e9b4c88..0eb0bec 100644 --- a/src/tests/unit/cpu/test_waveforms.py +++ b/src/tests/unit/cpu/test_waveforms.py @@ -196,7 +196,7 @@ def test_extract_waveforms(self): # with NaNs assert wfs[0, self.channels[0], self.trough_offset] == 1.0 assert np.all( - np.isnan(wfs[0, self.num_channels // 2 + self.channels[0] + 1 :, :]) + np.isnan(wfs[0, self.num_channels // 2 + self.channels[0] + 1:, :]) ) for i in range(1, 8):