示例#1
0
def test_round_trip():
    sph_io.savez('__test.npz', y=1)
    data = sph_io.load('__test.npz')
    assert_equal(data['y'], 1)
    sph_io.remove('__test.npz')
bvecs = bvecs[b > 0]
b = b[b > 0]

theta, phi, _ = coord.car2sph(*bvecs.T)
theta_odf, phi_odf = theta132, phi132

kernel = inv_funk_radon_even_kernel
kernel_N = 8
X = kernel_matrix(theta, phi, theta_odf, phi_odf, kernel=kernel, N=kernel_N)
D = 150 # Grid density for plots (higher => more dense)

b = 3000 + np.random.normal(scale=4, size=len(theta)) # Make up somewhat realistic b-values

xyz = np.column_stack(coord.sph2car(theta, phi))

sph_io.savez('sphere_pts', gradient_theta=theta, gradient_phi=phi,
                           odf_theta=theta_odf, odf_phi=phi_odf, b=b)

# Fiber weights
w = [0.5, 0.5]

angles = np.deg2rad(np.arange(40, 60, 5))
angles = np.insert(angles, 0, 0)

SNR = None

for k, gamma in enumerate(angles):
    print "Angle:", np.rad2deg(gamma)

    # Gamma is the angle separating fibres

    # ================