Skip to content
Snippets Groups Projects
Commit 23e66c4c authored by Generic Bliss account for Control Software's avatar Generic Bliss account for Control Software
Browse files

Update monitor with counter name

parent c9effa5b
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,17 @@ class MetadataTask(TaskWithDataAccess,
# Close file
self.close()
def _getPin(self, val):
try:
pin = int(val)
except ValueError:
if val in self.val_counter_names.values():
pin = int(list(self.val_counter_names.keys())[list(self.val_counter_names.values()).index(val)])
else:
raise
return pin
def write_counters_to_file(self):
"""
Process and write the counters to the output file
......@@ -214,7 +225,9 @@ class MetadataTask(TaskWithDataAccess,
self.mcs_grp.create_dataset("HS32V", data=HS32V, dtype=HS32V.dtype).attrs.__setitem__("interpretation", "spectrum")
if "HSTime" in self.input2:
pin = int(self.input2["HSTime"])
pin = self._getPin(self.input2['HSTime'])
if pin > self.HS32Len:
self.log_error("invalid pin number %s" % pin)
self.mcs_grp["HSTime"] = pin
......@@ -243,7 +256,7 @@ class MetadataTask(TaskWithDataAccess,
for I in ("HSI0", "HSI1"):
if I in self.input2:
dest = "Intensity" + I[-1]
pin = int(self.input2[I])
pin = self._getPin(self.input2[I])
if pin > self.HS32Len:
self.log_error("invalid pin number %s" % pin)
self.mcs_grp[I] = pin
......
......@@ -82,7 +82,8 @@ class PyFAIConfigFromHeaders(
self.outputs.reference = float(H['NormalizationFactor'])/f
# Monitor
self.outputs.monitor_name = H[f"HS32N{H['HSI1']:02d}"]
# self.outputs.monitor_name = H[f"HS32N{H['HSI1']:02d}"]
self.outputs.monitor_name = H['HSI1']
# self.outputs.monitor_name = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment