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