Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
time_dd_list = [(k1, k1) for k1 in self.time_list]
self.data_time_dd = bokeh.models.widgets.Dropdown(label='Time',
menu=time_dd_list,
button_type='warning',
width=300)
self.data_time_dd.on_change('value', self.on_data_time_change)
# Create next timestep button widget
self.time_next_button = bokeh.models.widgets.Button(label='Next',
button_type='warning',
width=100)
self.time_next_button.on_click(self.on_time_next)
# Set layout rows for widgets
self.time_row = \
bokeh.layouts.row(self.time_prev_button,
bokeh.models.Spacer(width=20, height=60),
self.data_time_dd,
bokeh.models.Spacer(width=20, height=60),
self.time_next_button)
self.major_config_row = bokeh.layouts.row(self.wavelength_dd)
self.plots_row = bokeh.layouts.row(*self.bokeh_imgs)
self.info_row = bokeh.layouts.row(bokeh.models.Spacer(width=400, height=100),
self.colorbar_div,
bokeh.models.Spacer(width=400, height=100))
# Create main layout
self.main_layout = bokeh.layouts.column(self.time_row,
self.major_config_row,
self.plots_row,
self.info_row,
)
div_range,
add_range_row_button,
row(range_row, Spacer(width=10), select_category, text_min, text_max, group_range,
delete_range_row_button, Spacer(width=10), range_not_operator_checkbox),
range_filter_data_table)
layout_dvhs = column(row(custom_title_dvhs_blue, Spacer(width=50), custom_title_dvhs_red),
row(radio_group_dose, radio_group_volume),
row(select_reviewed_mrn, select_reviewed_dvh, review_rx),
dvh_plots,
data_table_title,
data_table,
div_endpoint_start,
div_endpoint,
add_endpoint_row_button,
row(ep_row, Spacer(width=10), select_ep_type, ep_text_input, ep_units_in, delete_ep_row_button),
ep_data_table,
endpoint_table_title,
data_table_endpoints)
layout_rad_bio = column(row(custom_title_rad_bio_blue, Spacer(width=50), custom_title_rad_bio_red),
emami_text,
data_table_emami,
rad_bio_custom_text,
row(rad_bio_eud_a_input, Spacer(width=50),
rad_bio_gamma_50_input, Spacer(width=50), rad_bio_td_tcd_input, Spacer(width=50),
rad_bio_apply_filter, Spacer(width=50), rad_bio_apply_button),
row(rad_bio_update_button),
data_table_rad_bio_text,
data_table_rad_bio,
Spacer(width=1000, height=100))
self.reimport_title,
row(self.reimport_mrn_text, Spacer(width=10),
self.reimport_old_data_select, Spacer(width=140), self.reimport_button),
row(self.reimport_study_date_select, self.reimport_uid_select),
Div(text="<hr>", width=column_width),
row(self.delete_from_db_title),
row(self.delete_from_db_column, Spacer(width=300), self.delete_from_db_button),
row(self.delete_from_db_value, self.delete_auth_text),
Div(text="<hr>", width=column_width),
row(self.change_mrn_uid_title),
row(self.change_mrn_uid_column, Spacer(width=300), self.change_mrn_uid_button),
row(self.change_mrn_uid_old_value, self.change_mrn_uid_new_value)),
column(Div(text="<b>Query Database</b>", width=column_width),
row(self.query_table, self.query_columns),
self.query_condition,
row(self.query_button, Spacer(width=25), self.download),
self.query_data_table))
""
else:
reset_mod_functions(x_Im,y,y_mod,y_mod_Im,y_FT_Im,y_FT_Re,y_FT_Im_mod,y_FT_Re_mod)
update_all_arrows()
with_source.data=dict(t=with_text)
## define all possible modifications
mod_select = Select(title="Modification of input function f(t):", value=initial_mod,
options=["Shifting","Scaling", "Multiplication with exponential function", "Multiplication with other function", "Convolution with other function",
"Differentiation","Linear combination"], width = 430)
mod_select.on_change('value',changeMod)
## app layout
layout = column(description, row(Spacer(width=35), func_select), row(func_time_plot, column(Spacer(height=64),fig),
func_freq_plot),Spacer(height=20), row(Spacer(width=35),mod_select),row(Spacer(width=35),modification, column(Spacer(height=19),
lambda_input)), Spacer(height=10),row(mod_time_plot, column(Spacer(height=64),fig), mod_freq_plot))
## update modified functions f*(t) and F*(ω)
def update_mod_functions(x_Im,y_mod, y_mod_Im, y_FT_Re_mod, y_FT_Im_mod):
mod_time_source.data = dict(x=x,y=y_mod)
mod_freq_Re_source.data = dict(x=x,y=y_FT_Re_mod)
mod_freq_Im_source.data = dict(x=x, y=y_FT_Im_mod)
mod_time_Im_source.data = dict(x=x_Im, y=y_mod_Im)
## reset modified function: f*(t) = f(t) and F*(ω) = F(ω)
def reset_mod_functions(x_Im,y,y_mod,y_mod_Im,y_FT_Im,y_FT_Re,y_FT_Im_mod,y_FT_Re_mod):
for i in range(0,1401):
y_mod[i]=y[i]
y_FT_Im_mod[i]=y_FT_Im[i]
y_FT_Re_mod[i]=y_FT_Re[i]
update_mod_functions(x_Im,y_mod, y_mod_Im, y_FT_Re_mod, y_FT_Im_mod)
" (i.e., make sure you're backing up the correct database).", width=650)
host_div = Div(text="<b>Host</b>: %s" % self.config['host'])
port_div = Div(text="<b>Port</b>: %s" % self.config['port'])
db_div = Div(text="<b>Database</b>: %s" % self.config['dbname'])
self.delete_backup_button.on_click(self.delete_backup)
self.backup_db_button.on_click(self.backup_db)
self.restore_db_button.on_click(self.restore_db)
self.delete_backup_button_pref.on_click(self.delete_backup_pref)
self.backup_pref_button.on_click(self.backup_pref)
self.restore_pref_button.on_click(self.restore_preferences)
self.update_backup_select()
self.layout = column(row(self.backup_select, self.delete_backup_button, self.restore_db_button,
self.backup_db_button),
row(self.backup_pref_select, self.delete_backup_button_pref, self.restore_pref_button,
self.backup_pref_button),
warning_div,
host_div,
port_div,
db_div)
self.columns = ['mrn', 'roi_name', 'toxicity_grade']
relative_widths = [1, 1, 1, 1]
column_widths = [int(250. * rw) for rw in relative_widths]
table_columns = [TableColumn(field=c, title=c, width=column_widths[i]) for i, c in enumerate(self.columns)]
table_columns.insert(1, TableColumn(field='protocol', title='protocol', width=column_widths[0]))
table_columns.insert(1, TableColumn(field='physician', title='physician', width=column_widths[0]/3))
self.table = DataTable(source=self.source, columns=table_columns, width=800, editable=True, height=600)
self.update_physicians()
note = Div(text='<b>NOTE</b>: MRNs input below that are not in the table to the left will be '
'ignored on update.')
self.layout = column(self.protocol_select,
row(self.display_by, self.physician, self.roi),
row(self.table, Spacer(width=50), column(note,
self.update_button,
self.clear_source_selection_button,
row(self.mrn_input, self.toxicity_grade_input))))
p.add_tools(hover)
# Build dashboard
timeslider, checkbox, select_all, select_none, checkbox_title = self._get_widgets(all_glyphs, overtime_groups, run_groups,
slider_labels=timeslider_labels)
contour_checkbox, contour_title = self._contour_radiobuttongroup(contour_handles, color_mapper)
layout = p
if use_timeslider:
self.logger.debug("Adding timeslider")
layout = column(layout, widgetbox(timeslider))
if use_checkbox:
self.logger.debug("Adding checkboxes")
layout = row(layout,
column(widgetbox(checkbox_title),
widgetbox(checkbox),
row(widgetbox(select_all, width=100),
widgetbox(select_none, width=100)),
widgetbox(contour_title),
widgetbox(contour_checkbox)))
if self.output_dir:
path = os.path.join(self.output_dir, "content/images/configurator_footprint.png")
export_bokeh(p, path, self.logger)
return layout, over_time_paths
if new == "Differentiation":
""
else:
reset_mod_functions(x_Im,y,y_mod,y_mod_Im,y_FT_Im,y_FT_Re,y_FT_Im_mod,y_FT_Re_mod)
update_all_arrows()
with_source.data=dict(t=with_text)
## define all possible modifications
mod_select = Select(title="Modification of input function f(t):", value=initial_mod,
options=["Shifting","Scaling", "Multiplication with exponential function", "Multiplication with other function", "Convolution with other function",
"Differentiation","Linear combination"], width = 430)
mod_select.on_change('value',changeMod)
## app layout
layout = column(description, row(Spacer(width=35), func_select), row(func_time_plot, column(Spacer(height=64),fig),
func_freq_plot),Spacer(height=20), row(Spacer(width=35),mod_select),row(Spacer(width=35),modification, column(Spacer(height=19),
lambda_input)), Spacer(height=10),row(mod_time_plot, column(Spacer(height=64),fig), mod_freq_plot))
## update modified functions f*(t) and F*(ω)
def update_mod_functions(x_Im,y_mod, y_mod_Im, y_FT_Re_mod, y_FT_Im_mod):
mod_time_source.data = dict(x=x,y=y_mod)
mod_freq_Re_source.data = dict(x=x,y=y_FT_Re_mod)
mod_freq_Im_source.data = dict(x=x, y=y_FT_Im_mod)
mod_time_Im_source.data = dict(x=x_Im, y=y_mod_Im)
## reset modified function: f*(t) = f(t) and F*(ω) = F(ω)
def reset_mod_functions(x_Im,y,y_mod,y_mod_Im,y_FT_Im,y_FT_Re,y_FT_Im_mod,y_FT_Re_mod):
for i in range(0,1401):
y_mod[i]=y[i]
y_FT_Im_mod[i]=y_FT_Im[i]
y_FT_Re_mod[i]=y_FT_Re[i]
TOOLS="hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,tap,save,box_select,poly_select,lasso_select"
def mkplot(xaxis="below", yaxis="left"):
p = figure(width=300, height=300, tools=TOOLS, x_axis_location=xaxis, y_axis_location=yaxis)
p.scatter(x, y, radius=radii, fill_color=colors, fill_alpha=0.6, line_color=None)
return p
def mkgrid(plots, location):
return gridplot(plots, plot_width=300, plot_height=300, toolbar_location=location)
l_al = mkgrid([[mkplot(), mkplot()], [mkplot(), mkplot()]], "above")
l_ar = mkgrid([[mkplot(), mkplot()], [mkplot(), mkplot()]], "below")
l_bl = mkgrid([[mkplot(), mkplot()], [mkplot(), mkplot()]], "left")
l_br = mkgrid([[mkplot(), mkplot()], [mkplot(), mkplot()]], "right")
layout = column(row(l_al, l_ar), row(l_bl, l_br))
output_file("toolbars2.html", title="toolbars2.py example")
show(layout)
self.select['mrn'].on_change('value', self.update_mrn_ticker)
self.select['study_date'].on_change('value', self.update_study_date_ticker)
self.select['uid'].on_change('value', self.update_uid_ticker)
self.select['status'].on_change('value', self.update_status_ticker)
self.columns = ['mrn', 'sim_study_date', 'physician', 'rx_dose', 'fxs', 'tx_modality', 'tx_site',
'study_instance_uid', 'import_time_stamp', 'baseline']
relative_widths = [1, 1, 0.75, 0.5, 0.3, 1, 1, 3.5, 1.5, 0.5]
column_widths = [int(250. * rw) for rw in relative_widths]
table_columns = [TableColumn(field=c, title=c, width=column_widths[i]) for i, c in enumerate(self.columns)]
self.table = DataTable(source=self.source, columns=table_columns, width=1300, editable=True)
self.source.on_change('selected', self.source_selection_ticker)
self.layout = column(Div(text="<b>Query Database</b>", width=1000),
row(self.condition, self.query_button),
Div(text="<b>Update Database</b>", width=1025),
row(self.select['mrn'], self.select['study_date'], self.select['uid'],
self.select['status']),
self.table)