Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI: Connection Probability #841

Open
gtdang opened this issue Jul 31, 2024 · 4 comments · May be fixed by #843
Open

GUI: Connection Probability #841

gtdang opened this issue Jul 31, 2024 · 4 comments · May be fixed by #843
Assignees
Labels
hnn-gui HNN GUI

Comments

@gtdang
Copy link
Collaborator

gtdang commented Jul 31, 2024

Working on the Network configuration export I noticed that the GUI is not using the connection probability in any way.


The connectivity only have a weight widget parameter.
Screenshot 2024-07-31 at 10 20 16 AM

The connectivity widget constructor is shown below. Notice the docstring mentions probability, but it is not in the box construct. It's a bit hard to read but the connectivity box is a vertical box (Vbox) composed of 3 elements:

  1. HTML - Receptor label
  2. w_text_input - Weight widget
  3. HTML - Black horizontal bar
    def _get_connectivity_widgets(conn_data):
    """Create connectivity box widgets from specified weight and probability"""
    style = {'description_width': '150px'}
    style = {}
    sliders = list()
    for receptor_name in conn_data.keys():
    w_text_input = BoundedFloatText(
    value=conn_data[receptor_name]['weight'], disabled=False,
    continuous_update=False, min=0, max=1e6, step=0.01,
    description="weight", style=style)
    conn_widget = VBox([
    HTML(value=f"""<p>
    Receptor: {conn_data[receptor_name]['receptor']}</p>"""),
    w_text_input, HTML(value="<hr style='margin-bottom:5px'/>")
    ])

The Problem
A problem arises when initializing the new network from widget values. It tries to assign a probability from a widget that does not exist (see below). The vbox_key.children[2].value, is not a probability widget but the html widget that styles the black horizontal bar. So the network actually gets assigned a probability value of "<hr style='margin-bottom:5px'/>"!

hnn-core/hnn_core/gui/gui.py

Lines 1650 to 1653 in a1c94ee

single_simulation_data['net'].connectivity[conn_idx][
'nc_dict']['A_weight'] = vbox_key.children[1].value
single_simulation_data['net'].connectivity[conn_idx][
'probability'] = vbox_key.children[2].value


Solution
I suppose the easiest solution is to just add the probability as a widget for all the connections. Does this make sense for all types of connections?

@gtdang gtdang added the hnn-gui HNN GUI label Jul 31, 2024
@gtdang gtdang self-assigned this Jul 31, 2024
@ntolley
Copy link
Contributor

ntolley commented Jul 31, 2024

Is it an easy addition? The probability should default to 1.0 for all connections.

If it's straight forward to implement then I would say yes, it's a line of investigation that people haven't gone down because it wasn't possible in the old GUI

@gtdang
Copy link
Collaborator Author

gtdang commented Jul 31, 2024

Do all connections and all weights have an associated probability? Or is it conditional?

@ntolley
Copy link
Contributor

ntolley commented Jul 31, 2024

Whenever you call net.add_connection to add a drive or connect cell types, there's a probability argument that let's you randomly select some subset of all possible cell-cell connections. In that sense any entry in the net.connectivity list could have probability < 1.0, but by default it's always set to 1.0.

Where we need to be careful is that net.connectivity[conn_idx]['gid_pairs'] will change depending on the value of probability and conn_seed. Since the GUI builds each connection separately from the widget I don't think this will be a problem, since net.add_connection is still being used when you hit the run button and compile the Network object

@gtdang gtdang linked a pull request Jul 31, 2024 that will close this issue
@gtdang
Copy link
Collaborator Author

gtdang commented Aug 1, 2024

#843 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hnn-gui HNN GUI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants