ModelParameters.jl icon indicating copy to clipboard operation
ModelParameters.jl copied to clipboard

Add `Const` wrapper that acts just like a `Param` but explicitly isnt one

Open rafaqz opened this issue 5 months ago • 3 comments

Its common to want to switch some parameters to constants during modelling. Currently thats kind of annoying, I often comment out the Param definition.

If we had Const wrappers that acted just like Param except they were not flattened into the parameter list, switching would be easy, and the code would be pretty nice to read. We could also explicitly show the table of Const values and have a consts function that would get them all.

rafaqz avatar Jul 08 '25 01:07 rafaqz

Yeah, I have actually implemented this myself in my own packages multiple times 😅

bgroenks96 avatar Jul 09 '25 12:07 bgroenks96

Is this related to #39 or is the idea for Const to not be an AbstractParam?

bgroenks96 avatar Jul 09 '25 12:07 bgroenks96

Yeah this time not an AbstractParam - just another wrapper type that works in exactly the same way otherwise. So you can just swap Param to Const. But e.g. it wont get optimised, and wont get interactive sliders in MakieModel.

You could also get them all to put in table/csv, just separately to the Param, we could make some helpers for that.

rafaqz avatar Jul 09 '25 12:07 rafaqz