Beispiel #1
0
 def test_seed_duplicates(self, pattern):
     """ Same seed should imply same result """
     pattern = pattern + 1  # so that we can detect dead pixels
     z1 = add_dead_pixels(pattern, n=6, seed=7)
     z2 = add_dead_pixels(pattern, n=6, seed=7)
     assert np.allclose(z1, z2)
     assert np.sum(z1 == 0) == 6  # we should have 6 dead pixels!
Beispiel #2
0
 def test_copy_deadpixel(self, pattern):
     pattern = pattern + 1  # so that we can detect dead pixels
     z = add_dead_pixels(pattern, n=6, seed=7)
     assert not np.may_share_memory(pattern, z)
Beispiel #3
0
 def test_bad_kwarg_choices_b(self, pattern):
     _ = add_dead_pixels(pattern, n=6, fraction=0.2)
Beispiel #4
0
 def test_bad_kwarg_choices_a(self, pattern):
     _ = add_dead_pixels(pattern, n=None, fraction=None)
Beispiel #5
0
 def test_frac_kwarg(self, pattern):
     pattern = pattern + 1  # so that we can detect dead pixels
     pattern_size = pattern.shape[0] * pattern.shape[1]
     fraction = 6 / pattern_size
     z1 = add_dead_pixels(pattern, fraction=fraction)
     assert np.sum(z1 == 0) == 6  # we should have 6 dead pixels!