Passing data to modeling toolkit from a frontend

I am working on a little frontend for my modeling toolkit based project.

let’s say I have a model my_model. It has 3 parameters a,b, and c. I can call string.(parameters(my_model)) and get a list of the parameter names, pass that to the frontend saying hey, the model needs values for parameters a,b, and c, let the user supply values a_val, b_val, and c_val, and then pass those back to julia.

My question is now how can I get those user provided values into the parameter map that gets provided to the ODEProblem constructor [a => a_val, b => b_val, c => c_val]. Id like to do this in a general way for any model. Whats throwing me off is how to build that array of pairs.

ive tried doing something like:

ps = []
for p in parameters(my_model)
    append!(ps, Pair(p, val))

but it gives me a vector{Any} when I expected a vector of pairs

Edit: Ah! Its push! that I wanted not append!, push gives me the expected vector of pairs. I think that should work then. Will have to test that out tomorrow

1 Like