ap-features


Nameap-features JSON
Version 2024.0.0 PyPI version JSON
download
home_pageNone
SummaryPackage to compute features of traces from action potential models
upload_time2024-08-04 20:30:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseLGPL-2.1
keywords action potential cell models features
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![image](https://img.shields.io/pypi/v/ap_features.svg)](https://pypi.python.org/pypi/ap_features)
![CI](https://github.com/ComputationalPhysiology/ap_features/workflows/CI/badge.svg)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComputationalPhysiology/ap_features/main.svg)](https://results.pre-commit.ci/latest/github/ComputationalPhysiology/ap_features/main)
[![github pages](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/github-pages.yml/badge.svg)](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/github-pages.yml)
[![Build and upload to PyPI](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/pypi.yml/badge.svg)](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/pypi.yml)
[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/finsberg/a7290de789564f03eb6b1ee122fce423/raw/ap_features-coverage.json)](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/finsberg/a7290de789564f03eb6b1ee122fce423/raw/ap_features-coverage.json)
# Action Potential features

`ap_features` is package for computing features of action potential traces. This includes chopping, background correction and feature calculations.

Parts of this library is written in `numba` and is therefore highly performant. This is useful if you want to do feature calculations on a large number of traces.

## Quick start

```python
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import solve_ivp

import ap_features as apf

time = np.linspace(0, 999, 1000)
res = solve_ivp(
    apf.testing.fitzhugh_nagumo,
    [0, 1000],
    [0.0, 0.0],
    t_eval=time,
)
trace = apf.Beats(y=res.y[0, :], t=time)
print(f"Number of beats: {trace.num_beats}")
print(f"Beat rates: {trace.beat_rates}")

# Get a list of beats
beats = trace.beats
# Pick out the second beat
beat = beats[1]

# Compute features
print(f"APD30: {beat.apd(30):.3f}s, APD80: {beat.apd(80):.3f}s")
print(f"cAPD30: {beat.capd(30):.3f}s, cAPD80: {beat.capd(80):.3f}s")
print(f"Time to peak: {beat.ttp():.3f}s")
print(f"Decay time from max to 90%: {beat.tau(a=0.1):.3f}s")
```

```
Number of beats: 5
Beat rates: [779.2207792207793, 769.2307692307693, 779.2207792207793, 759.493670886076]
APD30: 37.823s, APD80: 56.564s
cAPD30: 88.525s, cAPD80: 132.387s
Time to peak: 21.000s
Decay time from max to 90%: 53.618s
```

## Install
Install the package with pip
```
python -m pip install ap_features
```
See [installation instructions](https://computationalphysiology.github.io/ap_features/INSTALL.html) for more options.


## Available features
The list of currently implemented features are as follows
- Action potential duration (APD)
- Corrected action potential duration (cAPD)
- Decay time (Time for the signal amplitude to go from maximum to (1 - a) * 100 % of maximum)
- Time to peak (ttp)
- Upstroke time (time from (1-a)*100 % signal amplitude to peak)
- Beating frequency
- APD up (The duration between first intersections of two APD lines)
- Maximum relative upstroke velocity
- Maximum upstroke velocity
- APD integral (integral of the signals above the APD line)


## Documentation
Documentation is hosted at GitHub pages: <https://computationalphysiology.github.io/ap_features/>

Note that the documentation is written using [`jupyterbook`](https://jupyterbook.org) and contains an [interactive demo](https://computationalphysiology.github.io/ap_features/demo_fitzhugh_nagumo.html)


## License
* Free software: LGPLv2.1

## Source Code
* <https://github.com/ComputationalPhysiology/ap_features>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ap-features",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "action potential, cell, models, features",
    "author": null,
    "author_email": "Henrik Finsberg <henriknf@simula.no>, \"Kristian G. Hustad\" <kghustad@simula.no>",
    "download_url": "https://files.pythonhosted.org/packages/4b/75/997de58a49645410a21e7ed387863855e5094451c9f7757b63609fec4a82/ap_features-2024.0.0.tar.gz",
    "platform": null,
    "description": "[![image](https://img.shields.io/pypi/v/ap_features.svg)](https://pypi.python.org/pypi/ap_features)\n![CI](https://github.com/ComputationalPhysiology/ap_features/workflows/CI/badge.svg)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComputationalPhysiology/ap_features/main.svg)](https://results.pre-commit.ci/latest/github/ComputationalPhysiology/ap_features/main)\n[![github pages](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/github-pages.yml/badge.svg)](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/github-pages.yml)\n[![Build and upload to PyPI](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/pypi.yml/badge.svg)](https://github.com/ComputationalPhysiology/ap_features/actions/workflows/pypi.yml)\n[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/finsberg/a7290de789564f03eb6b1ee122fce423/raw/ap_features-coverage.json)](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/finsberg/a7290de789564f03eb6b1ee122fce423/raw/ap_features-coverage.json)\n# Action Potential features\n\n`ap_features` is package for computing features of action potential traces. This includes chopping, background correction and feature calculations.\n\nParts of this library is written in `numba` and is therefore highly performant. This is useful if you want to do feature calculations on a large number of traces.\n\n## Quick start\n\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom scipy.integrate import solve_ivp\n\nimport ap_features as apf\n\ntime = np.linspace(0, 999, 1000)\nres = solve_ivp(\n    apf.testing.fitzhugh_nagumo,\n    [0, 1000],\n    [0.0, 0.0],\n    t_eval=time,\n)\ntrace = apf.Beats(y=res.y[0, :], t=time)\nprint(f\"Number of beats: {trace.num_beats}\")\nprint(f\"Beat rates: {trace.beat_rates}\")\n\n# Get a list of beats\nbeats = trace.beats\n# Pick out the second beat\nbeat = beats[1]\n\n# Compute features\nprint(f\"APD30: {beat.apd(30):.3f}s, APD80: {beat.apd(80):.3f}s\")\nprint(f\"cAPD30: {beat.capd(30):.3f}s, cAPD80: {beat.capd(80):.3f}s\")\nprint(f\"Time to peak: {beat.ttp():.3f}s\")\nprint(f\"Decay time from max to 90%: {beat.tau(a=0.1):.3f}s\")\n```\n\n```\nNumber of beats: 5\nBeat rates: [779.2207792207793, 769.2307692307693, 779.2207792207793, 759.493670886076]\nAPD30: 37.823s, APD80: 56.564s\ncAPD30: 88.525s, cAPD80: 132.387s\nTime to peak: 21.000s\nDecay time from max to 90%: 53.618s\n```\n\n## Install\nInstall the package with pip\n```\npython -m pip install ap_features\n```\nSee [installation instructions](https://computationalphysiology.github.io/ap_features/INSTALL.html) for more options.\n\n\n## Available features\nThe list of currently implemented features are as follows\n- Action potential duration (APD)\n- Corrected action potential duration (cAPD)\n- Decay time (Time for the signal amplitude to go from maximum to (1 - a) * 100 % of maximum)\n- Time to peak (ttp)\n- Upstroke time (time from (1-a)*100 % signal amplitude to peak)\n- Beating frequency\n- APD up (The duration between first intersections of two APD lines)\n- Maximum relative upstroke velocity\n- Maximum upstroke velocity\n- APD integral (integral of the signals above the APD line)\n\n\n## Documentation\nDocumentation is hosted at GitHub pages: <https://computationalphysiology.github.io/ap_features/>\n\nNote that the documentation is written using [`jupyterbook`](https://jupyterbook.org) and contains an [interactive demo](https://computationalphysiology.github.io/ap_features/demo_fitzhugh_nagumo.html)\n\n\n## License\n* Free software: LGPLv2.1\n\n## Source Code\n* <https://github.com/ComputationalPhysiology/ap_features>\n",
    "bugtrack_url": null,
    "license": "LGPL-2.1",
    "summary": "Package to compute features of traces from action potential models",
    "version": "2024.0.0",
    "project_urls": {
        "Documentation": "https://computationalphysiology.github.io/ap_features",
        "Homepage": "https://computationalphysiology.github.io/ap_features",
        "Source": "https://github.com/ComputationalPhysiology/ap_features",
        "Tracker": "https://github.com/ComputationalPhysiology/ap_features/issues"
    },
    "split_keywords": [
        "action potential",
        " cell",
        " models",
        " features"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dbc7723f548a9bdf84a03987bcc8d6b38d349d2575780f1622da9fd68486ae23",
                "md5": "6057e5fbf07bfaa49b6d802f16a0d190",
                "sha256": "3ba2f106e0e40f9b2fe8b7e4298eb64ea9f6762c6ba241016826d5ba20489dfe"
            },
            "downloads": -1,
            "filename": "ap_features-2024.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6057e5fbf07bfaa49b6d802f16a0d190",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 49402,
            "upload_time": "2024-08-04T20:30:41",
            "upload_time_iso_8601": "2024-08-04T20:30:41.432355Z",
            "url": "https://files.pythonhosted.org/packages/db/c7/723f548a9bdf84a03987bcc8d6b38d349d2575780f1622da9fd68486ae23/ap_features-2024.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b75997de58a49645410a21e7ed387863855e5094451c9f7757b63609fec4a82",
                "md5": "8c5527c7776ca31f8c82d47a75e21896",
                "sha256": "99349e203d4523af274e2733e7031f49f59c046861b3aa9eb9b069dd3e2e9b28"
            },
            "downloads": -1,
            "filename": "ap_features-2024.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8c5527c7776ca31f8c82d47a75e21896",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 447494,
            "upload_time": "2024-08-04T20:30:44",
            "upload_time_iso_8601": "2024-08-04T20:30:44.711645Z",
            "url": "https://files.pythonhosted.org/packages/4b/75/997de58a49645410a21e7ed387863855e5094451c9f7757b63609fec4a82/ap_features-2024.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-04 20:30:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ComputationalPhysiology",
    "github_project": "ap_features",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ap-features"
}
        
Elapsed time: 0.28573s