diff --git a/script/local.py b/script/local.py index 4acf4dac..252a28d5 100644 --- a/script/local.py +++ b/script/local.py @@ -2,6 +2,7 @@ import random import ch.psi.pshell.device.Readable.ReadableArray as ReadableArray import ch.psi.pshell.device.Readable.ReadableCalibratedArray as ReadableCalibratedArray import ch.psi.pshell.device.ArrayCalibration as ArrayCalibration +import ch.psi.utils.Str class SimulatedOutput(Writable): def write(self, value): @@ -177,17 +178,19 @@ diag_channels.append(ManipulatorTempB) diag_channels.append(ManipulatorCoolFlow) diag_channels.append(ManipulatorCoolFlowSet) +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" % (f.getName() , str(f.read())) + print "%-25s %s" % (get_diag_name(f) , str(f.read())) def create_diag_datasets(parent = None): if parent is None: parent = get_current_group() group = parent + "attrs/" for f in diag_channels: - create_dataset(group+f.getName() , 's' if (type(f) is ch.psi.pshell.epics.ChannelString) else 'i') + create_dataset(group+get_diag_name(f) , 's' if (type(f) is ch.psi.pshell.epics.ChannelString) else 'i') def append_diag_datasets(parent = None): if parent is None: @@ -197,7 +200,7 @@ def append_diag_datasets(parent = None): x = f.take() if x is None: x = '' if (type(f) is ch.psi.pshell.epics.ChannelString) else float('nan') - append_dataset(group+f.getName(), x) + append_dataset(group+get_diag_name(f), x) SAVE_DIAGS = True @@ -209,9 +212,9 @@ def after_readout(rec): def adjust_sensors(): global SENSORS - if (SENSORS is not None) and isinstance(SENSORS,list): + if SENSORS is not None: # Move integration to end - for dev in [Integration, AngleDistribution]: - if dev.getName() in SENSORS: - SENSORS=SENSORS+[SENSORS.pop(SENSORS.index(dev.getName()))] + for dev in ["Integration", "AngleDistribution"]: + if dev in SENSORS: + SENSORS=SENSORS+[SENSORS.pop(SENSORS.index(dev))] \ No newline at end of file