From ab4a22e923bdf2aadcdc1600a7d93bdeefdae7d5 Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Fri, 15 Nov 2024 16:39:55 -0600 Subject: [PATCH 1/3] return name of added param, helpful when adding maskParameter --- src/pint/models/timing_model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pint/models/timing_model.py b/src/pint/models/timing_model.py index a0b27b090..68fe886bf 100644 --- a/src/pint/models/timing_model.py +++ b/src/pint/models/timing_model.py @@ -3425,6 +3425,7 @@ def add_param(self, param, deriv_func=None, setup=False): if deriv_func is not None: self.register_deriv_funcs(deriv_func, param.name) param._parent = self + return param.name def remove_param(self, param): """Remove a parameter from the Component. From 7c2bf806bff01136fb7e7df298539932b1ad0325 Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Fri, 15 Nov 2024 16:40:16 -0600 Subject: [PATCH 2/3] fix logic when selection mask is array([0]) --- src/pint/models/noise_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pint/models/noise_model.py b/src/pint/models/noise_model.py index b1af8e10f..299787fe5 100644 --- a/src/pint/models/noise_model.py +++ b/src/pint/models/noise_model.py @@ -164,14 +164,14 @@ def scale_toa_sigma(self, toas, warn=True): if equad.quantity is None: continue mask = equad.select_toa_mask(toas) - if np.any(mask): + if len(mask) > 0: sigma_scaled[mask] = np.hypot(sigma_scaled[mask], equad.quantity) elif warn: warnings.warn(f"EQUAD {equad} has no TOAs") for efac_name in self.EFACs: efac = getattr(self, efac_name) mask = efac.select_toa_mask(toas) - if np.any(mask): + if len(mask) > 0: sigma_scaled[mask] *= efac.quantity elif warn: warnings.warn(f"EFAC {efac} has no TOAs") From a17f4aabce38b60502d1c0f350980d884cfa9d9c Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Mon, 18 Nov 2024 12:36:53 -0600 Subject: [PATCH 3/3] changelog --- CHANGELOG-unreleased.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG-unreleased.md b/CHANGELOG-unreleased.md index d15e5e781..8e7b884e3 100644 --- a/CHANGELOG-unreleased.md +++ b/CHANGELOG-unreleased.md @@ -11,6 +11,8 @@ the released changes. ### Changed ### Added - When TCB->TDB conversion info is missing, will print parameter name +- `add_param` returns the name of the parameter (useful for numbered parameters) ### Fixed - When EQUAD is created from TNEQ, has proper TCB->TDB conversion info +- TOA selection masks will work when only TOA is the first one ### Removed