ModelingToolkit.jl
ModelingToolkit.jl copied to clipboard
towards BifurcationKit @0.4
Checklist
- [ ] Appropriate tests were added
- [ ] Any code changes were done in a way that does not break public API
- [ ] All documentation related to code changes were updated
- [ ] The new code follows the contributor guidelines, in particular the SciML Style Guide and COLPRAC.
- [ ] Any new documentation only uses public API
Additional context
Add any other context about the problem here.
AssertionError: lens isa Int || lens isa AllOpticTypes @rveltz do you know what this is?
Yes it is to ensure that the parameter axis is an int or an @optic (from accessors.jl)
Note that you don't need setfield anymore and it is re exported by BK. Not sure why you put it back
LoadError: UndefVarError:@lensnot defined inMain.var"##BifurcationKit Extension Test#294"` I think doing what you are saying leads to this error?
I am confused. In [email protected] I replaced Setfield by Accessors. They should not be any @lens anywhere in the code
AssertionError: lens isa Int || lens isa AllOpticTypes@rveltz do you know what this is?
Yes. It is to allow to pass @optic _.bla or an Int as a parameter axis
replace the line https://github.com/SciML/ModelingToolkit.jl/blob/master/test/extensions/bifurcationkit.jl#L39 with BifurcationKit.@optic _[1] and it should work
LoadError: MethodError: no method matching (::Main.var"##BifurcationKit Extension Test#289".var"#2#6")(::Vector{Float64}, ::Float64; iter::BifurcationKit.ContIterable{BifurcationKit.EquilibriumCont, BifurcationKit.BifurcationProblem{BifurcationKit.BifFunction{Main.var"##BifurcationKit Extension Test#289".var"#f_BK#5", BifurcationKit.var"#8#24", Nothing, BifurcationKit.var"#6#22", Nothing, BifurcationKit.var"#11#28"{BifurcationKit.var"#d1Fad#26"}, BifurcationKit.var"#13#30", BifurcationKit.var"#15#32", BifurcationKit.var"#17#34", Bool, Float64}, Vector{Float64}, Vector{Float64}, Accessors.IndexLens{Tuple{Int64}}, typeof(BifurcationKit.plot_default), Main.var"##BifurcationKit Extension Test#289".var"#2#6", typeof(BifurcationKit.save_solution_default)}, BifurcationKit.PALC{BifurcationKit.Secant, BifurcationKit.MatrixBLS{BifurcationKit.DefaultLS}, Float64, BifurcationKit.DotTheta{BifurcationKit.var"#279#281", BifurcationKit.var"#280#282"}}, Float64, BifurcationKit.DefaultLS, BifurcationKit.DefaultEig{typeof(real)}, typeof(LinearAlgebra.norm), typeof(BifurcationKit.finalise_default), typeof(BifurcationKit.cb_default), Nothing}, state::BifurcationKit.ContState{BifurcationKit.BorderedArray{Vector{Float64}, Float64}, Float64, Vector{ComplexF64}, Matrix{ComplexF64}, Tuple{Nothing, Nothing}})
Closest candidates are:
(::Main.var"##BifurcationKit Extension Test#289".var"#2#6")(::Any, ::Any) got unsupported keyword arguments "iter", "state"
@ Main.var"##BifurcationKit Extension Test#289" ~/work/ModelingToolkit.jl/ModelingToolkit.jl/test/extensions/bifurcationkit.jl:40
Is this from some anonymous function generated by optic? I have no idea what's going on here or what @optic even is: is there a simpler way to write this?
What caused it? A test?
I dont see the line number of the closest candidates. I bet this is coming from
record_from_solution = (x, p) -> x[plot_idx]
# which is now (as it should)
record_from_solution = (x, p; k...) -> x[plot_idx]
When I submitted the PR, I made sure that the current MTK doc-page worked, so I am surprised by all this.
I have no idea what's going on here or what @optic even is: is there a simpler way to write this?
An optic is from Accessors.jl It allows to specify a parameter axis. For example, if you pass a named typle as a parameter
pars = (a=1., b=2.)
and would like to continue the solutions wrt to a, you can pass @optic _.a. If you pass an array and want to continue wrt to the first parameter, you can pass @optic _[1]. In this last case, you could pass directly 1 to continuation. See also https://github.com/bifurcationkit/BifurcationKit.jl/issues/159
Awesome, thanks so much!
No problem. I am embarassed, I thought my PR would have been more straightforward