Skip to main content

tklfp - Teleńczuk Kernel LFP

DOI

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.

This package was developed by Kyle Johnsen under the direction of Chris Rozell at Georgia Institute of Technology.

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.

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 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 exc_A0_by_depth and inh_A0_by_depth params are scipy interpolation objects built dynamically from the package's CSV data, but could theoretically be any callable that will return A0 (in μV) for an arbitrary depth (in mm).

Development

For development, you can install the package in editable mode with development dependencies:

pip install -e ".[dev]"

To format python files (via ruff) and clean notebooks (via nbdev-clean) before committing, run:

make scrub

To build and publish the package to PyPI, run:

make release

Citation

Please cite the publication for the Cleo simulator if you use this software in your research. You may also cite the Zenodo DOI for this repository.

Metadata

Release files for tklfp 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tklfp 0.3.0
File Size Uploaded Provenance Actions
tklfp-0.3.0.tar.gz 958.0 kB Without provenance Details for tklfp-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tklfp 0.3.0
File Interpreter ABI Platform Actions
tklfp-0.3.0-py3-none-any.whl Python 3 none any Details for tklfp-0.3.0-py3-none-any.whl

Total release size: 969.8 kB

Release files / tklfp-0.3.0.tar.gz

Download URL tklfp-0.3.0.tar.gz
Size 958.0 kB
Tags Source
SHA-256 checksum
How to use checksums
08eb0ecfba2a4c52cee2e861192afd5519493e3ba2110e748248229f5829063a
BLAKE2b-256 checksum
How to use checksums
1e94b7c5c4b21c1701946831ade3e1b72ec4d37fbe8b61048d2de7dd18443d74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tklfp-0.3.0-py3-none-any.whl

Download URL tklfp-0.3.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01cd3a489890a7612050ad9dc2d899dcdc53291126abe558fc1c6577c7441a91
BLAKE2b-256 checksum
How to use checksums
771ac0b02aba9b815fa12530ba5e7a66972fb751849d2498ad94681d5c2a43c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for tklfp 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page