def test_subsample_otu_evenly(self): '''Test that samples are chosen correctly.''' # test with proper divisor otu = arange(10) fraction = .5 exp_inds = array([0,3,5,7,9]) exp_otu = otu[exp_inds] obs_otu = subsample_otu_evenly(otu, fraction) assert_array_almost_equal(obs_otu, exp_otu)
def test_subsample_otu_evenly(self): '''Test that samples are chosen correctly.''' # test with proper divisor otu = arange(10) fraction = .5 exp_inds = array([0, 3, 5, 7, 9]) exp_otu = otu[exp_inds] obs_otu = subsample_otu_evenly(otu, fraction) assert_array_almost_equal(obs_otu, exp_otu)
def test_subsample_otu_zero(self): '''Tests zeroes placed in the right location.''' seed(0) otu = arange(20) ss_fraction = .5 zero_fraction = .5 exp_otu = subsample_otu_evenly(otu, ss_fraction) exp_otu[array([1, 2, 4, 8, 9])] = 0 #exp_inds = array([0,2,4,6,8,10,12,14,16,18]) #es_otu = otu[exp_inds] obs_otu = subsample_otu_zero(otu, ss_fraction, zero_fraction) assert_array_almost_equal(obs_otu, exp_otu)