@@ -335,7 +335,9 @@ class MetricsHistogramsWidget(BaseWidget):
335335 A SortingAnalyzer object with quality_metrics and/or template_metrics extensions computed.
336336 thresholds : dict, optional
337337 Dictionary of metric thresholds. Can be a flat dict with metric names as keys and dicts with 'min' and/or 'max'
338- as values, or a nested dict where top-level keys are different categories.
338+ as values, or a nested dict where top-level keys are different categories. Optionally, an "abs": True entry
339+ can be included in each metric's dict to indicate that the metric should be treated as an absolute value when
340+ applying thresholds. If None, default thresholds from `bombcell_get_default_thresholds` will be used.
339341 metrics_to_plot : list, default: None
340342 List of metric names to plot. If None, all metrics with thresholds will be plotted.
341343 """
@@ -412,15 +414,15 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
412414 self .figure , self .axes , self .ax = make_mpl_figure (** backend_kwargs )
413415
414416 colors = plt .cm .tab10 (np .linspace (0 , 1 , 10 ))
415- absolute_value_metrics = ["amplitude_median" ]
416417
417418 axes = self .axes
418419 for idx , metric_name in enumerate (metrics_to_plot ):
419420 row , col = idx // n_cols , idx % n_cols
420421 ax = axes [row , col ]
421422
422423 values = metrics [metric_name ].values
423- if metric_name in absolute_value_metrics :
424+ abs_value = thresholds .get (metric_name , {}).get ("abs" , False )
425+ if abs_value :
424426 values = np .abs (values )
425427 values = values [~ np .isnan (values ) & ~ np .isinf (values )]
426428
0 commit comments