{"id":37240221,"url":"https://github.com/LFPy/LFPy","last_synced_at":"2026-01-22T11:01:37.479Z","repository":{"id":5358345,"uuid":"6544527","full_name":"LFPy/LFPy","owner":"LFPy","description":"Python-module for calculation of extracellular potentials from multicompartment neuron models and networks","archived":false,"fork":false,"pushed_at":"2025-11-12T11:32:07.000Z","size":17443,"stargazers_count":83,"open_issues_count":12,"forks_count":46,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-11-12T13:19:20.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://LFPy.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LFPy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-11-05T13:14:06.000Z","updated_at":"2025-11-12T11:31:19.000Z","dependencies_parsed_at":"2023-02-14T07:00:43.310Z","dependency_job_id":"aa13779d-7cc9-4584-a932-380a6f58b34b","html_url":"https://github.com/LFPy/LFPy","commit_stats":{"total_commits":740,"total_committers":20,"mean_commits":37.0,"dds":0.727027027027027,"last_synced_commit":"5d241d62080f881415fd4becae06c8107571d2d1"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/LFPy/LFPy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LFPy%2FLFPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LFPy%2FLFPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LFPy%2FLFPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LFPy%2FLFPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LFPy","download_url":"https://codeload.github.com/LFPy/LFPy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LFPy%2FLFPy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28661882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-15T07:00:29.135Z","updated_at":"2026-01-22T11:01:37.471Z","avatar_url":"https://github.com/LFPy.png","language":"Python","readme":"LFPy  \n====\n\nSummary\n-------\n\nLFPy is a Python module for calculation of extracellular potentials from multicompartment neuron models.\nIt relies on the NEURON simulator (\u003chttp://www.neuron.yale.edu/neuron\u003e) and uses the\nPython interface (\u003chttp://www.frontiersin.org/neuroinformatics/10.3389/neuro.11.001.2009/abstract\u003e) it provides.\n\nLatest changes\n--------------\n\nJust updated LFPy? Please check the latest release notes: \u003chttps://github.com/LFPy/LFPy/releases\u003e\n\nUsage\n-----\nA brief video tutorial on LFPy is available here: \u003chttps://youtu.be/gCQkyTHZ1lw\u003e\n\nLFPy is preinstalled at the EBRAINS collaboratory, and you can test LFPy online without installation, by clicking this button:\n\n[![](https://nest-simulator.org/TryItOnEBRAINS.png)](https://lab.ebrains.eu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2FLFPy%2Ftutorial_at_EBRAINS\u0026urlpath=tree%2Ftutorial_at_EBRAINS%2F\u0026branch=main)\n\nNote that you might need to be logged into an EBRAINS account for the link to work.\nTo get a free EBRAINS account, sign up here: https://www.ebrains.eu/page/sign-up\n\nA basic simulation of extracellular potentials of a multicompartment neuron model set up with LFPy:\n\n    \u003e\u003e\u003e # import modules\n    \u003e\u003e\u003e import LFPy\n    \u003e\u003e\u003e from LFPy import Cell, Synapse, LineSourcePotential\n    \u003e\u003e\u003e import numpy as np\n    \u003e\u003e\u003e import matplotlib.pyplot as plt\n    \u003e\u003e\u003e # create Cell\n    \u003e\u003e\u003e cell = Cell(morphology=''.join(LFPy.__path__ +\n    \u003e\u003e\u003e                                ['/test/ball_and_sticks.hoc']),\n    \u003e\u003e\u003e             passive=True,  # NEURON 'pas' mechanism\n    \u003e\u003e\u003e             tstop=100,  # ms\n    \u003e\u003e\u003e            )\n    \u003e\u003e\u003e # create Synapse\n    \u003e\u003e\u003e synapse = Synapse(cell=cell,\n    \u003e\u003e\u003e                   idx=cell.get_idx(\"soma[0]\"),  # soma segment index\n    \u003e\u003e\u003e                   syntype='Exp2Syn',  # two-exponential synapse\n    \u003e\u003e\u003e                   weight=0.005,  # max conductance (uS)\n    \u003e\u003e\u003e                   e=0,  # reversal potential (mV)\n    \u003e\u003e\u003e                   tau1=0.5,  # rise time constant\n    \u003e\u003e\u003e                   tau2=5.,  # decay time constant\n    \u003e\u003e\u003e                   record_current=True,  # record synapse current\n    \u003e\u003e\u003e                  )\n    \u003e\u003e\u003e synapse.set_spike_times(np.array([20., 40]))  # set activation times\n    \u003e\u003e\u003e # create extracellular predictor\n    \u003e\u003e\u003e lsp = LineSourcePotential(cell=cell,\n    \u003e\u003e\u003e                           x=np.zeros(11) + 10,  # x-coordinates of contacts (µm)\n    \u003e\u003e\u003e                           y=np.zeros(11),  # y-coordinates\n    \u003e\u003e\u003e                           z=np.arange(11)*20,  # z-coordinates\n    \u003e\u003e\u003e                           sigma=0.3,  # extracellular conductivity (S/m)\n    \u003e\u003e\u003e                          )\n    \u003e\u003e\u003e # execute simulation\n    \u003e\u003e\u003e cell.simulate(probes=[lsp])  # compute measurements at run time\n    \u003e\u003e\u003e # plot results\n    \u003e\u003e\u003e fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))\n    \u003e\u003e\u003e axes[0].plot(cell.tvec, synapse.i)\n    \u003e\u003e\u003e axes[0].set_ylabel('i_syn (nA)')\n    \u003e\u003e\u003e axes[1].plot(cell.tvec, cell.somav)\n    \u003e\u003e\u003e axes[1].set_ylabel('V_soma (nA)')\n    \u003e\u003e\u003e axes[2].pcolormesh(cell.tvec, lsp.z, lsp.data, shading='auto')\n    \u003e\u003e\u003e axes[2].set_ylabel('z (µm)')\n    \u003e\u003e\u003e axes[2].set_xlabel('t (ms)')\n\nCode status\n-----------\n\n[![PyPI version](https://badge.fury.io/py/LFPy.svg)](https://badge.fury.io/py/LFPy)\n[![flake8 lint](https://github.com/LFPy/LFPy/actions/workflows/flake8.yml/badge.svg)](https://github.com/LFPy/LFPy/actions/workflows/flake8.yml)\n![Python application](https://github.com/LFPy/LFPy/workflows/Python%20application/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/LFPy/LFPy/badge.svg?branch=master)](https://coveralls.io/github/LFPy/LFPy?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/lfpy/badge/?version=latest)](http://lfpy.readthedocs.io/en/latest/?badge=latest)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/LFPy/LFPy_binder_examples/master)\n[![DOI](https://zenodo.org/badge/78627256.svg)](https://zenodo.org/badge/latestdoi/78627256)\n\nConda-forge status\n------------------\n\n[![Conda Recipe](https://img.shields.io/badge/recipe-lfpy-green.svg)](https://anaconda.org/conda-forge/lfpy)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy)\n[![Conda Platforms](https://img.shields.io/conda/pn/conda-forge/lfpy.svg)](https://anaconda.org/conda-forge/lfpy)\n\nInformation\n-----------\n\nLFPy provides a set of easy-to-use Python classes for setting up your model, running your simulations and calculating the extracellular potentials arising from activity in your model neuron. If you have a model working in NEURON (www.neuron.yale.edu) already, it is likely that it can be adapted to work with LFPy.\n\nThe extracellular potentials are calculated from transmembrane currents in multicompartment neuron models using the line-source method (Holt \u0026 Koch, J Comp Neurosci 1999),\nbut a simpler point-source method is also available. The calculations assume that the neuron are surrounded by an infinite extracellular medium with homogeneous and frequency\nindependent conductivity, and compartments are assumed to be at least at a minimal distance from the electrode (which can be specified by the user). For more information on\nthe biophysics underlying the numerical framework used see this coming book chapter:\n\n- K.H. Pettersen, H. Linden, A.M. Dale and G.T. Einevoll: Extracellular spikes and current-source density, in *Handbook of Neural Activity Measurement*, edited by R. Brette and A. Destexhe, Cambridge, to appear (preprint PDF, 5.7MB \u003chttp://www.csc.kth.se/~helinden/PettersenLindenDaleEinevoll-BookChapter-revised.pdf\u003e\n\nThe first release of LFPy (v1.x) was mainly designed for simulation extracellular potentials of single neurons, described in our paper on the package in Frontiers in Neuroinformatics entitled \"LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons\".\nThe article can be found at \u003chttps://dx.doi.org/10.3389/fninf.2013.00041\u003e.\nSince version 2 (LFPy v2.x), the tool also facilitates simulations of extracellular potentials and current dipole moment from ongoing activity in recurrently connected networks of multicompartment neurons, prediction of EEG scalp surface potentials,\nMEG scalp surface magnetic fields, as described in the publication \"Multimodal modeling of neural network activity: computing LFP, ECoG, EEG and MEG signals with LFPy2.0\" by Espen Hagen, Solveig Naess, Torbjoern V Ness, Gaute T Einevoll, found at \u003chttps://dx.doi.org/10.3389/fninf.2018.00092\u003e.\n\nCiting LFPy\n-----------\n\n- LFPy v2.x: Hagen E, Næss S, Ness TV and Einevoll GT (2018) Multimodal Modeling of Neural Network Activity: Computing LFP, ECoG, EEG, and MEG Signals With LFPy 2.0. Front. Neuroinform. 12:92. doi: 10.3389/fninf.2018.00092. \u003chttps://dx.doi.org/10.3389/fninf.2018.00092\u003e\n\n- LFPy v1.x: Linden H, Hagen E, Leski S, Norheim ES, Pettersen KH and Einevoll GT (2013). LFPy: A tool for biophysical simulation of extracellular potentials generated by detailed model neurons. Front. Neuroinform. 7:41. doi: 10.3389/fninf.2013.00041. \u003chttps://dx.doi.org/10.3389/fninf.2013.00041\u003e\n\nLFPy was developed in the Computational Neuroscience Group, Department of Mathemathical Sciences and Technology (\u003chttp://www.nmbu.no/imt\u003e),\nat the Norwegian University of Life Sciences (\u003chttp://www.nmbu.no\u003e),\nin collaboration with the Laboratory of Neuroinformatics (\u003chttp://www.nencki.gov.pl/en/laboratory-of-neuroinformatics\u003e),\nNencki Institute of Experimental Biology (\u003chttp://www.nencki.gov.pl\u003e), Warsaw, Poland. The effort was supported by\nInternational Neuroinformatics Coordinating Facility (\u003chttp://incf.org\u003e), the Research Council of Norway (\u003chttp://www.forskningsradet.no/english\u003e) (eScience, NevroNor),\nEU-FP7 (BrainScaleS, \u003chttp://www.brainscales.org\u003e),\nthe European Union Horizon 2020 Framework Programme for Research and Innovation under Specific Grant Agreement No. 785907 and No. 945539 [Human Brain Project (HBP) SGA2, SGA3 and EBRAINS].\n\nFor updated information on LFPy and online documentation, see the LFPy homepage (\u003chttp://lfpy.readthedocs.io\u003e).\n\nTutorial slides on LFPy\n-----------------------\n\n- Slides for OCNS 2019 meeting tutorial [T8: Biophysical modeling of extracellular potentials (using LFPy)](https://www.cnsorg.org/cns-2019-tutorials#T8) hosted in Barcelona, Spain on LFPy: [CNS2019 LFPy tutorial slides](https://LFPy.github.io/downloads/CNS2019_LFPy_tutorial.pdf \"slides\")\n- Older tutorial slides can be found at [https://github.com/LFPy/LFPy.github.io/tree/master/downloads](https://github.com/LFPy/LFPy.github.io/tree/master/downloads)\n\nRelated projects\n----------------\n\nLFPy has been used extensively in ongoing and published work, and may be a required dependency by the publicly available Python modules:\n\n- ViSAPy - Virtual Spiking Activity in Python (\u003chttps://github.com/espenhgn/ViSAPy\u003e, \u003chttp://software.incf.org/software/visapy\u003e),\n  as described in Hagen, E., et al. (2015), J Neurosci Meth, DOI:`10.1016/j.jneumeth.2015.01.029 \u003chttp://dx.doi.org/10.1016/j.jneumeth.2015.01.029\u003e`_\n\n- ViMEAPy that can be used to incorporate heterogeneous conductivity in calculations of extracellular potentials with LFPy\n  (\u003chttps://bitbucket.org/torbness/vimeapy\u003e, \u003chttp://software.incf.org/software/vimeapy\u003e). ViMEAPy and it's application is described\n  in Ness, T. V., et al. (2015), Neuroinform, DOI:`10.1007/s12021-015-9265-6 \u003chttp://dx.doi.org/10.1007/s12021-015-9265-6\u003e`_.\n\n- hybridLFPy - biophysics-based hybrid scheme for calculating the local field potential (LFP) of spiking activity in simplified\n  point-neuron network models (\u003chttps://github.com/INM-6/hybridLFPy\u003e),\n  as described in Hagen, E. and Dahmen, D., et al. (2016), Cereb Cortex, DOI:`10.1093/cercor/bhw237 \u003chttp://dx.doi.org/10.1093/cercor/bhw237\u003e`_\n\n- MEArec - Fast and customizable simulation of extracellular recordings on Multi-Electrode-Arrays (\u003chttps://github.com/alejoe91/MEArec\u003e)\n as described in Buccino, A.P., Einevoll, G.T. MEArec: A Fast and Customizable Testbench Simulator for Ground-truth Extracellular Spiking Activity. Neuroinform (2020). \u003chttps://doi.org/10.1007/s12021-020-09467-7\u003e\n\nRequirements\n------------\n\nDependencies should normally be automatically installed.\nFor manual preinstallation of dependencies, the following packages are needed:\n\n- Python modules numpy, scipy, matplotlib, h5py\n- MEAutility (\u003chttps://github.com/alejoe91/MEAutility\u003e)\n- LFPykit (\u003chttps://github.com/LFPy/LFPykit\u003e)\n- NEURON (from \u003chttp://www.neuron.yale.edu\u003e) and corresponding Python module. The following should execute without error in a Python console:\n\n        \u003e\u003e\u003e import neuron\n        \u003e\u003e\u003e neuron.test()\n\n- Cython (C-extensions for python, \u003chttp://cython.org\u003e) to speed up simulations of extracellular fields\n\nInstallation\n------------\n\nThere are few options to install LFPy:\n\n1. From the Python Package Index with only local access using pip:\n\n        pip install LFPy --user\n\n    as sudoer (in general not recommended as system Python files may be overwritten):\n\n        sudo pip install LFPy\n\n    Upgrading LFPy from the Python package index (without attempts at upgrading dependencies):\n\n        pip install --upgrade --no-deps LFPy --user\n\n    LFPy release candidates can be installed as:\n\n        pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple LFPy --user\n\n2. From the Python Package Index with only local access using easy_install:\n\n        easy_install --user LFPy\n\n    As sudoer:\n\n        sudo easy_install LFPy\n\n3. From source:\n\n        tar -xzf LFPy-x.x.tar.gz\n        cd LFPy-x.x\n        (sudo) python setup.py develop (--user)\n\n4. Development version from the GitHub repository:\n\n        git clone https://github.com/LFPy/LFPy.git\n        cd LFPy\n        (sudo) pip install -r requirements.txt (--user) # install dependencies\n        (sudo) python setup.py develop (--user)\n\n5. Anaconda Python (\u003chttps://www.anaconda.com\u003e, macos/linux only):\n\n    Add the conda-forge (\u003chttps://conda-forge.org\u003e) as channel:\n\n        conda config --add channels conda-forge\n        conda config --set channel_priority strict  # suggested\n\n    Create a new conda environment with LFPy and activate it:\n\n        conda create -n lfpy python=3 pip lfpy  # creates new Python 3.x conda environment named lfpy with pip and LFPy and their dependencies\n        conda activate lfpy  # activate the lfpy environment\n        python -c \"import LFPy; LFPy.run_tests()\"  # check that installation is working\n\n    LFPy can also be installed in existing conda environments if the dependency tree is solvable:\n\n        conda activate \u003cenvironment\u003e\n        conda install lfpy  # installs LFPy and its dependencies in the current conda environment\n\nUninstall\n---------\n\nTo remove installed LFPy files it should suffice to issue (repeat until no more LFPy files are found):\n\n    (sudo) pip uninstall LFPy\n\nIn case LFPy was installed using conda in an environment, it can be uninstalled by issuing:\n\n    conda uninstall lfpy\n\nDocker\n------\n\nWe provide a Docker (\u003chttps://www.docker.com\u003e) container recipe file with LFPy.\nTo get started, install Docker and issue either:\n\n    # build Dockerfile from GitHub\n    $ docker build -t lfpy https://raw.githubusercontent.com/LFPy/LFPy/master/Dockerfile\n    $ docker run -it -p 5000:5000 lfpy:latest\n\nor\n\n    # build local Dockerfile (obtained by cloning repo, checkout branch etc.)\n    $ docker build -t lfpy - \u003c Dockerfile\n    $ docker run -it -p 5000:5000 lfpy:latest\n\nIf the docker file should fail for some reason it is possible to store the build log and avoid build caches by issuing\n\n    docker build --no-cache --progress=plain -t lfpy - \u003c Dockerfile 2\u003e\u00261 | tee lfpy.log\n\nIf the build is successful, the ``--mount`` option can be used to mount a folder on the host to a target folder as:\n\n    docker run --mount type=bind,source=\"$(pwd)\",target=/opt -it -p 5000:5000 lfpy\n\nwhich mounts the present working dirctory (``$(pwd)``) to the ``/opt`` directory of the container.\nTry mounting the ``LFPy`` source directory for example (by setting ``source=\"\u003cpath-to-LFPy\u003e\"``).\nVarious LFPy example files can then be found in the folder ``/opt/LFPy/examples/``\nwhen the container is running.\n\nJupyter notebook servers running from within the\ncontainer can be accessed after invoking them by issuing:\n\n    cd /opt/LFPy/examples/\n    jupyter-notebook --ip 0.0.0.0 --port=5000 --no-browser --allow-root\n\nand opening the resulting URL in a browser on the host computer, similar to:\n\u003chttp://127.0.0.1:5000/?token=dcf8f859f859740fc858c568bdd5b015e0cf15bfc2c5b0c1\u003e\n\nHTML Documentation\n------------------\n\nTo generate the html documentation also hosted at \u003chttps://lfpy.rtfd.io\u003e using Sphinx,\nissue from the LFPy source code directory:\n\n    cd doc\n    make html\n\nThe main html file is in ``_build/html/index.html``.\nm2r2, Numpydoc and the Sphinx ReadTheDocs theme may be needed:\n\n    pip install m2r2 --user\n    pip install numpydoc --user\n    pip install sphinx-rtd-theme --user\n\nPhysical units in LFPy\n----------------------\n\nPhysical units follow the NEURON conventions found [here](https://www.neuron.yale.edu/neuron/static/docs/units/unitchart.html).\nThe units in LFPy for given quantities are:\n\n| Quantity                   | Symbol    | Unit      |\n|----------------------------|-----------|-----------|\n| Spatial dimensions         | x,y,z,d   | [μm]      |\n| Potential                  | v, Phi, Φ | [mV]      |\n| Reversal potential         | E         | [mV]      |\n| Current                    | i         | [nA]      |\n| Membrane capacitance       | c_m       | [μF/cm2]  |\n| Conductance                | g         | [S/cm2]   |\n| Synaptic conductance       | g         | [µS]      |\n| Extracellular conductivity | sigma, σ  | [S/m]     |\n| Current dipole moment      | P         | [nA µm]   |\n| Magnetic field             | H         | [nA/µm]   |\n| Magnetic permeability      | µ, mu     | [T m/A]   |\n| Current Source Density     | CSD       | [nA/µm3]  |  \n\nNote: resistance, conductance and capacitance are usually specific values, i.e per membrane area (lowercase r_m, g, c_m)\nDepending on the mechanism files, some may use different units altogether, but this should be taken care of internally by NEURON.\n","funding_links":[],"categories":["فیزیک"],"sub_categories":["کار با زمان و تقویم"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLFPy%2FLFPy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLFPy%2FLFPy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLFPy%2FLFPy/lists"}