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

Select cell ID to preview instead of pulse

parent 15fb4726
No related branches found
No related tags found
2 merge requests!12Snapshot: field test deployed version as of end of run 202201,!3Base correction device, CalCat interaction, DSSC and AGIPD devices
...@@ -315,19 +315,20 @@ class AgipdCorrection(BaseCorrection): ...@@ -315,19 +315,20 @@ class AgipdCorrection(BaseCorrection):
if do_generate_preview: if do_generate_preview:
if self._correction_flag_enabled != self._correction_flag_preview: if self._correction_flag_enabled != self._correction_flag_preview:
self.gpu_runner.correct(self._correction_flag_preview) self.gpu_runner.correct(self._correction_flag_preview)
# WARNING: actually looking for cell ID at the request of SPB
preview_slice_index = self._schema_cache["preview.pulse"] preview_slice_index = self._schema_cache["preview.pulse"]
if preview_slice_index >= 0: if preview_slice_index >= 0:
# look at pulse_table to find which index this pulse ID is in # look at cell_table to find which index this pulse ID is in
pulse_id_found = np.where(pulse_table == preview_slice_index)[0] cell_id_found = np.where(cell_table == preview_slice_index)[0]
if len(pulse_id_found) == 0: if len(cell_id_found) == 0:
pulse_found_instead = pulse_table[0] cell_found_instead = cell_table[0]
self.log_status_info( self.log_status_info(
f"Pulse {preview_slice_index} not found, arbitrary pulse " f"Cell {preview_slice_index} not found, arbitrary cell "
f"{pulse_found_instead} will be shown instead." f"{cell_found_instead} will be shown instead."
) )
preview_slice_index = 0 preview_slice_index = 0
else: else:
preview_slice_index = pulse_id_found[0] preview_slice_index = cell_id_found[0]
preview_raw, preview_corrected = self.gpu_runner.compute_preview( preview_raw, preview_corrected = self.gpu_runner.compute_preview(
preview_slice_index preview_slice_index
) )
......
...@@ -338,9 +338,10 @@ class BaseCorrection(PythonDevice): ...@@ -338,9 +338,10 @@ class BaseCorrection(PythonDevice):
.defaultValue(True) .defaultValue(True)
.reconfigurable() .reconfigurable()
.commit(), .commit(),
# TODO: Split into AGIPD-specific or see if others like cell ID over pulse ID
INT32_ELEMENT(expected) INT32_ELEMENT(expected)
.key("preview.pulse") .key("preview.pulse")
.displayedName("Pulse (or stat) for preview") .displayedName("Cell (or stat) for preview")
.description( .description(
"If this value is ≥ 0, the corresponding index from data will be " "If this value is ≥ 0, the corresponding index from data will be "
"sliced for the preview. If this value is ≤ 0, preview will be one of " "sliced for the preview. If this value is ≤ 0, preview will be one of "
...@@ -603,7 +604,7 @@ class BaseCorrection(PythonDevice): ...@@ -603,7 +604,7 @@ class BaseCorrection(PythonDevice):
# TODO: allow sending *all* frames for commissioning (request: Jola) # TODO: allow sending *all* frames for commissioning (request: Jola)
preview_hash = Hash() preview_hash = Hash()
preview_hash.set("image.trainId", train_id) preview_hash.set("image.trainId", train_id)
preview_hash.set("image.pulseId", self._schema_cache["preview.pulse"]) preview_hash.set("image.cellId", self._schema_cache["preview.pulse"])
# note: have to construct because setting .tid after init is broken # note: have to construct because setting .tid after init is broken
timestamp = Timestamp(Epochstamp(), Trainstamp(train_id)) timestamp = Timestamp(Epochstamp(), Trainstamp(train_id))
......
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