@@ -129,7 +129,7 @@ def endIter(self):
129129 model = self .invProb .model .copy ()
130130
131131 # Project bounds
132- if self .mode == "cartesian" and np . any ( ~ np . isinf ( self . opt . upper )) :
132+ if self .mode == "cartesian" :
133133 vec_model = []
134134 indices = []
135135 upper_bound = []
@@ -165,16 +165,19 @@ def endIter(self):
165165 vec_ref = []
166166 indices = []
167167 mappings = []
168+ upper_bound = []
168169 for reg in self .regularizations .objfcts :
169170 mappings .append (reg .mapping )
170171 vec_model .append (reg .mapping * model )
171172 vec_ref .append (reg .mapping * reg .reference_model )
173+ upper_bound .append (reg .mapping * self .opt .upper )
172174 mapping = reg .mapping .deriv (np .zeros (reg .mapping .shape [1 ]))
173175 indices .append (mapping .indices )
174176
175177 indices = np .hstack (indices )
176178 nC = mapping .shape [0 ]
177179 vec_model = cartesian2spherical (np .vstack (vec_model ).T )
180+ upper_bound = np .linalg .norm (np .vstack (upper_bound ), axis = 0 )
178181 vec_ref = cartesian2spherical (np .vstack (vec_ref ).T ).flatten ()
179182 model [indices ] = vec_model .flatten ()
180183
@@ -218,7 +221,9 @@ def endIter(self):
218221 self .opt .lower [indices ] = np .kron (
219222 np .asarray ([0 , - np .inf , - np .inf ]), np .ones (nC )
220223 )
221- self .opt .upper [indices [nC :]] = np .inf
224+ self .opt .upper [indices ] = np .r_ [
225+ upper_bound , np .ones_like (indices [nC :]) * np .inf
226+ ]
222227
223228 updates = {}
224229 for misfit in self .misfits :
0 commit comments