pynajax


Namepynajax JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA JAX backend for pynapple.
upload_time2024-09-16 19:31:31
maintainerNone
docs_urlNone
authorpynajax authors
requires_python>=3.8
licenseMIT License Copyright (c) 2024 pynapple-org 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.
keywords neuroscience jax-backend pynapple
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pynajax

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/pynapple-org/pynajax/blob/main/LICENSE)
![Python version](https://img.shields.io/badge/python-3.10-blue.svg)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![pynajax CI](https://github.com/pynapple-org/pynajax/actions/workflows/ci.yml/badge.svg)](https://github.com/pynapple-org/pynajax/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/pynapple-org/pynajax/badge.svg)](https://coveralls.io/github/pynapple-org/pynajax)
![PyPI - Version](https://img.shields.io/pypi/v/pynajax)

Welcome to `pynajax`, a GPU accelerated backend for [pynapple](https://github.com/pynapple-org/pynapple) built on top on [jax](https://github.com/google/jax). It offers a fast acceleration for the core pynapple functions using GPU. 

> **Warning**
> ⚠️ This package is not meant to be used on its own. It should only be used through the pynapple API.

## Installation
Run the following `pip` command in your virtual environment.

**For macOS/Linux users:**
 ```bash
 pip install pynajax
 ```

**For Windows users:**
 ```
 python -m pip install pynajax
 ```

Alternatively, you can install pynapple and pynajax together.

```bash
 pip install pynapple[jax]
```



## Basic usage

To use pynajax, you need to change the pynapple backend using `nap.nap_config.set_backend`. See the example below : 

```python
import pynapple as nap
import numpy as np
nap.nap_config.set_backend("jax")

tsd = nap.Tsd(t=np.arange(100), d=np.random.randn(100))

# This will run on GPU or CPU depending on the jax installation
tsd.convolve(np.ones(11)) 
```

## Benchmark

This benchmark for the `convolve` function was run on a GPU.

![benchmark_convolve](./docs/images/convolve_benchmark.png)

See the documentation for others benchmarks.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pynajax",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "neuroscience, jax-backend, pynapple",
    "author": "pynajax authors",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c1/cf/7e18258c5aa9da9b50bd752cd6b9ac1e31578aadc1873338cb145d866ef2/pynajax-0.2.0.tar.gz",
    "platform": null,
    "description": "# pynajax\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/pynapple-org/pynajax/blob/main/LICENSE)\n![Python version](https://img.shields.io/badge/python-3.10-blue.svg)\n[![Project Status: Active \u2013 The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![pynajax CI](https://github.com/pynapple-org/pynajax/actions/workflows/ci.yml/badge.svg)](https://github.com/pynapple-org/pynajax/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/pynapple-org/pynajax/badge.svg)](https://coveralls.io/github/pynapple-org/pynajax)\n![PyPI - Version](https://img.shields.io/pypi/v/pynajax)\n\nWelcome to `pynajax`, a GPU accelerated backend for [pynapple](https://github.com/pynapple-org/pynapple) built on top on [jax](https://github.com/google/jax). It offers a fast acceleration for the core pynapple functions using GPU. \n\n> **Warning**\n> \u26a0\ufe0f This package is not meant to be used on its own. It should only be used through the pynapple API.\n\n## Installation\nRun the following `pip` command in your virtual environment.\n\n**For macOS/Linux users:**\n ```bash\n pip install pynajax\n ```\n\n**For Windows users:**\n ```\n python -m pip install pynajax\n ```\n\nAlternatively, you can install pynapple and pynajax together.\n\n```bash\n pip install pynapple[jax]\n```\n\n\n\n## Basic usage\n\nTo use pynajax, you need to change the pynapple backend using `nap.nap_config.set_backend`. See the example below : \n\n```python\nimport pynapple as nap\nimport numpy as np\nnap.nap_config.set_backend(\"jax\")\n\ntsd = nap.Tsd(t=np.arange(100), d=np.random.randn(100))\n\n# This will run on GPU or CPU depending on the jax installation\ntsd.convolve(np.ones(11)) \n```\n\n## Benchmark\n\nThis benchmark for the `convolve` function was run on a GPU.\n\n![benchmark_convolve](./docs/images/convolve_benchmark.png)\n\nSee the documentation for others benchmarks.\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 pynapple-org  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. ",
    "summary": "A JAX backend for pynapple.",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [
        "neuroscience",
        " jax-backend",
        " pynapple"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1225af24b5c36f8cb134e310666398d0739ff749c74db5e2f6f9f306a592794",
                "md5": "29a475ce5030500cb86a5451ee47512a",
                "sha256": "1d9f90b4975c4307aec123163db5080adc5daa2881e53ab828b37d8b23ac7670"
            },
            "downloads": -1,
            "filename": "pynajax-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29a475ce5030500cb86a5451ee47512a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17749,
            "upload_time": "2024-09-16T19:31:29",
            "upload_time_iso_8601": "2024-09-16T19:31:29.746367Z",
            "url": "https://files.pythonhosted.org/packages/c1/22/5af24b5c36f8cb134e310666398d0739ff749c74db5e2f6f9f306a592794/pynajax-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1cf7e18258c5aa9da9b50bd752cd6b9ac1e31578aadc1873338cb145d866ef2",
                "md5": "8581a7ab0912b14bdbfe4fff0d28817d",
                "sha256": "235a6a2c8147c8e564a47e955ee24dd65a3e5857751a8077bbdbafc64351b7b7"
            },
            "downloads": -1,
            "filename": "pynajax-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8581a7ab0912b14bdbfe4fff0d28817d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 65342,
            "upload_time": "2024-09-16T19:31:31",
            "upload_time_iso_8601": "2024-09-16T19:31:31.011517Z",
            "url": "https://files.pythonhosted.org/packages/c1/cf/7e18258c5aa9da9b50bd752cd6b9ac1e31578aadc1873338cb145d866ef2/pynajax-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-16 19:31:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pynajax"
}
        
Elapsed time: 1.10949s