示例#1
0
ampli = np.array([3, 4, 4])

dataset = simul.surrogate_2d_dataset(n_subj=1, shape=shape, pos=pos,
                                     ampli=ampli, width=10.0).squeeze()

fig = plt.figure(figsize=(12, 10))
plt.subplot(3, 3, 1)
plt.imshow(dataset, cmap=plt.cm.hot)
plt.colorbar()
plt.title('Raw data')

Beta = dataset.ravel().squeeze()

###############################################################################
# fit Beta's histogram with a Gamma-Gaussian mixture
gam_gaus_pp = en.gamma_gaussian_fit(Beta, Beta)
gam_gaus_pp = np.reshape(gam_gaus_pp, (shape[0], shape[1], 3))

plt.figure(fig.number)
plt.subplot(3, 3, 4)
plt.imshow(gam_gaus_pp[..., 0], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n first component posterior proba.')
plt.colorbar()
plt.subplot(3, 3, 5)
plt.imshow(gam_gaus_pp[..., 1], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n second component posterior proba.')
plt.colorbar()
plt.subplot(3, 3, 6)
plt.imshow(gam_gaus_pp[..., 2], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n third component posterior proba.')
plt.colorbar()
示例#2
0
nim = load(mask_image)
mask = nim.get_data()

# read the functional image
rbeta = load(input_image)
beta = rbeta.get_data()
beta = beta[mask > 0]

mf = plt.figure(figsize=(13, 5))
a1 = plt.subplot(1, 3, 1)
a2 = plt.subplot(1, 3, 2)
a3 = plt.subplot(1, 3, 3)

# fit beta's histogram with a Gamma-Gaussian mixture
bfm = np.array([2.5, 3.0, 3.5, 4.0, 4.5])
bfp = en.gamma_gaussian_fit(beta, bfm, verbose=1, mpaxes=a1)

# fit beta's histogram with a mixture of Gaussians
alpha = 0.01
pstrength = 100
bfq = en.three_classes_GMM_fit(beta, bfm, alpha, pstrength,
                               verbose=1, mpaxes=a2)

# fit the null mode of beta with the robust method
efdr = en.NormalEmpiricalNull(beta)
efdr.learn()
efdr.plot(bar=0, mpaxes=a3)

a1.set_title('Fit of the density with \n a Gamma-Gaussian mixture')
a2.set_title('Fit of the density with \n a mixture of Gaussians')
a3.set_title('Robust fit of the density \n with a single Gaussian')
示例#3
0
ampli = np.array([3, 4, 4])

dataset = simul.surrogate_2d_dataset(n_subj=1, shape=shape, pos=pos,
                                     ampli=ampli, width=10.0).squeeze()

fig = plt.figure(figsize=(12, 10))
plt.subplot(3, 3, 1)
plt.imshow(dataset, cmap=plt.cm.hot)
plt.colorbar()
plt.title('Raw data')

Beta = dataset.ravel().squeeze()

###############################################################################
# fit Beta's histogram with a Gamma-Gaussian mixture
gam_gaus_pp = en.gamma_gaussian_fit(Beta, Beta)
gam_gaus_pp = np.reshape(gam_gaus_pp, (shape[0], shape[1], 3))

plt.figure(fig.number)
plt.subplot(3, 3, 4)
plt.imshow(gam_gaus_pp[..., 0], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n first component posterior proba.')
plt.colorbar()
plt.subplot(3, 3, 5)
plt.imshow(gam_gaus_pp[..., 1], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n second component posterior proba.')
plt.colorbar()
plt.subplot(3, 3, 6)
plt.imshow(gam_gaus_pp[..., 2], cmap=plt.cm.hot)
plt.title('Gamma-Gaussian mixture,\n third component posterior proba.')
plt.colorbar()