-
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
Sermon et al. helper functions #378
base: master
Are you sure you want to change the base?
Conversation
@harisorgn the latest version of |
@helmutstrey @harisorgn quick update: I've got the code working in the sense that it's all connected and running, but it doesn't remotely reproduce the paper with the parameters and equations the authors give. I've noted some diagnostic plots that should reproduce some of the figures from the paper directly (but don't) and where I think there must be a dropped factor in one of the equations. I'll also put this in Slack so we can discuss if it's worth reaching out to the authors for their code. |
|
||
if haskey(kwargs, :sermon_rule) | ||
if haskey(kwargs, :extra_bloxs) && haskey(kwargs, :extra_params) | ||
RRP, RP, RtP = kwargs[:extra_bloxs] |
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.
This looks hardcoded for the particular tutorial case, i.e. expecting 3 elements in kwargs[:extra_bloxs]
. You can imagine this breaking very easily if a user passes a different number in that keyword. We should generalize this in a loop, seems doable?
out_RP = namespace_expr(RP.output, get_namespaced_sys(RP)) | ||
out_RtP = namespace_expr(RtP.output, get_namespaced_sys(RtP)) | ||
|
||
M_RRP, M_RP, M_RtP, k_μ, I = kwargs[:extra_params] |
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.
Same as above about kwargs[:extra_bloxs]
but now it's kwargs[:extra_params]
. I understand that we might want to keep this conenction rule specific to the tutorial (for now) in the interest of development speed, but we should think about the most likely breaking cases.
w = generate_weight_param(bloxout, bloxin; kwargs...) | ||
push!(bc.weights, w) | ||
|
||
if haskey(kwargs, :sermon_rule) |
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 don't see an else
to this if
. Could we just claim that (for now) :sermon_rule
is the only possible connection rule to reduce the kwargs
that are exposed to the user? Or were you planning on adding more rules?
Does it make sense to define a The alternative could be that you keep pools and oscillators separate as you do and pass in the connection rule between oscillators some expression that involves pool states/parameters. We would then need to get the namespaces of these pool symbolics correct, so that you don't get almost duplicates in |
# Create a new DBS stimulator block | ||
# Largely based on MTK Standard Library pulse block from the digital electronics | ||
# Implements unnumbered equation below equation 2 for the pulse train, with default parameters from the paper | ||
struct SermonDBS <: NeuralMassBlox |
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.
@gabrevaya this is the stimulator for an arbitrary pulse train
end | ||
|
||
# Connects the DBS stimulator to the Kuramoto oscillators (Iₜ term in equation 1) | ||
function (bc::BloxConnector)( |
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.
@gabrevaya this is the connection rule for the DBS stimulator to Kuramoto blocks
Helper functions to resolve #377.