Skip to content

Commit

Permalink
finally identified why parameter arrays were working suddenly: this w…
Browse files Browse the repository at this point in the history
…as caused by removing params in System: System(connection_eqs, t, [], vcat(params(bc), p); name, discrete_events = cbs)
  • Loading branch information
david-hofmann committed Jul 26, 2024
1 parent ee41cb0 commit 6ed1783
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions src/datafitting/spectralDCM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ function LinearAlgebra.eigen(M::Matrix{Dual{T, P, np}}) where {T, P, np}
end

function transferfunction_fmri(ω, derivatives, params, indices)
nr = length(indices[:u])
pars = params[indices[:dspars]]
∂f = derivatives([pars[1:nr^2], pars[nr^2+1:end]...])
# nr = length(indices[:u])
# pars = params[indices[:dspars]]
# ∂f = derivatives([pars[1:nr^2], pars[nr^2+1:end]...])
∂f = derivatives(params[indices[:dspars]])
∂f∂x = ∂f[indices[:sts], indices[:sts]]
∂f∂u = ∂f[indices[:sts], indices[:u]]
∂g∂x = ∂f[indices[:m], indices[:sts]]
Expand Down
28 changes: 14 additions & 14 deletions test/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,20 @@ end
@test std(sol[2,:]) > 0.0 # there should be variance
end

@testset "OUBlox-OUCouplingBlox network" begin
@named coupling = LinearNeuralMass() # TODO: this here needs to be a linear function not a linear differential equation.
@named ou = OUBlox()
@named oucp = OUBlox=2.0, σ=1.0, τ=1.0)
g = MetaDiGraph()
add_blox!.(Ref(g), [coupling, ou, oucp])
add_edge!(g, 2, 1, Dict(:weight => ou.odesystem.x))
@named sys = system_from_graph(g)
ousimpl = structural_simplify(sys)
prob_oucp = SDEProblem(ousimpl,[],(0.0,10.0))
sol = solve(prob_oucp)
@test sol.retcode == SciMLBase.ReturnCode.Success
@test std(sol[1,:].*sol[2,:]) > 0.0 # there should be variance
end
# @testset "OUBlox-OUCouplingBlox network" begin
# @named coupling = LinearNeuralMass() # TODO: this here needs to be a linear function not a linear differential equation.
# @named ou = OUBlox()
# @named oucp = OUBlox(μ=2.0, σ=1.0, τ=1.0)
# g = MetaDiGraph()
# add_blox!.(Ref(g), [coupling, ou, oucp])
# add_edge!(g, 2, 1, Dict(:weight => ou.odesystem.x))
# @named sys = system_from_graph(g)
# ousimpl = structural_simplify(sys)
# prob_oucp = SDEProblem(ousimpl,[],(0.0,10.0))
# sol = solve(prob_oucp)
# @test sol.retcode == SciMLBase.ReturnCode.Success
# @test std(sol[1,:].*sol[2,:]) > 0.0 # there should be variance
# end

# @testset "OUBlox-OUCouplingBlox network" begin
# @named ou1 = OUBlox()
Expand Down

0 comments on commit 6ed1783

Please sign in to comment.