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] Set legacy mode to false by default #619
Conversation
Unfortunately #614 didn't solve all our problems since the GUI has it's own code to loop over drives and add them. I've added the same logic to skip over these drives. Not really sure what the best course of action is. @chenghuzi @jasmainak it seems like this will be necessary for loading old param files? Unless we enforce that you need to delete drive elements that contain invalid values. |
sounds like the logic of |
Could we have a more structured way of creating networks? |
What do you propose? At some point we need to cut out all the param file bloat (e.g., consolidate |
@@ -69,7 +69,6 @@ def test_gui_upload_params(): | |||
assert gui.drive_widgets[-1]['tstop'].value == 250. | |||
gui._simulate_upload_drives(file1_url) | |||
assert gui.connectivity_widgets[0][0].children[1].value == 0.01 | |||
assert gui.drive_widgets[-1]['tstop'].value == 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not apply anymore, the poisson drive (that is not used, hence tstop=0) is no longer added when legacy_mode=False
Ok I've moved all of the logic into |
@@ -353,6 +355,12 @@ def __init__(self, params, add_drives_from_params=False, legacy_mode=True): | |||
# XXX this can be removed once tests are made independent of HNN GUI | |||
# creates nc_dict-entries for ALL cell types | |||
self._legacy_mode = legacy_mode | |||
if self._legacy_mode: | |||
warnings.warn( | |||
'Legacy mode is used solely to maintain compatibility with' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasmainak what do you think of this? I'm ok with being annoying if you are 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay for me ! what happens during optimization though? Hope the warning is emitted only once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point - I'm assuming this will get printed anytime Network.copy()
is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we could place this warning in jones_2009_model()
since all the other template models call that function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning was they all have legacy mode as well as an option
Just remembered I need to double check how badly the beta example is impacted by this before this PR is set to merge (it's fairly sensitive to the random seed) |
hnn_core/tests/test_drives.py
Outdated
|
||
|
||
def test_external_drive_times(): | ||
"""Test the different external drives.""" | ||
|
||
params = Params() | ||
params_fname = op.join(hnn_core_root, 'param', 'gamma_L5weak_L2weak.json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test below assumes the existence of a poisson drive, which only gets added if legacy_mode=True
for default.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to get away with removing this read_params()
step along with _extract_drive_specs_from_hnn_params
by defining the poisson drive dynamics on L38 explicitly. I think this would be a cleaner unit test that circumvents the black magic contained in _extract_drive_specs_from_hnn_params
.
Just checked the beta example locally and it isn't impacted! I'll keep an eye on lingering CI's but I can see the legacy mode cord being cut very soon 😄 |
Also, looks like something is now off with the seed values that causes |
This is huge @ntolley !! Don't forget to document in |
Co-authored-by: Ryan Thorpe <ryvthorpe@gmail.com>
Do you want help with this @ntolley in order to be ready for tomorrow? |
If you have the time to check out the seed problem that'd be great! I'm literally troubleshooting my MPI build right now |
I updated the PR description to close #526 ! |
if legacy_mode: | ||
drive['event_seed'] -= 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was one of the culprits causing test_parallel_backend.py
to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!!
legacy_mode = False | ||
# Legacy mode necessary for exact dipole comparison test | ||
net = jones_2009_model(params, add_drives_from_params=True, | ||
legacy_mode=legacy_mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other culprit was here. When test_parallel_backend.test_mpi_failure()
was called, it didn't expect to encounter the new legacy mode deprecation warning. The easiest way around this was to just set legacy_mode=False
when running the reduced model simulation.
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #619 +/- ##
==========================================
- Coverage 92.19% 92.04% -0.15%
==========================================
Files 22 22
Lines 4229 4238 +9
==========================================
+ Hits 3899 3901 +2
- Misses 330 337 +7
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
closes #526
Changes all network models to use
legacy_mode=False
by default. Some minor changes in tests/examples were necessary but overall a pretty small change.