@@ -27,20 +27,24 @@ def test_rf_map(self):
2727
2828 rf_map_times , rf_map_pos , rf_stim_frames = passive .get_on_off_times_and_positions (rf_map )
2929
30- assert ( all (rf_map_times == test_times ))
31- assert (rf_map_pos .shape == (15 * 15 , 2 ))
32- assert (len (rf_stim_frames ['on' ]) == 15 * 15 )
33- assert (len (rf_stim_frames ['off' ]) == 15 * 15 )
30+ self . assertTrue ( np . all (rf_map_times == test_times ))
31+ self . assertEqual (rf_map_pos .shape , (15 * 15 , 2 ))
32+ self . assertEqual (len (rf_stim_frames ['on' ]), 15 * 15 )
33+ self . assertEqual (len (rf_stim_frames ['off' ]), 15 * 15 )
3434
3535 # Off is for the 0 ones
36- assert (all (rf_stim_frames ['off' ][ismember2d (rf_map_pos , np .array ([[8 , 8 ]]))[0 ]][0 ][0 ]
37- == [10 , 50 ]))
38- assert (rf_stim_frames ['off' ][ismember2d (rf_map_pos , np .array ([[4 , 9 ]]))[0 ]][0 ][0 ] == 40 )
39- assert (rf_stim_frames ['off' ][ismember2d (rf_map_pos , np .array ([[11 , 4 ]]))[0 ]][0 ][0 ] == 42 )
36+ idx = ismember2d (rf_map_pos , np .array ([[8 , 8 ]]))[0 ]
37+ self .assertTrue (np .all (rf_stim_frames ['off' ][idx ][0 ][0 ] == [10 , 50 ]))
38+ idx = ismember2d (rf_map_pos , np .array ([[4 , 9 ]]))[0 ]
39+ self .assertEqual (rf_stim_frames ['off' ][idx ][0 ][0 ], 40 )
40+ idx = ismember2d (rf_map_pos , np .array ([[11 , 4 ]]))[0 ]
41+ self .assertEqual (rf_stim_frames ['off' ][idx ][0 ][0 ], 42 )
4042
4143 # On is for the 255 ones
42- assert (rf_stim_frames ['on' ][ismember2d (rf_map_pos , np .array ([[10 , 13 ]]))[0 ]][0 ][0 ] == 25 )
43- assert (rf_stim_frames ['on' ][ismember2d (rf_map_pos , np .array ([[6 , 10 ]]))[0 ]][0 ][0 ] == 42 )
44+ idx = ismember2d (rf_map_pos , np .array ([[10 , 13 ]]))[0 ]
45+ self .assertEqual (rf_stim_frames ['on' ][idx ][0 ][0 ], 25 )
46+ idx = ismember2d (rf_map_pos , np .array ([[6 , 10 ]]))[0 ]
47+ self .assertEqual (rf_stim_frames ['on' ][idx ][0 ][0 ], 42 )
4448
4549 # Next test that the firing rate function works
4650 # Basically just make one square responsive
@@ -51,19 +55,19 @@ def test_rf_map(self):
5155 rf_stim_frames , spike_times ,
5256 spike_depths , x_lim = [0 , 60 ])
5357 non_zero = np .where (rf_map_avg ['on' ] != 0 )
54- assert (np .argmin (np .abs (depths - 500 )) == non_zero [0 ][0 ])
55- assert ( all (non_zero [1 ] == 10 ))
56- assert ( all (non_zero [2 ] == 13 ))
58+ self . assertEqual (np .argmin (np .abs (depths - 500 )), non_zero [0 ][0 ])
59+ self . assertTrue ( np . all (non_zero [1 ] == 10 ))
60+ self . assertTrue ( np . all (non_zero [2 ] == 13 ))
5761
58- assert (np .all (rf_map_avg ['off' ] == 0 ))
62+ self . assertTrue (np .all (rf_map_avg ['off' ] == 0 ))
5963
6064 rf_svd = passive .get_svd_map (rf_map_avg )
6165 # Make sure that the one responsive element is non-zero
62- assert (rf_svd ['on' ][non_zero [0 ][0 ]][non_zero [1 ][0 ], non_zero [2 ][0 ]] != 0 )
66+ self . assertTrue (rf_svd ['on' ][non_zero [0 ][0 ]][non_zero [1 ][0 ], non_zero [2 ][0 ]] != 0 )
6367 # But that all the rest are zero
6468 rf_svd ['on' ][non_zero [0 ][0 ]][non_zero [1 ][0 ], non_zero [2 ][0 ]] = 0
65- assert (np .all (np .isclose (np .vstack (rf_svd ['on' ]), 0 )))
66- assert (np .all (np .vstack (rf_svd ['off' ]) == 0 ))
69+ self . assertTrue (np .all (np .isclose (np .vstack (rf_svd ['on' ]), 0 )))
70+ self . assertTrue (np .all (np .vstack (rf_svd ['off' ]) == 0 ))
6771
6872 def test_stim_aligned (self ):
6973
@@ -78,8 +82,8 @@ def test_stim_aligned(self):
7882 stim_activity = passive .get_stim_aligned_activity (aud_stim , spike_times , spike_depths ,
7983 z_score_flag = False , x_lim = [0 , 40 ])
8084
81- assert ( list ( stim_activity .keys ()) == ['valveOn' ])
85+ self . assertCountEqual ( stim_activity .keys (), ['valveOn' ])
8286 # The first may be a bit different due to overlap with noise floor
83- assert ( all (stim_activity ['valveOn' ][0 ][1 :] == 5 ))
87+ self . assertTrue ( np . all (stim_activity ['valveOn' ][0 ][1 :] == 5 ))
8488 # make sure the rest of the depths are all zero
85- assert (np .all (stim_activity ['valveOn' ][1 :] == 0 ))
89+ self . assertTrue (np .all (stim_activity ['valveOn' ][1 :] == 0 ))
0 commit comments