def make_plot(self, b): controller = self.controller b.description = 'Creating plot... Please Wait.' b.disabled = True try: b.pvals = controller.pvals.copy() if b.plot_type.value == 'Design Space (interactive)': self.make_interactive_plot(b) elif b.plot_type.value == 'Design Space': self.make_static_plot(b) elif b.plot_type.value == 'Stability': self.make_stability_plot(b) elif b.plot_type.value == 'Eigenvalues': self.make_eigenvalue_plot(b) else: self.make_function_plot(b) except Exception as e: close_button = Button(description="Close") error_message = '<div width="200px" style="float:center; text-align:center;">' error_message += '<b>An error occured while plotting</b></div>' error_window = Popup(children=[HTML(value=error_message),close_button]) close_button.window = error_window close_button.on_click(lambda x: x.window.close()) if old_ipython is False: error_window.box_style='danger' close_button.float = 'center' error_window.width='250px' error_window.height='150px' display(error_window) b.description = 'Add Plot' b.disabled = False else: b.description = 'Add Plot' b.disabled = False
def __init__(self, name='', version='', equations=None, parameters=None, get_parameters=None, auxiliary_variables=[], constraints=[], symbols={}, resolve_cycles=False, resolve_codominance=False, centered_axes=False, xaxis=None, yaxis=None, recast=True, x_range=[1e-3, 1e3], y_range=[1e-3, 1e3], zlim=None, by_signature=False, kinetic_orders=None, included_cases=None, biological_constraints=[], resolution=100, **kwargs): ''' ''' setattr(self, 'ds', None) setattr(self, 'equations', []) setattr(self, 'name', name) setattr(self, 'version', version) setattr(self, 'pvals', None) setattr(self, 'cyclical', resolve_cycles) setattr(self, 'codominance', resolve_codominance) setattr(self, 'recast', recast) setattr(self, 'auxiliary', []) setattr(self, 'constraints', []) setattr(self, 'kinetic_orders', []) setattr(self, 'symbols', symbols) setattr(self, 'widget', Tab()) setattr(self, 'figures', None) setattr(self, 'figure_data', []) setattr(self, 'tables', None) setattr(self, 'table_data', []) setattr(self, 'display_system', None) setattr(self, 'options', dict(kwargs)) self.options.update(center_axes=centered_axes, xaxis=xaxis, yaxis=yaxis, range_x=x_range, range_y=y_range, zlim=zlim, by_signature=by_signature, kinetic_orders=kinetic_orders, get_parameters=get_parameters, included_cases=included_cases, biological_constraints=biological_constraints, resolution=resolution) if equations is not None: self.equations = equations if isinstance(equations, list) is False: self.equations = [equations] if auxiliary_variables is not None: self.auxiliary = auxiliary_variables if isinstance(auxiliary_variables, list) is False: self.auxiliary = [auxiliary_variables] if constraints is not None: self.constraints = constraints if isinstance(constraints, list) is False: self.constraints = [constraints] if parameters is not None: self.pvals = dspace.VariablePool(names = parameters.keys()) self.pvals.update(parameters) self.root = VBox(children=[self.widget]) display(self.root) self.update_child('About', self.help_widget()) self.update_child('Main Menu', self.edit_equations_widget())
def modify_equations_widget(self, b): self.ds = None self.figure_data = [] self.table_data = [] self.widget.close() self.widget = Tab() display(self.root) self.update_child('Main Menu', self.edit_equations_widget(editing=True))
def reload_widgets(self): self.widget = Tab() display(self.root) self.update_child('Main Menu', self.edit_equations_widget()) if self.ds is None: return self.update_widgets() self.figures.load_widgets()