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

Merge branch 'fix/close_constant_h5file' into 'master'

close h5file properly

See merge request detectors/pycalibration!314
parents 73582b10 4ead3f5b
No related branches found
No related tags found
1 merge request!314close h5file properly
...@@ -1655,8 +1655,8 @@ class AgipdCorrections: ...@@ -1655,8 +1655,8 @@ class AgipdCorrections:
for cname, mdata in const_yaml[dname].items(): for cname, mdata in const_yaml[dname].items():
when[cname] = mdata["creation-time"] when[cname] = mdata["creation-time"]
if when[cname]: if when[cname]:
cf = h5py.File(mdata["file-path"]) with h5py.File(mdata["file-path"], "r") as cf:
cons_data[cname] = np.copy(cf[f"{dname}/{cname}/0/data"]) cons_data[cname] = np.copy(cf[f"{dname}/{cname}/0/data"])
else: else:
# Create empty constant using the list elements # Create empty constant using the list elements
cons_data[cname] = \ cons_data[cname] = \
......
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