Beispiel #1
0
 def test_with_spikes(self):
     transform = RandomSpike()
     transformed = transform(self.sample_subject)
     self.assertTensorNotEqual(
         self.sample_subject.t1.data,
         transformed.t1.data,
     )
Beispiel #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,
     )
Beispiel #3
0
 def test_wrong_intensity_type(self):
     with self.assertRaises(ValueError):
         RandomSpike(intensity='wrong')
Beispiel #4
0
 def test_wrong_num_spikes_type(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes='wrong')
Beispiel #5
0
 def test_not_integer_num_spikes(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=(0.7, 4))
Beispiel #6
0
 def test_num_spikes_range_with_negative_min(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=(-1, 4))
Beispiel #7
0
 def test_negative_num_spikes(self):
     with self.assertRaises(ValueError):
         RandomSpike(num_spikes=-1)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)