-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save user-defined functions along with MizerParams object #171
Comments
…s class and setting them to defaults in `emptyParams()`.
One thing to think about is whether |
…he issue about what environment to load into still needs thought. Currently `loadParams()` is just doing `load()`.
It turns out that there does not seem to be an easy and reliable way to save a function with all its dependencies. There is a function So |
So there are now |
I propose new functions
saveParams()
andreadParams()
for saving MizerParams objects. Currently one would use the genericsaveRDS()
andreadRDS()
, which are fine as long as the MizerParams object does not contain any user-defined functions (either rate functions registered withsetRateFunction()
or component functions registered withsetComponent()
or a resource dynamics function registered withsetResource()
and density-dependence function registered withsetReproduction()
). For these functions, only their name is saved bysaveRDS()
, not their definition. That is fine if the saved params object is always shared together with an R script defining those functions. But it would be nice to be able to save all that is necessary to simulate the model in one place. This is what the functionsaveParams()
should do.readParams()
would then also read in those function definitions.Perhaps we should also have functions
saveSim()
andreadSim()
to save and read MizerSim objects.For a discussion of why the MizerParams object holds the names of the user-defined functions rather than the functions themselves, which one might have thought would circumvent the issue, see #91 . For a discussion of other meta data that we might want to include in a saved MizerParams object, see #45.
The text was updated successfully, but these errors were encountered: