From 1fb0c12664b86ea0e8805ebb75b8dcef45307e0b Mon Sep 17 00:00:00 2001 From: domfournier Date: Fri, 19 Sep 2025 15:22:12 -0700 Subject: [PATCH] Use length distance instead of sign() to compute degree radian (cherry picked from commit 6ea0f5c2453bd95b11b13cb74d505ee16b21c9ea) --- simpeg/regularization/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simpeg/regularization/base.py b/simpeg/regularization/base.py index a5c59aee3f..3aa3a9cb86 100644 --- a/simpeg/regularization/base.py +++ b/simpeg/regularization/base.py @@ -983,8 +983,12 @@ def f_m(self, m): dfm_dl = self.mapping * self._delta_m(m) if self.units is not None and self.units.lower() == "radian": + # Cannot use the self.cell_gradient.sign() with rotated gradients, as partial + # gradients are fractional distances return ( - utils.mat_utils.coterminal(self.cell_gradient.sign() @ dfm_dl) + utils.mat_utils.coterminal( + (self.cell_gradient @ dfm_dl) * self._cell_distances + ) / self._cell_distances ) return self.cell_gradient @ dfm_dl