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

Fix LPD bad pixel mask buffer, update defaults

parent 72baa028
No related branches found
No related tags found
1 merge request!12Snapshot: field test deployed version as of end of run 202201
......@@ -61,7 +61,7 @@ class LpdGpuRunner(base_gpu.BaseGpuRunner):
self.gain_amp_map_gpu = cupy.ones(self.map_shape, dtype=cupy.float32)
self.rel_gain_slopes_map_gpu = cupy.ones(self.map_shape, dtype=cupy.float32)
self.flatfield_map_gpu = cupy.ones(self.map_shape, dtype=cupy.float32)
self.bad_pixel_map_gpu = cupy.ones(self.map_shape, dtype=cupy.uint32)
self.bad_pixel_map_gpu = cupy.zeros(self.map_shape, dtype=cupy.uint32)
self.bad_pixel_mask_value = bad_pixel_mask_value
self.update_block_size((1, 1, 64))
......@@ -101,9 +101,10 @@ class LpdGpuRunner(base_gpu.BaseGpuRunner):
elif constant_type in (LpdConstants.BadPixelsDark, LpdConstants.BadPixelsFF):
self.bad_pixel_map_gpu |= cupy.asarray(
np.transpose(
constant_data.astype(np.uint32),
constant_data,
(2, 1, 0, 3),
)
),
dtype=np.uint32,
)
elif constant_type is LpdConstants.GainAmpMap:
self.gain_amp_map_gpu.set(
......@@ -148,6 +149,7 @@ class LpdGpuRunner(base_gpu.BaseGpuRunner):
self.gain_amp_map_gpu.fill(1)
self.rel_gain_slopes_map_gpu.fill(1)
self.flatfield_map_gpu.fill(1)
self.bad_pixel_map_gpu.fill(0)
class LpdCalcatFriend(base_calcat.BaseCalcatFriend):
......@@ -208,21 +210,15 @@ class LpdCalcatFriend(base_calcat.BaseCalcatFriend):
DOUBLE_ELEMENT(schema)
.key(f"{param_prefix}.photonEnergy")
.assignmentOptional()
.defaultValue(12)
.defaultValue(9.3)
.reconfigurable()
.commit(),
DOUBLE_ELEMENT(schema)
.key(f"{param_prefix}.category")
.displayedName("Some category")
.description(
"I don't know what this exactly is supposed to mean. Looking at "
"existing constants, I saw a GainAmpMap with 'category 1.0' and "
"'Source Energy 9.2 keV' and another one with 'category 0.0' and "
"'Source Energy 12.0 keV'. So maybe they're related."
)
.displayedName("Category")
.assignmentOptional()
.defaultValue(1)
.defaultValue(0)
.reconfigurable()
.commit(),
)
......
......@@ -60,7 +60,7 @@ extern "C" {
corrected *= rel_gain_slopes_map[gm_map_index];
}
if (corr_flags & FF_CORR) {
corrected /= flatfield_map[gm_map_index];
corrected *= flatfield_map[gm_map_index];
}
}
}
......
......@@ -274,9 +274,9 @@ class Stopwatch:
def __repr__(self):
if self.name is None:
return f"{self.elapsed():.3f} s"
return f"{self.elapsed:.3f} s"
else:
return f"{self.name}: {self.elapsed():.3f} s"
return f"{self.name}: {self.elapsed:.3f} s"
class StateContext:
......
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