From 5cb9fcfd153afcb9f1d6d40958af00a16a87a458 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 24 May 2013 15:54:13 -0400 Subject: [PATCH] storage: Add 'load_config()' for those that don't want an AFM instance For example, when setting up unfold-config, we may just want to load the default configuration but don't need to control an experiment quite yet. --- pyafm/storage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyafm/storage.py b/pyafm/storage.py index 9b1e0f8..73b69eb 100644 --- a/pyafm/storage.py +++ b/pyafm/storage.py @@ -38,7 +38,7 @@ def save_afm(afm, filename=None, group=None): storage = _HDF5_Storage(filename=filename, group=group) storage.save(config=afm.config) -def load_afm(filename=None, group=None): +def load_config(filename=None, group=None): if filename is None: filename = DEFAULT_FILENAME if group is None: @@ -47,6 +47,10 @@ def load_afm(filename=None, group=None): _LOG.info('loading AFM config from {} {}'.format(filename, group)) config = _AFMConfig(storage=_HDF5_Storage(filename=filename, group=group)) config.load() + return config + +def load_afm(filename=None, group=None): + config = load_config(filename=filename, group=group) _LOG.debug( 'constructing AFM from configuration:\n{}'.format(config.dump())) return AFM(config=config) -- 2.26.2