From fbf1283e10266220da88787aaaacfe43c1e2f338 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Tue, 16 May 2023 12:01:05 -0600 Subject: [PATCH] move GPS Clock Power to the middle of GPS Lk/Unlk, show sample number of the 2 channel separately --- sohstationviewer/model/reftek/log_info.py | 2 +- .../view/plotting/plotting_widget/plotting.py | 11 +++++++++-- .../view/plotting/plotting_widget/plotting_axes.py | 9 +++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sohstationviewer/model/reftek/log_info.py b/sohstationviewer/model/reftek/log_info.py index c242f822a..ac0bf9430 100644 --- a/sohstationviewer/model/reftek/log_info.py +++ b/sohstationviewer/model/reftek/log_info.py @@ -457,7 +457,7 @@ class LogInfo(): elif "EXTERNAL CLOCK IS UNLOCKED" in line: epoch = self.simple_read(line)[1] if epoch: - self.add_chan_info('GPS Lk/Unlk', epoch, 0, idx) + self.add_chan_info('GPS Lk/Unlk', epoch, -1, idx) elif "EXTERNAL CLOCK IS LOCKED" in line: epoch = self.simple_read(line)[1] if epoch: diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting.py b/sohstationviewer/view/plotting/plotting_widget/plotting.py index ec2ab8e8a..bbeb09f68 100644 --- a/sohstationviewer/view/plotting/plotting_widget/plotting.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting.py @@ -1,4 +1,6 @@ # class with all plotting functions +import numpy as np + from sohstationviewer.controller.util import get_val from sohstationviewer.controller.plotting_data import get_masspos_value_colors @@ -250,9 +252,14 @@ class Plotting: self.parent.plotting_bot, plot_h) x_list, y_list = c_data['times'], c_data['data'] - total_x = sum([len(x) for x in x_list]) + if chan_id == 'GPS Lk/Unlk': + sample_no_list = [] + sample_no_list.append(np.where(y_list[0] == -1)[0].size) + sample_no_list.append(np.where(y_list[0] == 1)[0].size) + else: + sample_no_list = [sum([len(x) for x in x_list])] self.plotting_axes.set_axes_info( - ax, [total_x], chan_db_info=chan_db_info, + ax, sample_no_list, chan_db_info=chan_db_info, info=info, y_list=y_list, linked_ax=linked_ax) colors = {} if chan_db_info['valueColors'] not in [None, 'None', '']: diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py index 940110dc3..06a3c0ab2 100644 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py @@ -236,7 +236,7 @@ class PlottingAxes: # bottom ax.text( - 1.005, 0.25, + 1.005, 0.05, sample_no_list[0], horizontalalignment='left', verticalalignment='center', @@ -247,7 +247,7 @@ class PlottingAxes: ) # top ax.text( - 1.005, 0.75, + 1.005, 0.95, sample_no_list[1], horizontalalignment='left', verticalalignment='center', @@ -257,6 +257,11 @@ class PlottingAxes: size=self.parent.font_size ) + if linked_ax is not None: + ax.set_yticks([]) + + return + if y_list is None: # draw center line ax.plot([self.parent.min_x, self.parent.max_x], -- GitLab