def test_select_n_reflectances_permutes(self): image_shape = self.image.shape new_first_layer = np.random.random_sample(image_shape[0:-1]) self.image[:, :, 0] = new_first_layer shuffled_image = select_n_reflectances(self.image, image_shape[0] * image_shape[1]) # restore_shape shuffled_image = np.reshape(shuffled_image, image_shape) self.assertFalse(np.allclose(shuffled_image[:, :, 0], new_first_layer), "image has been shuffled")
def test_select_n_reflectances_selects(self): n = 10 new_image = select_n_reflectances(self.image, n) self.assertEqual(new_image.shape, (n, self.image.shape[-1]), "correct shape after selection")