Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic: LFPy–Arbor coordination #18

Closed
4 tasks
halfflat opened this issue Jun 26, 2020 · 3 comments
Closed
4 tasks

Epic: LFPy–Arbor coordination #18

halfflat opened this issue Jun 26, 2020 · 3 comments
Assignees

Comments

@halfflat
Copy link
Collaborator

halfflat commented Jun 26, 2020

Aspect Detail
Summary How might Arbor be used in conjunction with LFPy, or directly for LFP simulation?
Task Area Development
Assignee
Information
Prerequisites
Dependencies

Summary

Tasks

  • Develop prototype LFP demos in Arbor
  • Determine if we should pursue Arbor-specific LFP support, or instead interface with LFPy.
  • Finalize specifications.
  • Produce working implementations.

Arbor prototype development is current tracked in Arbor issues #1057 and #1036.

Requirements

In the first instance (prototype development) we will develop an LFP demo based on Arbor, emulating an equivalent simple NEURON demo provided by LFPy.

Acceptance criteria

@halfflat halfflat self-assigned this Jun 26, 2020
@torbjone torbjone changed the title LFPy–Arbor coordination Epic: LFPy–Arbor coordination Jun 26, 2020
@espenhgn
Copy link

espenhgn commented Aug 5, 2020

Hi @halfflat and @torbjone. Feel free to add me to this issue.

I would advocate that methods to compute extracellular potentials and related measures of neural activity (current dipole moments, EEG, MEG, etc.) get native support in Arbor, instead of adding Arbor as a simulation back end to LFPy. LFPy in it's present form is very much built around NEURON's Python interface and it would be a substantial effort to rewrite LFPy, in particular the LFPy.Cell class. I guess it is not in the plan to clone the hoc interface of NEURON in Arbor (as import arbor as neuron) anyway.

I'm looking at the simple LFP example file https://github.com/arbor-sim/arbor/blob/master/example/lfp/lfp.cpp, and for such linearly dependent measures, it should be feasible within Arbor to precompute the mapping M between transmembrane currents of compartments on each process I and corresponding measure V_e at each (interpolated) time step in the simulation as MI. Alternatively the the currents can be buffered. Then the different contributions of cells on different processes can be summed using MPI.Reduce(V_ext, OP=MPI.SUM) every few time steps.

In order to compute different mappings, there are already some lower lever Python functions in LFPy that can possibly be carried over however, see https://github.com/LFPy/LFPy/blob/master/LFPy/lfpcalc.py
They do not require NEURON.

From the user's perspective in order to create an extracellular recording electrode, I think having a syntax in Python similar to the following would be nice:

import arbor
import numpy as np
# create cells, attach stimulus etc. 
...

# create extracellular recording device
e = arbor.create_extracellular_recording_device(
    dt = 0.05,      # sampling interval [ms]
    sigma = 0.3,  # conductivity of extracellular medium [S/m]
    contact_points=np.array([[...]]), # xyz-coordinates of probe contact points [um]
    source_geometry='line',  # selector for 'line' or 'point' sources for each compartment
    gids=[...],  # List of gids of cells from which to compute extracellular potential, optional
    **kwargs # additional arguments
)

# create current dipole moment recorder for EEG/MEG like signals
p = arbor.create_current_dipole_moment(
    dt=1.  # sampling interval [ms]
    cells = [....]  # optional list of gids of cells from which to compute dipole moments
)

# make model
m = arbor...

# run simulation
m.run(100)

# get data
e.traces  # extracellular potential at the different recording sites for each time step [mV]
p.traces  # x,y,z-components of the current dipole moment at each time step [nA um] 

I don't know however how this would appear on the C++ level, but if a generic method to compute measures that depend linearly on transmembrane currents (and/or voltages) can be provided natively in Arbor, it could be quite trivial to write python functions for different measurement modalities.

What do you think?

@espenhgn
Copy link

@halfflat, I've created an issue in the main hybridLFPy repo for the hybridLFPy-Arbor idea we discussed here: INM-6/hybridLFPy#67 (for future reference and all that).

@w-klijn
Copy link
Contributor

w-klijn commented Nov 23, 2021

This work is done in a seperate repo. Closing the issue at this location

@w-klijn w-klijn closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants