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

[ENH] Added tonic input to GUI drivers tab #773

Merged
merged 9 commits into from
Jun 6, 2024

Conversation

kmilo9999
Copy link
Collaborator

@kmilo9999 kmilo9999 commented May 20, 2024

Wok on new Feature to add tonic input from in the GUI
Solves #715

image
image

@kmilo9999 kmilo9999 changed the title [ENH] Added tonic input to GUI drivers tab [WIP] Added tonic input to GUI drivers tab May 20, 2024
@kmilo9999 kmilo9999 linked an issue May 21, 2024 that may be closed by this pull request
3 tasks
@kmilo9999 kmilo9999 requested review from gtdang and ntolley May 21, 2024 02:53
@kmilo9999 kmilo9999 changed the title [WIP] Added tonic input to GUI drivers tab [ENH] Added tonic input to GUI drivers tab May 21, 2024
@kmilo9999 kmilo9999 marked this pull request as ready for review May 21, 2024 02:56
@gtdang
Copy link
Collaborator

gtdang commented May 21, 2024

@ntolley @jasmainak @rythorpe Thoughts on if times should be above or below the amplitudes?
Also the Synchronous Inputs checkbox isn't needed for Tonics, correct?

@rythorpe
Copy link
Contributor

@ntolley @jasmainak @rythorpe Thoughts on if times should be above or below the amplitudes?

I vote above, but it's a mild preference.

@rythorpe
Copy link
Contributor

Correct, synchronous inputs don't make sense to tonic inputs.

gtdang
gtdang previously requested changes May 21, 2024
Copy link
Collaborator

@gtdang gtdang left a comment

Choose a reason for hiding this comment

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

Looking good Camilo! Per the discussion:

  • Remove Sync Inputs checkbox from tonics
  • Move times above amplitudes
  • Add test to check tonic widget is created with prespecified_drive_data
  • Add test to check an added tonic amplitude is added to the network when _init_network_from_widgets is called

amplitude=weights_amplitudes,
t0=drive["t0"].value,
tstop=drive["tstop"].value)
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be returning?

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 rest of the logic in that function doesnt apply to Tonic inputs. I want to avoid the elif branching

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We talked it over and I'll remove the return

@kmilo9999 kmilo9999 requested a review from gtdang May 21, 2024 19:36
@codecov-commenter
Copy link

codecov-commenter commented May 21, 2024

Codecov Report

Attention: Patch coverage is 78.84615% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 92.28%. Comparing base (819f4f4) to head (4bb3f23).
Report is 32 commits behind head on master.

Current head 4bb3f23 differs from pull request most recent head 301948d

Please upload reports for the commit 301948d to get more accurate results.

Files Patch % Lines
hnn_core/gui/gui.py 78.84% 11 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #773      +/-   ##
==========================================
- Coverage   92.33%   92.28%   -0.05%     
==========================================
  Files          27       27              
  Lines        5059     5096      +37     
==========================================
+ Hits         4671     4703      +32     
- Misses        388      393       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

hnn_core/gui/gui.py Outdated Show resolved Hide resolved
@kmilo9999 kmilo9999 requested a review from gtdang May 22, 2024 14:30
Copy link
Collaborator

@gtdang gtdang left a comment

Choose a reason for hiding this comment

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

I played around with this and replicated the Simulate Gamma API Tutorial tonic example. Below is the plot comparing the simulations with and without the added tonic.
Screenshot 2024-05-22 at 11 09 01 AM
I think everything is working as expected! Great job Camilo!

Some quality of life considerations.

  • When adding a tonic drive, the default Stop Time is set to 0. Should this sync with the simulation tstop parameter on creation?
  • The simulation tab stop time label is "tstop (ms)" while in the tonic it's "Stop Time". Should we be consistent here? And which do you prefer?
  • I think the cell types should be ordered alphabetically: [L2_basket, L2_pyramidal, L5_basket, L5_pyramidal]

@ntolley @jasmainak @rythorpe Thoughts?

@kmilo9999 kmilo9999 requested a review from gtdang May 22, 2024 17:50
@kmilo9999
Copy link
Collaborator Author

kmilo9999 commented May 23, 2024

This is the new order of the amplitudes
image

@@ -457,6 +458,10 @@ def _simulation_list_change(value):
is_disabled="", btn_height=self.layout['run_btn'].height,
color_theme=self.layout['theme_color']))

def _driver_type_change(value):
self.widget_location_selection.disabled = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Very useful! Glad to see this is implemented natively

'amplitude': 0,
't0': 0,
'tstop': 0,
'seedcore': 14,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'seedcore': 14,

is seedcore actually used anywhere? net.add_tonic_drives doesn't have any randomization so probably safe to delete

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed


start_times = BoundedFloatText(
value=deepcopy(default_data['t0']), description="Start time",
min=0, max=1e6, step=0.01, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
min=0, max=1e6, step=0.01, **kwargs)
min=0, max=1e6, step=1.0, **kwargs)

This is a pretty small step size considering what's being changed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

min=0, max=1e6, step=0.01, **kwargs)
stop_times = BoundedFloatText(
value=deepcopy(default_data['tstop']), description="Stop time",
min=-1, max=1e6, step=0.01, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
min=-1, max=1e6, step=0.01, **kwargs)
min=-1, max=1e6, step=1.0, **kwargs)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -1026,6 +1082,10 @@ def add_drive_widget(drive_type, drive_boxes, drive_widgets, drives_out,
sync_evinput=False):
"""Add a widget for a new drive."""

# Check only adds 1 tonic input widget
if drive_type == "Tonic" and not _is_valid_add_tonic_input(drive_widgets):
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this just mean the add drive button doesn't do anything once you add a tonic 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.

That is correct.
@gtdang

@gtdang
Copy link
Collaborator

gtdang commented May 23, 2024

I played around with this and replicated the Simulate Gamma API Tutorial tonic example. Below is the plot comparing the simulations with and without the added tonic. Screenshot 2024-05-22 at 11 09 01 AM I think everything is working as expected! Great job Camilo!

Some quality of life considerations.

  • When adding a tonic drive, the default Stop Time is set to 0. Should this sync with the simulation tstop parameter on creation?
  • The simulation tab stop time label is "tstop (ms)" while in the tonic it's "Stop Time". Should we be consistent here? And which do you prefer?
  • I think the cell types should be ordered alphabetically: [L2_basket, L2_pyramidal, L5_basket, L5_pyramidal]

@ntolley @jasmainak @rythorpe Thoughts?

This was discussed at our dev sync.
1.) We are not syncing tstop. Poisson drive does not.
2.) Will open an issue to standardize name and unit labels
3.) Cell types are ordered alphabetically now.

@kmilo9999
Copy link
Collaborator Author

@gtdang @ntolley The CodeSpell checks fails in a file I have not modified in this PR

@kmilo9999 kmilo9999 requested a review from ntolley May 23, 2024 21:08
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.

Great work @kmilo9999 !!

I'm a bit confused about the codespell, I wonder if the github action somehow got updated and is now checking new files...

Do you think you could modify the typos in any case? It's just the 3 lines and they'll need to be fixed at some point

@gtdang
Copy link
Collaborator

gtdang commented May 24, 2024

Great work @kmilo9999 !!

I'm a bit confused about the codespell, I wonder if the github action somehow got updated and is now checking new files...

Do you think you could modify the typos in any case? It's just the 3 lines and they'll need to be fixed at some point

Created a separate PR for those typos #777

@ntolley
Copy link
Contributor

ntolley commented May 25, 2024

@gtdang is this request satisfied?

  • Add test to check tonic widget is created with prespecified_drive_data

Did you mean for there to be a test with assert statements?

@kmilo9999
Copy link
Collaborator Author

@gtdang is this request satisfied?

  • Add test to check tonic widget is created with prespecified_drive_data

Did you mean for there to be a test with assert statements?

This prespecified_drive_data function reads the params from default.json, and I dont see a tonic bias input described on this file. Also, I think some logic needs to be implemented to be able to read and load tonic bias from a file.

@gtdang
Copy link
Collaborator

gtdang commented May 29, 2024

@gtdang is this request satisfied?

  • Add test to check tonic widget is created with prespecified_drive_data

Did you mean for there to be a test with assert statements?

This prespecified_drive_data function reads the params from default.json, and I dont see a tonic bias input described on this file. Also, I think some logic needs to be implemented to be able to read and load tonic bias from a file.

@ntolley is there an example of the flat a json or param file with tonics encoded?

@ntolley
Copy link
Contributor

ntolley commented May 29, 2024

These are the parameters in the .param file that need to be modified
image

Do you think we should save loading for a separate PR and go ahead with merging this one?

@kmilo9999
Copy link
Collaborator Author

kmilo9999 commented May 29, 2024

These are the parameters in the .param file that need to be modified image

Do you think we should save loading for a separate PR and go ahead with merging this one?

@ntolley why the L2Basket and L5Basket cell types dont have the suffix _soma?

@ntolley
Copy link
Contributor

ntolley commented May 30, 2024

@ntolley why the L2Basket and L5Basket cell types dont have the suffix _soma?

These cells are modeled as just one single Section, so the whole cell is represented by the soma.

@ntolley ntolley dismissed gtdang’s stale review June 6, 2024 18:34

moving to another PR based on discussion

@ntolley ntolley merged commit 86b971a into jonescompneurolab:master Jun 6, 2024
13 of 17 checks passed
@ntolley
Copy link
Contributor

ntolley commented Jun 6, 2024

Merging since every test is passing besides Ubuntu (which is in progress)

Thanks @kmilo9999!!!

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 tonic inputs
5 participants