From 8a8e5160563505407a046e6b4e7b2cbe478cd054 Mon Sep 17 00:00:00 2001 From: "Boisselet Alexandre (IFAT DC ATV SC D TE2)" Date: Fri, 5 Apr 2024 11:02:07 +0200 Subject: [PATCH] fix polarization bug for rotated objects --- magpylib_material_response/demag.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/magpylib_material_response/demag.py b/magpylib_material_response/demag.py index 8c9999b..ffb4f84 100644 --- a/magpylib_material_response/demag.py +++ b/magpylib_material_response/demag.py @@ -331,7 +331,10 @@ def apply_demag( with timelog(demag_msg, min_log_time=min_log_time): # set up mr pol_magnets = [ - src.orientation.apply(src.polarization) for src in magnets_list + src.orientation.apply( + (0.0, 0.0, 0.0) if src.polarization is None else (src.polarization) + ) + for src in magnets_list ] # ROTATION CHECK pol_magnets = np.reshape( pol_magnets, (3 * n, 1), order="F"