mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-26 13:37:21 +08:00
Bug fix in timeStep (must return something, not an error.) Minor updates to Optimize and Inversion.
This commit is contained in:
@@ -15,10 +15,10 @@ class RichardsProblem(Problem):
|
||||
@property
|
||||
def timeStep(self):
|
||||
"""The time between steps."""
|
||||
return self._timeStep
|
||||
return getattr(self, '_timeStep', None)
|
||||
@timeStep.setter
|
||||
def timeStep(self, value):
|
||||
self._timeStep = float(value)
|
||||
self._timeStep = float(value) # Because integers suck.
|
||||
|
||||
@property
|
||||
def numIts(self):
|
||||
|
||||
@@ -93,6 +93,8 @@ class BaseInversion(object):
|
||||
self.m = m0
|
||||
self._iter = 0
|
||||
self._beta = None
|
||||
self.phi_d_last = np.nan
|
||||
self.phi_m_last = np.nan
|
||||
|
||||
def doEndIteration(self):
|
||||
"""
|
||||
|
||||
@@ -189,7 +189,9 @@ class Minimize(object):
|
||||
self.f, self.g, self.H = evalFunction(self.xc, return_g=True, return_H=True)
|
||||
if doPub: pub.sendMessage('Minimize.evalFunction', minimize=self, f=self.f, g=self.g, H=self.H)
|
||||
self.printIter()
|
||||
if self.stoppingCriteria(): break
|
||||
if self.stoppingCriteria():
|
||||
self.doEndIteration(self.xc)
|
||||
break
|
||||
p = self.findSearchDirection()
|
||||
if doPub: pub.sendMessage('Minimize.searchDirection', minimize=self, p=p)
|
||||
p = self.scaleSearchDirection(p)
|
||||
@@ -273,6 +275,11 @@ class Minimize(object):
|
||||
parent.printIter function and call that.
|
||||
|
||||
"""
|
||||
|
||||
for method in [posible for posible in dir(self) if '_printIter' in posible]:
|
||||
if self.debug: print 'printIter is calling self.'+method
|
||||
getattr(self,method)(inLS)
|
||||
|
||||
if doPub and not inLS: pub.sendMessage('Minimize.printIter', minimize=self)
|
||||
pad = ' '*10 if inLS else ''
|
||||
printLine(self, self.printers if not inLS else self.printersLS, pad=pad)
|
||||
|
||||
Reference in New Issue
Block a user