Skip to content
Snippets Groups Projects
Commit b3f2b266 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

set variant[cname] to 0 for old constants when read YAML

parent da929a31
No related branches found
No related tags found
1 merge request!619Feat: Expose the CCV `variant` to cal_tools sending and retrieving and expose it in agipdlib
......@@ -1212,9 +1212,12 @@ class AgipdCorrections:
if when[cname]:
with h5py.File(mdata["file-path"], "r") as cf:
cons_data[cname] = np.copy(cf[f"{base_key}/data"])
# The variant attribute is missing for old constants.
# Set variant to 0 if the attribute is missing
# as for old constants.
if "variant" in cf[base_key].attrs.keys():
variant[cname] = cf[base_key].attrs["variant"] # noqa
variant[cname] = cf[base_key].attrs["variant"]
else:
variant[cname] = 0
else:
# Create empty constant using the list elements
cons_data[cname] = getattr(np, mdata["file-path"][0])(mdata["file-path"][1]) # noqa
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment