-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from pynapple-org/dev
Dev
- Loading branch information
Showing
7 changed files
with
453 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* Flexbox layout for the list items */ | ||
.grid.cards ul > li { | ||
display: flex !important; /* Ensure flexbox is applied */ | ||
flex-direction: column; | ||
justify-content: space-between; | ||
height: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
/* Ensure the link stays at the bottom */ | ||
.grid.cards ul > li > p:last-of-type { | ||
margin-top: auto; | ||
padding-top: 10px; /* Optional spacing */ | ||
} | ||
|
||
/* Adjust the spacing for the hr element */ | ||
.grid.cards ul > li > hr { | ||
margin: 10px 0; /* Adjust this value to match the original spacing */ | ||
flex-shrink: 0; /* Prevent the hr from shrinking */ | ||
} | ||
|
||
/* Center the icon and title within the first paragraph */ | ||
.grid.cards ul > li > p:first-of-type { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
} | ||
|
||
/* Add spacing between the icon and the title */ | ||
.grid.cards ul > li > p:first-of-type img { | ||
margin-right: 8px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,102 @@ | ||
<!-- <!-- ![pic1](banner_logo.png) --> | ||
--- | ||
hide: | ||
- navigation | ||
- toc | ||
--- | ||
|
||
# <div style="text-align: center;"> <img src="images/Pynapple_logo_final.svg" width="50%" alt="Pynapple logo."> </div> | ||
|
||
|
||
<div style="text-align: center;" markdown> | ||
|
||
[![image](https://img.shields.io/pypi/v/pynapple.svg)](https://pypi.python.org/pypi/pynapple) | ||
[![pynapple CI](https://github.com/pynapple-org/pynapple/actions/workflows/main.yml/badge.svg)](https://github.com/pynapple-org/pynapple/actions/workflows/main.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/pynapple-org/pynapple/badge.svg?branch=main)](https://coveralls.io/github/pynapple-org/pynapple?branch=main) | ||
[![GitHub issues](https://img.shields.io/github/issues/pynapple-org/pynapple)](https://github.com/pynapple-org/pynapple/issues) | ||
![GitHub contributors](https://img.shields.io/github/contributors/pynapple-org/pynapple) | ||
![Twitter Follow](https://img.shields.io/twitter/follow/thepynapple?style=social) | ||
|
||
PYthon Neural Analysis Package. | ||
[:material-book-open-variant-outline: __Cite the paper__](https://elifesciences.org/reviewed-preprints/85786) | ||
|
||
</div> | ||
|
||
|
||
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> | ||
## __Overview__ | ||
|
||
|
||
> **Note** | ||
> :page_with_curl: If you are using pynapple, please cite the following [paper](https://elifesciences.org/reviewed-preprints/85786) | ||
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. | ||
|
||
------------------------------------------------------------------------ | ||
|
||
Community | ||
--------- | ||
<div class="grid cards" markdown> | ||
|
||
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. | ||
- :material-clock-fast:{ .lg .middle } __Getting Started__ | ||
|
||
New releases :fire: | ||
------------------ | ||
--- | ||
|
||
### pynapple >= 0.7 | ||
New to Pynapple? Checkout the quickstart. | ||
|
||
Pynapple now implements signal processing. For example, to filter a 1250 Hz sampled time series between 10 Hz and 20 Hz: | ||
[:octicons-arrow-right-24: Quickstart](quickstart) | ||
|
||
```python | ||
nap.apply_bandpass_filter(signal, (10, 20), fs=1250) | ||
``` | ||
New functions includes power spectral density and Morlet wavelet decomposition. See the [documentation](https://pynapple-org.github.io/pynapple/reference/process/) for more details. | ||
- :material-lightbulb-on-10:{ .lg .middle } __How-To Guide__ | ||
|
||
### pynapple >= 0.6 | ||
--- | ||
|
||
Starting with 0.6, [`IntervalSet`](https://pynapple-org.github.io/pynapple/reference/core/interval_set/) objects are behaving as immutable numpy ndarray. Before 0.6, you could select an interval within an `IntervalSet` object with: | ||
Learn the pynapple API with notebooks. | ||
|
||
```python | ||
new_intervalset = intervalset.loc[[0]] # Selecting first interval | ||
``` | ||
[:octicons-arrow-right-24: API guide](https://pynapple.org/generated/api_guide/) | ||
|
||
With pynapple>=0.6, the slicing is similar to numpy and it returns an `IntervalSet` | ||
- :material-brain:{ .lg .middle} __Neural Analysis__ | ||
|
||
```python | ||
new_intervalset = intervalset[0] | ||
``` | ||
--- | ||
|
||
### pynapple >= 0.4 | ||
Explore fully worked examples to learn how to analyze neural recordings using pynapple. | ||
|
||
[:octicons-arrow-right-24: Tutorials](https://pynapple.org/generated/examples/) | ||
|
||
Starting with 0.4, pynapple rely on the [numpy array container](https://numpy.org/doc/stable/user/basics.dispatch.html) approach instead of Pandas for the time series. Pynapple builtin functions will remain the same except for functions inherited from Pandas. | ||
- :material-cog:{ .lg .middle } __API__ | ||
|
||
This allows for a better handling of returned objects. | ||
--- | ||
|
||
Additionaly, it is now possible to define time series objects with more than 2 dimensions with `TsdTensor`. You can also look at this [notebook](https://pynapple-org.github.io/pynapple/generated/api_guide/tutorial_pynapple_numpy/) for a demonstration of numpy compatibilities. | ||
Access a detailed description of each module and function, including parameters and functionality. | ||
|
||
Getting Started | ||
--------------- | ||
[:octicons-arrow-right-24: Modules](https://pynapple.org/reference/) | ||
|
||
### Installation | ||
- :material-hammer-wrench:{ .lg .middle } __Installation Instructions__ | ||
|
||
The best way to install pynapple is with pip within a new [conda](https://docs.conda.io/en/latest/) environment : | ||
--- | ||
|
||
Run the following `pip` command in your virtual environment. | ||
=== "macOS/Linux" | ||
|
||
```bash | ||
pip install pynapple | ||
``` | ||
|
||
=== "Windows" | ||
|
||
``` | ||
python -m pip install pynapple | ||
``` | ||
|
||
``` {.sourceCode .shell} | ||
$ conda create --name pynapple pip python=3.8 | ||
$ conda activate pynapple | ||
$ pip install pynapple | ||
``` | ||
|
||
or directly from the source code: | ||
|
||
``` {.sourceCode .shell} | ||
$ conda create --name pynapple pip python=3.8 | ||
$ conda activate pynapple | ||
$ # clone the repository | ||
$ git clone https://github.com/pynapple-org/pynapple.git | ||
$ cd pynapple | ||
$ # Install in editable mode with `-e` or, equivalently, `--editable` | ||
$ pip install -e . | ||
``` | ||
> **Note** | ||
> The package is now using a pyproject.toml file for installation and dependencies management. If you want to run the tests, use pip install -e .[dev] | ||
This procedure will install all the dependencies including | ||
|
||
- pandas | ||
- numpy | ||
- scipy | ||
- numba | ||
- pynwb 2.0 | ||
- tabulate | ||
- h5py | ||
|
||
<!-- For spyder users, it is recommended to install spyder after installing pynapple with : | ||
``` {.sourceCode .shell} | ||
$ conda create --name pynapple pip python=3.8 | ||
$ conda activate pynapple | ||
$ pip install pynapple | ||
$ pip install spyder | ||
$ spyder | ||
``` | ||
--> | ||
|
||
Basic Usage | ||
----------- | ||
|
||
After installation, you can now import the package: | ||
|
||
``` {.sourceCode .shell} | ||
$ python | ||
>>> import pynapple as nap | ||
``` | ||
|
||
You'll find an example of the package below. Click [here](https://www.dropbox.com/s/su4oaje57g3kit9/A2929-200711.zip?dl=1) to download the example dataset. The folder includes a NWB file containing the data. | ||
|
||
``` py | ||
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_1d_tuning_curves( | ||
spikes, head_direction, 120, minmax=(0, 2 * np.pi) | ||
) | ||
|
||
|
||
# PLOT | ||
plt.figure() | ||
for i in spikes: | ||
plt.subplot(3, 5, i + 1, projection="polar") | ||
plt.plot(tuning_curves[i]) | ||
plt.xticks([0, np.pi / 2, np.pi, 3 * np.pi / 2]) | ||
|
||
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. | ||
|
||
<!-- ![pic1](readme_figure.png) --> | ||
<p align="center"> | ||
<img width="80%" src="readme_figure.png"> | ||
</p> | ||
|
||
### 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. | ||
|
||
<!-- Logo: Sofia Skromne Carrasco, 2021. --> | ||
*For more information see:*<br> | ||
[:octicons-arrow-right-24: Install](installation) | ||
|
||
- :material-frequently-asked-questions:{ .lg .middle } __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. | ||
|
||
*To open an issue see :*<br> | ||
[:octicons-arrow-right-24: Issues](https://github.com/pynapple-org/pynapple/issues) | ||
|
||
</div> | ||
|
||
|
||
|
||
## :material-scale-balance:{ .lg } License | ||
|
||
Open source, [licensed under MIT](https://github.com/pynapple-org/pynapple/blob/main/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
hide: | ||
- navigation | ||
--- | ||
|
||
# Installation | ||
|
||
The best way to install pynapple is with pip within a new [conda](https://docs.conda.io/en/latest/) environment : | ||
|
||
|
||
``` {.sourceCode .shell} | ||
$ conda create --name pynapple pip python=3.8 | ||
$ conda activate pynapple | ||
$ pip install pynapple | ||
``` | ||
|
||
or directly from the source code: | ||
|
||
``` {.sourceCode .shell} | ||
$ conda create --name pynapple pip python=3.8 | ||
$ conda activate pynapple | ||
$ # clone the repository | ||
$ git clone https://github.com/pynapple-org/pynapple.git | ||
$ cd pynapple | ||
$ # Install in editable mode with `-e` or, equivalently, `--editable` | ||
$ pip install -e . | ||
``` | ||
> **Note** | ||
> The package is now using a pyproject.toml file for installation and dependencies management. If you want to run the tests, use pip install -e .[dev] | ||
This procedure will install all the dependencies including | ||
|
||
- pandas | ||
- numpy | ||
- scipy | ||
- numba | ||
- pynwb 2.0 | ||
- tabulate | ||
- h5py | ||
|
||
|
Oops, something went wrong.