From 07137d7414387dcb2da2bded77fe4f26bd14ebf7 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins <jameson.rollins@ligo.org> Date: Tue, 26 May 2020 14:12:49 -0700 Subject: [PATCH] io: load_hdf5 don't fail if 'ifo' attribute can not be de-serialized --- gwinc/io.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gwinc/io.py b/gwinc/io.py index 035836c..fb40748 100644 --- a/gwinc/io.py +++ b/gwinc/io.py @@ -1,6 +1,8 @@ import h5py +import yaml import datetime +from . import logger from . import Struct @@ -72,5 +74,8 @@ def load_hdf5(path): traces = _read_trace_recursive(f['/traces']) attrs = dict(f.attrs) if 'ifo' in attrs: - attrs['ifo'] = Struct.from_yaml(attrs['ifo']) + try: + attrs['ifo'] = Struct.from_yaml(attrs['ifo']) + except yaml.constructor.ConstructorError: + logger.warning("HDF5 load warning: Could not de-serialize 'ifo' YAML attribute.") return freq, traces, attrs -- GitLab