From 7b116b0e9c098c9453c9649c6493b9d4de4aa680 Mon Sep 17 00:00:00 2001
From: kienle <kienle@passcal.nmt.edu>
Date: Wed, 27 Sep 2023 17:54:26 -0600
Subject: [PATCH] Documentation and type hint

---
 sohstationviewer/model/reftek_data/reftek.py | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/sohstationviewer/model/reftek_data/reftek.py b/sohstationviewer/model/reftek_data/reftek.py
index 27efed848..acd9103f3 100755
--- a/sohstationviewer/model/reftek_data/reftek.py
+++ b/sohstationviewer/model/reftek_data/reftek.py
@@ -66,6 +66,8 @@ class RT130(GeneralData):
     def processing_data(self):
         if self.creator_thread.isInterruptionRequested():
             raise ThreadStopped()
+        # We separate the reading of log files and real data sets because their
+        # formats are very different.
         if self.rt130_log_files:
             self.read_log_files()
         else:
@@ -125,6 +127,12 @@ class RT130(GeneralData):
                 self.log_data[file_key]['EHET'] = [(1, reader.eh_et_lines)]
                 self.log_data[file_key]['SOH'] = [(1, reader.soh_lines)]
             else:
+                # Just in case we are reading multiple files with the same key.
+
+                # We are going to assume that the log files are read in order.
+                # That makes dealing with multiple files a lot easier. We can
+                # always sort the processed SOH data if this assumption is
+                # wrong.
                 key_file_count = self.log_data[file_key]['EHET'][-1][0] + 1
                 self.log_data[file_key]['EHET'].append(
                     (key_file_count, reader.eh_et_lines)
@@ -132,9 +140,18 @@ class RT130(GeneralData):
                 self.log_data[file_key]['SOH'].append(
                     (key_file_count, reader.soh_lines)
                 )
-            self.convert_mass_pos_log_lines_to_data(file_key, reader.masspos_lines)
+            self.process_mass_pos_log_lines(file_key, reader.masspos_lines)
+
+    def process_mass_pos_log_lines(self, current_key: Tuple[str, str],
+                                   masspos_lines: List[str]):
+        """
+        Process mass-position log lines and store the result in
+        self.masspos_data.
 
-    def convert_mass_pos_log_lines_to_data(self, current_key, masspos_lines):
+        :param current_key: the current data set key
+        :param masspos_lines: the mass-position lines to process
+        """
+        # Mass-position channels is suffixed by a number from 1 to 6.
         for masspos_num in range(1, 7):
             masspos_string = f'MassPos{masspos_num}'
             current_lines = [line.split()
-- 
GitLab