PYthon Neural Analysis Package Pour Laboratoires d’Excellence
Project description
PYthon Neural Analysis Package.
pynapple is a light-weight python library for neurophysiological data analysis. The goal is to offer a versatile set of tools to study typical data in the field, i.e. time series (spike times, behavioral events, etc.) and time intervals (trials, brain states, etc.). It also provides users with generic functions for neuroscience such as tuning curves and cross-correlograms.
- Free software: MIT License
- Documentation: https://pynapple.org
Note :page_with_curl: If you are using pynapple, please cite the following paper
Learning pynapple
Workshops are regularly organized by the center for Computational Neuroscience of the Flatiron institute to teach pynapple & NeMos to new users.
The next workshop will take place before FENS in Barcelona. More details will come soon.
New release :fire:
pynapple >= 0.10.0
Tuning curves computation have been generalized to n-dimensions with the function compute_tuning_curves.
It can now return a xarray DataArray instead of a Pandas DataFrame.
pynapple >= 0.8.2
The objects IntervalSet, TsdFrame and TsGroup inherits a new metadata class. It is now possible to add labels for
each interval of an IntervalSet, each column of a TsdFrame and each unit of a TsGroup.
See the documentation for more details
pynapple >= 0.7
Pynapple now implements signal processing. For example, to filter a 1250 Hz sampled time series between 10 Hz and 20 Hz:
nap.apply_bandpass_filter(signal, (10, 20), fs=1250)
New functions includes power spectral density and Morlet wavelet decomposition. See the documentation for more details.
Community
To ask any questions or get support for using pynapple, please consider joining our slack. Please send an email to thepynapple[at]gmail[dot]com to receive an invitation link.
Getting Started
Installation
The best way to install pynapple is with pip inside a new conda environment:
$ conda create --name pynapple pip python=3.11
$ conda activate pynapple
$ pip install pynapple
Running pip install pynapple will install all the dependencies, including:
- pandas
- numpy
- scipy
- numba
- pynwb 2.0
- tabulate
- h5py
- xarray
For development, see the contributor guide for steps to install from source code.
Basic Usage
After installation, you can now import the package:
$ python
>>> import pynapple as nap
You'll find an example of the package below. Click here to download the example dataset. The folder includes a NWB file containing the data.
import matplotlib.pyplot as plt
import numpy as np
import pynapple as nap
# LOADING DATA FROM NWB
data = nap.load_file("A2929-200711.nwb")
spikes = data["units"]
head_direction = data["ry"]
wake_ep = data["position_time_support"]
# COMPUTING TUNING CURVES
tuning_curves = nap.compute_tuning_curves(
spikes, head_direction, 120, epochs=wake_ep, range=(0, 2 * np.pi)
)
# PLOT
g=tuning_curves.plot(
row="unit",
col_wrap=5,
subplot_kws={"projection": "polar"},
sharey=False
)
plt.xticks([0, np.pi / 2, np.pi, 3 * np.pi / 2])
g.set_titles("")
g.set_xlabels("")
plt.show()
Shown below, the final figure from the example code displays the firing rate of 15 neurons as a function of the direction of the head of the animal in the horizontal plane.
Credits
Special thanks to Francesco P. Battaglia (https://github.com/fpbattaglia) for the development of the original TSToolbox (https://github.com/PeyracheLab/TStoolbox) and neuroseries (https://github.com/NeuroNetMem/neuroseries) packages, the latter constituting the core of pynapple.
This package was developped by Guillaume Viejo (https://github.com/gviejo) and other members of the Peyrache Lab.
Contributing
We welcome contributions, including documentation improvements. For more information, see the contributor guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynapple-0.10.3.tar.gz.
File metadata
- Download URL: pynapple-0.10.3.tar.gz
- Upload date:
- Size: 89.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff61427aea851b92c22dfbdf9a044b4e913ee7301bfa3d6c4281e3b9008c6852
|
|
| MD5 |
cfd59659f09c0d4d3016dd0885cf96d2
|
|
| BLAKE2b-256 |
e17472f7a268274efe45df78c17a2f05ce56d90c4541cee37943723102bae2d1
|
Provenance
The following attestation bundles were made for pynapple-0.10.3.tar.gz:
Publisher:
deploy.yml on pynapple-org/pynapple
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynapple-0.10.3.tar.gz -
Subject digest:
ff61427aea851b92c22dfbdf9a044b4e913ee7301bfa3d6c4281e3b9008c6852 - Sigstore transparency entry: 930653483
- Sigstore integration time:
-
Permalink:
pynapple-org/pynapple@0f74afb33dbb11e8d8021a8d66872aeb0fbd9204 -
Branch / Tag:
refs/tags/v0.10.3 - Owner: https://github.com/pynapple-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@0f74afb33dbb11e8d8021a8d66872aeb0fbd9204 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pynapple-0.10.3-py3-none-any.whl.
File metadata
- Download URL: pynapple-0.10.3-py3-none-any.whl
- Upload date:
- Size: 144.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c4f55bac04b1ed7f3cc98dba531207266790d7398d26ef29f1d4d84c0d3ae3
|
|
| MD5 |
622b1dacf9c27c93daa12d5dbeda4e1f
|
|
| BLAKE2b-256 |
5d84555089e25291dd769425393d6f9c6b89f7ca9c212db575b94d90278ed828
|
Provenance
The following attestation bundles were made for pynapple-0.10.3-py3-none-any.whl:
Publisher:
deploy.yml on pynapple-org/pynapple
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynapple-0.10.3-py3-none-any.whl -
Subject digest:
97c4f55bac04b1ed7f3cc98dba531207266790d7398d26ef29f1d4d84c0d3ae3 - Sigstore transparency entry: 930653550
- Sigstore integration time:
-
Permalink:
pynapple-org/pynapple@0f74afb33dbb11e8d8021a8d66872aeb0fbd9204 -
Branch / Tag:
refs/tags/v0.10.3 - Owner: https://github.com/pynapple-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@0f74afb33dbb11e8d8021a8d66872aeb0fbd9204 -
Trigger Event:
release
-
Statement type: