Skip to content
Snippets Groups Projects
Commit 385420de authored by David Hammer's avatar David Hammer
Browse files

Hopefully better handling of empty DAQ hashes

parent f39d435b
No related branches found
No related tags found
1 merge request!12Snapshot: field test deployed version as of end of run 202201
...@@ -928,36 +928,30 @@ class BaseCorrection(PythonDevice): ...@@ -928,36 +928,30 @@ class BaseCorrection(PythonDevice):
elif not data_hash.has(self._image_data_path): elif not data_hash.has(self._image_data_path):
self.log_status_info("Ignoring hash without image node") self.log_status_info("Ignoring hash without image node")
return return
elif len(self.input_data_shape) != len(data_hash.get(f"{self._image_data_path}.shape")):
train_id = metadata.getAttribute("timestamp", "tid") self.log_status_info("DAQ probably not sending data")
self._train_ratio_tracker.update(train_id)
cell_table = data_hash.get(self._cell_table_path)
if (
isinstance(cell_table, np.ndarray)
and (len(cell_table.shape) == 0 or cell_table.size == 0)
) or len(cell_table) == 0:
self.log_status_warn("Empty cell table, DAQ probably not sending data.")
return return
cell_table = np.ravel(cell_table)
# no more common reasons to skip input, so go to processing # no more common reasons to skip input, so go to processing
if state is State.ON: if state is State.ON:
self.updateState(State.PROCESSING) self.updateState(State.PROCESSING)
self.log_status_info("Processing data") self.log_status_info("Processing data")
correction_cell_num = self.unsafe_get("constantParameters.memoryCells") train_id = metadata.getAttribute("timestamp", "tid")
cell_table_max = np.max(cell_table) self._train_ratio_tracker.update(train_id)
cell_table = data_hash.get(self._cell_table_path).ravel()
if self.unsafe_get("constantParameters.memoryCells") <= cell_table.max():
self.log_status_warn("Input cell IDs out of range of constants")
image_data = data_hash.get(self._image_data_path)
if cell_table.size != self.unsafe_get("dataFormat.memoryCells"): if cell_table.size != self.unsafe_get("dataFormat.memoryCells"):
self.log_status_info( self.log_status_info(
f"Updating new input shape {image_data.shape}, updating buffers" f"Updating new input shape to account for {cell_table.size} cells"
) )
self.set("dataFormat.memoryCells", cell_table.size) self.set("dataFormat.memoryCells", cell_table.size)
with self._buffer_lock: self._lock_and_update_in_background(self._update_frame_filter)
self._update_frame_filter()
image_data = data_hash.get(self._image_data_path)
# DataAggregator typically tells us the wrong axis order # DataAggregator typically tells us the wrong axis order
if self.unsafe_get("dataFormat.overrideInputAxisOrder"): if self.unsafe_get("dataFormat.overrideInputAxisOrder"):
expected_shape = self.input_data_shape expected_shape = self.input_data_shape
...@@ -986,7 +980,6 @@ class BaseCorrection(PythonDevice): ...@@ -986,7 +980,6 @@ class BaseCorrection(PythonDevice):
self._rate_tracker.update() self._rate_tracker.update()
def _update_rate_and_state(self): def _update_rate_and_state(self):
if self.get("state") is State.PROCESSING: if self.get("state") is State.PROCESSING:
self._buffered_status_update.set( self._buffered_status_update.set(
"performance.rate", self._rate_tracker.get() "performance.rate", self._rate_tracker.get()
......
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