Commit fcd51c75 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

Merge branch '1010-lima-files-when-scan_saving-writer-null' into 'master'

Resolve "Lima files when SCAN_SAVING.writer == 'null'"

Closes #1010

See merge request bliss/bliss!1573
parents 3466b30d de91f058
Pipeline #14925 failed with stages
in 41 minutes and 26 seconds
......@@ -722,7 +722,11 @@ class Scan:
if save:
self.__writer = scan_config["writer"]
else:
self.__writer = NullWriter()
self.__writer = NullWriter(
scan_config["root_path"],
scan_config["images_path"],
os.path.basename(scan_config["data_path"]),
)
self.__writer._save_images = save_images
### order is important in the next lines...
......
......@@ -9,8 +9,8 @@ from bliss.scanning.writer.file import FileWriter
class Writer(FileWriter):
def __init__(self, *args, **keys):
FileWriter.__init__(self, "", "", "")
def __init__(self, root_path, images_root_path, data_filename, *args, **keys):
FileWriter.__init__(self, root_path, images_root_path, data_filename)
def new_file(self, *args):
pass
......@@ -21,6 +21,14 @@ class Writer(FileWriter):
def create_path(self, scan_recorder):
return
def prepare_saving(self, device, images_path):
any_image = any(
channel.reference and len(channel.shape) == 2 for channel in device.channels
)
if any_image:
super().create_path(images_path)
super().prepare_saving(device, images_path)
def new_master(self, *args):
return
......
......@@ -232,6 +232,34 @@ def test_images_dir_prefix_saving_absolute(lima_simulator, scan_tmpdir, session)
scan_saving.from_dict(scan_saving_dump)
def test_images_dir_saving_null_writer(lima_simulator, scan_tmpdir, session):
# issue 1010
simulator = session.config.get("lima_simulator")
scan_saving = setup_globals.SCAN_SAVING
scan_saving_dump = scan_saving.to_dict()
scan_saving.base_path = str(scan_tmpdir)
scan_saving.template = "test"
scan_saving.images_path_relative = False
scan_saving.images_path_template = "{base_path}/test/{scan_name}_{scan_number}/tata"
scan_saving.images_prefix = "{img_acq_device}"
scan_saving.scan_number_format = "%1d"
scan_saving.writer = "null"
try:
scan_config = scan_saving.get()
setup_globals.timescan(0.1, simulator, npoints=1)
assert os.path.exists(
os.path.join(
scan_config["root_path"], "timescan_1/tata/lima_simulator0000.edf"
)
)
finally:
scan_saving.from_dict(scan_saving_dump)
def test_lima_scan_internal_trigger_with_roi(session, lima_simulator):
# test for issue #485
simulator = session.config.get("lima_simulator")
......
Supports Markdown
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