Metadata-Version: 2.4
Name: pynapple
Version: 0.10.0
Summary: PYthon Neural Analysis Package Pour Laboratoires d’Excellence
Author-email: Guillaume Viejo <guillaume.viejo@gmail.com>
License: MIT License
        
        Copyright (c) pynapple authors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, http://pynapple.org/
Project-URL: documentation, http://pynapple.org/
Project-URL: repository, https://github.com/pynapple-org/pynapple
Keywords: neuroscience
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>1.0.3
Requires-Dist: numpy>=1.17.4
Requires-Dist: scipy>=1.3.2
Requires-Dist: numba>=0.46.0
Requires-Dist: numba>=0.53.0; python_version >= "3.9"
Requires-Dist: numba>=0.55.0; python_version >= "3.10"
Requires-Dist: numba>=0.57.0; python_version >= "3.11"
Requires-Dist: numba>=0.59.0; python_version >= "3.12"
Requires-Dist: numba>=0.61.0; python_version >= "3.13"
Requires-Dist: pynwb>=2.0.0
Requires-Dist: tabulate
Requires-Dist: h5py
Requires-Dist: rich
Requires-Dist: xarray>=2023.1.0
Provides-Extra: jax
Requires-Dist: pynajax; extra == "jax"
Provides-Extra: dev
Requires-Dist: black>=24.2.0; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: Flake8-pyproject; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Provides-Extra: doc
Requires-Dist: matplotlib; extra == "doc"
Requires-Dist: zarr; extra == "doc"
Requires-Dist: seaborn; extra == "doc"
Requires-Dist: tqdm; extra == "doc"
Requires-Dist: numpydoc; extra == "doc"
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: pydata-sphinx-theme; extra == "doc"
Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
Requires-Dist: sphinx-copybutton; extra == "doc"
Requires-Dist: sphinx-design; extra == "doc"
Requires-Dist: sphinx-issues; extra == "doc"
Requires-Dist: sphinxcontrib-apidoc; extra == "doc"
Requires-Dist: myst-parser; extra == "doc"
Requires-Dist: myst-nb; extra == "doc"
Requires-Dist: dandi; extra == "doc"
Requires-Dist: sphinx-autobuild; extra == "doc"
Requires-Dist: sphinx-contributors; extra == "doc"
Requires-Dist: scikit-learn; extra == "doc"
Provides-Extra: dandi
Requires-Dist: dandi; extra == "dandi"
Requires-Dist: fsspec; extra == "dandi"
Requires-Dist: requests; extra == "dandi"
Requires-Dist: aiohttp; extra == "dandi"
Dynamic: license-file



[![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)
[![codecov](https://codecov.io/gh/pynapple-org/pynapple/branch/main/graph/badge.svg?token=VN9BDBOEGZ)](https://codecov.io/gh/pynapple-org/pynapple)
[![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.

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>](https://pynapple-org.github.io/pynapple/)

> **Note**
> :page_with_curl: If you are using pynapple, please cite the following [paper](https://elifesciences.org/reviewed-preprints/85786)

------------------------------------------------------------------------

New release :fire:
------------------

### pynapple >= 0.10.0

Tuning curves computation have been generated with the function `compute_tuning_curves`.
It can now return a [xarray DataArray](https://docs.xarray.dev/en/stable/) 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](https://pynapple.org/user_guide/03_metadata.html) 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:

```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.


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](https://docs.conda.io/en/latest/) environment:
    
``` {.sourceCode .shell}
$ 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](CONTRIBUTING.md) for steps to install from source code.

<!-- For spyder users, it is recommended to install spyder after installing pynapple with :

``` {.sourceCode .shell}
$ conda create --name pynapple pip python=3.11
$ 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://osf.io/fqht6) 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_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.

<!-- ![pic1](readme_figure.png) -->
<p align="center">
  <img width="80%" src="doc/_static/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. -->

## Contributing

We welcome contributions, including documentation improvements. For more information, see the [contributor guide](CONTRIBUTING.md).
