Skip to content

Commit

Permalink
[Fix] neo v0.13.4 deprecated copy (NeuralEnsemble#646)
Browse files Browse the repository at this point in the history
* remove copy from conversion

* remove copy from spike_train_correlation

* fix surrogates

* fix statistics
  • Loading branch information
Moritz-Alexander-Kern authored Oct 28, 2024
1 parent c6d047d commit 123ca04
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion elephant/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion elephant/spike_train_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 2 additions & 5 deletions elephant/spike_train_surrogates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion elephant/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 123ca04

Please sign in to comment.