SciML / ReactionNetworkImporters.jl

Julia Catalyst.jl importers for various reaction network file formats like BioNetGen and stoichiometry matrices
https://docs.sciml.ai/ReactionNetworkImporters/stable/
MIT License
26 stars 8 forks source link

Internal conversion of integer Float values (e.g. `1.0`) to Int (e.g. 1) #106

Open TorkelE opened 9 months ago

TorkelE commented 9 months ago

I have a BCR model stored in a .net file. If I try this:

using Catalyst, JumpProcesses
using ReactionNetworkImporters
BCR = loadrxnetwork(BNGNetwork(), "BCR.net")

d_prob = remake(d_prob; u0=Int64.(d_prob.u0))                                 
j_prob = JumpProblem(BCR.rn, d_prob, RSSACR(); save_positions=(false,false)) 
sol = solve(j_prob, SSAStepper(); saveat=0.1);                                

I get an error since some initial condition end up as a Float. Instead, I have to add this line:

d_prob = remake(d_prob; u0=Int64.(d_prob.u0))

It would be neat to automatically convert stuff that is Float to Ints. This example is slightly more complicated, as the non-zero initial conditions are set by parameters, which values are Floats.

TorkelE commented 6 months ago

Basically, this would require the automatic conversion of integer parameter values from the Float64 to the Int64 form. I don't think this is generally done in the system, so while it might be convenient for certain cases, it might still be undesired.