@@ -181,6 +181,21 @@ def plot_performances_vs_snr(self, **kwargs):
181181
182182 return plot_performances_vs_snr (self , ** kwargs )
183183
184+ def plot_performances_comparison (self , * args , ** kwargs ):
185+ from .benchmark_plot_tools import plot_performances_comparison
186+
187+ return plot_performances_comparison (self , * args , ** kwargs )
188+
189+ def plot_performance_losses (self , * args , ** kwargs ):
190+ from .benchmark_plot_tools import plot_performance_losses
191+
192+ return plot_performance_losses (self , * args , ** kwargs )
193+
194+ def plot_performances_vs_depth_and_snr (self , * args , ** kwargs ):
195+ from .benchmark_plot_tools import plot_performances_vs_depth_and_snr
196+
197+ return plot_performances_vs_depth_and_snr (self , * args , ** kwargs )
198+
184199 def plot_error_metrics (self , metric = "cosine" , case_keys = None , figsize = (15 , 5 )):
185200
186201 if case_keys is None :
@@ -351,104 +366,6 @@ def plot_metrics_vs_depth_and_snr(self, metric="agreement", case_keys=None, figs
351366
352367 return fig
353368
354- def plot_unit_losses (self , cases_before , cases_after , metric = "agreement" , figsize = None ):
355-
356- fig , axs = plt .subplots (ncols = len (cases_before ), nrows = 1 , figsize = figsize )
357-
358- for count , (case_before , case_after ) in enumerate (zip (cases_before , cases_after )):
359-
360- ax = axs [count ]
361- dataset_key = self .cases [case_before ]["dataset" ]
362- _ , gt_sorting1 = self .datasets [dataset_key ]
363- positions = gt_sorting1 .get_property ("gt_unit_locations" )
364-
365- analyzer = self .get_sorting_analyzer (case_before )
366- metrics_before = analyzer .get_extension ("quality_metrics" ).get_data ()
367- x = metrics_before ["snr" ].values
368-
369- y_before = self .get_result (case_before )["gt_comparison" ].get_performance ()[metric ].values
370- y_after = self .get_result (case_after )["gt_comparison" ].get_performance ()[metric ].values
371- ax .set_ylabel ("depth (um)" )
372- ax .set_ylabel ("snr" )
373- if count > 0 :
374- ax .set_ylabel ("" )
375- ax .set_yticks ([], [])
376- im = ax .scatter (positions [:, 1 ], x , c = (y_after - y_before ), cmap = "coolwarm" )
377- im .set_clim (- 1 , 1 )
378- # fig.colorbar(im, ax=ax)
379- # ax.set_title(k)
380-
381- fig .subplots_adjust (right = 0.85 )
382- cbar_ax = fig .add_axes ([0.9 , 0.1 , 0.025 , 0.75 ])
383- cbar = fig .colorbar (im , cax = cbar_ax , label = metric )
384- # cbar.set_clim(-1, 1)
385-
386- return fig
387-
388- def plot_comparison_clustering (
389- self ,
390- case_keys = None ,
391- performance_names = ["accuracy" , "recall" , "precision" ],
392- colors = ["g" , "b" , "r" ],
393- ylim = (- 0.1 , 1.1 ),
394- figsize = None ,
395- ):
396-
397- if case_keys is None :
398- case_keys = list (self .cases .keys ())
399- import pylab as plt
400-
401- num_methods = len (case_keys )
402- fig , axs = plt .subplots (ncols = num_methods , nrows = num_methods , figsize = (10 , 10 ))
403- for i , key1 in enumerate (case_keys ):
404- for j , key2 in enumerate (case_keys ):
405- if len (axs .shape ) > 1 :
406- ax = axs [i , j ]
407- else :
408- ax = axs [j ]
409- comp1 = self .get_result (key1 )["gt_comparison" ]
410- comp2 = self .get_result (key2 )["gt_comparison" ]
411- if i <= j :
412- for performance , color in zip (performance_names , colors ):
413- perf1 = comp1 .get_performance ()[performance ]
414- perf2 = comp2 .get_performance ()[performance ]
415- ax .plot (perf2 , perf1 , "." , label = performance , color = color )
416-
417- ax .plot ([0 , 1 ], [0 , 1 ], "k--" , alpha = 0.5 )
418- ax .set_ylim (ylim )
419- ax .set_xlim (ylim )
420- ax .spines [["right" , "top" ]].set_visible (False )
421- ax .set_aspect ("equal" )
422-
423- label1 = self .cases [key1 ]["label" ]
424- label2 = self .cases [key2 ]["label" ]
425- if j == i :
426- ax .set_ylabel (f"{ label1 } " )
427- else :
428- ax .set_yticks ([])
429- if i == j :
430- ax .set_xlabel (f"{ label2 } " )
431- else :
432- ax .set_xticks ([])
433- if i == num_methods - 1 and j == num_methods - 1 :
434- patches = []
435- import matplotlib .patches as mpatches
436-
437- for color , name in zip (colors , performance_names ):
438- patches .append (mpatches .Patch (color = color , label = name ))
439- ax .legend (handles = patches , bbox_to_anchor = (1.05 , 1 ), loc = "upper left" , borderaxespad = 0.0 )
440- else :
441- ax .spines ["bottom" ].set_visible (False )
442- ax .spines ["left" ].set_visible (False )
443- ax .spines ["top" ].set_visible (False )
444- ax .spines ["right" ].set_visible (False )
445- ax .set_xticks ([])
446- ax .set_yticks ([])
447-
448- plt .tight_layout (h_pad = 0 , w_pad = 0 )
449-
450- return fig
451-
452369 def plot_some_over_merged (self , case_keys = None , overmerged_score = 0.05 , max_units = 5 , figsize = None ):
453370 if case_keys is None :
454371 case_keys = list (self .cases .keys ())
0 commit comments