jonescompneurolab / hnn-core

Simulation and optimization of neural circuits for MEG/EEG source estimates
https://jonescompneurolab.github.io/hnn-core/
BSD 3-Clause "New" or "Revised" License
51 stars 50 forks source link

add CSD plot for comparing against animal studies #68

Open jasmainak opened 5 years ago

jasmainak commented 5 years ago

Background

The ability to calculate LFP for simulated electrodes in the model (#150) allow for time vs. depth laminar CSD plots to be generated. Laminar CSD (electrodes arranged vertically) is the primary goal of this feature because laminar CSD is commonly used in animal studies where a laminar probe is inserted into the cortext to measure extracellular potentials. In the experimental animal studies, CSD is calculated from the bandpass filtered LFP data (low-frequency portion of extracellular potentials) to identify underlying neuronal activity at specific cortical layers. Such activity is identified as a "sink" (net influx of current into cell) or "source" (efflux into extracellular space) in the temporal-spatial domain.

Figure 5 from Sherman et al. 2016 shows laminar CSD plots of an anesthetized mouse and an awake monkey.

Screen Shot 2020-09-08 at 8 41 05 AM

Sherman MA, Lee S, Law R, et al. Neural mechanisms of transient neocortical beta rhythms: Converging evidence from humans, computational modeling, monkeys, and mice. Proc Natl Acad Sci U S A. 2016;113(33):E4885-E4894. doi:10.1073/pnas.1604135113

CSD can be calculated via

numpy.diff(LFP_data,n=2,axis=ax)/spacing_mm**2

The sign may be adjusted to make a current sinks negative and sources positive.

Goal

Create laminar CSD plots from simulated data that are comparable to Figure 5 in Sherman et al. 2016

Requirements

  1. Averaging LFP over multiple trials is typically done before computing CSD
  2. CSD plots are created using a 2D spline over values at each electrode depth. Support various spline functions.
  3. Users need to be able to easily adjust the X,Y scales to match simulated data with their experimental data
  4. The CSD of the first and last channels cannot be computed using the 2nd spatial derivative. The Vaknin method is used to derive approximate CSD signals at these points

    G. Vaknin, P.G. DiScenna, T.J. Teyler, A method for calculating current source density (CSD) analysis without resorting to recording sites outside the sampling volume, Journal of Neuroscience Methods, Volume 24, Issue 2, 1988, Pages 131-135, ISSN 0165-0270, https://doi.org/10.1016/0165-0270(88)90056-8.

  5. Implement iCSD method as an alternative to numpy.diff() above
jasmainak commented 3 years ago

@blakecaldwell can you help me in this issue by adding more details what is needed? You can edit the issue description and perhaps add an image? Perhaps link to publication or an already existing implementation somewhere?

jasmainak commented 3 years ago

@cjayb I'm reopening this since CSD is not yet implemented

jasmainak commented 2 years ago

API settled upon after discussion with @ntolley and Ayo was the following:

csd = net.lfp_array[‘array1’][trial_idx].get_csd(method=’laplacian’, interpolation=’spline’)
net.lfp_array[‘array1’][trial_idx].plot(…, csd=csd)
rythorpe commented 1 year ago

I just re-discovered this issue after finishing #517. Have we moved past this or should we make the above-mentioned features + API the next PR?

jasmainak commented 1 year ago

I think it would be good for users to have access to the CSD array somehow. I can imagine it being a common use-case and also makes it easier to write tests.

Also in terms of implementation, we should start using the "f-matrix" even for the basic implementation, as in here. That way, it will be easier to extend to the other methods.

ntolley commented 1 month ago

Our conversation at dinner made me think of this.

We technically have a CSD plot in what of the examples (just not smoothed/interpolated). Should we consider this closed?

jasmainak commented 1 month ago

I'd like to have at least one of the interpolated versions so that it can be overlaid with LFP. It's not too hard to implement, just need a motivated student to complete it :)