Skip to content

Commit

Permalink
Merge branch 'final_testing' of https://github.com/Neuroblox/Neuroblo…
Browse files Browse the repository at this point in the history
…x.jl into final_testing
  • Loading branch information
anandpathak31 committed Jan 17, 2024
2 parents 871bc50 + 0210e40 commit 3055e7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Neuroblox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,6 @@ export create_adjacency_edges!
export get_namespaced_sys, nameof
export run_experiment!, run_trial!
export addnontunableparams, get_hemodynamic_observers
export get_weights

end
16 changes: 16 additions & 0 deletions src/blox/blox_utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,22 @@ function get_event_time(kwargs, name_blox1, name_blox2)
end
end

function get_weights(agent::Agent, blox_out, blox_in)
ps = parameters(agent.odesystem)
pv = agent.problem.p
map_idxs = Int.(ModelingToolkit.varmap_to_vars([ps[i] => i for i in eachindex(ps)], ps))

name_out = String(namespaced_nameof(blox_out))
name_in = String(namespaced_nameof(blox_in))

idxs_weight = findall(ps) do p
n = String(Symbol(p))
occursin("w_", n) && occursin(name_out, n) && occursin(name_in, n)
end

return pv[map_idxs[idxs_weight]]
end

function find_spikes(x::AbstractVector{T}; minprom=zero(T), maxprom=nothing, minheight=zero(T), maxheight=nothing) where {T}
spikes, _ = argmaxima(x)
peakproms!(spikes, x; minprom, maxheight)
Expand Down

0 comments on commit 3055e7e

Please sign in to comment.