diff --git a/SimPEG/ObjFunction.py b/SimPEG/ObjFunction.py index 18d9cfc3..cae85ba4 100644 --- a/SimPEG/ObjFunction.py +++ b/SimPEG/ObjFunction.py @@ -61,7 +61,7 @@ class BaseObjFunction(object): if self.debug: print 'Calling ObjFunction.startup' if self.reg.mref is None: - print 'Regularization has not set mref. SimPEG will set it to m0.' + print 'Regularization has not set mref. SimPEG.ObjFunction will set it to m0.' self.reg.mref = m0 self.phi_d = np.nan diff --git a/SimPEG/Parameters.py b/SimPEG/Parameters.py index 417051df..fa15ff67 100644 --- a/SimPEG/Parameters.py +++ b/SimPEG/Parameters.py @@ -56,7 +56,7 @@ class Parameter(object): if (self.current is None or not self.opt.iter == self.currentIter): self.current = self.nextIter() - self.currentIter = self.opt.iter + self.currentIter = getattr(self.opt, 'iter', 0) return self.current def nextIter(self): @@ -162,3 +162,16 @@ class BetaSchedule(BetaEstimate): self.beta /= self.coolingFactor return self.beta + + +class UpdateReferenceModel(Parameter): + + mref0 = None + + def nextIter(self): + mref = getattr(self, 'm_prev', None) + if mref is None: + if self.debug: print 'UpdateReferenceModel is using mref0' + mref = self.mref0 + self.m_prev = self.objFunc.m_current + return mref