99from .unit_templates import UnitTemplatesWidget
1010from ..core import Templates
1111
12+
1213class DriftingTemplatesWidget (BaseWidget ):
1314 """
1415 Plot a drifting templates object to explore motion
1516
1617 Parameters
1718 ----------
18- drifting_templates :
19+ drifting_templates :
1920 A drifting templates object
2021 scale : float, default: 1
2122 Scale factor for the waveforms/templates (matplotlib backend)
@@ -45,7 +46,7 @@ def plot_ipywidgets(self, data_plot, **backend_kwargs):
4546 check_ipywidget_backend ()
4647
4748 # self.next_data_plot = data_plot.copy()
48- self .drifting_templates = data_plot [' drifting_templates' ]
49+ self .drifting_templates = data_plot [" drifting_templates" ]
4950
5051 cm = 1 / 2.54
5152
@@ -68,9 +69,9 @@ def plot_ipywidgets(self, data_plot, **backend_kwargs):
6869
6970 self .slider = widgets .IntSlider (
7071 orientation = "horizontal" ,
71- value = arr .shape [0 ]// 2 ,
72+ value = arr .shape [0 ] // 2 ,
7273 min = 0 ,
73- max = arr .shape [0 ]- 1 ,
74+ max = arr .shape [0 ] - 1 ,
7475 readout = False ,
7576 continuous_update = True ,
7677 layout = widgets .Layout (width = f"100%" ),
@@ -91,13 +92,13 @@ def plot_ipywidgets(self, data_plot, **backend_kwargs):
9192 if backend_kwargs ["display" ]:
9293 display (self .widget )
9394
94- def _change_unit (self , change = None ):
95+ def _change_unit (self , change = None ):
9596 self ._update_ipywidget (keep_lims = False )
9697
97- def _change_displacement (self , change = None ):
98+ def _change_displacement (self , change = None ):
9899 self ._update_ipywidget (keep_lims = True )
99100
100- def _update_ipywidget (self ,keep_lims = False ):
101+ def _update_ipywidget (self , keep_lims = False ):
101102 if keep_lims :
102103 xlim = self .ax .get_xlim ()
103104 ylim = self .ax .get_ylim ()
@@ -119,10 +120,9 @@ def _update_ipywidget(self,keep_lims=False):
119120 probe = self .drifting_templates .probe ,
120121 )
121122
122- UnitTemplatesWidget (templates , unit_ids = unit_ids , scale = 5 ,
123- plot_legend = False ,
124- backend = "matplotlib" , ax = self .ax , same_axis = True )
125-
123+ UnitTemplatesWidget (
124+ templates , unit_ids = unit_ids , scale = 5 , plot_legend = False , backend = "matplotlib" , ax = self .ax , same_axis = True
125+ )
126126
127127 displacement = self .drifting_templates .displacements [displacement_index ]
128128 self .ax .set_title (f"{ displacement_index } :{ displacement } - untis:{ unit_ids } " )
@@ -134,4 +134,3 @@ def _update_ipywidget(self,keep_lims=False):
134134 fig = self .ax .get_figure ()
135135 fig .canvas .draw ()
136136 fig .canvas .flush_events ()
137-
0 commit comments