Skip to content

Commit 90fb11c

Browse files
refactor(src/nectarchain/dqm/bokeh_app): (#304)
- app_hooks.py: adapt z-range of camera displays to handle outliers
1 parent 1d9539b commit 90fb11c

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/nectarchain/dqm/bokeh_app/app_hooks.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,20 @@ def make_camera_display(source, parent_key, child_key):
392392
mask_high_gain, mask_low_gain = get_bad_pixels_position(
393393
source=source, image_shape=image.shape
394394
)
395-
min_colorbar = np.min(
396-
image[~mask_low_gain if "LOW-GAIN" in parent_key else ~mask_high_gain]
395+
# plotting by default range with 99.5% of all events, so that
396+
# outliers do not prevent us from seing the bulk of the data
397+
min_colorbar = np.nanquantile(
398+
image[~mask_low_gain if "LOW-GAIN" in parent_key else ~mask_high_gain],
399+
0.005,
397400
)
398-
max_colorbar = np.max(
399-
image[~mask_low_gain if "LOW-GAIN" in parent_key else ~mask_high_gain]
401+
max_colorbar = np.nanquantile(
402+
image[~mask_low_gain if "LOW-GAIN" in parent_key else ~mask_high_gain],
403+
0.995,
400404
)
405+
if max_colorbar == min_colorbar:
406+
# avoid problems with bokeh display
407+
max_colorbar *= 1.05
408+
min_colorbar *= 0.95
401409
image[mask_low_gain if "LOW-GAIN" in parent_key else mask_high_gain] = 0.0
402410

403411
display = CameraDisplay(geometry=geom)

0 commit comments

Comments
 (0)