From fa038411b0a1b9b636c3568a0eb9097fb7416679 Mon Sep 17 00:00:00 2001
From: pcain-usgs <pcain@usgs.gov>
Date: Tue, 26 May 2020 13:55:48 -0600
Subject: [PATCH] remove inchannels and outchannels from __init__, replace with
 algorithm methods

---
 geomagio/algorithm/AdjustedAlgorithm.py | 21 +++------------------
 geomagio/algorithm/Algorithm.py         |  6 ++++--
 2 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/geomagio/algorithm/AdjustedAlgorithm.py b/geomagio/algorithm/AdjustedAlgorithm.py
index 35b59daab..a6d054c8b 100644
--- a/geomagio/algorithm/AdjustedAlgorithm.py
+++ b/geomagio/algorithm/AdjustedAlgorithm.py
@@ -35,8 +35,6 @@ class AdjustedAlgorithm(Algorithm):
         self.statefile = statefile
         self.data_type = data_type
         self.location = location
-        self.inchannels = inchannels
-        self.outchannels = outchannels
 
         if matrix is None:
             self.load_state()
@@ -133,8 +131,8 @@ class AdjustedAlgorithm(Algorithm):
         """
 
         out = None
-        inchannels = self.inchannels
-        outchannels = self.outchannels
+        inchannels = self.get_input_channels()
+        outchannels = self.get_output_channels()
         # Gather input traces in order of user input(inchannels)
         raws = [
             stream.select(channel=channel) for channel in inchannels if channel != "F"
@@ -170,7 +168,7 @@ class AdjustedAlgorithm(Algorithm):
             The input stream we want to make certain has data for the algorithm
         """
 
-        channels = self.inchannels
+        channels = self.get_input_channels()
 
         # if F is available, can produce at least adjusted F
         if "F" in channels and super(AdjustedAlgorithm, self).can_produce_data(
@@ -233,16 +231,3 @@ class AdjustedAlgorithm(Algorithm):
         Algorithm.configure(self, arguments)
         self.statefile = arguments.adjusted_statefile
         self.load_state()
-
-        self._inchannels = self.inchannels = arguments.inchannels or [
-            "H",
-            "E",
-            "Z",
-            "F",
-        ]
-        self._outchannels = self.outchannels = arguments.outchannels or [
-            "X",
-            "Y",
-            "Z",
-            "F",
-        ]
diff --git a/geomagio/algorithm/Algorithm.py b/geomagio/algorithm/Algorithm.py
index d59aa4a7c..9e8fea301 100644
--- a/geomagio/algorithm/Algorithm.py
+++ b/geomagio/algorithm/Algorithm.py
@@ -139,8 +139,10 @@ class Algorithm(object):
         arguments: Namespace
             parsed command line arguments
         """
-        self._inchannels = arguments.inchannels
-        self._outchannels = arguments.outchannels or arguments.inchannels
+        self._inchannels = arguments.inchannels or self._inchannels
+        self._outchannels = (
+            arguments.outchannels or self._outchannels or self._inchannels
+        )
 
     @classmethod
     def create_trace(cls, channel, stats, data):
-- 
GitLab