Skip to content

Conversation

@TorkelE
Copy link
Member

@TorkelE TorkelE commented Aug 4, 2020

Should now be able to create ReactionSystems without parameters, and create problems fro them. This should no longer yield an error:

using Catalyst, DiffEqBase, OrdinaryDiffEq
rn = @reaction_network begin
           exp(-(t-5)^2), 0 --> S
           1.0, S --> 0
       end 
oprob = ODEProblem(rn, [0.0], (0.0,20.0))

Solves SciML/Catalyst.jl#239

u0 = typeof(u0) <: Array{<:Pair} ? u0 : Pair.(rs.states,u0)
p = typeof(p) <: Array{<:Pair} ? p : Pair.(rs.ps,p)
function DiffEqBase.ODEProblem(rs::ReactionSystem, u0::Union{AbstractArray, Number}, tspan, p=DiffEqBase.NullParameters(), args...; kwargs...)
u0 = typeof(u0) <: Union{Array{<:Pair},DiffEqBase.NullParameters} ? u0 : Pair.(rs.states,u0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why NullParameters for u0?

@isaacsas
Copy link
Member

isaacsas commented Aug 4, 2020

Maybe add a test for this too? Even just the example I gave as each problem type?

@TorkelE
Copy link
Member Author

TorkelE commented Aug 4, 2020

That would be sensible. Should we have it in Catalyst though? It is a bit confusing that so many of the tests are over there right now, but now mostly all the tests including creating problems and beyond are there, so might make it more consistent.

@ChrisRackauckas
Copy link
Member

The whole ReactionSystem should move over to Catalyst IMO, we just need like another week of refactoring the abstract system API

@isaacsas
Copy link
Member

isaacsas commented Aug 4, 2020

Either location is fine! We just need to remember to include it.

@TorkelE
Copy link
Member Author

TorkelE commented Aug 4, 2020

I'll add tests for it over at Catalyst later today.

@isaacsas
Copy link
Member

isaacsas commented Aug 4, 2020

Sounds good!

@isaacsas
Copy link
Member

isaacsas commented Aug 4, 2020

@TorkelE OK to merge?

@TorkelE
Copy link
Member Author

TorkelE commented Aug 4, 2020

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants