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

Alpha/beta tutorial documentation issue #285

Open
jasmainak opened this issue Mar 30, 2021 · 13 comments
Open

Alpha/beta tutorial documentation issue #285

jasmainak opened this issue Mar 30, 2021 · 13 comments

Comments

@jasmainak
Copy link
Collaborator

jasmainak commented Mar 30, 2021

I'm starting an issue with all the issues I notice in the alpha/beta tutorial as I go through it on latest HNN (that uses HNN-core). I'll keep updating this description

cc @stephanie-r-jones @dylansdaniels

  • spikes/burst is not restricted to be 1 or 2 anymore, thanks to hnn-core. You can provide any value.
  • "Start simulation" -> "Run simulation"
  • The tutorial explains how subthresholded activity is needed for alpha but I didn't find an explanation why
  • ylim of dipole plot has changed with respect to the website
  • OnlyRhythmicDistal.param gives a different output than the website:
    image

vs

image

@cjayb
Copy link
Contributor

cjayb commented Apr 1, 2021

  • I confirmed that hnn-core produces the upper plot given the file OnlyRhythmicDist.param
  • b1522b9 produces the lower plot

My suspicion is that the seed assignment is not working as expected (seedcore=4 in the param file).

@jasmainak
Copy link
Collaborator Author

wrong commit linked?

@cjayb
Copy link
Contributor

cjayb commented Apr 1, 2021

Nope, should be OK: b1522b9

I tried to bisect, but there are so many commits in between that fail (apparently for other reasons) that it's impossible to figure out (+100 for CI!)

I'll have to go in and manually debug/inspect the drive (feed) creation process.

@jasmainak
Copy link
Collaborator Author

It just links me to a README

Maybe this is a good argument to switch to the "merge and squash" model ... that way we ensure all the commits have passing tests. Let's see ... I'm still hoping it's not too much of a pain

@cjayb
Copy link
Contributor

cjayb commented Apr 3, 2021

After much digging, I finally determined that the discrepancy is due to seeding. There are some deep, hard-coded assumptions still lurking in HNN-GUI about the number and identity of drives. Using a param file with 'DistOnly' causes the seed to be offset by 1. Changing the seedcore from 4 to 3 produces this output in master

Screenshot 2021-04-03 at 11 21 45

As for the "fix"... I actually think hnn-core is doing what it's supposed to here. It's assigning the seed value for the 'bursty2' drive to be seedcore + the GID of the 271st cell in the network. What black magic the GUI is doing to change that, I don't (really care to) know.

I think the Documentation-label is correct for this issue, and the fix is to create a new plot for the tutorial website. Changing seedcore=3 in the param-file would also do the trick.

@jasmainak
Copy link
Collaborator Author

jasmainak commented Apr 3, 2021

Thanks for digging in! For now, I think fixing the seed to a new value is good enough.

HOWEVER, I think there needs to be some effort in understanding what's going on a bit deeper. I'm tempted to say that there is too much flexibility in the input spike timings when the seed changes. Looking at the spike histograms and the waveforms, I think both the plots are equally legitimate and the network is behaving as it should. The question is -- why is the spike generation process such that changing the seed has such a dramatic effect (observing only alpha to observing alpha/beta complex)?

I'm curious what happens if we take say 100 or even 500 seeds and plot the event times of the input spikes. What does it look like?

@jasmainak
Copy link
Collaborator Author

is this acceptable for the jitter example:

image

this is the original HNN example:

image

I'm leaning towards saying this is acceptable. The input spikes are different probably due to somewhat different seeding.

@jasmainak
Copy link
Collaborator Author

I can't quite figure out how to select the spectrogram for an individual trial

@cjayb
Copy link
Contributor

cjayb commented Apr 6, 2021

I think that looks pretty acceptable and agree the minor details are due to seeding differences.

I don't know how to make a single-trial spectrogram either, anyone?

@jasmainak
Copy link
Collaborator Author

jasmainak commented Apr 6, 2021

image

Code to reproduce:

import matplotlib.pyplot as plt

import hnn_core
from hnn_core import read_params, Network

params_fname = ('/Users/mainak/Documents/github_repos/hnn/param/'
                'OnlyRhythmicDist.param')
params = read_params(params_fname)

for seed, symbol in zip([1, 2, 3, 4], ['r.', 'b.', 'g.', 'y.']):
    params['prng_*'] = seed
    net = Network(params, add_drives_from_params=True)
    net._instantiate_drives(n_trials=1)

    event_times = net.external_drives['bursty2']['events'][0][0]
    plt.plot(event_times, [seed] * len(event_times), symbol,
             label=f'seed {seed}')
plt.legend()
plt.show()

The 10 pairs of bursts are overlapping ... is that how it's meant to be? I somehow had the impression from the tutorial that they were different trials and/or cells.

image

See how for seed=4, there is an overlap in two consecutive population bursts. I think reducing the burst std dev (it's 20 ms) will reduce this overlap and produce a more clean 10 Hz regardless of the seed. Wdyt @stephanie-r-jones @ntolley @rythorpe ?

ps: this idea of a doublet does not look super useful to me now that I look at what spike train it creates ...

@cjayb
Copy link
Contributor

cjayb commented Apr 7, 2021

Nice viz (plot_events)! I think the alpha/beta-example is mostly about how a near-simultaneous burst of distal and proximal drive creates beta-events (see my reproduction of a relevant paper) that look like this:

Law2019_Fig4B

It arises because the width of the distal and proximal bursts are different, even though they're occurring at the same mean times. I think if you want to drive a network at 10 Hz, yes: reducing the std will work. What I find interesting (and what the tutorial is working towards), though, is how 20 Hz events arise out of two 10 Hz drives (not immediately obvious).

As for the doublets: my guess is that the ISI (10 ms) is tuned to affect the cells somehow. Perhaps the first spike primes (depolarises) the membrane, so that the second one leads to a larger Ca-influx through NMDA channels. This might lead to a larger dendritic current. But I'm riffing here. @stephanie-r-jones am I close?

@jasmainak
Copy link
Collaborator Author

jasmainak commented Apr 7, 2021

Here is a zoomed in view to the population burst

image

there are some doublets for sure but there is a lot of overlap, and in some population bursts there is too much overlap and they all overlap. Also I see some singlets. I guess my first question is -- does this look like what was meant to be implemented?

Next question is that I'm not super-convinced it matters :) You could just draw straight from a gaussian distribution and you'd get the same dipole waveforms. Not sure if it would make a lot of neuroscientific sense but it would fit the data ...

@stephanie-r-jones
Copy link
Member

stephanie-r-jones commented Apr 12, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants