diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 1da2c0294352d4401542badbd28e601a6df865da..1fb570080b34e7672198566896e1c20b0b8caa34 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -160,7 +160,7 @@ class Controller(object): algorithm.get_input_channels() output_channels = options.outchannels or \ algorithm.get_output_channels() - starttime = algorithm.get_starttime() or options.starttime + starttime = algorithm.get_next_starttime() or options.starttime endtime = options.endtime # input timeseries = input_timeseries or self._get_input_timeseries( @@ -215,7 +215,7 @@ class Controller(object): if update_count >= options.update_limit: return algorithm = self._algorithm - if algorithm.get_starttime() is not None: + if algorithm.get_next_starttime() is not None: raise AlgorithmException( 'Stateful algorithms cannot use run_as_update') input_channels = options.inchannels or \ diff --git a/geomagio/algorithm/Algorithm.py b/geomagio/algorithm/Algorithm.py index b482cb420aa6d76dd26f5cdb3bae5ddf97c1ea24..038f5f3fd8edad6ed87684e50aa8696b3dfeb116 100644 --- a/geomagio/algorithm/Algorithm.py +++ b/geomagio/algorithm/Algorithm.py @@ -111,11 +111,12 @@ class Algorithm(object): return False return True - def get_starttime(self): + def get_next_starttime(self): """Check whether algorithm has a stateful start time. - When an algorithm reports a start time, the Controller attempts to - only process data moving forward. + When an algorithm reports a next_starttime, the Controller attempts to + only process data moving forward. This is typically the time of the + last processed sample, plus the delta between samples. Returns ------- diff --git a/geomagio/algorithm/SqDistAlgorithm.py b/geomagio/algorithm/SqDistAlgorithm.py index 3908a3ca28555444995f0f4cbf727478428ef6f3..8f3a16a5ab082fc49cd0ef5c03e43d5cb00511bc 100644 --- a/geomagio/algorithm/SqDistAlgorithm.py +++ b/geomagio/algorithm/SqDistAlgorithm.py @@ -86,7 +86,7 @@ class SqDistAlgorithm(Algorithm): 'reinitializing.', file=sys.stderr) return (start - 3 * 30 * 24 * 60 * 60, end) - def get_starttime(self): + def get_next_starttime(self): """Return the next_starttime from the state, if it is set. """ return self.next_starttime