Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@santisoler
Copy link
Member

Summary

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. Update docstring of the constructor to reflect latest changes. Fix the expected shape of the location_a and location_b arguments.

PR Checklist

  • If this is a work in progress PR, set as a Draft PR
  • Linted my code according to the style guides.
  • Added tests to verify changes to the code.
  • Added necessary documentation to any new functions/classes following the
    expect style.
  • Marked as ready for review (if this is was a draft PR), and converted
    to a Pull Request
  • Tagged @simpeg/simpeg-developers when ready for review.

Reference issue

Works towards solving #1391

What does this implement/fix?

Additional information

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.
@santisoler santisoler requested a review from dccowan March 26, 2024 23:47
@codecov
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.36%. Comparing base (712cfda) to head (721deab).

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.
📢 Have feedback on the report? Share it here.

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),
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member Author

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.

santisoler and others added 2 commits April 26, 2024 15:13
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
santisoler and others added 3 commits April 26, 2024 15:45
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>
Copy link
Member

@lheagy lheagy left a 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 🚀

Comment on lines 145 to 148
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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Member Author

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,
Copy link
Member

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`.
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.

4 participants