_bokeh_manipulation Module#
_bokeh_manipulation Module#
Here there are all sorts of Bokeh related manipulations, but most dominantly custom jslink.
- waloviz._bokeh_manipulation.add_interactivity_with_jslinks(player_bokeh: Model, stay_color: str, follow_color: str, plots: List[Model], vlines: List[Model], vspans: List[Model], glyphs: List[Model]) Model[source]#
- Adds custom jslink interactivity.
Parameters#
player_bokehbokeh.model.Model.
stay_colorstr.
follow_colorstr.
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
vlinesList[bokeh.model.Model]Bokeh elements for current time cursors
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
glyphsList[bokeh.model.Model]Bokeh elements for play icons and the progress bar circular handle
Returns#
player_bokehbokeh.model.ModelWith custom jslink interactivity
- waloviz._bokeh_manipulation.apply_theme(plot: Model, theme: Dict[str, Any], theme_elements_mapping: Dict[str, str]) None[source]#
- Manually sets theme values of a plot.
Parameters#
plot: bokeh.model.Modeltheme: Dict[str, Any]theme_elements_mappingDict[str, str]A mapping between theme keys and plot attributes
- waloviz._bokeh_manipulation.finalize_player_bokeh_gui(player_bokeh: Model, theme: Dict[str, Any], total_seconds: float, stay_color: str, follow_color: str, aspect_ratio: Optional[float], sizing_mode: Optional[str], single_min_height: int) Model[source]#
- Modify bokeh settings and adds custom jslink interactivity.
Parameters#
player_bokehbokeh.model.ModelAs rendered by HoloViews
theme: Dict[str, Any]total_seconds: floatstay_color: strfollow_color: straspect_ratio: float | Nonesingle_min_height: intReturns#
player_bokehbokeh.model.ModelWith modifications and custom jslink interactivity
- waloviz._bokeh_manipulation.get_audio_xformatter(total_seconds: float) CustomJSTickFormatter[source]#
- Create a relative time tick formatter, with dynamic resolution from days up to milliseconds.
Parameters#
total_seconds: floatReturns#
xformatterCustomJSTickFormatterRelative time tick formatter.
- waloviz._bokeh_manipulation.get_follow_callback(plot: Model, vspan: Model) CustomJS[source]#
- Create a jslink callback which updates the x range when in “follow” mode.
Parameters#
plotbokeh.model.ModelThe current
plotvspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
Returns#
follow_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_keep_dump_range_callback(plot: Model) CustomJS[source]#
- Create a jslink callback which keeps the ‘_dump’ y axis between 0 and 1.The ‘_dump’ axis is used for the play and stop icons as well as the progress bar handle.
Parameters#
plotbokeh.model.ModelThe current
plot
Returns#
keep_dump_range_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_keep_x_range_callback(plot: Model, plots: List[Model]) CustomJS[source]#
- Create a jslink callback which keeps the constant x range when the mouse is over the progress bar.Uses
is_x_fixed,x_fixed_range.startandx_fixed_range.endof the zeroth plot (first spectrogram).Parameters#
plotbokeh.model.ModelThe current
plotplotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
keep_x_range_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_keep_y_range_callback(plot: Model, plots: List[Model]) CustomJS[source]#
- Create a jslink callback which keeps the constant y range when the mouse is over the spectrograms.Uses
is_y_fixed,hz_fixed_range.startandhz_fixed_range.endof the zeroth plot (first spectrogram).Parameters#
plotbokeh.model.ModelThe current
plotplotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
keep_y_range_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_move_pbar_callback(vspans: List[Model], plots: List[Model]) CustomJS[source]#
- Create a jslink callback which moves the current time to the mouse position when the mouse is over the progress bar.
Parameters#
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
move_pbar_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_move_time_callback(vspans: List[Model], plots: List[Model]) CustomJS[source]#
- Create a jslink callback which moves the current time to the mouse position.Used when double clicking.
Parameters#
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
move_time_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_play_pause_callback(plots: List[Model], glyphs: List[Model]) CustomJS[source]#
- Create a jslink callback which toggles play\pause when the mouse is over the spectrograms.Makes the zeroth glyph (first spectrogram play icon) visible.
Parameters#
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
glyphsList[bokeh.model.Model]Bokeh elements for play icons and the progress bar circular handle
Returns#
play_pause_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_record_ranges_callback(plots: List[Model]) CustomJS[source]#
- Create a jslink callback which records the previous ranges, important for following and zooming on x axis only.Saves
prev_x_rangeandprev_y_rangein the zeroth plot (first spectrogram).Parameters#
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
record_ranges_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_reset_callback(plot: Model, plots: List[Model]) CustomJS[source]#
- Create a jslink callback which updates saved values to their presets.
Parameters#
plotbokeh.model.ModelThe current
plotplotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
reset_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_set_pbar_x_range_callback(plot: Model, plots: List[Model]) CustomJS[source]#
- Create a jslink callback which stops the x zoom by setting a constant x range when the mouse is over the progress bar.Sets
is_x_fixed,x_fixed_range.startandx_fixed_range.endof the zeroth plot (first spectrogram).Parameters#
plotbokeh.model.ModelThe current
plotplotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
set_pbar_x_range_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_set_y_range_callback(plot: Model, plots: List[Model]) CustomJS[source]#
- Create a jslink callback which stops the y zoom by setting a constant y range when the mouse is over the spectrograms.Sets
is_y_fixed,hz_fixed_range.startandhz_fixed_range.endof the zeroth plot (first spectrogram).Parameters#
plotbokeh.model.ModelThe current
plotplotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
set_y_range_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_start_follow_callback(follow_color: str, vspans: List[Model], plots: List[Model]) CustomJS[source]#
- Create a jslink callback which activates “follow” mode.Saves
is_followingto the zeroth vspan (first spectrogram bright section).Also used to synchronize the vline follow color with the vspanline_color.Parameters#
follow_colorList[bokeh.model.Model]The color of the vlines when in “follow” mode
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
Returns#
start_follow_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.get_stop_follow_callback(stay_color: str, vspans: List[Model]) CustomJS[source]#
- Create a jslink callback which activates “stay” mode, stops “follow” mode.Sets
is_followingof the zeroth vspan (first spectrogram bright section).Also used to synchronize the vline stay color with the vspanline_color.Parameters#
stay_colorList[bokeh.model.Model]The color of the vlines when in “stay” mode
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
Returns#
stop_follow_callbackCustomJSA jslink callback.
- waloviz._bokeh_manipulation.modify_bokeh_elements(player_bokeh: Model, theme: Dict[str, Any], total_seconds: float, aspect_ratio: Optional[float], sizing_mode: Optional[str], single_min_height: int, plots: List[Model], vlines: List[Model], vspans: List[Model], glyphs: List[Model]) Model[source]#
- Adds custom jslink interactivity.
Parameters#
player_bokehbokeh.model.Model.
themeDict[str, Any].
total_secondsfloat.
aspect_ratiofloat | None.
sizing_modestr | None.
single_min_heightint.
plotsList[bokeh.model.Model]Bokeh plots for the spectrograms and progress bar
vlinesList[bokeh.model.Model]Bokeh elements for current time cursors
vspansList[bokeh.model.Model]Bokeh elements that brighten the section played so far
glyphsList[bokeh.model.Model]Bokeh elements for play icons and the progress bar circular handle
Returns#
player_bokehbokeh.model.ModelWith manual modifications