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.

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 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

tklfp-0.2.1.tar.gz (966.9 kB view details)

Uploaded Source

Built Distribution

tklfp-0.2.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tklfp-0.2.1.tar.gz
  • Upload date:
  • Size: 966.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for tklfp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2a3a8de3fb7dd9aed60c3d14accf262b9fc625114f532532f75137ea1f48d0c9
MD5 e7d74118659bc1c043cce90694904359
BLAKE2b-256 c25f6982a9f78fe60acfc13814d3d30ba62d39d2801da064cdf9fa1f24d205a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tklfp-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for tklfp-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0238f2840b9129bbb83c7cd2e33442f5aae1bc641a68eb659ae235bf5ccf4781
MD5 0961093fbba43390db1130d20527b3b1
BLAKE2b-256 1a70caf02c53a5298569775e7c9aca5e225368218126444a438ff93664465f0b

See more details on using hashes here.

Supported by

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