-
Notifications
You must be signed in to change notification settings - Fork 52
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
follow-up GUI improvements #497
Comments
I'm wondering if it's better to just use matplotlib subplots instead of two Output windows so that the plots are always aligned ... |
That could work, although it might conflict with @ntolley's dream of eventually having widgets that can be moved around in a drag-and-drop fashion. One benefit of going the subplots route is that it would allow users to produce custom figures that could more easily be incorporated into publications. |
we're wasting a lot of real-estate in the current approach. One could use |
Following up on our conversation about the connectivity. I think we can avoid using the hardcoded values referencing the params file through a combination of the attribute @chenghuzi happy to chat about this when you think it's a good time to prioritize this change |
Thanks fore reminding me of this. Yes we can definitely add the probability parameter into all boxes and I like the idea of extracting connectivity from the network object. But if my understanding is correct, doing so involves rewriting the |
@chenghuzi the One of the long-term goals of the project is to be able to incorporate more complex models of the neocortex, so we should try to anticipate and keep the code general to ease such transitions in the future. |
@ntolley can you share a code snippet how to avoid the hardcoded values so @chenghuzi can get an idea? I'm guessing you're referring to this part of the code? Lines 978 to 979 in c7460ba
|
Here is an example of the logic I've recently implemented in #419 that allows you to see if a given You could loop through every combination of cell in |
As for modifying connections directly, here's an example of how it'd be done: new_weight = 0.1
new_prob = 0.5
conn_indices = pick_connection(net, src_gids='L2_pyramidal', target_gids='L5_pyramidal', loc='proximal', receptor='ampa')
assert len(conn_indices) == 1 # should only be modifying one specific connection
conn_idx = conn_indices[0]
net.connectivity[conn_idx]['nc_dict']['A_weight'] = new_weight
net.connectivity[conn_idx]['probability'] = new_prob |
I think I got this part. Will add this to the GUI soon |
Okay this allows us to directly modify an existing network. We can incorporate this to the GUI later. For now we can stick to the current solution. |
You mean something like this? Below lists all possible connections and it will be a really long list... and for each of them we need to include both the strength and probability input widgets. cell_types = [ct for ct in gui.variables['net'].cell_types.keys()]
receptors = ('ampa', 'nmda', 'gabaa', 'gabab')
locations = ('proximal', 'distal', 'soma')
for src_gids in cell_types:
for target_gids in cell_types:
for receptor in receptors:
for location in locations:
conn_indices = pick_connection(net=gui.variables['net'],
src_gids=src_gids,
target_gids=target_gids,
loc=location, receptor=receptor)
if len(conn_indices)>0:
conn_idx = conn_indices[0]
current_w = gui.variables['net'].connectivity[conn_idx]['nc_dict']['A_weight']
current_p = gui.variables['net'].connectivity[conn_idx]['probability']
print(f"{src_gids}_{target_gids}_{receptor}_{location}_w_{current_w}_p_{current_p}")
pass And the output is:
|
Perhaps I misunderstood, but isn't this what you meant by "specify all (possible) parameters in a file and we construct the UI from that."? I think my main point was to show that this information doesn't need to be hard-coded into a file, and can leverage the objects themself. As for implementation, likely the best way to go forward is to generate a nested dictionary that stores the valid connections for the valid_conns = {'target_cells' : {'L2_pyramidal': {'src_cells': 'L2_basket': {'L2Basket_L2Pyr_gabaa_soma': {'weight': 0.5, ...}}}}} This object would only need to be generated once at the start (using the loop from above), and then the panels of the GUI could be constructed based on it's elements. Feel free to take another approach if you see a better way! I remember you commenting that you wanted to have access to this sort of information so this is mainly just to show you how to access it. |
Check the latest commit in #500. Now all connections are generated from the initialized network object using |
Also, I just noticed that for certain combinations of source and targets, Since we're using net.connectivity[conn_idx]['nc_dict']['A_weight'] = new_weight
net.connectivity[conn_idx]['probability'] = new_prob it seems this leads to parameter overwriting. Attached output:
generates:
|
hmm this is definitely not the expected behavior. If you look at the I'll need to play around with the code to see what's going on. |
This seems also to give us repeating indices: conn_idxs = []
for connectivity_slider in gui.connectivity_sliders:
for vbox in connectivity_slider:
# specify connection
conn_indices = pick_connection(
net=gui.variables['net'],
src_gids=vbox._belongsto['src_gids'],
target_gids=vbox._belongsto['target_gids'],
loc=vbox._belongsto['location'],
receptor=vbox._belongsto['receptor'])
assert len(conn_indices) > 0
if len(conn_indices)==1:
conn_idx = conn_indices[0]
conn_idxs.append(conn_idx)
w = gui.variables['net'].connectivity[conn_idx][
'nc_dict']['A_weight']
print(f"src_gids={vbox._belongsto['src_gids']}, target_gids={vbox._belongsto['target_gids']},location={vbox._belongsto['location']},conn_idx={conn_idx}")
print(len(conn_idxs)-len(set(conn_idxs))) generates:
Are we supposed to use short names instead of long names? |
After running some tests something is indeed going wrong with Not sure if this issue has always existed, or if it was introduced by a more recent PR. Will work on it today and open an issue/PR soon. |
I might be misunderstanding the issue here, but it looks like the duplicate connection indices belong to different receptors (i.e., AMPA, NMDA, GABAA, and GABAB). |
you can use |
So the bug always existed. The problem was that I accidentally wrote a test for the one situation where an empty list is actually returned when the connection doesn't exist (has to do with the order in which parameters are checked in the function). This just didn't come up previously because typically we know what connection we want. I added several more tests that check different ways a connection searched should return an empty list. |
Closing this in favor of the more up-to-date to-do list, #671. |
Checklist for follow-up adjustments to the initial implementation of the IPywidgets GUI in #76. Feel free to modify this list as needed!
MAINT:
Network
instance (e.g., assuming thatNetwork
contains 4 cell types). Instead, pull from general attributes of theNetwork
object whenever possible so that the GUI can flexibly support various network models (see here for initial discussion).plot_tfr_morlet()
so that hitting plot does not render multiple color barsENH:
jones_2009_model
,law_2021_model
).ipywidgets.FloatText
to something much smaller (e.g., 0.001 uS maybe?).The text was updated successfully, but these errors were encountered: