A minimal package for computing the kernel LFP approximation from Telenczuk et al., 2020
Project description
tklfp - Teleńczuk Kernel LFP
This is a lightweight package for computing the kernel LFP approximation from Teleńczuk et al., 2020. 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.
How to install:
Simply install from pypi:
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):
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):
lfp = tklfp.compute(i_n, t_ms, t_eval_ms)
A complete example, reworking the demo from the original paper, can be found here. Basic usage information is also accessible in docstrings.
Future development
The package uses parameters from the original 2020 paper by default. This can be changed by passing in an alternate parameter dictionary on initialization:
tklfp = TKLFP(..., params=new_params)
The new params must have the same content as the default tklfp.params2020
. 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).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tklfp-0.1.1.tar.gz
.
File metadata
- Download URL: tklfp-0.1.1.tar.gz
- Upload date:
- Size: 973.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8813c07d6b3c90c973f23275dd2bcd2f5fb2242565def55dd647d07e7cc002 |
|
MD5 | 452ec702ab6d4b5297d32b448cfabeaf |
|
BLAKE2b-256 | f45ea421454476628560bc51d362e2fc38928998a3844998f39f51ad24cf633d |
File details
Details for the file tklfp-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tklfp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f8e5ca562bb51b076a68aa2fc7b18f1c11673dc3ccba62c96541e5f4d7fcf23 |
|
MD5 | 57d5c6b5509d75af9e5bc68f46a491f9 |
|
BLAKE2b-256 | eb8cc67dbb9f96fb60cc1cfff00f6a48ef0a1a3f373f9d4b81995abd8f6f0c54 |