def test_plot_1d_cluster(): data_reduced_1d = reducer(data, ndims=1) geo = plot.plot(data_reduced_1d, cluster='KMeans', show=False) assert all([i.shape[1] == 1 for i in geo.data]) and len(geo.ax.get_lines()) == 3
def test_plot_3d(): data_reduced_3d = reduc(data, ndims=3) _, _, data_3d = plot.plot(data_reduced_3d, show=False, return_data=True) assert all([i.shape[1] == 3 for i in data_3d])
def test_plot_data_is_list(): _, _, data_nd = plot.plot(data, show=False, return_data=True) assert type(data_nd) is list
def test_plot_animate_check_line_ani(): _, _, _, line_ani = plot.plot(data, animate=True, show=False, return_data=True) assert isinstance(line_ani, mpl.animation.FuncAnimation)
def test_plot_1dim(): _, _, data_1dim = plot.plot(np.array([1, 2, 3, 4]), show=False, return_data=True) assert data_1dim[0].ndim == 2
def test_plot_reduce_align5d(): # should return 5d data since ndims=5 geo = plot.plot(weights, ndims=5, align=True, show=False) assert all([i.shape[1] == 5 for i in geo.xform_data])
def test_reduce_geo(): geo = plot(data, show=False) reduced_data_3d = reducer(geo, ndims=3) assert reduced_data_3d[0].shape==(10,3)
def test_plot_animate_check_fig(): geo = plot.plot(data, animate=True, show=False) assert isinstance(geo.fig, mpl.figure.Figure)
def test_plot_animate_check_ax(): geo = plot.plot(data, animate=True, show=False) assert isinstance(geo.ax, mpl.axes._axes.Axes)
def test_plot_nd_animate(): geo = plot.plot(data, animate=True, show=False) assert all([i.shape[1] == d.shape[1] for i, d in zip(geo.data, data)])
def test_plot_data_animate_is_list(): geo = plot.plot(data, animate=True, show=False) assert type(geo.data) is list
def test_plot_2d_animate(): data_reduced_2d = reducer(data, ndims=2) with pytest.raises(Exception) as e_info: plot.plot(data_reduced_2d, animate=True, show=False)
def test_plot_data_is_list(): geo = plot.plot(data, show=False) assert type(geo.data) is list
def test_plot_nd(): geo = plot.plot(data, show=False) assert all([i.shape[1] == d.shape[1] for i, d in zip(geo.data, data)])
def test_plot_reduce2d(): # should return 2d data since ndims=2 geo = plot.plot(data, ndims=2, show=False) assert all([i.shape[1] == 2 for i in geo.xform_data])
def test_plot_animate_check_line_ani(): geo = plot.plot(data, animate=True, show=False) assert isinstance(geo.line_ani, mpl.animation.FuncAnimation)
def test_plot_reduce1d(): # should return 1d data since ndims=1 geo = plot.plot(data, ndims=1, show=False) assert all([i.shape[1] == 1 for i in geo.xform_data])
def test_plot_1d(): data_reduced_1d = reducer(data, ndims=1) geo = plot.plot(data_reduced_1d, show=False) assert all([i.shape[1] == 1 for i in geo.data])
def test_plot_reduce10d(): # should return 10d data since ndims=10 geo = plot.plot(weights, ndims=10, show=False) assert all([i.shape[1] == 10 for i in geo.xform_data])
def test_plot_1dim(): geo = plot.plot(np.array([1, 2, 3, 4]), show=False) assert geo.data[0].ndim == 2
def test_plot_animate_check_ax(): _, ax, _, _ = plot.plot(data, animate=True, show=False, return_data=True) assert isinstance(ax, mpl.axes._axes.Axes)
def test_plot_2d(): data_reduced_2d = reducer(data, ndims=2) geo = plot.plot(data_reduced_2d, show=False) assert all([i.shape[1] == 2 for i in geo.data])
def test_plot_1d(): data_reduced_1d = reduc(data, ndims=1) _, _, data_1d = plot.plot(data_reduced_1d, show=False, return_data=True) assert all([i.shape[1] == 1 for i in data_1d])
def test_plot_3d(): data_reduced_3d = reducer(data, ndims=3) geo = plot.plot(data_reduced_3d, show=False) assert all([i.shape[1] == 3 for i in geo.data])
def test_plot_2d(): data_reduced_2d = reduc(data, ndims=2) _, _, data_2d = plot.plot(data_reduced_2d, show=False, return_data=True) assert all([i.shape[1] == 2 for i in data_2d])
def test_plot_reduce_none(): # Should return same dimensional data if ndims is None geo = plot.plot(data, show=False) assert all([i.shape[1] == d.shape[1] for i, d in zip(geo.data, data)])
def test_plot_nd(): _, _, data_nd = plot.plot(data, show=False, return_data=True) assert all([i.shape[1] == 3 for i in data_nd])
def test_plot_reduce3d(): # should return 3d data since ndims=3 geo = plot.plot(data, ndims=3, show=False) assert all([i.shape[1] == 3 for i in geo.xform_data])
def test_plot_check_fig(): fig, _, _ = plot.plot(data, show=False, return_data=True) assert isinstance(fig, mpl.figure.Figure)
def test_normalize_geo(): geo = plot(data, show=False) norm_data = normalize(geo, normalize='row') assert np.allclose(np.mean(np.vstack(norm_data), axis=1),0)