From e2d7efa3db355004ee728aadf73e576ebb6130f9 Mon Sep 17 00:00:00 2001 From: George Dang <53052793+gtdang@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:13:08 -0400 Subject: [PATCH] test: WIP test for probability --- hnn_core/tests/test_gui.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/hnn_core/tests/test_gui.py b/hnn_core/tests/test_gui.py index 4995d0b00..9cfe308c5 100644 --- a/hnn_core/tests/test_gui.py +++ b/hnn_core/tests/test_gui.py @@ -209,6 +209,42 @@ def test_gui_change_connectivity(): plt.close('all') +def test_gui_connectivty_probability(): + gui = HNNGUI() + _ = gui.compose() + + for conn_widget in gui.connectivity_widgets: + assert conn_widget[0].children[2].description == 'probability' + assert isinstance(conn_widget[0].children[2].value, float) + + # Change probability of the first widget + probability = 0.5 + gui.connectivity_widgets[0][0].children[2].value = probability + conn_specs = gui.connectivity_widgets[0][0]._belongsto + + + # now the default parameter has been loaded. + single_simulation = {} + single_simulation['net'] = jones_2009_model(gui.params) + + conn_idx = pick_connection( + net=single_simulation['net'], + src_gids=conn_specs['src_gids'], + target_gids=conn_specs['target_gids'], + loc=conn_specs['location'], + receptor=conn_specs['receptor']) + + + _init_network_from_widgets(gui.params, gui.widget_dt, gui.widget_tstop, + single_simulation, gui.drive_widgets, + gui.connectivity_widgets, + gui.cell_pameters_widgets) + + conn = single_simulation['net'].connectivity[conn_idx[0]] + + assert conn['probability'] == probability + + def test_gui_add_drives(): """Test if gui add different type of drives.""" gui = HNNGUI()