From: Ian Jackson Date: Mon, 27 Nov 2017 12:40:46 +0000 (+0000) Subject: visdebug works now X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=62e66bc59f43496607ce723d7e8d2a3d1c7da0f7;p=moebius3.git visdebug works now Signed-off-by: Ian Jackson --- diff --git a/helixish.py b/helixish.py index 910e3de..eebe120 100644 --- a/helixish.py +++ b/helixish.py @@ -166,6 +166,8 @@ class HelixishCurve(): print(*findcurve_input, file=findcurve_subproc.stdin) findcurve_subproc.stdin.flush() + hc.func = symbolic.get_python() + while True: l = findcurve_subproc.stdout.readline() l = l.rstrip() @@ -174,17 +176,19 @@ class HelixishCurve(): l = eval(l) if l is None: break - hc.findcurve_result = l[0:5] - hc.func = symbolic.get_python(something) - hc.threshold = l[0]**2 - hc.total_dist = hc.threshold + l[1]**2 + hc.findcurve_result = l[0:6] + hc.threshold = l[0]**2 + hc.total_dist = hc.threshold + l[1]**2 + vdbg().curve( hc.point_at_t ) def point_at_t(hc, normalised_parameter): dist = normalised_parameter * hc.total_dist - ours = [p for p in findcurve_result] + ours = list(hc.findcurve_result) if dist <= hc.threshold: ours[0] = sqrt(dist) ours[1] = 0 else: ours[1] = sqrt(dist - hc.threshold) - return hc.func(*ours) + asmat = hc.func(*ours) + p = asmat[:,0] + return p diff --git a/symbolic.py b/symbolic.py index 1c90bca..ede36c4 100644 --- a/symbolic.py +++ b/symbolic.py @@ -3,11 +3,11 @@ from __future__ import print_function from sympy import * import itertools +from sympy.utilities.lambdify import lambdify, implemented_function +import numpy as np from moedebug import * -from sympy.utilities.lambdify import lambdify, implemented_function - r, theta, s, la, mu, kappa = symbols('r theta s lambda mu kappa') # start original formulation diff --git a/visual b/visual index 95125e8..8912531 100755 --- a/visual +++ b/visual @@ -19,7 +19,9 @@ nw = 40 class Visdebug(): def curve(vd, fn): # fn(t) => 3-tuple, 3-list, or similar, for t \elem [0,1] - curve(pos = [ list(fn(t)) for t in np.linspace(0,1,11) ]) + ps = [ fn(t) for t in np.linspace(0,1,11) ] + dbg('Visdebug', ps) + curve(pos = ps) def crashing(vd, msg): print("CRASHING - VISDEBUG", msg, file=sys.stderr) rate(1E-8)