diag_channels = [] diag_channels.append(out) def get_diag_name(diag): return ch.psi.utils.Str.toTitleCase(diag.getName()).replace(" ", "") def print_diag(): for f in 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 + "attrs/" for f in 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 + "attrs/" for f in diag_channels: try: x = f.read() if x is None: x = '' if (type(f) is ch.psi.pshell.epics.ChannelString) else float('nan') append_dataset(group+get_diag_name(f), x) except: log("Error sampling " + str(get_diag_name(f)) + ": " + str(sys.exc_info()[1])) def after_readout(rec): if get_exec_pars().persist: if rec.index == 0: create_diag_datasets() append_diag_datasets() a= lscan(inp, (arr), 0, 40, 10, 0.2, after_read=after_readout)