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

[MRG] GUI new json loading #837

Merged
merged 25 commits into from
Jul 31, 2024

Conversation

gtdang
Copy link
Collaborator

@gtdang gtdang commented Jul 29, 2024

Changed the configuration/parameter file format support of the GUI.

  • The loading of connectivity and drives use the new multi-level json structure that mirrors the structure of the Network object.
  • BREAKING: Flat parameter and json configuration files are no longer supported by the GUI

split from #808

@gtdang gtdang marked this pull request as ready for review July 30, 2024 14:39
@gtdang gtdang changed the title GUI new json loading [MRG] GUI new json loading Jul 30, 2024
@gtdang gtdang force-pushed the gui-new-json-loading branch from 5a9a16c to bc8164b Compare July 30, 2024 14:55
hnn_core/gui/gui.py Outdated Show resolved Hide resolved
@gtdang gtdang linked an issue Jul 31, 2024 that may be closed by this pull request
2 tasks
@@ -1493,10 +1498,8 @@ def get_cell_param_default_value(cell_type_key, param_dict):

def add_drive_tab(params, log_out, drives_out, drive_widgets, drive_boxes,
tstop, layout):
net = jones_2009_model(params)

drive_specs = _extract_drive_specs_from_hnn_params(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can likely deprecate (or just remove since it's private) this function in the future

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Just need to check if it's only use is in the GUI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there should be a test to make sure this is synchronized with the file in hnn_data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. I'll make it an issue.

gui._simulate_upload_connectivity(file2_url)
# now connectivity is refreshed.
assert gui.connectivity_widgets[0][0].children[1].value == 0.01
assert gui.drive_widgets[-1]['tstop'].value == 250.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be a good one to keep for the poisson drive in file2 to make sure it's loaded properly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The weight check is currently preserved on line 116. However the stop time check is not because tstop isn't currently saved with the Network configurations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that this was referring to the stop time of the drive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you're right! hmm... I can add it back in. I'm curious if the drive widget will set it to the tstop widget if the config tstop is greater than the the widget...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the test but set it to 170 instead of 250. The logic sets the drive tstop to the GUI's widget tstop value if the drive tstop value is larger. We currently don't save a universal tstop value to Network object, so the GUI doesn't set its tstop widget from Network configuration files.

This may change in the future if we want to save a stop value with a Network.

Copy link
Contributor

@ntolley ntolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with the changes on my end! Just a few test suggestions otherwise good to go

@ntolley ntolley enabled auto-merge (rebase) July 31, 2024 18:20
auto-merge was automatically disabled July 31, 2024 18:37

Rebase failed

gtdang added 16 commits July 31, 2024 15:26
…param structure with dict_to_network function
Separated connectivity upload tests from test_gui_upload_params to be able to develop and test the load connectivity behavior in isolation.
…etwork using the gui param attribute.

Replaced jones_2009_model function with dict_to_network because it supports the new param/config format.
…widget

The new config files may not have a tstop value encoded for certain drives. This would cause an error if a None type is passed into the default_data through the update method. The update_nested_dict function does not pass None types by default.
@gtdang gtdang force-pushed the gui-new-json-loading branch from 3cd58d5 to ded6d01 Compare July 31, 2024 19:27
@ntolley ntolley merged commit 9adce11 into jonescompneurolab:master Jul 31, 2024
12 checks passed
@ntolley ntolley mentioned this pull request Aug 1, 2024
4 tasks
@gtdang gtdang deleted the gui-new-json-loading branch August 29, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GUI: update to use new json format
2 participants