diff --git a/src/calng/agipd_gpu.py b/src/calng/agipd_gpu.py index 5ae1aa9c1e7af5519f4015c605d64ff18f3f497c..aa0a4519afc8b62036d3b75b4be923026039a9cc 100644 --- a/src/calng/agipd_gpu.py +++ b/src/calng/agipd_gpu.py @@ -178,16 +178,13 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner): def load_rel_gain_ff_map(self, slopes_ff_map): # constant shape: y, x, memory cell if slopes_ff_map.shape[2] == 2: + # TODO: remove support for old format # old format, is per pixel only (shape is y, x, 2) # note: we should not support this in online slopes_ff_map = np.broadcast_to( slopes_ff_map[..., 0][..., np.newaxis], (self.pixels_y, self.pixels_x, self.constant_memory_cells), ) - else: - # TODO: maybe extend in case constant has too few memory cells - # TODO: maybe divide by something because new constants are absolute - ... self.rel_gain_xray_map_gpu.set(np.transpose(slopes_ff_map).astype(np.float32)) def set_g_gain_value(self, override_value): diff --git a/src/calng/base_correction.py b/src/calng/base_correction.py index 9d39383060c0e6577a3313446fc457625212dba2..36fabc3188a160c08fe27d17148c0819610f0bfe 100644 --- a/src/calng/base_correction.py +++ b/src/calng/base_correction.py @@ -3,7 +3,6 @@ import threading import timeit import dateutil.parser -import hashToSchema import numpy as np from karabo.bound import ( BOOL_ELEMENT, @@ -710,6 +709,9 @@ class BaseCorrection(PythonDevice): ): if self.get("state") is State.PROCESSING: self.updateState(State.ON) + self.log_status_info( + f"No new train in {PROCESSING_STATE_TIMEOUT} s, switching state." + ) def handle_eos(self, channel): self.updateState(State.ON) diff --git a/src/calng/base_gpu.py b/src/calng/base_gpu.py index e51bc99b0f67a24a2fc91cfbf39710af78be7e7f..4850dcbaa8c4108369daffc85719bd4184bd32ee 100644 --- a/src/calng/base_gpu.py +++ b/src/calng/base_gpu.py @@ -73,7 +73,6 @@ class BaseGpuRunner: self.preview_corrected = np.empty(self.preview_shape, dtype=np.float32) # to get data from respective buffers to cell, x, y shape for preview computation - # TODO: handle shape juggling programmatically, removing need for these two helpers def _preview_preprocess_raw(self): """Should return view of self.input_data_gpu with shape (cell, x, y)""" raise NotImplementedError() @@ -112,16 +111,14 @@ class BaseGpuRunner: will be loaded into the provided array, which must match shape / dtype. """ # TODO: avoid copy - # TODO: check if necessary to make contiguous if output_order == self._corrected_axis_order: - self.reshaped_data_gpu = cupy.ascontiguousarray(self.processed_data_gpu) + self.reshaped_data_gpu = self.processed_data_gpu else: - self.reshaped_data_gpu = cupy.ascontiguousarray( - cupy.transpose( - self.processed_data_gpu, - utils.transpose_order(self._corrected_axis_order, output_order), - ) + self.reshaped_data_gpu = cupy.transpose( + self.processed_data_gpu, + utils.transpose_order(self._corrected_axis_order, output_order), ) + return self.reshaped_data_gpu.get(out=out) def load_data(self, raw_data): @@ -156,7 +153,6 @@ class BaseGpuRunner: ): image_data = preprocces() if preview_index >= 0: - # TODO: change axis order when moving reshape to after correction image_data[preview_index].astype(np.float32).get(out=output_buffer) elif preview_index == -1: # TODO: confirm that max is pixel and not integrated intensity diff --git a/src/calng/calcat_utils.py b/src/calng/calcat_utils.py index 5b5818cac538e9937f48b710791cb915e12a7841..e6c6a8f10fb2e9c073c8876388f1bcd8c1bd4787 100644 --- a/src/calng/calcat_utils.py +++ b/src/calng/calcat_utils.py @@ -315,7 +315,7 @@ class BaseCalcatFriend: self.device.set(f"{self.param_prefix}.{key}", value) def _get_status(self, constant, key): - return self.device.get(f"{self.status_prefix}.{constant.name}.{key}", value) + return self.device.get(f"{self.status_prefix}.{constant.name}.{key}") def _set_status(self, constant, key, value): """Helper to update information about found constants on device"""