1616waveform = numpy .array ([waveforms [0 ]])
1717sampling_freq = 10000
1818
19+
20+ @pytest .mark .unit
1921def test_peak_to_valley ():
2022 """ephys.extra_features_utils: Test peak_to_valley"""
2123 ptv = ephys .extra_features_utils .peak_to_valley (waveform , sampling_freq )
2224 assert len (ptv ) == 1
2325 assert ptv [0 ] == pytest .approx (0.0013 )
2426
2527
28+ @pytest .mark .unit
2629def test_peak_trough_ratio ():
2730 """ephys.extra_features_utils: Test peak_trough_ratio"""
2831 ptratio = ephys .extra_features_utils .peak_trough_ratio (waveform )
@@ -31,6 +34,7 @@ def test_peak_trough_ratio():
3134 assert ptratio [0 ] == pytest .approx (0.53804035 )
3235
3336
37+ @pytest .mark .unit
3438def test_halfwidth ():
3539 """ephys.extra_features_utils: Test halfwidth"""
3640 ret = ephys .extra_features_utils .halfwidth (waveform , sampling_freq , True )
@@ -41,66 +45,95 @@ def test_halfwidth():
4145 assert hw [0 ] == pytest .approx (0.0015 )
4246
4347
48+ @pytest .mark .unit
4449def test_repolarization_slope ():
4550 """ephys.extra_features_utils: Test repolarization_slope"""
46- ret = ephys .extra_features_utils .repolarization_slope (waveform , sampling_freq , True )
51+ ret = ephys .extra_features_utils .repolarization_slope (
52+ waveform , sampling_freq , True
53+ )
4754 assert len (ret ) == 2
4855
49- rslope = ephys .extra_features_utils .repolarization_slope (waveform , sampling_freq )
56+ rslope = ephys .extra_features_utils .repolarization_slope (
57+ waveform , sampling_freq
58+ )
5059 assert len (rslope ) == 1
5160 assert rslope [0 ] == pytest .approx (73.12572131 )
5261
5362
63+ @pytest .mark .unit
5464def test_recovery_slope ():
5565 """ephys.extra_features_utils: Test recovery_slope"""
56- window = 0.7
57- rslope = ephys .extra_features_utils .recovery_slope (waveform , sampling_freq , window = window )
66+ window = 0.7
67+ rslope = ephys .extra_features_utils .recovery_slope (
68+ waveform , sampling_freq , window = window
69+ )
5870 assert len (rslope ) == 1
5971 assert rslope [0 ] == pytest .approx (- 3.63355521 )
6072
6173
74+ @pytest .mark .unit
6275def test_peak_image ():
6376 """ephys.extra_features_utils: Test peak_image"""
64- rel_peaks = ephys .extra_features_utils .peak_image (waveforms , sign = "negative" )
77+ rel_peaks = ephys .extra_features_utils .peak_image (
78+ waveforms , sign = "negative"
79+ )
6580 assert len (rel_peaks ) == 209
6681 assert rel_peaks [0 ] == pytest .approx (0.06084468 )
6782
68- rel_peaks = ephys .extra_features_utils .peak_image (waveforms , sign = "positive" )
83+ rel_peaks = ephys .extra_features_utils .peak_image (
84+ waveforms , sign = "positive"
85+ )
6986 assert len (rel_peaks ) == 209
7087 assert rel_peaks [0 ] == pytest .approx (0.10850117 )
7188
7289
90+ @pytest .mark .unit
7391def test_relative_amplitude ():
7492 """ephys.extra_features_utils: Test relative_amplitude"""
75- rel_amp = ephys .extra_features_utils .relative_amplitude (waveforms , sign = "negative" )
93+ rel_amp = ephys .extra_features_utils .relative_amplitude (
94+ waveforms , sign = "negative"
95+ )
7696 assert len (rel_amp ) == 209
7797 assert rel_amp [0 ] == pytest .approx (0.09513392 )
7898
79- rel_amp = ephys .extra_features_utils .relative_amplitude (waveforms , sign = "positive" )
99+ rel_amp = ephys .extra_features_utils .relative_amplitude (
100+ waveforms , sign = "positive"
101+ )
80102 assert len (rel_amp ) == 209
81103 assert rel_amp [0 ] == pytest .approx (0.2135929 )
82104
83105
106+ @pytest .mark .unit
84107def test_peak_time_diff ():
85108 """ephys.extra_features_utils: Test peak_time_diff"""
86- peak_t = ephys .extra_features_utils .peak_time_diff (waveforms , sampling_freq , sign = "negative" )
109+ peak_t = ephys .extra_features_utils .peak_time_diff (
110+ waveforms , sampling_freq , sign = "negative"
111+ )
87112 assert len (peak_t ) == 209
88113 assert peak_t [0 ] == pytest .approx (0.0009 )
89114
90- peak_t = ephys .extra_features_utils .peak_time_diff (waveforms , sampling_freq , sign = "positive" )
115+ peak_t = ephys .extra_features_utils .peak_time_diff (
116+ waveforms , sampling_freq , sign = "positive"
117+ )
91118 assert len (peak_t ) == 209
92119 assert peak_t [0 ] == pytest .approx (0.0007 )
93120
94121
122+ @pytest .mark .unit
95123def test__get_trough_and_peak_idx ():
96124 """ephys.extra_features_utils: Test _get_trough_and_peak_idx"""
97- t_idx , p_idx = ephys .extra_features_utils ._get_trough_and_peak_idx (waveform )
125+ t_idx , p_idx = ephys .extra_features_utils ._get_trough_and_peak_idx (
126+ waveform
127+ )
98128 assert t_idx == 102
99129 assert p_idx == 115
100130
101131
132+ @pytest .mark .unit
102133def test_calculate_features ():
103134 """ephys.extra_features_utils: Test calculate_features"""
104- feats = ephys .extra_features_utils .calculate_features (waveforms , sampling_freq )
135+ feats = ephys .extra_features_utils .calculate_features (
136+ waveforms , sampling_freq
137+ )
105138 for feature_name in ephys .extra_features_utils .all_1D_features :
106- assert feature_name in feats
139+ assert feature_name in feats
0 commit comments