Open russelljjarvis opened 6 years ago
Perhaps if I export to LEMs model via the file parse_glif.py
I can re-simulate with a similar LEMs and verify the output?
Could also do parse_glif
, then convert the LEMS file to NEURON with jnml, and then check the output. NEURON does not support NaN values so PG had to decide how to deal with them when he converted the original models. You could also examine the NeuroML glif definition to see how he ensures all values are defined:
Thanks, Justas yes I will take the parse glif_approach for sure.
The reason, the waveform looks like it pertains to, two unrealistic spikes instead of one is because I am using the glif cells own spike counting function, instead of the alternative of just using neuronunits own spike_train function instead.
vms = self.get_membrane_potential()
from neuronunit.capabilities.spike_functions import get_spike_train
return get_spike_train(vms)
code for this is now at
https://github.com/russelljjarvis/neuronunit/blob/glif/neuronunit/models/interfaces/glif.py#L62-#L65
Through trial and error I learned that the glif cells simply have different units (seconds, voltage) as opposed to (ms, mV). Using the approach above I have learned that I can get smooth membrane potential waveforms, indicative of time constants and capacitive resistance, however I also think that the default glif models, may lead to very unrealistic traces under the default parameters.
Running dir over the glif model indicates a lot of object attributes that are actually changeable model parameters. If I attach these to the genetic algorithm, I think I would start to get realistic outputs.
As discussed I have attached the GLIF cells to the BluePyOpt optimizer.
The result is more realistic waveforms, but still not realistic enough to do spike width and height tests.
Right, the GLIF model is definitely not meant to capture anything about spike waveform properties, only spike timing and maybe a little bit of simple subthreshold behavior.
@russelljjarvis @rgerkin Glad to see you're using the GLIFs from the Allen Institute OSB repo. I haven't been following all of the discussions here, but if you do have any issue with running these, do open up issues in the https://github.com/OpenSourceBrain/AllenInstituteNeuroML repo.
BTW, as you'll probably have seen the cells are I&F (so no real spikes), but also the resting potentials of the cells are all shifted to 0mV to ease tuning/comparison between cells. This would probably mean many of the measures of whether they're like the equivalent bio cell can be expected to fail. The GLIFs could be adjusted to be more like the real ephys data, but that's a project in itself...
Yes, I was slow to remember that GLIF actually expands out to (Generalized Leaky Integrate and Fire) Neurons. It's hard to know what tests to run if any. I can imagine a case for testing the Coefficient of Variation of spike times, in a network connected GLIF cell, perhaps.
@rgerkin @JustasB @vrhaynes
Currently in the GLIF model, to deal with
nan
values, I have substituted in the code belowThe y-axis is
(pA)
and the x-axis is(seconds)
. From visual inspection, there might be something a bit wrong with the time scale and I am thinking through this issue now ...However the returned membrane potential looks much more like the current injection value than an expected membrane potential. See the figure for of
plt.plot(times,vm)
below:@vrhaynes you seem pretty savy with the GLIF models. Do you think replacing nans with
self.results['interpolated_spike_voltage']'s
is appropriate? Is it correct to think ofglif.run(stim)
as a first pass run, andresults['interpolated_spike_voltage']
as a components of a second pass run?plotting code: