-
Notifications
You must be signed in to change notification settings - Fork 0
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
Reenable the connection matrix storage for the DBS structures #455
Conversation
When you asked me for mean firing rate test I thought you meant tests for the If we want it to be robust to some small changes (like floating point errors due to different calculations or something that makes the randomness to change) we would need to for the simulations to run for a long timespan, which would add more computation time and resources consumption for the tests. Maybe I can make the tests with just a few neurons in each population. Would you prefer a separate firing rate test for each composite blox, a single one for all the populations connected, or only a test for FSI (which would test both |
Ah yeah, sorry for the confusion.
Yeah, true. I think doing a single test per population should be fine, since the problematic change here was internal to the population and didn't require interactions. |
- fix the trimming of initial transient
I added the firing rate tests, checking if an average over an ensemble of 5 simulations is approximate to their corresponding mean firing rates, with tolerances of 2.5*std. I calculated those mean firing rates and stds on the original implementation, over 100 whole repetitions (creating the populations from scratch in order to account for different random connections between the neurons). I'm testing isolated populations, as you suggested, including 10 neurons each, integrating for 6500 ms and trimming the initial 1000 ms to skip the transient. The tests pass for all populations except for FSI. So I guess there might be a problem with the |
Okay so the FSI stuff is now fixed! |
return t_fr, fr | ||
end | ||
|
||
function mean_firing_rate(blox, sols::SciMLBase.EnsembleSolution; trim_transient = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a dispatch working for blox::Union{CompositeBlox, AbstractVector{<:AbstractNeuronBlox}}
probably using get_components
and calling this dispatch internally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a dispatch working with a simple solution instead of ensemble, although this could be sorted here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally I would rename this just firing_rate
both for brevity and because you are not just returning the mean. The function should work with a single AbstractNeuronBlox
too where it returns a single rate (there are no more bloxs to average over).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function should work with a single AbstractNeuronBlox too where it returns a single rate (there are no more bloxs to average over).
Ok this is not always true, my bad. You can average over the solutions in an ensemble.
mean_fr = mean(firing_rates) | ||
std_fr = std(firing_rates) | ||
|
||
return t_fr, mean_fr, std_fr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a big fan of tuple outputs like these. Particularly when we add a dispatch for a single solution, the std_fr
can become meaningless, except for the case of a CompositeBlox
or a vector or bloxs where the average would be over neurons. Given that this function is relatively fast, would it be too bad to have a separate std
function that has dispatches only for combinations of inputs that are meaningfull, e.g.
(blox::Neuron_or_NeuralMass, ::EnsembleSolution)
(blox::Union{Composite, Vector{<:Neuron_or_NeuralMass}, ::SingleSolution)
- and maybe
(blox::Union{Composite, Vector{<:Neuron_or_NeuralMass}, ::EnsembleSolution)
where we'll need to specify over what exactly we average.
My comments are not relevant for the original purpose of this PR, so you could merge without addressing them here. I just added them here because a new Thanks for adding firing rate tests. When we finish adding all dispatches of that function we should test extracting firing rates from components and manually average them to compare against extracting firing rates from composite bloxs (that contain the components). |
@MasonProtter Thanks for fixing the FSI stuff! @harisorgn Thanks for all your comments, I'll make the suggested changes :) I agree, we can already merge this PR and continue working on the firing rates tomorrow on a different PR. |
Great, thanks guys! |
@gabrevaya I checked the firing rates and whatnot with this change and it looks good to me, but without tests it's hard to know. Can you take a look at this and tell me if it's good?
CI may complain about this PR until #454 is merged, because there are some previously broken GraphDynamics tests that are now fixed upstream and #454 reenables them