Skip to content

Commit

Permalink
Release v0.9.0 (NeuralEnsemble#379)
Browse files Browse the repository at this point in the history
* added viziphant info

* don't test deprecated ChannelIndex

* added python 3.9 support

* neo 0.9; python 3 only
  • Loading branch information
dizcza committed Nov 13, 2020
1 parent fa5e8eb commit 8e465fd
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 97 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ ignored/

# data
*.nix

# neo logs
**/logs
20 changes: 3 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ addons:

matrix:
include:
- name: "conda 2.7"
python: 2.7
env: DISTRIB="conda"
before_install: sed -i 's/conda-forge/conda/g' requirements/environment.yml

- name: "pip 2.7"
python: 2.7
env: DISTRIB="pip"

- name: "pip 3.5"
python: 3.5
env: DISTRIB="pip"

- name: "pip 3.6 requirements-extras"
python: 3.6
env: DISTRIB="pip"
Expand All @@ -40,8 +27,8 @@ matrix:
python: 3.8
env: DISTRIB="conda"

- name: "pip 3.8"
python: 3.8
- name: "pip 3.9"
python: 3.9
env: DISTRIB="pip"

- name: "docs"
Expand All @@ -60,8 +47,7 @@ matrix:
install:
- if [[ "${DISTRIB}" == "conda" ]];
then
py_major=${TRAVIS_PYTHON_VERSION:0:1};
wget https://repo.continuum.io/miniconda/Miniconda${py_major}-latest-Linux-x86_64.sh -O miniconda.sh;
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda;
source "$HOME/miniconda/etc/profile.d/conda.sh";
conda config --set always_yes yes;
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Elephant - Electrophysiology Analysis Toolkit

![](https://travis-ci.org/NeuralEnsemble/elephant.png?branch=master "Unit Test Status")
![](https://coveralls.io/repos/NeuralEnsemble/elephant/badge.png "Unit Test Coverage")
![](https://readthedocs.org/projects/elephant/badge/?version=latest "Documentation Status")
![](https://img.shields.io/pypi/v/elephant)
![](https://img.shields.io/pypi/dm/elephant)
[![Build Status](https://travis-ci.org/NeuralEnsemble/elephant.svg?branch=master)](https://travis-ci.org/NeuralEnsemble/elephant)
[![Coverage Status](https://coveralls.io/repos/github/NeuralEnsemble/elephant/badge.svg?branch=master)](https://coveralls.io/github/NeuralEnsemble/elephant?branch=master)
[![Documentation Status](https://readthedocs.org/projects/elephant/badge/?version=latest)](https://elephant.readthedocs.io/en/latest/?badge=latest)
[![![PyPi]](https://img.shields.io/pypi/v/elephant)](https://pypi.org/project/elephant/)
[![Statistics](https://img.shields.io/pypi/dm/elephant)](https://seladb.github.io/StarTrack-js/#/preload?r=neuralensemble,elephant)
[![Gitter](https://badges.gitter.im/python-elephant/community.svg)](https://gitter.im/python-elephant/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

*Elephant* package analyses all sorts of neurophysiological data:
Expand All @@ -18,6 +18,13 @@ spike trains, LFP, analog signals. The input-output data format is either
* Mailing list: https://groups.google.com/group/neuralensemble


#### Visualization of Elephant analysis objects

Viziphant package (https://github.com/INM-6/viziphant) is developed by Elephant
team for plotting and visualization of the output of Elephant functions in a
few lines of code.


#### License

Modified BSD License, see [LICENSE.txt](LICENSE.txt) for details.
Expand Down
6 changes: 4 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@
#epub_tocdup = True


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
# configuration for intersphinx: refer to Viziphant
intersphinx_mapping = {
'viziphant': ('https://viziphant.readthedocs.io/en/latest/', None)
}

# Use more reliable mathjax source
mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
Expand Down
11 changes: 11 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ Quantity is a Numpy-wrapper package for handling physical quantities like
seconds, milliseconds, Hz, volts, etc. Quantity is used in both Neo and
Elephant.


**Visualization of Elephant analysis objects**

`Viziphant <https://viziphant.readthedocs.io/en/latest/>`_ package is developed
by Elephant team and provides a high-level API to easily generate plots and
interactive visualizations of neuroscientific data and analysis results.
The API uses and extends the same structure as in Elephant to ensure intuitive
usage for scientists that are used to Elephant.



Table of Contents
-----------------

Expand Down
8 changes: 5 additions & 3 deletions doc/maintainers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ Making a release
:file:`doc/modules.rst` and make a file with a short description in
:file:`doc/reference/<modulename>.rst`.

5. Remove :file:`elephant/spade_src/fim.so`. Otherwise, it'll be included in
5. Push the commit with release notes and version updated to github.

6. Remove :file:`elephant/spade_src/fim.so`. Otherwise, it'll be included in
the built package (it should be downloaded at pip install).

6. Build a source package and upload it to PyPi.
7. Build a source package and upload it to PyPi.

Build a source package (see `Packaging Python Projects
<https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives>`_)::
Expand All @@ -144,7 +146,7 @@ Making a release

$ python -m twine upload dist/elephant-X.Y.Z.tar.gz

7. Finally, make a release on GitHub UI page and copy-paste the release notes.
8. Finally, make a release on GitHub UI page and copy-paste the release notes.
Then tag the release in the Git repository and push it::

$ git tag <version>
Expand Down
1 change: 0 additions & 1 deletion doc/reference/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ BinnedSpikeTrain (conversion)
=============================

.. automodule:: elephant.conversion
:members:
12 changes: 0 additions & 12 deletions doc/reference/gpfa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,3 @@ Gaussian-Process Factor Analysis (GPFA)
=======================================

.. automodule:: elephant.gpfa.gpfa
:members:


Tutorial
--------

:doc:`View tutorial <../tutorials/gpfa>`

Run tutorial interactively:

.. image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/NeuralEnsemble/elephant/master?filepath=doc/tutorials/gpfa.ipynb
1 change: 0 additions & 1 deletion doc/reference/spade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ Spike Pattern Detection and Evaluation (SPADE)
==============================================

.. automodule:: elephant.spade
:members:
2 changes: 0 additions & 2 deletions doc/reference/spike_train_correlation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ Spike train correlation


.. automodule:: elephant.spike_train_correlation
:members:
:exclude-members: cch, sttc
2 changes: 0 additions & 2 deletions doc/reference/spike_train_dissimilarity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ Spike train dissimilarity


.. automodule:: elephant.spike_train_dissimilarity
:members:

70 changes: 69 additions & 1 deletion doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,75 @@
Release Notes
*************


Elephant 0.9.0 release notes
============================

This release is titled to accompany the [2nd Elephant User Workshop](https://www.humanbrainproject.eu/en/education/participatecollaborate/infrastructure-events-trainings/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 (https://github.com/NeuralEnsemble/elephant/pull/332, https://github.com/NeuralEnsemble/elephant/pull/359)
* Spike contrast function that measures the synchrony of spike trains (https://github.com/NeuralEnsemble/elephant/pull/354; thanks to @Broxy7 for bringing this in Elephant).
* Revised local variability LvR (https://github.com/NeuralEnsemble/elephant/pull/346) as an alternative to the LV measure.
* Three surrogate methods: Trial-shifting, Bin Shuffling, ISI dithering (https://github.com/NeuralEnsemble/elephant/pull/343).
* Added a new function to generate spike trains: `inhomogeneous_gamma_process` (https://github.com/NeuralEnsemble/elephant/pull/339).
* The output of `instantaneous_rate` function is now a 2D matrix of shape `(time, len(spiketrains))` (https://github.com/NeuralEnsemble/elephant/issues/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 https://github.com/NeuralEnsemble/elephant/issues/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](https://github.com/NeuralEnsemble/elephant/tree/295c6bd7fea196cf9665a78649fafedab5840cfa) 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 (https://github.com/NeuralEnsemble/elephant/pull/378). It doesn't mean though that you need to care about units on your own: `t_start`, `t_stop`, and `bin_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 (https://github.com/NeuralEnsemble/elephant/pull/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 (https://github.com/NeuralEnsemble/elephant/pull/362; thanks to @gyyang for the idea and original implementation).
* Memory-efficient `zscore` function (https://github.com/NeuralEnsemble/elephant/pull/372).
* Don't sort the input array in ISI function (https://github.com/NeuralEnsemble/elephant/pull/371), which reduces function algorithmic time complexity from `O(N logN)` to linear `O(N)`. Now, when the input time array is not sorted, a warning is shown.
* Vectorized Current Source Density `generate_lfp` function (https://github.com/NeuralEnsemble/elephant/pull/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](https://elephant.readthedocs.io/en/latest/install.html#mpi-support) installation page in elephant.
* BinnedSpikeTrain (https://github.com/NeuralEnsemble/elephant/pull/368, https://github.com/NeuralEnsemble/elephant/pull/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 of `is_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 (https://github.com/NeuralEnsemble/elephant/pull/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](https://elephant.readthedocs.io/en/latest/get_in_touch.html).

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 (https://github.com/NeuralEnsemble/elephant/pull/341).
* SPADE: New way to count patterns for multiple testing (https://github.com/NeuralEnsemble/elephant/pull/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 (https://github.com/NeuralEnsemble/elephant/pull/362).
* The number of discarded spikes that fall into the last bin of a BinnedSpikeTrain object was incorrectly calculated (https://github.com/NeuralEnsemble/elephant/pull/368).
* Fixed index selection in `spike_triggered_phase` (https://github.com/NeuralEnsemble/elephant/pull/382)
* Fixed surrogates bugs:
- `joint-ISI` and `shuffle ISI` output spike trains were not sorted in time (https://github.com/NeuralEnsemble/elephant/pull/364);
- surrogates get arbitrary sampling_rate (https://github.com/NeuralEnsemble/elephant/pull/353), which relates to the provenance tracking issue;



Elephant 0.8.0 release notes
============================

Expand Down Expand Up @@ -29,7 +98,6 @@ Breaking changes
----------------
* Naming convention changes (`binsize` -> `bin_size`, etc.) in almost all Elephant functions (https://github.com/NeuralEnsemble/elephant/pull/316).


Elephant 0.7.0 release notes
============================

Expand Down
2 changes: 1 addition & 1 deletion elephant/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.0
0.9.0
8 changes: 7 additions & 1 deletion elephant/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
An example is the representation of a spike train as a sequence of 0-1 values
(binned spike train).
.. autosummary::
:toctree: toctree/conversion
BinnedSpikeTrain
binarize
:copyright: Copyright 2014-2016 by the Elephant team, see `doc/authors.rst`.
:license: BSD, see LICENSE.txt for details.
"""

from __future__ import division, print_function, unicode_literals

import warnings
from copy import deepcopy

import neo
import numpy as np
Expand Down
30 changes: 30 additions & 0 deletions elephant/gpfa/gpfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,31 @@
3) orthonormalization of the matrix C and the corresponding subspace, for
visualization purposes: (c.f., `gpfa_core.orthonormalize()`)
.. autosummary::
:toctree: toctree/gpfa
GPFA
Visualization
-------------
Visualization of GPFA transforms is covered in Viziphant:
https://viziphant.readthedocs.io/en/latest/modules.html
Tutorial
--------
:doc:`View tutorial <../tutorials/gpfa>`
Run tutorial interactively:
.. image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/NeuralEnsemble/elephant/master
?filepath=doc/tutorials/gpfa.ipynb
References
----------
The code was ported from the MATLAB code based on Byron Yu's implementation.
Expand All @@ -59,6 +84,11 @@
from elephant.utils import deprecated_alias


__all__ = [
"GPFA"
]


class GPFA(sklearn.base.BaseEstimator):
"""
Apply Gaussian process factor analysis (GPFA) to spike train data
Expand Down
27 changes: 24 additions & 3 deletions elephant/spade.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@
statistical tests to detect and assess the statistical significance of repeated
occurrences of spike sequences (spatio-temporal patterns, STP).
Given a list of Neo Spiketrain objects, assumed to be recorded in parallel, the
SPADE analysis can be applied as demonstrated in this short toy example of 10
artificial spike trains of exhibiting fully synchronous events of order 10.
.. autosummary::
:toctree: toctree/spade
spade
concepts_mining
pvalue_spectrum
test_signature_significance
approximate_stability
pattern_set_reduction
concept_output_to_patterns
Visualization
-------------
Visualization of SPADE analysis is covered in Viziphant:
https://viziphant.readthedocs.io/en/latest/modules.html
Notes
-----
This modules relies on the implementation of the fp-growth algorithm contained
in the file fim.so which can be found here (http://www.borgelt.net/pyfim.html)
and should be available in the spade_src folder (elephant/spade_src/).
Expand All @@ -17,6 +34,10 @@
Examples
--------
Given a list of Neo Spiketrain objects, assumed to be recorded in parallel, the
SPADE analysis can be applied as demonstrated in this short toy example of 10
artificial spike trains of exhibiting fully synchronous events of order 10.
>>> from elephant.spade import spade
>>> import elephant.spike_train_generation
>>> import quantities as pq
Expand Down

0 comments on commit 8e465fd

Please sign in to comment.