Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# p_logo.background_fill_color = "black"
# p_logo.border_fill_color = "black"
# p_logo.grid.grid_line_color = "black"
# p_logo.outline_line_color = "black"
# radio button group for uploading file
radio_group = RadioButtonGroup(labels=["NO-SPLIT", "SPLIT", "START"], button_type="success")
radio_group.width = 500
radio_group.on_click(_fit_util)
# text for console output
text_input = TextInput(value="", title="CONSOLE")
text_input.width = 500
cluster_stats = Div(
render_as_text=False,
text=generate_display_string("", name="Cluster Statistics", height=100)
)
cluster_stats.width = 500
cluster_stats.height = 100
cluster_commonality = Div(
render_as_text=False,
text=generate_display_string("")
)
cluster_commonality.width = 500
cluster_commonality.height = 300
split_button = Button(label="Split", button_type="success", width=150)
no_split_button = Button(label="Keep", button_type="success", width=150)
start_button = Button(label="Start", button_type="success", width=150)
self.source_map = ColumnDataSource(data={'name': [], 'color': [], 'x': [], 'y': [],
'x0': [], 'y0': [], 'x1': [], 'y1': []})
self.roi_map_plot.circle("x", "y", size=12, source=self.source_map, line_color="black", fill_alpha=0.8,
color='color')
labels = LabelSet(x="x", y="y", text="name", y_offset=8, text_color="#555555",
source=self.source_map, text_align='center')
self.roi_map_plot.add_layout(labels)
self.roi_map_plot.segment(x0='x0', y0='y0', x1='x1', y1='y1', source=self.source_map, alpha=0.5)
self.update_roi_map_source_data()
self.category_map = {0: self.select_institutional_roi,
1: self.select_physician,
2: self.select_physician_roi,
3: self.select_variation}
self.layout = row(column(Div(text="<b>WARNING:</b> Buttons in orange cannot be easily undone.",
width=widget_width*3+100),
Div(text="<hr>", width=widget_width * 3),
row(self.select_institutional_roi, self.select_physician),
Div(text="<hr>", width=widget_width*3),
row(self.select_physician_roi, self.select_variation,
self.select_unlinked_institutional_roi),
Div(text="<hr>", width=widget_width*3),
row(self.operator, self.category),
row(self.input_text, Spacer(width=30), self.action_button, Spacer(width=50),
self.div_action),
Div(text="<hr>", width=widget_width * 3),
row(self.select_uncategorized_variation, Spacer(width=50),
self.select_ignored_variation),
row(self.ignore_button_roi, Spacer(width=10), self.delete_uncategorized_button_roi,
Spacer(width=50),
self.unignore_button_roi, Spacer(width=10), self.delete_ignored_button_roi),
button_del_selected.on_click(partial(vis_cbs.cb_button_delete, curr_doc=curr_doc, all_selected=False))
# add and configure a button to delete selected elements of the input graph
button_del_all = Button(label="Delete all", width=b_del_w)
button_del_all.on_click(partial(vis_cbs.cb_button_delete, curr_doc=curr_doc, all_selected=True))
'''
############################################
# BOX OF ELEMENTS TO SELECT FOR INPUT PLOT
############################################
'''
# titles for groups of mechanical elements
text_supports = Div(text="Supports:", width=100, height=20)
text_springs = Div(text="Springs:", width=100, height=20)
text_node = Div(text="Node:", width=100, height=20)
text_joints = Div(text="Joints:", width=100, height=20)
text_elements = Div(text="Line elements:", width=100, height=20)
text_loads = Div(text="Loads:", width=100, height=20)
b_height = 50
b_line_width = 72
# configure buttons for mechanical supports
button_support_clamped = Button(label="", css_classes=[eLnum.ElSupEnum.SUPPORT_CLAMPED.name], width=b_height,
height=b_height)
curr_doc.buttons[eLnum.ElSupEnum.SUPPORT_CLAMPED.value] = button_support_clamped
button_support_clamped.on_click(partial(vis_cbs.cb_button_element_click, curr_doc=curr_doc,
button_enum=eLnum.ElSupEnum.SUPPORT_CLAMPED))
button_support_normal = Button(label="", css_classes=[eLnum.ElSupEnum.SUPPORT_NORMAL_FORCE.name], width=b_height,
height=b_height)
curr_doc.buttons[eLnum.ElSupEnum.SUPPORT_NORMAL_FORCE.value] = button_support_normal
def _get_model(self, doc, root=None, parent=None, comm=None):
model = _BkColumn()
if root is None:
root = model
msg = self._process_param_change(self._init_properties())
div = _BkDiv(text=msg['text'])
slider = _BkSlider(start=msg['start'], end=msg['end'], value=msg['value'],
title=None, step=1, show_value=False, tooltips=None)
# Link parameters and bokeh model
self._link_params(model, slider, div, ['value', 'options'], doc, root, comm)
self._link_props(slider, ['value'], doc, root, comm)
model.children = [div, slider]
self._models[root.ref['id']] = model
return model
def temperature_plots(conn, start, end):
'''Combines plots to a tab
Parameters
----------
conn : DBobject
Connection object that represents database
start : time
Startlimit for x-axis and query (typ. datetime.now()- 4Months)
end : time
Endlimit for x-axis and query (typ. datetime.now())
Return
------
p : tab object
used by dashboard.py to set up dashboard
'''
descr = Div(text=
"""
<style>
table, th, td {
border: 1px solid black;
background-color: #efefef;
border-collapse: collapse;
padding: 5px
}
table {
border-spacing: 15px;
}
</style>
<table style="width:100%">
<tbody><tr></tr></tbody></table>
width=400)
self.model_dd.on_change('value',
functools.partial(self.on_config_change, 0))
# Create GPM IMERG selection radio button group widget
imerg_labels = [ds_name for ds_name in self.datasets.keys() if 'imerg' in ds_name]
self.imerg_rbg = \
bokeh.models.widgets.RadioButtonGroup(labels=imerg_labels,
button_type='warning',
width=800)
self.imerg_rbg.on_change('active',
functools.partial(self.on_imerg_change, 1))
# Create accumulation selection label div widget
accum_div_text = '<p style="vertical-align:middle;">Accumulation window:</p>'
self.accum_div = bokeh.models.widgets.Div(text=accum_div_text,
height=60,
width=150)
# Create accumulation selection radio button group widget
accum_labels = ['{}hr'.format(val) for val in [3, 6, 12, 24]]
self.accum_rbg = \
bokeh.models.widgets.RadioButtonGroup(labels=accum_labels,
button_type='warning',
width=800,
active=0)
self.accum_rbg.on_change('active',
functools.partial(self.on_accum_change, 1))
# Create colorbar div widget
colorbar_link = "<img src="plot_sea_model_and_gpm_mpl/static/" + \
"precip_accum_colorbar.png">"
def show_exception_page():
""" show an error page in case of an unknown/unhandled exception """
title = 'Internal Error'
error_message = ('<h3>Internal Server Error</h3>'
'<p>Please open an issue on <a>'
'https://github.com/PX4/flight_review/issues</a> with a link '
'to this log.')
div = Div(text=error_message, width=int(plot_width*0.9))
plots = [widgetbox(div, width=int(plot_width*0.9))]
curdoc().template_variables['internal_error'] = True
return (title, error_message, plots)
</p>
def get_widgets(self):
"""
Creates a set of widgets representing the dimensions on the
plot object used to instantiate the widgets class.
"""
widgets = OrderedDict()
mappings = {}
for dim in self.mock_obj.kdims:
holomap = None if self.plot.dynamic else self.mock_obj
widget, label, mapping = self.create_widget(dim, holomap, self.editable)
if label is not None and not isinstance(label, Div):
label.on_change('value', partial(self.on_change, dim, 'label'))
widget.on_change('value', partial(self.on_change, dim, 'widget'))
widgets[dim.pprint_label] = (label, widget)
if mapping:
mappings[dim.pprint_label] = OrderedDict(mapping)
return widgets, mappings
def fpe_fpa_plots(conn, start, end):
'''Combines plots to a tab
Parameters
----------
conn : DBobject
Connection object that represents database
start : time
Startlimit for x-axis and query (typ. datetime.now()- 4Months)
end : time
Endlimit for x-axis and query (typ. datetime.now())
Return
------
p : tab object
used by dashboard.py to set up dashboard
'''
descr = Div(text=
"""
<style>
table, th, td {
border: 1px solid black;
background-color: #efefef;
border-collapse: collapse;
padding: 5px
}
table {
border-spacing: 15px;
}
</style>
<table style="width:100%">
<tbody><tr></tr></tbody></table>
'Pericarditus', 'Nephritis', 'Cataract', 'Liver Failure',
'Pneumonitis', 'Blindness', 'Blindness'],
eud_a=[5, 7, 25, 6, 31, 31, 19, 3, 1, 3, 3, 1, 25, 15],
gamma_50=[3, 3, 3, 4, 3, 4, 4, 3, 3, 1, 3, 2, 3, 2],
td_tcd=[60, 65, 65, 55, 40, 65, 68, 50, 28, 18, 40, 24.5, 65, 65]))
columns = [TableColumn(field="roi", title="Structure", width=150),
TableColumn(field="ep", title="Endpoint", width=250),
TableColumn(field="eud_a", title="a", width=75),
TableColumn(field="gamma_50", title=u"\u03b3_50", width=75),
TableColumn(field="td_tcd", title="TD_50", width=150)]
data_table_emami = DataTable(source=source_emami, columns=columns, editable=False, width=1100)
source_emami.on_change('selected', emami_selection)
emami_text = Div(text="<b>Published EUD Parameters from Emami et. al. for 1.8-2.0Gy fractions</b> (Click to apply)",
width=600)
rad_bio_custom_text = Div(text="<b>Applied Parameters:</b>", width=150)
data_table_rad_bio_text = Div(text="<b>EUD Calculations for Query</b>", width=500)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ROI Viewer Objects
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
roi_colors = plot_colors.cnames.keys()
roi_colors.sort()
roi_viewer_options = [''] + source.data['mrn']
roi_viewer_mrn_select = Select(value='', options=roi_viewer_options, width=200, title='MRN')
roi_viewer_study_date_select = Select(value='', options=[''], width=200, title='Sim Study Date')
roi_viewer_uid_select = Select(value='', options=[''], width=400, title='Study Instance UID')
roi_viewer_roi_select = Select(value='', options=[''], width=250, title='ROI 1 Name')
roi_viewer_roi2_select = Select(value='', options=[''], width=200, title='ROI 2 Name')
roi_viewer_roi3_select = Select(value='', options=[''], width=200, title='ROI 3 Name')
roi_viewer_roi4_select = Select(value='', options=[''], width=200, title='ROI 4 Name')
roi_viewer_roi5_select = Select(value='', options=[''], width=200, title='ROI 5 Name')
roi_viewer_roi1_select_color = Select(value='blue', options=roi_colors, width=150, title='ROI 1 Color')