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

Merge getBH_dict into getBH #449

Merged
merged 14 commits into from
Jan 26, 2022
Merged

Merge getBH_dict into getBH #449

merged 14 commits into from
Jan 26, 2022

Conversation

Alexboiboi
Copy link
Member

@Alexboiboi Alexboiboi commented Jan 10, 2022

This PR aims to merge the functionality of the getB_dict and getH_dict into getB and getH respectively, in order to make the top level interface less cluttered. This introduces some minor breaking changes by removing getB_dict and getH_dict functions from the library top level. These library can still be accessed privately, as they remain unchanged internally.
The original getB and getH function remain unchanged in their classical use.

Before

import magpylib as magpy
import numpy as np

B = magpy.getB_dict(
    source_type = 'Cuboid',
    observer = (1,2,3),
    magnetization = np.linspace((0.,0.,500.),(0.,0.,1000.),6),
    dimension = np.linspace((1.,1.,1.),(2.,2.,2.),6)
)
print(B)

After

import magpylib as magpy
import numpy as np

B = magpy.getB(
    'Cuboid',
    (1,2,3),
    magnetization = np.linspace((0.,0.,500.),(0.,0.,1000.),6),
    dimension = np.linspace((1.,1.,1.),(2.,2.,2.),6)
)
print(B)

Note

providing kwargs when the source is not a string will raise an error

import magpylib as magpy
import numpy as np

cuboid  = magpy.magnet.Cuboid((0,0,1), (1,1,1))

B = magpy.getB(
    cuboid,
    (1,2,3),
    magnetization = np.linspace((0.,0.,500.),(0.,0.,1000.),6),
    dimension = np.linspace((1.,1.,1.),(2.,2.,2.),6)
)
## raises MagpylibBadUserInput

TODO

  • modify getB and getH
  • update tests
  • update docstrings
  • update changelog
  • update documentation

@Alexboiboi Alexboiboi added breaking changes implementation introduces breaking changes refactoring labels Jan 10, 2022
@Alexboiboi Alexboiboi added this to the 4.0 milestone Jan 10, 2022
@Alexboiboi Alexboiboi self-assigned this Jan 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2022

Codecov Report

Merging #449 (acc80a2) into development (3da5b03) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development     #449   +/-   ##
============================================
  Coverage        99.75%   99.75%           
============================================
  Files               49       49           
  Lines             4883     4888    +5     
============================================
+ Hits              4871     4876    +5     
  Misses              12       12           
Impacted Files Coverage Δ
magpylib/__init__.py 100.00% <100.00%> (ø)
magpylib/_src/fields/field_wrap_BH_level2.py 100.00% <100.00%> (ø)
magpylib/_src/fields/field_wrap_BH_level3.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3da5b03...acc80a2. Read the comment docs.

@OrtnerMichael OrtnerMichael merged commit 28c554e into development Jan 26, 2022
@OrtnerMichael OrtnerMichael deleted the combine_getB branch January 26, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes implementation introduces breaking changes refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants