From 6c487482c462dbd500d4087bbb7902f5943da11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Jos=C3=A9=20Gomes?= <83699808+mj-gomes@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:26:48 +0100 Subject: [PATCH] Fix bugs in default mueller parameters definition --- litebird_sim/hwp_sys/hwp_sys.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/litebird_sim/hwp_sys/hwp_sys.py b/litebird_sim/hwp_sys/hwp_sys.py index 0b6034e3..cd00e260 100644 --- a/litebird_sim/hwp_sys/hwp_sys.py +++ b/litebird_sim/hwp_sys/hwp_sys.py @@ -959,24 +959,25 @@ def set_parameters( } for attr, default_value in default_attrs.items(): - if not hasattr(self, attr): + if not paramdict.get(attr): setattr(self, attr, default_value) self.beta = np.deg2rad(self.beta) + else: # mueller_or_jones == "mueller": default_attrs = { - "mII": 0.0, + "mII": 1.0, "mQI": 0.0, "mUI": 0.0, "mIQ": 0.0, "mIU": 0.0, - "mQQ": 0.0, - "mUU": 0.0, + "mQQ": 1.0, + "mUU": -1.0, "mUQ": 0.0, "mQU": 0.0, } for attr, default_value in default_attrs.items(): - if not hasattr(self, attr): + if not paramdict.get(attr): setattr(self, attr, default_value) if np.any(maps) is None: @@ -1067,26 +1068,27 @@ def set_parameters( "z2s": 0.0, } - for attr, default_value in default_attrs.items(): - if not hasattr(self, attr): - setattr(self, attr, default_value) + for attr, default_value in default_attrs.items(): + if not paramdict.get(attr): + setattr(self, attr, default_value) self.betas = np.deg2rad(self.betas) + else: # mueller_or_jones == "mueller": default_attrs = { - "mIIs": 0.0, + "mIIs": 1.0, "mQIs": 0.0, "mUIs": 0.0, "mIQs": 0.0, "mIUs": 0.0, - "mQQs": 0.0, - "mUUs": 0.0, + "mQQs": 1.0, + "mUUs": -1.0, "mUQs": 0.0, "mQUs": 0.0, } - for attr, default_value in default_attrs.items(): - if not hasattr(self, attr): - setattr(self, attr, default_value) + for attr, default_value in default_attrs.items(): + if not paramdict.get(attr): + setattr(self, attr, default_value) # conversion from Jones to Mueller if mueller_or_jones == "jones":