def update_arc_data(data,teo=False): """ Update the data dictionary for an arc with the hyperbola fit parameters """ x, y = np.array(data["x"]), np.array(data["y"]) m = np.abs(np.degrees(np.arctan2(y, x))) - 100.0 <= 0. # Force the hyperbola axis to be along the circle fit axis # Initial guess is that center is also the same. if teo: Rh, thh, PAh, xh, yh = conic_utils.fit_conic( x[m], y[m], Rh=data["Rc"], thh=-45.0, PAh=data["PAc"], xxh=data["xc"], yyh=data["yc"]) else: Rh, thh, PAh, xh, yh = conic_utils.fit_conic( x, y, Rh=data["Rc"], thh=45.0, PAh=data["PAc"], xxh=data["xc"], yyh=data["yc"]) R0 = np.max(x) R90 = Rh*conic_utils.x90(R0,thh) data.update(Rh=Rh, thh=thh, PAh=PAh, xh=xh, yh=yh,R0=R0,R90=R90) if cmd_args.savefig: plt.plot(-x, y, ".") xx,yy = conic_utils.world_hyperbola(Rh,thh,PAh,xh,yh) if teo: ax.grid() ax.set_xlim(-1.0,2) ax.set_ylim(-2,2) t=np.linspace(0,2*np.pi) ax.plot(-data["xc"], data["yc"], "+r", ms=5.0) ax.plot(-data["xc"]+data["Rc"]*np.cos(t),data["yc"]+data["Rc"]*np.sin(t),"g-",alpha=0.9) ax.plot(-xx,yy,"m-",alpha=1.0) ax.plot(xh,yh,"k+",ms=5.0) else: plt.plot(-xh, yh, "+" + colors[arc], ms=5.0) plt.plot(-xx,yy,colors[arc],alpha=0.9) print(arc, ":", xh, yh, Rh, thh) # c = plt.Circle((-xc, yc), radius=Rc, # fc='none', ec=colors[arc], alpha=0.4, lw=0.2) # plt.gca().add_patch(c) return None