Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.limit_cb = widgets.Checkbox(description='limit', style={'description_width': 'initial'}, disabled=True,
indent=False, layout=Layout(max_width='70px'))
self.limit_cb.observe(self.limit_cb_observer)
self.order_dd = widgets.Dropdown(options=[None] + list(groups), description='order by',
layout=Layout(max_width='120px'), style={'description_width': 'initial'})
self.order_dd.observe(self.order_dd_observer)
self.ascending_dd = widgets.Dropdown(options=['ASC', 'DESC'], disabled=True,
layout=Layout(max_width='70px'))
self.ascending_dd.observe(self.ascending_dd_observer)
range_controller_max = min(30, self.nitems)
if window is None:
self.range_controller = RangeController(0, self.nitems, start_value=(0, range_controller_max), dtype='int', description='units',
orientation='vertical')
self.range_controller.observe(self.range_controller_observer)
self.window = self.range_controller.value
elif window is False:
self.window = (0, self.nitems)
self.range_controller = widgets.HTML('')
self.group_sm = widgets.SelectMultiple(layout=Layout(max_width='100px'), disabled=True, rows=1)
self.group_sm.observe(self.group_sm_observer)
if group_by is None:
self.group_dd = widgets.Dropdown(options=[None] + list(groups), description='group by',
style={'description_width': 'initial'}, layout=Layout(width='90%'))
self.group_dd.observe(self.group_dd_observer)
else:
self.group_dd = None
def single_trace_widget(timeseries: TimeSeries, time_window_controller=None):
controls = dict(timeseries=fixed(timeseries))
gen_time_window_controller = False
if time_window_controller is None:
gen_time_window_controller = True
tmin = get_timeseries_mint(timeseries)
tmax = get_timeseries_maxt(timeseries)
time_window_controller = RangeController(tmin, tmax, start_value=[tmin, min(tmin+30, tmax)])
controls.update(time_window=time_window_controller.slider)
out_fig = widgets.interactive_output(show_trace, controls)
if gen_time_window_controller:
return widgets.VBox(children=[time_window_controller, out_fig])
else:
return widgets.VBox(children=[out_fig])
time_window_controller=None, start=None, dur=None,
trace_controller=None, trace_starting_range=None,
**kwargs):
if time_window_controller is None:
tmax = get_timeseries_maxt(node)
tmin = get_timeseries_mint(node)
if start is None:
start = tmin
if dur is None:
dur = min(tmax-tmin, 5)
time_window_controller = StartAndDurationController(tmax, tmin, start=start, duration=dur)
if trace_controller is None:
if trace_starting_range is None:
trace_starting_range = (0, min(30, node.data.shape[1]))
trace_controller = RangeController(0, node.data.shape[1], start_range=trace_starting_range,
description='channels', dtype='int', orientation='vertical')
controls = {
'time_series': widgets.fixed(node),
'time_window': time_window_controller,
'trace_window': trace_controller.slider,
}
controls.update({key: widgets.fixed(val) for key, val in kwargs.items()})
out_fig = widgets.interactive_output(plot_traces, controls)
lower = widgets.HBox(children=[
trace_controller,
out_fig
])