select_vmm,
select_vmm_cv)
-
from nose.tools import assert_true, assert_equal
+from numpy.testing import decorators
+
+from nibabel.optpkg import optional_package
+
+matplotlib, HAVE_MPL, _ = optional_package('matplotlib')
+needs_mpl = decorators.skipif(not HAVE_MPL, "Test needs matplotlib")
def test_spherical_area():
< 1e-2)
+@needs_mpl
+def test_von_mises_fisher_show():
+ # Smoke test for VonMisesMixture.show
+ x = np.random.randn(100, 3)
+ x = (x.T/np.sqrt(np.sum(x**2, 1))).T
+ vmd = VonMisesMixture(1, 1)
+ # Need to estimate to avoid error in show
+ vmd.estimate(x)
+ # Check that show does not raise an error
+ vmd.show(x)
+
+
def test_dimension_selection_bic():
# Tests whether dimension selection yields correct results
x1 = [0.6, 0.48, 0.64]
Parameters
----------
- x: array fo shape(n,3)
+ x: array of shape (n, 3)
should be on the unit sphere
+
+ Notes
+ -----
+
+ Uses ``matplotlib``.
"""
# label the data
z = np.argmax(self.responsibilities(x), 1)
fig = pylab.figure()
ax = p3.Axes3D(fig)
colors = (['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'] * \
- (1 + (1 + self.k) / 8))[:self.k + 1]
+ (1 + (1 + self.k) // 8))[:self.k + 1]
if (self.null_class) and (z == 0).any():
ax.plot3D(x[z == 0, 0], x[z == 0, 1], x[z == 0, 2], '.',
color=colors[0])