hnn-core icon indicating copy to clipboard operation
hnn-core copied to clipboard

Optimize rhythmic drives

Open carolinafernandezp opened this issue 1 year ago • 13 comments

The goals are:

  1. To be able to optimize parameters associated with rhythmic drives. The user sets the frequency bands and relative bandpower. In the example below, we wish to optimize power in the 9-11 Hz and 19-21 Hz bands in a ratio of 1 to 2 (i.e. twice as much power in the beta band as in the alpha band).
optim = Optimizer(net, tstop=tstop, constraints=constraints,
                  set_params=set_params, obj_fun='maximize_psd')
optim.fit(f_bands=[(9, 11), (19, 21)], relative_bandpower=(1, 2), scale_factor=scale_factor,
                  smooth_window_len=smooth_window_len)

Example output image image

Reversing the ratios

optim.fit(f_bands=[(9, 11), (19, 21)], relative_bandpower=(2, 1), scale_factor=scale_factor,
                  smooth_window_len=smooth_window_len)

image image

  1. To allow the user to define obj_fun as a callable.

carolinafernandezp avatar Sep 14 '23 21:09 carolinafernandezp

Codecov Report

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

Project coverage is 92.55%. Comparing base (54ddd40) to head (78ab67d). Report is 49 commits behind head on master.

:exclamation: Current head 78ab67d differs from pull request most recent head d046764. Consider uploading reports for the commit d046764 to get more accurate results

Files Patch % Lines
hnn_core/gui/_viz_manager.py 59.09% 9 Missing :warning:
hnn_core/optimization/objective_functions.py 83.33% 4 Missing :warning:
hnn_core/optimization/general_optimization.py 76.92% 3 Missing :warning:

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #673      +/-   ##
==========================================
- Coverage   92.66%   92.55%   -0.12%     
==========================================
  Files          27       27              
  Lines        4911     4945      +34     
==========================================
+ Hits         4551     4577      +26     
- Misses        360      368       +8     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 14 '23 21:09 codecov-commenter

can you share what the example outputs in the PR description?

jasmainak avatar Sep 21 '23 01:09 jasmainak

can you share what the example outputs in the PR description?

Updated! I'm not getting the expected ratios (1:2, α:β) so I'm looking into that now.

carolinafernandezp avatar Sep 29 '23 18:09 carolinafernandezp

whatever happened to this PR ? Was this close to merge? Is this something this year's GSoC student can work on?

jasmainak avatar Mar 13 '24 21:03 jasmainak

whatever happened to this PR ? Was this close to merge? Is this something this year's GSoC student can work on?

Hi, I'm going to work on getting this merged but I think it's definitely something this year's GSoC student can expand on.

carolinafernandezp avatar Mar 20 '24 17:03 carolinafernandezp

@carolinafernandezp you seem to have rebase conflicts ... might be easiest to create a new branch from latest master, cherry pick your commits on to that branch, rename that branch to optimize_rhythmic and force push.

jasmainak avatar Mar 28 '24 15:03 jasmainak

The build is failing because of the GUI example ... @gtdang @kmilo9999 how best to address this? maybe we could separate the GUI examples into a separate build using Github actions?

jasmainak avatar Apr 23 '24 18:04 jasmainak

We can just get rid of those GUI docs from the build. New docs for the GUI will just be markdown to reduce the complexity and fragility of the notebook builds.

gtdang avatar Apr 24 '24 14:04 gtdang

How do we guarantee that the examples will run as expected for the user? unit tests?

jasmainak avatar Apr 24 '24 14:04 jasmainak

How do we guarantee that the examples will run as expected for the user? unit tests?

Exactly this, after going through the numerous problems with rendering the GUI tutorials, having hand-made tutorials with less extensive testing seems like the better option than having absolutely no tutorials due to an updated package

ntolley avatar Apr 24 '24 14:04 ntolley

alright, go for it ... please remove it so we can move ahead with @carolinafernandezp 's PR

jasmainak avatar Apr 24 '24 14:04 jasmainak

@carolinafernandezp we've finally fixed the documentation issues, if you have the bandwidth in the next week or so would you want to do a quick zoom call to rebase this together and go ahead and merge it?

Also note for myself to close #176 once this is merged

ntolley avatar Jul 10 '24 19:07 ntolley

Sounds great @ntolley, how is Thursday the 18th? Any time would work for me

carolinafernandezp avatar Jul 15 '24 21:07 carolinafernandezp

Just tested this locally and everything is running great, thanks a bunch @carolinafernandezp this is a super useful contribution!!

ntolley avatar Jul 29 '24 18:07 ntolley

Thanks @ntolley and everyone that helped!👏🏻

carolinafernandezp avatar Jul 29 '24 20:07 carolinafernandezp