Commit ffe27169 authored by Linus Pithan's avatar Linus Pithan Committed by Matias Guijarro

fix bug: do not remove positioners from scan.scan_info during hdf5 writing

parent 2de3734a
......@@ -11,6 +11,7 @@ import h5py
import numpy
import time
import datetime
import copy
from silx.io.dictdump import dicttoh5
from bliss.scanning.writer.file import FileWriter
from bliss.scanning.scan_meta import categories_names
......@@ -130,15 +131,16 @@ class Writer(FileWriter):
#### use scan_meta to fill fields ####
instrument = self.file.create_group(f"{scan_name}/instrument")
instrument.attrs["NX_class"] = "NXinstrument"
positioners = instrument.create_group("positioners")
positioners.attrs["NX_class"] = "NXcollection"
positioners_dial = instrument.create_group("positioners_dial")
positioners_dial.attrs["NX_class"] = "NXcollection"
# copy should be removed once positioners are no longer treated as special case
hdf5_scan_meta = copy.deepcopy(
{cat_name: scan_info.get(cat_name, {}) for cat_name in categories_names()}
)
try:
positioners = instrument.create_group("positioners")
positioners.attrs["NX_class"] = "NXcollection"
positioners_dial = instrument.create_group("positioners_dial")
positioners_dial.attrs["NX_class"] = "NXcollection"
hdf5_scan_meta = {
cat_name: scan_info.get(cat_name, {}) for cat_name in categories_names()
}
positioners_dict = hdf5_scan_meta.get("instrument", {}).pop(
"positioners", {}
)
......
......@@ -200,3 +200,21 @@ def test_lima_instrument_entry(alias_session, scan_tmpdir):
)
assert "acq_mode" in f["1_ascan/instrument/lima_simulator/lima_parameters"]
assert "height" in f["1_ascan/instrument/lima_simulator/roi_counters/r1"]
def test_positioners_in_scan_info(alias_session, scan_tmpdir):
env_dict, session = alias_session
# put scan file in a tmp directory
env_dict["SCAN_SAVING"].base_path = str(scan_tmpdir)
s = scans.ascan(
env_dict["robyy"], 0, 1, 3, .1, env_dict["lima_simulator"], run=False
)
assert "positioners" in s.scan_info["instrument"]
s.run()
assert "positioners" in s.scan_info["instrument"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment