Skip to main content

A minimal package for computing the kernel LFP approximation from Telenczuk et al., 2020

Project description

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.

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

tklfp-0.3.0.tar.gz (958.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tklfp-0.3.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file tklfp-0.3.0.tar.gz.

File metadata

  • Download URL: tklfp-0.3.0.tar.gz
  • Upload date:
  • Size: 958.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for tklfp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 08eb0ecfba2a4c52cee2e861192afd5519493e3ba2110e748248229f5829063a
MD5 759bc1fc4d6ba74a10ce30440da61d59
BLAKE2b-256 1e94b7c5c4b21c1701946831ade3e1b72ec4d37fbe8b61048d2de7dd18443d74

See more details on using hashes here.

File details

Details for the file tklfp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tklfp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for tklfp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01cd3a489890a7612050ad9dc2d899dcdc53291126abe558fc1c6577c7441a91
MD5 a72f449e4016664946d157f784671896
BLAKE2b-256 771ac0b02aba9b815fa12530ba5e7a66972fb751849d2498ad94681d5c2a43c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page