From 500c44a829cc0cd04f8ea253804ddc1225cb814c Mon Sep 17 00:00:00 2001 From: gac-x04sa Date: Wed, 31 Oct 2018 08:24:24 +0100 Subject: [PATCH] Script execution --- script/local.py | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/script/local.py b/script/local.py index 38a346e..9012cc0 100644 --- a/script/local.py +++ b/script/local.py @@ -124,41 +124,55 @@ def save_metadata(rec): """ -diag_channels = [ phi, \ - omegaH, - nu,\ - omegaV, \ - alpha, \ - delta, \ - gamma, \ - xv, \ - y1, \ - y2, \ - y3, \ - trx, \ - thy, \ - ] + + + +def get_diag_channels(): + diag_channels = [ phi, \ + omegaH, + nu,\ + omegaV, \ + alpha, \ + delta, \ + gamma, \ + xv, \ + y1, \ + y2, \ + y3, \ + trx, \ + thy, \ + ] + if dp.getByName("h") is not None: + diag_channels.append(h) + if dp.getByName("k") is not None: + diag_channels.append(k) + if dp.getByName("l") is not None: + diag_channels.append(l) + if dp.getByName("wavelength") is not None: + diag_channels.append(wavelength) + return diag_channels + def get_diag_name(diag): return ch.psi.utils.Str.toTitleCase(diag.getName()).replace(" ", "") def print_diag(): - for f in diag_channels: + for f in get_diag_channels(): print "%-25s %s" % (get_diag_name(f) , str(f.read())) def create_diag_datasets(parent = None): if parent is None: parent = get_exec_pars().group group = parent + "meta/" - for f in diag_channels: + for f in get_diag_channels(): create_dataset(group+get_diag_name(f) , 's' if (type(f) is ch.psi.pshell.epics.ChannelString) else 'd') def append_diag_datasets(parent = None): if parent is None: parent = get_exec_pars().group group = parent + "meta/" - for f in diag_channels: + for f in get_diag_channels(): try: x = f.read() if x is None: