def set_math_text(self, math_text, font_size=None): if self.non_math_text: self.text = r'$\mathrm{\mathsf{' + math_text + '}}$' else: if is_float(math_text): self.text = r'$ {:g} $'.format(float(math_text)) else: self.text = r'$ {} $'.format(math_text) if font_size: self.fontSize = float(font_size) self.img = pyHImage() self.updateFigure()
def matrix_to_latex(matrix): h, w = matrix.shape text = '' for row in range(h): for column in range(w): value = matrix[row][column] if is_float(value): if int(value) - value == 0: text += ' {} &'.format(int(value)) else: text += ' {:.2f} &'.format(value) else: text += ' {} &'.format(value) text = text[:-1] + r'\\ ' return text[:-3]
def get_expression(self, v0, v1): i0 = format_value(v0) i1 = format_value(v1) if is_float(v1) and is_negative(v1): return '%s - %s' % (i0, 1 * float(i1)) return '(%s + %s)' % (i0, i1)
def updateWeights(self): a = self.toolBar["&ADTool"].actions()[1].defaultWidget().text() if ops.is_float(a): alpha = float(a) self.graph.updateWeight(alpha, True) self.show_evaluateGraph_View()
def run(self): alpha = self.toolBar["&ADTool"].actions()[1].defaultWidget().text() if self.graph.hiddenNodes() and ops.is_float(alpha): self.actionGroup["&ADTool"].actions()[0].setEnabled(False) self.graph.run(alpha) self.actionGroup["&ADTool"].actions()[0].setEnabled(True)