Example #1
0
 def test_with_spikes(self):
     transform = RandomSpike()
     transformed = transform(self.sample_subject)
     self.assertTensorNotEqual(
         self.sample_subject.t1.data,
         transformed.t1.data,
     )
Example #2
0
 def test_with_zero_intensity(self):
     transform = RandomSpike(intensity=0)
     transformed = transform(self.sample_subject)
     self.assertTensorAlmostEqual(
         self.sample_subject.t1.data,
         transformed.t1.data,
     )
Example #3
0
 def test_wrong_intensity_type(self):
     with self.assertRaises(ValueError):
         RandomSpike(intensity='wrong')
Example #4
0
 def test_wrong_num_spikes_type(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes='wrong')
Example #5
0
 def test_not_integer_num_spikes(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=(0.7, 4))
Example #6
0
 def test_num_spikes_range_with_negative_min(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=(-1, 4))
Example #7
0
 def test_negative_num_spikes(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=-1)
Example #8
0
 def test_with_zero_spike(self):
     transform = RandomSpike(num_spikes=0)
     transformed = transform(self.sample)
     self.assertTensorAlmostEqual(self.sample.t1.data, transformed.t1.data)
Example #9
0
 def test_with_zero_intensity(self):
     transform = RandomSpike(intensity=0)
     transformed = transform(self.sample)
     assert_array_equal(self.sample.t1.data, transformed.t1.data)
Example #10
0
 def test_with_spikes(self):
     transform = RandomSpike()
     transformed = transform(self.sample)
     with self.assertRaises(AssertionError):
         assert_array_equal(self.sample.t1.data, transformed.t1.data)
Example #11
0
 def test_with_zero_spike(self):
     transform = RandomSpike(num_spikes=0)
     transformed = transform(self.sample)
     assert_array_equal(self.sample.t1.data, transformed.t1.data)