Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tutorial examples giving MethodError: no method matching keys(::Catlab.ColumnImplementations.DenseAttr{Union{Float64, Int64, AbstractString, Expr, Function, Symbol}}) #2

Closed
anandijain opened this issue Oct 13, 2022 · 3 comments

Comments

@anandijain
Copy link

anandijain commented Oct 13, 2022

Hello, thanks for the package!

I wanted to play around with some of the tutorials and see how it compares with Catalyst.jl and ModelingToolkit.jl, however, I ran into an issue. (I should note that I haven't really used Catlab, so maybe the solution is obvious)

I started with https://github.com/Merck/ReactiveDynamics.jl/blob/main/tutorial/example.jl
When I ran the following using the main branch of ReactiveDynamics :

using ReactiveDynamics

# acs as a model : incomplete dynamics
sir_acs = @ReactionNetwork

I got

ERROR: MethodError: no method matching keys(::Catlab.ColumnImplementations.DenseAttr{Union{Float64, Int64, AbstractString, Expr, Function, Symbol}})
Closest candidates are:
  keys(::Union{Tables.AbstractColumns, Tables.AbstractRow}) at ~/.julia/packages/Tables/T7rHm/src/Tables.jl:189
  keys(::DataStructures.Accumulator) at ~/.julia/packages/DataStructures/59MD0/src/accumulator.jl:58
  keys(::ComponentArrays.AbstractAxis) at ~/.julia/packages/ComponentArrays/D6i2q/src/axis.jl:146
  ...
Stacktrace:
 [1] eachindex(itrs::Catlab.ColumnImplementations.DenseAttr{Union{Float64, Int64, AbstractString, Expr, Function, Symbol}})
   @ Base ./abstractarray.jl:282
 [2] assign_defaults!(acs::ReactiveDynamics.FoldedReactionNetworkType{Symbol, Union{Missing, String, Symbol}, Union{Float64, Int64, AbstractString, Expr, Function, Symbol}, Set{Symbol}, ReactiveDynamics.FoldedObservable, Any})
   @ ReactiveDynamics ~/.julia/dev/ReactiveDynamics.jl/src/ReactiveDynamics.jl:99
 [3] merge_acs!(acs::ReactiveDynamics.FoldedReactionNetworkType{Symbol, Union{Missing, String, Symbol}, Union{Float64, Int64, AbstractString, Expr, Function, Symbol}, Set{Symbol}, ReactiveDynamics.FoldedObservable, Any}, transitions::Vector{Any}, reactants::Vector{Any}, obs::Vector{Any}, events::Vector{Any})
   @ ReactiveDynamics ~/.julia/dev/ReactiveDynamics.jl/src/ReactiveDynamics.jl:137
 [4] ReactiveDynamics.FoldedReactionNetworkType{Symbol, Union{Missing, String, Symbol}, Union{Float64, Int64, AbstractString, Expr, Function, Symbol}, Set{Symbol}, ReactiveDynamics.FoldedObservable, Any}(transitions::Vector{Any}, reactants::Vector{Any}, obs::Vector{Any}, events::Vector{Any})
   @ ReactiveDynamics ~/.julia/dev/ReactiveDynamics.jl/src/ReactiveDynamics.jl:111
 [5] top-level scope
   @ ~/.julia/dev/ReactiveDynamics.jl/tutorial/example.jl:4

Thanks

@thevolatilebit
Copy link
Collaborator

Many thanks for pointing this out! The issue here is that accessing subparts in Catlab.jl has changed lately; a new version of ReactiveDynamics.jl will address the problem (and it is already on its way to the general registry).

@thevolatilebit
Copy link
Collaborator

thevolatilebit commented Oct 14, 2022

This is solved by d303952.

However, there's a Catlab.jl hack,

# Catlab.jl hack: bypass @isdefined check
function Base.getindex(m::Catlab.ColumnImplementations.PartialVecMap, x::Int)
m.v[x]
end

versus

function Base.getindex(m::PartialVecMap, x::Int)
  @assert m.defined[x]
  m.v[x]
end

This is alright since I always perform isdefined checks manually. Anyway, I plan to drop the Catlab backend in an upcoming release.

@anandijain
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants