def update(self): y = numpy.array(self.input.value) # first skim it y = skim_top_and_bottom(y, self.config.skim) # put the max in the history self.state.max.insert(0, max(abs(y))) # prune the history self.state.max = self.state.max[:self.config.hist] # get the history percent M = max(skim_top(numpy.array(self.state.max), self.config.skim_hist)) if self.state.M is None: self.state.M = M else: self.state.M += self.config.tau * (M - self.state.M) y = minimum(y, self.state.M) y = maximum(y, -self.state.M) y = y / self.state.M self.output.value_scaled = y
def skim(a, percent=5): return skim_top_and_bottom(a, percent)
def skim(a, percent=5): return skim_top_and_bottom(a, percent)