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

amplitude based stimuli in apply_multiple_stimuli #182

Merged
merged 4 commits into from
May 8, 2024
Merged

Conversation

AurelienJaquier
Copy link
Contributor

can choose to use apply_multiple_stimuli with amplitude based stimuli by passing raw amplitudes to amplitudes and setting threshold_based to False.

@AurelienJaquier AurelienJaquier self-assigned this May 8, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2024

Codecov Report

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

Project coverage is 91.18%. Comparing base (fcf8ad0) to head (87e8986).
Report is 1 commits behind head on main.

Files Patch % Lines
bluecellulab/stimulus/factory.py 79.31% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
- Coverage   91.23%   91.18%   -0.06%     
==========================================
  Files          95       95              
  Lines        5626     5662      +36     
==========================================
+ Hits         5133     5163      +30     
- Misses        493      499       +6     

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

@AurelienJaquier
Copy link
Contributor Author

It looks like my additions to the tests increased the ci testing time. :')
Do you think my additional tests are worth the time @anilbey ?

@@ -32,16 +32,19 @@ def mock_run_stimulus():
def test_apply_multiple_step_stimuli(mock_run_stimulus):
"""Do not run the code in parallel, mock the return value via MockRecording."""
amplitudes = [80, 100, 120, 140]
thres_perc = [0.08, 0.1, 0.12, 0.14]
Copy link
Collaborator

Choose a reason for hiding this comment

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

For test time maybe instead of 4, just 1 or 2 values can be kept here

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the future more protocols and therefore more tests will be added, so the tests will take even longer. Maybe after running the protocols once, the other tests can just mock the expensive neuron simulation run part to retrieve precomputed (or even constant) voltage results to us. That way the newly added code still can be tested.

amplitude=amplitude,
)

raise TypeError("You have to give either threshold_current or amplitude")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like to catch these edge cases in the tests. It may look trivial but there are sometimes issues due to those.

Comment on lines +342 to +344
threshold_current: Optional[float] = None,
threshold_percentage: Optional[float] = 200.0,
amplitude: Optional[float] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if the user mistakenly provides all the 3 of threshold_current, threshold_percentage and amplitude?
Or what if both the amplitude and threshold_current are provided but the threshold_percentage missing?
Can those cases also be covered with logs/exceptions/warnings?

Copy link
Collaborator

@anilbey anilbey left a comment

Choose a reason for hiding this comment

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

Thanks looks good to me.

@AurelienJaquier
Copy link
Contributor Author

Great! This should solve Issue #180

@AurelienJaquier AurelienJaquier merged commit 2de98ed into main May 8, 2024
10 checks passed
@AurelienJaquier AurelienJaquier deleted the issue-180 branch May 8, 2024 14:57
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.

None yet

3 participants