Skip to content

CylinderSegment barycenter #484

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

Merged
merged 2 commits into from
Mar 3, 2022
Merged

CylinderSegment barycenter #484

merged 2 commits into from
Mar 3, 2022

Conversation

Alexboiboi
Copy link
Member

Adresses #480

The CylinderSegment magnetization should maybe use this PR for the arrow start position (see #482)

Question: Should we cache the call for barycenter to avoid recalculation every time it is called (e.g. using @lru_cache)

import magpylib as magpy
import numpy as np

cs = magpy.magnet.CylinderSegment(
    magnetization=(100, 0, 0), dimension=(1, 2, 1, 85, 170), style_opacity=0.5
)

cs.rotate_from_angax([76 * i for i in range(0, 5)], "x", anchor=(0, 0, 5), start=0)

cs.show(
    markers=cs._barycenter.tolist(),
    style_marker_size=5,
    style_path_frames=1,
    backend="plotly",
)

image

@Alexboiboi Alexboiboi requested a review from OrtnerMichael March 3, 2022 09:46
@Alexboiboi Alexboiboi changed the title Centroid cyl seg CylinderSegment barycenter Mar 3, 2022
Copy link
Member

@OrtnerMichael OrtnerMichael left a comment

Choose a reason for hiding this comment

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

Looks good,

There is a minor docstring error which makes me realize that I did not review the property docstrings. I will fix this in a subsequent update.

"Output shape is matches position and orientation."

@OrtnerMichael OrtnerMichael merged commit 96a2c38 into main Mar 3, 2022
@Alexboiboi Alexboiboi added this to the 4.0 milestone Mar 3, 2022
@Alexboiboi Alexboiboi self-assigned this Mar 3, 2022
@Alexboiboi Alexboiboi deleted the centroid-cyl-seg branch March 5, 2022 20:35
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

2 participants