def draw_sphere(color=(241/255., 233/255., 199/255.), alpha=0.25, radius=1.): # plot unit sphere sphere_pts = coord_primitives.sphere() sphere_pts = tuple([radius * x for x in sphere_pts]) sphere1 = mlab.mesh(*sphere_pts) sphere1.actor.mapper.scalar_visibility = False sphere1.actor.property.color = color sphere1.actor.property.opacity = alpha
def construct_targets_mesh(): ''' Returns ------- x,y,z : ndarrays ''' sphere_pts = sphere(npts=(9,5)) sp = np.asarray(sphere_pts) sp2 = sp.reshape(3, 5*9) wrong = np.abs(np.abs(sp2[0]) - 0.5) < 1e-8 signs = np.sign(sp2[:,wrong]) sp2[:,wrong] = signs * 1/np.sqrt(3.) x,y,z = sp return x,y,z,sp2