tklfp


Nametklfp JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/kjohnsen/tklfp/tree/master/
SummaryA minimal package for computing the kernel LFP approximation from Telenczuk et al., 2020
upload_time2023-12-20 17:11:11
maintainer
docs_urlNone
authorKyle Johnsen
requires_python>=3.9
licenseApache Software License 2.0
keywords neuroscience kernel lfp telenczuk spikes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tklfp - Teleńczuk Kernel LFP

[![DOI](https://zenodo.org/badge/440986279.svg)](https://zenodo.org/badge/latestdoi/440986279)

This is a lightweight package for computing the kernel LFP approximation from 
[Teleńczuk et al., 2020](https://www.sciencedirect.com/science/article/pii/S0165027020302946). This method approximates LFP from spikes alone, without the need for more expensive simulations of spatially extended neurons. See the original authors' demo code [here](https://doi.org/10.5281/zenodo.3866253).

## How to install:
Simply install from pypi:
```bash
pip install tklfp
```

## How to use:

### Initialization
First you must initialize a `TKLFP` object which computes and caches the per-spike contribution of each neuron to the total LFP. You will need X, Y, and Z coordinates of the neurons, their cell types (excitatory/inhibitory, represented as a boolean), and the coordinates of the electrode(s):
```python
from tklfp import TKFLP
tklfp = TKLFP(xs_mm, ys_mm, zs_mm, is_excitatory, elec_coords_mm)
```

The first four arguments must all have the same length N_n, the total number of neurons. `elec_coords_mm` must an N_e by 3 array-like object, where N_e is the number of recording sites.

### Computing LFP
LFP can then be computed with the neuron indices and times of spikes (indices must be between 0 and N_n - 1, corresponding to the parameters given on initialization), as well as the timepoints to evaluate at (must be an iterable):
```python
lfp = tklfp.compute(i_n, t_ms, t_eval_ms)
```

A complete example, reworking the demo from the original paper, can be found [here](https://github.com/kjohnsen/tklfp/blob/master/notebooks/demo_lfp_kernel.ipynb). Basic usage information is also accessible in docstrings.

### Cortical orientation
The `TKLFP` constructor can also take an `orientation` argument which represents which direction is "up," that is, towards the surface of the cortex or parallel to the apical dendrites of pyramidal cells.
The default is `[0, 0, 1]`, indicating that the positive z axis is "up."
In the case your population isn't a sheet of neurons with uniform orientation (for a curved cortical area, for example), you can pass an N_n by 3 array containing the individual orientation vectors for all the neurons.

## Future development
The package uses [parameters from the original 2020 paper](https://github.com/kjohnsen/tklfp/blob/master/notebooks/param_prep.ipynb) by default. This can be changed by passing in an alternate parameter dictionary on initialization:
```python
tklfp = TKLFP(..., params=new_params)
```

The new params must have the same content as the default [`tklfp.params2020`](https://github.com/kjohnsen/tklfp/blob/master/tklfp/__init__.py#:~:text=_sig_i%20%3D%202.1-,params2020%20%3D,-%7B). The `A0_by_depth` params are scipy interpolation objects, but could theoretically be any callable that will return A0 (in μV) for an arbitrary depth (in mm).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kjohnsen/tklfp/tree/master/",
    "name": "tklfp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "neuroscience kernel LFP Telenczuk spikes",
    "author": "Kyle Johnsen",
    "author_email": "kjohnsen@gatech.edu",
    "download_url": "https://files.pythonhosted.org/packages/c2/5f/6982a9f78fe60acfc13814d3d30ba62d39d2801da064cdf9fa1f24d205a2/tklfp-0.2.1.tar.gz",
    "platform": null,
    "description": "# tklfp - Tele\u0144czuk Kernel LFP\n\n[![DOI](https://zenodo.org/badge/440986279.svg)](https://zenodo.org/badge/latestdoi/440986279)\n\nThis is a lightweight package for computing the kernel LFP approximation from \n[Tele\u0144czuk et al., 2020](https://www.sciencedirect.com/science/article/pii/S0165027020302946). This method approximates LFP from spikes alone, without the need for more expensive simulations of spatially extended neurons. See the original authors' demo code [here](https://doi.org/10.5281/zenodo.3866253).\n\n## How to install:\nSimply install from pypi:\n```bash\npip install tklfp\n```\n\n## How to use:\n\n### Initialization\nFirst you must initialize a `TKLFP` object which computes and caches the per-spike contribution of each neuron to the total LFP. You will need X, Y, and Z coordinates of the neurons, their cell types (excitatory/inhibitory, represented as a boolean), and the coordinates of the electrode(s):\n```python\nfrom tklfp import TKFLP\ntklfp = TKLFP(xs_mm, ys_mm, zs_mm, is_excitatory, elec_coords_mm)\n```\n\nThe first four arguments must all have the same length N_n, the total number of neurons. `elec_coords_mm` must an N_e by 3 array-like object, where N_e is the number of recording sites.\n\n### Computing LFP\nLFP can then be computed with the neuron indices and times of spikes (indices must be between 0 and N_n - 1, corresponding to the parameters given on initialization), as well as the timepoints to evaluate at (must be an iterable):\n```python\nlfp = tklfp.compute(i_n, t_ms, t_eval_ms)\n```\n\nA complete example, reworking the demo from the original paper, can be found [here](https://github.com/kjohnsen/tklfp/blob/master/notebooks/demo_lfp_kernel.ipynb). Basic usage information is also accessible in docstrings.\n\n### Cortical orientation\nThe `TKLFP` constructor can also take an `orientation` argument which represents which direction is \"up,\" that is, towards the surface of the cortex or parallel to the apical dendrites of pyramidal cells.\nThe default is `[0, 0, 1]`, indicating that the positive z axis is \"up.\"\nIn the case your population isn't a sheet of neurons with uniform orientation (for a curved cortical area, for example), you can pass an N_n by 3 array containing the individual orientation vectors for all the neurons.\n\n## Future development\nThe package uses [parameters from the original 2020 paper](https://github.com/kjohnsen/tklfp/blob/master/notebooks/param_prep.ipynb) by default. This can be changed by passing in an alternate parameter dictionary on initialization:\n```python\ntklfp = TKLFP(..., params=new_params)\n```\n\nThe new params must have the same content as the default [`tklfp.params2020`](https://github.com/kjohnsen/tklfp/blob/master/tklfp/__init__.py#:~:text=_sig_i%20%3D%202.1-,params2020%20%3D,-%7B). The `A0_by_depth` params are scipy interpolation objects, but could theoretically be any callable that will return A0 (in \u03bcV) for an arbitrary depth (in mm).\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "A minimal package for computing the kernel LFP approximation from Telenczuk et al., 2020",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/kjohnsen/tklfp/tree/master/"
    },
    "split_keywords": [
        "neuroscience",
        "kernel",
        "lfp",
        "telenczuk",
        "spikes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a70caf02c53a5298569775e7c9aca5e225368218126444a438ff93664465f0b",
                "md5": "0961093fbba43390db1130d20527b3b1",
                "sha256": "0238f2840b9129bbb83c7cd2e33442f5aae1bc641a68eb659ae235bf5ccf4781"
            },
            "downloads": -1,
            "filename": "tklfp-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0961093fbba43390db1130d20527b3b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12550,
            "upload_time": "2023-12-20T17:11:08",
            "upload_time_iso_8601": "2023-12-20T17:11:08.349143Z",
            "url": "https://files.pythonhosted.org/packages/1a/70/caf02c53a5298569775e7c9aca5e225368218126444a438ff93664465f0b/tklfp-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c25f6982a9f78fe60acfc13814d3d30ba62d39d2801da064cdf9fa1f24d205a2",
                "md5": "e7d74118659bc1c043cce90694904359",
                "sha256": "2a3a8de3fb7dd9aed60c3d14accf262b9fc625114f532532f75137ea1f48d0c9"
            },
            "downloads": -1,
            "filename": "tklfp-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e7d74118659bc1c043cce90694904359",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 966879,
            "upload_time": "2023-12-20T17:11:11",
            "upload_time_iso_8601": "2023-12-20T17:11:11.638368Z",
            "url": "https://files.pythonhosted.org/packages/c2/5f/6982a9f78fe60acfc13814d3d30ba62d39d2801da064cdf9fa1f24d205a2/tklfp-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-20 17:11:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kjohnsen",
    "github_project": "tklfp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tklfp"
}
        
Elapsed time: 0.15149s