Skip to content

Prefix callback functions #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webviz_subsurface/containers/_disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def layout(self):
def set_callbacks(self, app):
@app.callback(Output(self.chart_id, 'figure'),
[Input(self.plot_type_id, 'value')])
def update_plot(plot_type):
def _update_plot(plot_type):
if plot_type == 'Pie chart':
data = [{
'values': self.usage,
Expand Down
6 changes: 3 additions & 3 deletions webviz_subsurface/containers/_inplace_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def set_callbacks(self, app):
@app.callback(
Output(self.chart_id, 'children'),
self.vol_callback_inputs)
def render_vol_chart(*args):
def _render_vol_chart(*args):
'''Renders a volume visualization which could either by a dcc.Graph
or a Dash table object.
The arguments are given by the vol_callback_inputs property
Expand Down Expand Up @@ -282,7 +282,7 @@ def render_vol_chart(*args):
[Output(self.selectors_id['ENSEMBLE'], 'multi'),
Output(self.selectors_id['ENSEMBLE'], 'value')],
[Input(self.radio_selectors_id, 'value')])
def set_iteration_selector(group_by):
def _set_iteration_selector(group_by):
'''If iteration is selected as group by set the iteration
selector to allow multiple selections, else use single selection
'''
Expand All @@ -295,7 +295,7 @@ def set_iteration_selector(group_by):
[Output(self.selectors_id['SOURCE'], 'multi'),
Output(self.selectors_id['SOURCE'], 'value')],
[Input(self.radio_selectors_id, 'value')])
def set_source_selector(group_by):
def _set_source_selector(group_by):
'''If iteration is selected as group by set the iteration
selector to allow multiple selections, else use single selection
'''
Expand Down
26 changes: 13 additions & 13 deletions webviz_subsurface/containers/_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,28 @@ def set_callbacks(self, app):
Input(self.surf_list_id, 'value'),
Input(self.well_tvd_id, 'value'),
Input(self.zoom_state_id, 'value')])
def set_fence(_well_path, _reals, _surfs, _tvdmin, _keep_zoom_state):
def _set_fence(well_path, reals, surfs, tvdmin, keep_zoom_state):
'''Callback to update intersection on data change'''
if not isinstance(_surfs, list):
_surfs = [_surfs]
if not isinstance(_reals, list):
_reals = [_reals]
if not _reals:
_reals = list(self.realizations.keys())
if not _surfs:
_surfs = self.surface_names
s_names = [s for s in self.surface_names if s in _surfs]
xsect = self.plot_xsection(_well_path, _reals, s_names, _tvdmin)
if not isinstance(surfs, list):
surfs = [surfs]
if not isinstance(reals, list):
reals = [reals]
if not reals:
reals = list(self.realizations.keys())
if not surfs:
surfs = self.surface_names
s_names = [s for s in self.surface_names if s in surfs]
xsect = self.plot_xsection(well_path, reals, s_names, tvdmin)
layout = self.graph_layout
if _keep_zoom_state:
if keep_zoom_state:
layout['uirevision'] = 'keep'
return {'data': xsect, 'layout': layout}

@app.callback(Output(self.table_id, 'data'),
[Input(self.intersection_id, 'hoverData')],
[State(self.intersection_id, 'figure'),
State(self.surf_list_id, 'value')])
def hover(_data, _fig, _surfaces):
def _hover(_data, _fig, _surfaces):
'''Callback to update table on mouse over'''
try:
graph = _fig['data']
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/containers/_morris_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def set_callbacks(self, app):
Output(self.graph_id, 'parameter'),
Output(self.graph_id, 'parameters')],
[Input(self.vector_id, 'value')])
def update_plot(vector):
def _update_plot(vector):
df = self.data[self.data['name'] == vector]
df = df.sort_values('time')
output = df[['mean', 'max', 'min', 'time']]\
Expand Down
8 changes: 4 additions & 4 deletions webviz_subsurface/containers/_parameter_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pandas as pd
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
from dash.dependencies import Input, Output
import dash_daq as daq
from webviz_config.webviz_store import webvizstore
from webviz_config.common_cache import cache
Expand Down Expand Up @@ -144,7 +144,7 @@ def set_callbacks(self, app):
[Input(self.ens_matrix_id, 'value'),
Input(self.p1_drop_id, 'value'),
Input(self.p2_drop_id, 'value')])
def update_matrix(ens, p1, p2):
def _update_matrix(ens, p1, p2):
'''Renders correlation matrix.
Currently also re-renders matrix to update currently
selected cell. This is not optimal, but hard to prevent
Expand Down Expand Up @@ -180,7 +180,7 @@ def update_matrix(ens, p1, p2):
Input(self.p2_drop_id, 'value'),
Input(self.scatter_color_id, 'value'),
Input(self.density_id, 'value')])
def update_scatter(ens1, p1, ens2, p2, color, density):
def _update_scatter(ens1, p1, ens2, p2, color, density):
return render_scatter(ens1, p1, ens2, p2, color, density)

@app.callback([Output(self.p1_drop_id, 'value'),
Expand All @@ -190,7 +190,7 @@ def update_scatter(ens1, p1, ens2, p2, color, density):
[Input(self.matrix_id, 'clickData'),
Input(self.ens_matrix_id, 'value')]
)
def update_from_click(cd, ens):
def _update_from_click(cd, ens):
try:
points = cd['points'][0]
# TypeError is returned if no cells are clicked
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/containers/_summary_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def set_callbacks(self, app):
[Input(self.dropwdown_vector_id, 'value'),
Input(self.radio_plot_type_id, 'value'),
Input(self.show_history_uncertainty_id, 'value')])
def update_plot(
def _update_plot(
vector,
summary_plot_type,
show_history_uncertainty_id):
Expand Down