Skip to content

Commit

Permalink
cell-repsonse test
Browse files Browse the repository at this point in the history
  • Loading branch information
wagdy88 committed Jun 9, 2024
1 parent 8b19b30 commit 04026b4
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions hnn_core/tests/test_cell_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def test_cell_response(tmp_path):
sim_times = np.arange(tstart, tstop, 1 / fs)
gid_ranges = {'L2_pyramidal': range(1, 2), 'L2_basket': range(3, 4),
'L5_pyramidal': range(5, 6), 'L5_basket': range(7, 8)}
cell_response = CellResponse(spike_times=spike_times,
cell_response = CellResponse(cell_type_names=['L2_basket', 'L2_pyramidal',
'L5_basket', 'L5_pyramidal'],
spike_times=spike_times,
spike_gids=spike_gids,
spike_types=spike_types,
times=sim_times)
Expand Down Expand Up @@ -52,7 +54,9 @@ def test_cell_response(tmp_path):
sim_attributes + net_attributes

# Test recovery of empty spike files
empty_spike = CellResponse(spike_times=[[], []], spike_gids=[[], []],
empty_spike = CellResponse(cell_type_names=['L2_basket', 'L2_pyramidal',
'L5_basket', 'L5_pyramidal'],
spike_times=[[], []], spike_gids=[[], []],
spike_types=[[], []])
empty_spike.write(tmp_path / 'empty_spk_%d.txt')
empty_spike.write(tmp_path / 'empty_spk.txt')
Expand All @@ -63,23 +67,35 @@ def test_cell_response(tmp_path):

with pytest.raises(TypeError,
match="spike_times should be a list of lists"):
cell_response = CellResponse(spike_times=([2.3456, 7.89],
cell_response = CellResponse(cell_type_names=['L2_basket',
'L2_pyramidal', 'L5_basket',
'L5_pyramidal'],
spike_times=([2.3456, 7.89],
[4.2812, 93.2]),
spike_gids=spike_gids,
spike_types=spike_types)

with pytest.raises(TypeError,
match="spike_times should be a list of lists"):
cell_response = CellResponse(spike_times=[1, 2], spike_gids=spike_gids,
cell_response = CellResponse(cell_type_names=['L2_basket',
'L2_pyramidal',
'L5_basket', 'L5_pyramidal'],
spike_times=[1, 2], spike_gids=spike_gids,
spike_types=spike_types)

with pytest.raises(ValueError, match="spike times, gids, and types should "
"be lists of the same length"):
cell_response = CellResponse(spike_times=[[2.3456, 7.89]],
cell_response = CellResponse(cell_type_names=['L2_basket',
'L2_pyramidal',
'L5_basket', 'L5_pyramidal'],
spike_times=[[2.3456, 7.89]],
spike_gids=spike_gids,
spike_types=spike_types)

cell_response = CellResponse(spike_times=spike_times,
cell_response = CellResponse(cell_type_names=['L2_basket',
'L2_pyramidal',
'L5_basket', 'L5_pyramidal'],
spike_times=spike_times,
spike_gids=spike_gids,
spike_types=spike_types)

Expand Down

0 comments on commit 04026b4

Please sign in to comment.