Release 0.9.0
This release is titled to accompany the 2nd Elephant User Workshop
Viziphant
Meet Viziphant, the visualization of Elephant analysis methods, at https://viziphant.readthedocs.io/en/latest/. This package provides support to easily plot and visualize the output of Elephant functions in a few lines of code.
Provenance tracking
Provenance is becoming a separate direction in Elephant. Many things are still to come, and we started with annotating time_histogram
, instantaneous_rate
and cross_correlation_histogram
outputs to carry the information about the parameters these functions used. This allowed Viziphant, the visualization of Elephant analyses, to look for the .annotations
dictionary of the output of these function to "understand" how the object has been generated and label the plot axes accordingly.
New functionality and features
- Time-domain pairwise and conditional pairwise Granger causality measures (#332, #359)
- Spike contrast function that measures the synchrony of spike trains (#354; thanks to @Broxy7 for bringing this in Elephant).
- Revised local variability LvR (#346) as an alternative to the LV measure.
- Three surrogate methods: Trial-shifting, Bin Shuffling, ISI dithering (#343).
- Added a new function to generate spike trains:
inhomogeneous_gamma_process
(#339). - The output of
instantaneous_rate
function is now a 2D matrix of shape(time, len(spiketrains))
(#363). Not only can the users assess the averaged instantaneous rate (rates.mean(axis=1)
) but also explore how much the instantaneous rate deviates from trial to trial (rates.std(axis=1)
) (originally asked in #363).
Python 3 only
- Python 2.7 and 3.5 support is dropped. You can still however enjoy the features of Elephant v0.9.0 with Python 2.7 or 3.5 by installing Elephant from this commit
pip install git+https://github.com/NeuralEnsemble/elephant@295c6bd7fea196cf9665a78649fafedab5840cfa#egg=elephant[extras]
- Added Python 3.9 support.
Optimization
- You have been asking for direct numpy support for years. Added
_t_start
,_t_stop
, and_bin_size
attributes of BinnedSpikeTrain are guaranteed to be of the same units and hence are unitless (#378). It doesn't mean though that you need to care about units on your own:t_start
,t_stop
, andbin_size
properties are still quantities with units. The.rescale()
method of a BinnedSpikeTrain rescales the internal units to new ones in-place. The following Elephant functions are optimized with unitless BinnedSpikeTrain:- cross_correlation_histogram
- bin_shuffling (one of the surrogate methods)
- spike_train_timescale
- X4 faster binning and overall BinnedSpikeTrain object creation (#368).
instantaneous_rate
function is vectorized to work with a list of spike train trials rather than computing them in a loop (previously,for spiketrain in spiketrains; do compute instantaneous_rate(spiketrain); done
), which brought X25 speedup (#362; thanks to @gyyang for the idea and original implementation).- Memory-efficient
zscore
function (#372). - Don't sort the input array in ISI function (#371), which reduces function algorithmic time complexity from
O(N logN)
to linearO(N)
. Now, when the input time array is not sorted, a warning is shown. - Vectorized Current Source Density
generate_lfp
function (#358).
Breaking changes
- mpi4py package is removed from the extra requirements to allow
pip install elephant[extras]
on machines without MPI installed system-wide. Refer to MPI support installation page in elephant. - BinnedSpikeTrain (#368, #377):
- previously, when t_start/stop, if set manually, was outside of the shared time interval, only the shared [t_start_shared=max(t_start), t_stop_shared=min(t_stop)] interval was implicitly considered without any warnings. Now an error is thrown with a description on how to fix it.
- removed
lst_input
,input_spiketrains
,matrix_columns
,matrix_rows
(in favor of the new attribute -shape
),tolerance
,is_spiketrain
,is_binned
attributes from BinnedSpikeTrain class. Part of them are confusing (e.g.,is_binned
was just the opposite ofis_spiketrain
, but one can erroneously think that it's data is clipped to 0 and 1), and part of them -lst_input
,input_spiketrains
input data - should not have been saved as attributes of an object in the first place because the input spike trains are not used after the sparse matrix is created. - now the users can directly access
.sparse_matrix
attribute of BinnedSpikeTrain to do efficient (yet unsafe in general) operations. For this reason,to_sparse_array()
function, which does not make a copy, as one could think of, is deprecated.
instantaneous_rate
function (#362):- in case of multiple input spike trains, the output of the instantaneous rate function is (always) a 2D matrix of shape
(time, len(spiketrains))
instead of a pseudo 1D array (previous behavior) of shape(time, 1)
that contained the instantaneous rate summed across input spike trains; - in case of multiple input spike trains, the user needs to manually provide the input kernel instead of
auto
, which is set by default, for the reason that it's currently not clear how to estimate the common kernel for a set of spike trains. If you have an idea how to do this, we`d appreciate if you let us know by getting in touch with us.
- in case of multiple input spike trains, the output of the instantaneous rate function is (always) a 2D matrix of shape
Other changes
waveform_snr
function now directly takes a 2D or 3D waveforms matrix rather than a spike train (deprecated behavior).- Added a warning in fanofactor function when the input spiketrains vary in their durations (#341).
- SPADE: New way to count patterns for multiple testing (#347)
- GPFA renamed 'xsm' -> 'latent_variable' and 'xorth' -> 'latent_variable_orth'
Bug fixes
- Instantaneous rate arrays were not centered at the origin for spike trains that are symmetric at t=0 with
center_kernel=True
option (#362). - The number of discarded spikes that fall into the last bin of a BinnedSpikeTrain object was incorrectly calculated (#368).
- Fixed index selection in
spike_triggered_phase
(#382) - Fixed surrogates bugs: