def plot_ODF(grid_density=100): theta_grid = np.linspace(0, np.pi, grid_density) phi_grid = np.linspace(0, 2 * np.pi, grid_density) phi_vec, theta_vec = np.meshgrid(phi_grid, theta_grid) phi_vec, theta_vec = phi_vec.ravel(), theta_vec.ravel() xyz = np.column_stack(coord.sph2car(theta_vec, phi_vec)) ODF = w[0] * single_tensor_ODF(xyz, rotation=R0) ODF += w[1] * single_tensor_ODF(xyz, rotation=R1) ODF = ODF.reshape((grid_density, grid_density)) plot.surf_grid_3D(ODF, theta_grid, phi_grid, scale_radius=True)
def show_coverage_3d(rg, field, rm=None, vmin=None, sphere_colormap='jet'): """ """ # Resolution with which the small spheres are drawn pt_resolution = 20 # Size factor for small spheres scale_factor = 0.1 # missing directions in red, if any if rm is not None: xm, ym, zm = rm theta, phi, rho = coord.car2sph(xm, ym, zm) plot.scatter_3D(theta, phi, resolution=pt_resolution, scale_factor=scale_factor, name='Bad direction') # 'good' directions in green xg, yg, zg = rg theta, phi, rho = coord.car2sph(xg, yg, zg) # As simple spheres plot.scatter_3D(theta, phi, color=(0, 1, 0), scale_factor=scale_factor, resolution=pt_resolution, name='Good directions') npts_lat, npts_lon = field.shape theta = np.linspace(0, np.pi, npts_lat) phi = np.linspace(0, 2 * np.pi, npts_lon) s = plot.surf_grid_3D(field, theta, phi, vmin=vmin, name='Coverage') mlab = plot.get_mlab() mlab.colorbar(s, orientation='horizontal') mlab.show()