From 4427851c78866c91e03144e63cb0d7e7d391bab2 Mon Sep 17 00:00:00 2001
From: Jeremy Fee <jmfee@usgs.gov>
Date: Fri, 2 Nov 2018 09:47:43 -0600
Subject: [PATCH] Rename Algorithm.get_starttime() to
 Algorithm.get_next_starttime()

---
 geomagio/Controller.py                | 4 ++--
 geomagio/algorithm/Algorithm.py       | 7 ++++---
 geomagio/algorithm/SqDistAlgorithm.py | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 1da2c0294..1fb570080 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 b482cb420..038f5f3fd 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 3908a3ca2..8f3a16a5a 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
-- 
GitLab