-
Notifications
You must be signed in to change notification settings - Fork 280
Improve interface for DC Dipole source #1393
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
Conversation
Remove `**kwargs` from the constructor of the class, add `current` as one of the arguments. Improve the logic and error messages for the `location`, `location_a` and `location_b` arguments. Add tests for these new checks.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1393 +/- ##
==========================================
- Coverage 82.57% 82.36% -0.21%
==========================================
Files 168 168
Lines 25728 25727 -1
==========================================
- Hits 21244 21190 -54
- Misses 4484 4537 +53 ☔ View full report in Codecov by Sentry. |
Add test function that checks if error is being raised after passing a location tuple with the wrong number of elements.
| location_b=None, | ||
| location=None, | ||
| **kwargs, | ||
| current=(1.0, -1.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.
I wouldn't support having different currents for each electrode on this class.
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 makes total sense! And the sign of the current for each electrode should be always (+, -), right?
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.
If that's so, then I think we should only take a single float as the current argument for this method.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The current for each electrode will have the same absolute value, but different sign: positive for the first electrode, negative for the second one.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
lheagy
left a comment
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 looks great Santi! Just one minor comment to address with docstrings, then it is good to go from my perspective 🚀
| location_b : (dim) numpy.array_like | ||
| B electrode locations; remember to set 'location_a' keyword argument to | ||
| define M electrode locations. location : list or tuple of length 2 of | ||
| numpy.array_like |
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.
| location_b : (dim) numpy.array_like | |
| B electrode locations; remember to set 'location_a' keyword argument to | |
| define M electrode locations. location : list or tuple of length 2 of | |
| numpy.array_like | |
| location_b : (dim) numpy.array_like | |
| B electrode locations; remember to set 'location_a' keyword argument to | |
| define A electrode locations. | |
| location : list or tuple of length 2 of | |
| numpy.array_like |
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.
Nice catch. I missed that mistake. Fixing it!
| location_a=None, | ||
| location_b=None, | ||
| location=None, | ||
| **kwargs, |
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.
🎉
Improve description of the `location` argument. Fix wrong name for the A and B electrodes. Make argument descriptions to follow numpydoc style.
Promote the use of `location_a` and `location_b` instead of `location`.
Summary
Remove
**kwargsfrom the constructor of the class, addcurrentas one of the arguments. Improve the logic and error messages for thelocation,location_aandlocation_barguments. Add tests for these new checks. Update docstring of the constructor to reflect latest changes. Fix the expected shape of thelocation_aandlocation_barguments.PR Checklist
expect style.
to a Pull Request
@simpeg/simpeg-developerswhen ready for review.Reference issue
Works towards solving #1391
What does this implement/fix?
Additional information