Mimi Framework

Retrieving parameter values

Suppose that I have an un-run model, which has its external parameters filled in. How can I get the values of these parameters?

Previously, I could say m.external_parameters[:paramname].values. I can’t figure out how to do this in the new version, except to run the model, and then I can say: get_param_value(m.mi.components[:ComponentName], :paramname).data

Is that the intended approach? (I couldn’t figure out a reasonable way to use the components function to help with this.)

Hi James, so am I right in saying that what you would ideally like to do here is access the values of the external parameters that have been filled in without running the model?

In this case, once the model is run, it seems the intended way to get the value is model[:ComponentName, :ParamName]. Per your question about an unrun model, that wouldn’t work since there’s no model instance of an unrun model, and this function requires a model instance. I can probably add an error message and we could also discuss possibilities for an unrun model if that’s useful. The parameters are held in m.md.external_params, but we haven’t written API functions to make it easy to access those and deal with their types, so would probably want to think on that.

I can work with that! It’s worth flagging that I’ll be going outside of the API, but I understand that the general solution is likely to be somewhat involved: it would be nice to be able to run any function that does not require the model to have been run without running it.

Yes that makes sense, the arrays are of special type TimestepArray so that may be a little tricky, I’m happy to look into it with you though.

I second @jrising’s suggestion. I find myself in a situation where it would be helpful to run functions that don’t require a solved model.