reflectometry / refl1d

1-D reflectometry fitting
https://refl1d.readthedocs.io/
Other
17 stars 23 forks source link

Don't use bumps vfs to load models from zip files #154

Open pkienzle opened 1 year ago

pkienzle commented 1 year ago

When loading models from zip files use the safe and boring process of expanding the zip file into a temporary directory and loading the model from there.

The challenge is in cleanup. For arbitrary python model files we do not know when we are "done" with the directory. It may be that the model needs a special function in some rare condition that is lazy-loaded from the model directory so technically we would need to keep it around while the problem is in memory. (Maybe attach the cleanup to the problem delete hook?) In practice, however, the directory will not be needed after the model is loaded and can be deleted immediately. So long as we document the behaviour the user can adjust the model file to load everything they will need when they define the problem.

Another possibility is that we can expand the zip file into the store directory. This works from the CLI where we require a store directory before starting the fit but not from the GUI.