Skip to content

Commit

Permalink
Merge pull request #3161 from vyudu/MTK
Browse files Browse the repository at this point in the history
fixing record from solution for observables in the BifurcationKit extension
  • Loading branch information
ChrisRackauckas authored Oct 29, 2024
2 parents 91eabc7 + e27da93 commit 75fdc56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/MTKBifurcationKitExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ObservableRecordFromSolution{S, T}
end
end
# Functor function that computes the value.
function (orfs::ObservableRecordFromSolution)(x, p)
function (orfs::ObservableRecordFromSolution)(x, p; k...)
# Updates the state values (in subs_vals).
for state_idx in 1:(orfs.state_end_idxs)
orfs.subs_vals[state_idx] = orfs.subs_vals[state_idx][1] => x[state_idx]
Expand Down
8 changes: 8 additions & 0 deletions test/extensions/bifurcationkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,12 @@ let
bf = bifurcationdiagram(bp, PALC(), 2, opts_br)

@test bf.γ.specialpoint[1].param0.1 atol=1e-4 rtol=1e-4

# Test with plot variable as observable
pvar = ModelingToolkit.get_var_to_name(fol)[:RHS]
bp = BifurcationProblem(fol, u0, par, bif_par; plot_var = pvar)
opts_br = ContinuationPar(p_min = -1.0,
p_max = 1.0)
bf = bifurcationdiagram(bp, PALC(), 2, opts_br)
@test bf.γ.specialpoint[1].param0.1 atol=1e-4 rtol=1e-4
end

0 comments on commit 75fdc56

Please sign in to comment.