Skip to content

Commit a876015

Browse files
authored
fix polarization bug for rotated objects (#7)
Co-authored-by: Boisselet Alexandre (IFAT DC ATV SC D TE2) <Alexandre.Boisselet@infineon.com>
1 parent 34fcefd commit a876015

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

magpylib_material_response/demag.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ def apply_demag(
331331
with timelog(demag_msg, min_log_time=min_log_time):
332332
# set up mr
333333
pol_magnets = [
334-
src.orientation.apply(src.polarization) for src in magnets_list
334+
src.orientation.apply(
335+
(0.0, 0.0, 0.0) if src.polarization is None else (src.polarization)
336+
)
337+
for src in magnets_list
335338
] # ROTATION CHECK
336339
pol_magnets = np.reshape(
337340
pol_magnets, (3 * n, 1), order="F"

0 commit comments

Comments
 (0)