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

Fix up loading and axis orders (I think)

parent 25cbe981
No related branches found
No related tags found
1 merge request!12Snapshot: field test deployed version as of end of run 202201
......@@ -34,7 +34,7 @@ class LpdConstants(enum.Enum):
class LpdGpuRunner(base_gpu.BaseGpuRunner):
_kernel_source_filename = "lpd_gpu.cu"
_corrected_axis_order = "cxy" # TODO: get specs for LPD data
_corrected_axis_order = "cxy"
def __init__(
self,
......@@ -97,28 +97,28 @@ class LpdGpuRunner(base_gpu.BaseGpuRunner):
self.offset_map_gpu.set(
np.transpose(
constant_data.astype(np.float32),
(2, 0, 1, 3),
(2, 1, 0, 3),
)
)
elif constant_type in (LpdConstants.BadPixelsDark, LpdConstants.BadPixelsFF):
self.bad_pixel_map_gpu |= cupy.asarray(
np.transpose(
constant_data.astype(np.uint32),
(2, 0, 1, 3),
(2, 1, 0, 3),
)
)
elif constant_type is LpdConstants.GainAmpMap:
self.gain_amp_map_gpu.set(
np.transpose(
constant_data.astype(np.float32),
(2, 0, 1, 3),
(2, 1, 0, 3),
)
)
elif constant_type is LpdConstants.FFMap:
self.gain_amp_map_gpu.set(
np.transpose(
constant_data.astype(np.float32),
(2, 0, 1, 3),
(2, 1, 0, 3),
)
)
elif constant_type is LpdConstants.RelativeGain:
......@@ -126,17 +126,9 @@ class LpdGpuRunner(base_gpu.BaseGpuRunner):
self.rel_gain_slopes_map_gpu.set(
np.transpose(
constant_data.astype(np.float32),
(2, 0, 1, 3),
(2, 1, 0, 3),
)
)
"""
self.rel_gain_intercept_map_gpu.set(
np.transpose(
constant_data.astype(np.float32),
(2, 0, 1, 3),
)
)
"""
def _init_kernels(self):
kernel_source = self._kernel_template.render(
......@@ -323,12 +315,25 @@ class LpdCorrection(BaseCorrection):
return (
self.unsafe_get("dataFormat.memoryCells"),
1,
self.unsafe_get("dataFormat.pixelsY"),
self.unsafe_get("dataFormat.pixelsX"),
self.unsafe_get("dataFormat.pixelsY"),
)
def _load_constant_to_runner(self, constant, constant_data):
self.kernel_runner.load_constant(constant, constant_data)
correction_step = {
LpdConstants.Offset: "offset",
LpdConstants.GainAmpMap: "gainAmp",
LpdConstants.RelativeGain: "relGain",
LpdConstants.FFMap: "flatfield",
LpdConstants.BadPixelsDark: "badPixels",
LpdConstants.BadPixelsFF: "badPixels",
}[constant]
correction_node = f"corrections.{correction_step}"
if not self.get(f"{correction_node}.available"):
self.set(f"{correction_node}.available", True)
self._update_correction_flags()
self.log_status_info(f"Done loading {constant.name} to GPU")
def process_data(
self,
......
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