Skip to content

Commit

Permalink
add regression test, testing for np.float32 and np.float64
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz-Alexander-Kern committed Aug 30, 2023
1 parent b464d07 commit 31e6257
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion elephant/test/test_signal_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def test_zscore_list_inplace(self):
self.assertIs(result[0], signal_list[0])
self.assertIs(result[1], signal_list[1])

def test_wrong_input(self):
def test_z_score_wrong_input(self):
# wrong type
self.assertRaises(TypeError, elephant.signal_processing.zscore,
signal=[1, 2] * pq.uV)
Expand All @@ -411,6 +411,23 @@ def test_wrong_input(self):
self.assertRaises(ValueError, elephant.signal_processing.zscore,
signal=[asig1, asig2])

def test_z_score_np_float32_64(self):
"""
Regression test: Inplace operations for z_score failed when using
np.float32 or np.float64 types.
See Issue #591
https://github.com/NeuralEnsemble/elephant/issues/591
"""
test_types = (np.float32, np.float64)
for test_type in test_types:
with self.subTest(test_type):
signal = neo.AnalogSignal(self.test_seq1, units='mV',
t_start=0. * pq.ms,
sampling_rate=1000. * pq.Hz,
dtype=test_type)
# This should not raise a ValueError
elephant.signal_processing.zscore(signal, inplace=True)


class ButterTestCase(unittest.TestCase):

Expand Down

0 comments on commit 31e6257

Please sign in to comment.