Commit 2889b550 authored by bliss administrator's avatar bliss administrator
Browse files

Modification about files naming convention for zseries

parent 08fa55cd
......@@ -5,6 +5,7 @@ import time
import ast
import datetime
import h5py
import os
import PyTango
import bliss
......@@ -794,8 +795,9 @@ class ZSeries(FastTomo):
log_info(self, "run() entering")
with error_cleanup(self.z_axis, restore_list=(cleanup_axis.POS,)):
with cleanup(self.scan_cleanup):
dataset_name = setup_globals.SCAN_SAVING.dataset_name
with cleanup(self.scan_cleanup,prev_dataset_name=dataset_name):
# move Z motor to start position
umv(self.z_axis, self.start_pos)
......@@ -806,19 +808,28 @@ class ZSeries(FastTomo):
scan_info = self.tomo.meta_data.tomo_scan_info()
scan_info["technique"]["scan"]["nb_scans"] = self.nb_scans
scan_info["technique"]["scan"]["start_nb"] = self.start_nb
alias_name = "None"
if setup_globals.ALIASES.get_alias(self.z_axis.name) is not None:
alias_name = setup_globals.ALIASES.get_alias(self.z_axis.name)
scan_info["technique"]["scan"]["motor"].extend(["z_axis",self.z_axis.name,alias_name])
ScanDisplay.NB_SCANS = self.nb_scans
ScanDisplay.SCAN_NB = 0
dataset_name = setup_globals.SCAN_SAVING.dataset_name
setup_globals.newdataset(dataset_name + "_stage" + str(0).zfill(2))
collection_dir = '/'.join(setup_globals.SCAN_SAVING.get_path().split('/')[:-1])+'/'
zstage_name = "_stage" + str(0).zfill(3)
if not os.path.exists(collection_dir):
suffix = "_0001"
else:
last_index = int(max([f.split('_')[-1] for f in os.listdir(collection_dir) if os.path.isdir(collection_dir+f)]))
suffix = "_"+str(last_index+1).zfill(4)
setup_globals.newdataset(dataset_name + zstage_name + suffix)
# prepare scan sequence
seq = Sequence(
title=self.tomo.sequence + "_stage" + str(0).zfill(2),
title=self.tomo.sequence + zstage_name + suffix,
scan_info=scan_info,
)
with seq.sequence_context() as scan_seq:
......@@ -838,10 +849,12 @@ class ZSeries(FastTomo):
# sleep when requested
time.sleep(self.sleep)
setup_globals.newdataset(dataset_name + "_stage" + str(i).zfill(2))
zstage_name = "_stage" + str(i).zfill(3)
setup_globals.newdataset(dataset_name + zstage_name + suffix)
# prepare scan sequence
seq = Sequence(
title=self.tomo.sequence + "_stage" + str(i).zfill(2),
title=self.tomo.sequence + zstage_name + suffix,
scan_info=scan_info,
)
with seq.sequence_context() as scan_seq:
......@@ -857,7 +870,7 @@ class ZSeries(FastTomo):
log_info(self, "run() leaving")
def scan_cleanup(self):
def scan_cleanup(self, prev_dataset_name):
"""
Restores all parameters that have been modified by the zseries acquisition.
"""
......@@ -865,7 +878,7 @@ class ZSeries(FastTomo):
self.tomo.scan_motors = [self.tomo.rotation_axis]
self.tomo.tomo_musst.set_timer_back()
setup_globals.newdataset(
"_".join(setup_globals.SCAN_SAVING.dataset_name.split("_")[:-1])
prev_dataset_name
)
......
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