Skip to content
Snippets Groups Projects
Commit a9b558d2 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Minor fixes for local smoothing

- updated init and process_one functions to handle "smooth" parameter
- included a *very* minor fix to updates in Sigma in additive function
parent b6fb6400
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,8 @@ class SqDistAlgorithm(Algorithm): ...@@ -26,7 +26,8 @@ class SqDistAlgorithm(Algorithm):
def __init__(self, alpha=None, beta=None, gamma=None, phi=1, m=1, def __init__(self, alpha=None, beta=None, gamma=None, phi=1, m=1,
yhat0=None, s0=None, l0=None, b0=None, sigma0=None, yhat0=None, s0=None, l0=None, b0=None, sigma0=None,
zthresh=6, fc=0, hstep=0, statefile=None, mag=False): zthresh=6, fc=0, hstep=0, statefile=None, mag=False,
smooth=1):
Algorithm.__init__(self, inchannels=None, outchannels=None) Algorithm.__init__(self, inchannels=None, outchannels=None)
self.alpha = alpha self.alpha = alpha
self.beta = beta self.beta = beta
...@@ -38,6 +39,7 @@ class SqDistAlgorithm(Algorithm): ...@@ -38,6 +39,7 @@ class SqDistAlgorithm(Algorithm):
self.hstep = hstep self.hstep = hstep
self.statefile = statefile self.statefile = statefile
self.mag = mag self.mag = mag
self.smooth = smooth
# state variables # state variables
self.yhat0 = yhat0 self.yhat0 = yhat0
self.s0 = s0 self.s0 = s0
...@@ -208,7 +210,8 @@ class SqDistAlgorithm(Algorithm): ...@@ -208,7 +210,8 @@ class SqDistAlgorithm(Algorithm):
sigma0=self.sigma0, sigma0=self.sigma0,
zthresh=self.zthresh, zthresh=self.zthresh,
fc=self.fc, fc=self.fc,
hstep=self.hstep) hstep=self.hstep,
smooth=self.smooth)
# update state # update state
self.yhat0 = yhat0 self.yhat0 = yhat0
self.s0 = s0 self.s0 = s0
...@@ -451,6 +454,7 @@ class SqDistAlgorithm(Algorithm): ...@@ -451,6 +454,7 @@ class SqDistAlgorithm(Algorithm):
# still update sigma using et when et > zthresh * sigma # still update sigma using et when et > zthresh * sigma
# (and is not NaN) # (and is not NaN)
sigma[i + 1] = alpha * np.abs(et) + (1 - alpha) * sigma[i] sigma[i + 1] = alpha * np.abs(et) + (1 - alpha) * sigma[i]
jstep = hstep
else: else:
# smooth (i.e., update l, b, and s by filtering et) # smooth (i.e., update l, b, and s by filtering et)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment