Skip to content

Trouble Flipping Magnetization of Object #570

Answered by OrtnerMichael
leahkong02 asked this question in Q&A
Discussion options

You must be logged in to vote

hi @leahkong02

Thanks for reaching out. There are two problems

  1. There is a Bug in our Matplotlib graphic output
  2. There is also a Bug in your code (the first rotation should be with respect to -90°)

Both together lead to confusion that is however easily solved !
Your correct code should be like this:

import magpylib as magpy

inner_r = 60
outer_r = 35
h = 10
mag = [0, 0, 1000]
nmag = [0, 0,-1000]
distance = 70
dim = (outer_r, inner_r, h, 0, 360)

a = magpy.magnet.CylinderSegment( mag, dim, [0, 0,  distance])
b = magpy.magnet.CylinderSegment(nmag, dim, [0, 0, -distance])
c = magpy.magnet.CylinderSegment( mag, dim, [0,  distance, 0])
d = magpy.magnet.CylinderSegment(nmag, dim, [0, -distance, 0

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@leahkong02
Comment options

@OrtnerMichael
Comment options

Answer selected by leahkong02
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@leahkong02
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants