-
-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Hey, first of all - massive congratulations on all this work over the past few years! The amount of supported functionality added over the past year or two is crazy, and I'm really enjoying the current version! As I may have gone a bit overboard with my modelling I ran into a small problem recently (bug/feature request?). Namely, I want to use the experimental MTK.ImperativeAffect interface within the DSL, which does not seem to be supported:
function affect(x, obs, ctx, int)
dX = rand(Poisson(1))
@set! x.X = x.X + dX
end
rn = @reaction_network begin
k, 0 --> X
@discrete_events begin
1.0 => affect
end
endThis throws the following error:
The affect part of all events (the right-hand side) must be a vector. This is not the case for: affect.
in Catalyst.read_events_option. This is because the DSL expects affects of the form [ X ~ X + 1 ], even though MTK supports more general affect functions.
My current solution is:
- hack the code for
Catalyst.read_events_optionto remove those checks - create
affect_wrapper = MTK.ImperativeAffect(...)wrapping the affect function - use the line
1.0 => $affect_wrapper
This seems to work, but is messy. Any chance one could incorporate this into the DSL by fine-tuning these checks?
Alternatively, is there a convenient way of adding events to an existing reaction system (copies are fine)? It seems like I'd have to manually recreate one to do so, which involves copying a lot of fields and is very reliant on Catalyst internals...
As an extension, I'd like to have random times between these events. I might be able to concoct something using JumpProcesses, but is there an easier way to do this with newer versions?