From 123ca040b11a5961643c4de080df89af9b1fcd24 Mon Sep 17 00:00:00 2001 From: Moritz Kern <92092328+Moritz-Alexander-Kern@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:58:28 +0100 Subject: [PATCH] [Fix] neo v0.13.4 deprecated copy (#646) * remove copy from conversion * remove copy from spike_train_correlation * fix surrogates * fix statistics --- elephant/conversion.py | 2 +- elephant/spike_train_correlation.py | 2 +- elephant/spike_train_surrogates.py | 7 ++----- elephant/statistics.py | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/elephant/conversion.py b/elephant/conversion.py index f3686d643..a80b51ee0 100644 --- a/elephant/conversion.py +++ b/elephant/conversion.py @@ -854,7 +854,7 @@ def to_spike_trains(self, spikes="random", as_array=False, array_ants = dict(bins=bin_indices) spiketrain = neo.SpikeTrain(spiketrain, t_start=self._t_start, t_stop=self._t_stop, - units=self.units, copy=False, + units=self.units, description=description, array_annotations=array_ants, bin_size=self.bin_size) diff --git a/elephant/spike_train_correlation.py b/elephant/spike_train_correlation.py index 65ccf6800..1d7cf0656 100644 --- a/elephant/spike_train_correlation.py +++ b/elephant/spike_train_correlation.py @@ -809,7 +809,7 @@ def cross_correlation_histogram( signal=np.expand_dims(cross_corr, axis=1), units=pq.dimensionless, t_start=t_start, - sampling_period=binned_spiketrain_i.bin_size, copy=False, + sampling_period=binned_spiketrain_i.bin_size, **annotations) return cch_result, lags diff --git a/elephant/spike_train_surrogates.py b/elephant/spike_train_surrogates.py index 5d6cd4300..962596423 100644 --- a/elephant/spike_train_surrogates.py +++ b/elephant/spike_train_surrogates.py @@ -736,7 +736,6 @@ def _continuous_time_bin_shuffling(spiketrain, max_displacement, bin_size, units=units, t_start=t_start, t_stop=t_stop, - copy=False, ) surrogate_spiketrains.append(surrogate_spiketrain) @@ -1252,8 +1251,7 @@ def trial_shifting(spiketrains, dither, n_surrogates=1): surrogate_spiketrain[trial_id] * pq.s, t_start=t_starts[trial_id] * pq.s, t_stop=t_stops[trial_id] * pq.s, - units=units, - sampling_rate=sampling_rates[trial_id]) + sampling_rate=sampling_rates[trial_id]).rescale(units) for trial_id in range(len(surrogate_spiketrain))] for surrogate_spiketrain in surrogate_spiketrains] @@ -1337,8 +1335,7 @@ def _trial_shifting_of_concatenated_spiketrain( np.hstack(surrogate_spiketrain) * pq.s, t_start=t_start * pq.s, t_stop=t_stop * pq.s, - units=units, - sampling_rate=spiketrain.sampling_rate) + sampling_rate=spiketrain.sampling_rate).rescale(units) for surrogate_spiketrain in surrogate_spiketrains] return surrogate_spiketrains diff --git a/elephant/statistics.py b/elephant/statistics.py index 0ab389572..45d9cd283 100644 --- a/elephant/statistics.py +++ b/elephant/statistics.py @@ -1201,7 +1201,7 @@ def _rate() -> pq.Quantity: sampling_period=bin_size, units=normalised_bin_hist.units, t_start=binned_spiketrain.t_start, - normalization=output, copy=False) + normalization=output) @deprecated_alias(binsize='bin_size')