From: W. Trevor King Date: Fri, 24 May 2013 19:54:13 +0000 (-0400) Subject: storage: Add 'load_config()' for those that don't want an AFM instance X-Git-Tag: v0.5~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5cb9fcfd153afcb9f1d6d40958af00a16a87a458;p=pyafm.git 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. --- 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)