def comp_graph_embed(): output = ADgraph.draw_graph2(out_num[visfunc], G[visfunc], edge_labs[visfunc], pos[visfunc], labs[visfunc]) print('entered function') #output = io.BytesIO() #FigureCanvasSVG(fig).print_svg(output) return Response(output.getvalue(), mimetype='image/svg+xml')
def build_function(): global out_num out_num = [None] * master_outs for i in range(master_outs): if master_ins == 1: out_num[i] = function_output[i](x[i]) if master_ins == 2: out_num[i] = function_output[i](x[i], y[i]) if master_ins == 3: out_num[i] = function_output[i](x[i], y[i], z[i]) if master_ins == 4: out_num[i] = function_output[i](x[i], y[i], z[i], u[i]) if master_ins == 5: out_num[i] = function_output[i](x[i], y[i], z[i], u[i], v[i]) global disp_val, disp_der disp_val = '[' disp_der = '[' for out in out_num: #disp_val = str(np.round(out.val, 2)) #disp_der = str(np.round(out.der, 2)) try: disp_val += str(np.round(out.val, 2)) disp_der += str(np.round(out.der, 2)) except: disp_val += str(np.round(out, 2)) disp_der + +str([0] * master_ins) disp_val += ',\n' disp_der += ',\n' disp_val = disp_val[:-2] + ']' disp_der = disp_der[:-2] + ']' global G, edge_labs, pos, labs G = [None] * master_outs edge_labs = [None] * master_outs pos = [None] * master_outs labs = [None] * master_outs for i, out in enumerate(out_num): try: G[i], edge_labs[i], pos[i], labs[i] = ADgraph.get_graph_setup(out) except AttributeError: pass
def rev_graph_embed(): output = ADgraph.draw_graph_rev2(out_num[visfunc], G[visfunc], edge_labs[visfunc], pos[visfunc], labs[visfunc]) return Response(output.getvalue(), mimetype='image/svg+xml')