From 13c8c7fa1da1028f69a18b17f541572be442b1d1 Mon Sep 17 00:00:00 2001
From: ldam <ldam@passcal.nmt.edu>
Date: Mon, 4 Mar 2024 10:14:23 -0700
Subject: [PATCH] add key show to all data_dict to show or hide the channel
 when plotting

---
 sohstationviewer/model/general_data/data_structures.MD | 5 +++--
 sohstationviewer/model/mseed_data/mseed_reader.py      | 3 ++-
 sohstationviewer/model/reftek_data/log_info.py         | 1 +
 sohstationviewer/model/reftek_data/reftek_helper.py    | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sohstationviewer/model/general_data/data_structures.MD b/sohstationviewer/model/general_data/data_structures.MD
index 36a59d5fa..05e4a0b33 100644
--- a/sohstationviewer/model/general_data/data_structures.MD
+++ b/sohstationviewer/model/general_data/data_structures.MD
@@ -25,8 +25,9 @@ Note: log_data for RT130's dataset has only one channel: SOH
         'data' (np.array): data that has been trimmed and down-sampled for plotting
         'chan_db_info' (dict): the plotting parameters got from database
             for this channel - dict,
-        ax: axes to draw the channel in PlottingWidget
-        ax_wf (matplotlib.axes.Axes): axes to draw the channel in WaveformWidget
+        'ax': axes to draw the channel in PlottingWidget
+        'ax_wf' (matplotlib.axes.Axes): axes to draw the channel in WaveformWidget
+        'show': flag to show or hide channel
     }
 }
 
diff --git a/sohstationviewer/model/mseed_data/mseed_reader.py b/sohstationviewer/model/mseed_data/mseed_reader.py
index f5addd856..cc05017fa 100644
--- a/sohstationviewer/model/mseed_data/mseed_reader.py
+++ b/sohstationviewer/model/mseed_data/mseed_reader.py
@@ -220,7 +220,8 @@ class MSeedReader:
                     'endTmEpoch': meta.end_time,
                     'data': [data_point],
                     'times': [meta.start_time]
-                }]
+                }],
+                'show': True
             }
         else:
             channel = station[chan_id]
diff --git a/sohstationviewer/model/reftek_data/log_info.py b/sohstationviewer/model/reftek_data/log_info.py
index 8c2f46b46..01f646693 100644
--- a/sohstationviewer/model/reftek_data/log_info.py
+++ b/sohstationviewer/model/reftek_data/log_info.py
@@ -328,6 +328,7 @@ class LogInfo():
                 'reftek': True,
                 'samplerate': 1,
                 'chanID': chan_id,
+                'show': True,
                 'tracesInfo': [{
                     'unitID': self.unit_id,
                     'expNo': self.exp_no,
diff --git a/sohstationviewer/model/reftek_data/reftek_helper.py b/sohstationviewer/model/reftek_data/reftek_helper.py
index 69972c783..448398fa9 100644
--- a/sohstationviewer/model/reftek_data/reftek_helper.py
+++ b/sohstationviewer/model/reftek_data/reftek_helper.py
@@ -50,7 +50,8 @@ def check_reftek_header(
         samplerate = trace.stats['sampling_rate']
         if chan_id not in cur_data_dict:
             cur_data_dict[chan_id] = {'tracesInfo': [],
-                                      'samplerate': samplerate}
+                                      'samplerate': samplerate,
+                                      'show': True}
         if trace.stats.npts == 0:
             #  this trace isn't available to prevent bug when creating memmap
             #  with no data
-- 
GitLab