[minor] visual tweaks

This commit is contained in:
Marcel Paffrath 2022-12-21 16:03:10 +01:00
parent c90b430fa8
commit bf000fe042
4 changed files with 31 additions and 20 deletions

View File

@ -62,7 +62,7 @@ THRESHOLDS:
CHANNELS: CHANNELS:
EX1: EX1:
unit: 1e-6 unit: 1e-6
name: "Temperature (°C)" name: "PowBox Temperature (°C)"
ticks: [-10, 50, 10] ticks: [-10, 50, 10]
transform: transform:
- ["*", 20] - ["*", 20]
@ -70,40 +70,40 @@ CHANNELS:
warn: "max_temp" warn: "max_temp"
EX2: EX2:
unit: 1e-6 unit: 1e-6
name: "230V/12V (V)" name: "PowBox 230V/12V (V)"
ticks: [1, 5, 1] ticks: [1, 5, 1]
warn: [2, 3, 4, 4.5, 5] warn: [2, 3, 4, 4.5, 5]
EX3: EX3:
unit: 1e-6 unit: 1e-6
name: "Rout/Charge (V)" name: "PowBox Router/Charger (V)"
ticks: [1, 5, 1] ticks: [1, 5, 1]
warn: [2, 2.5, 3, 4, 5] warn: [2, 2.5, 3, 4, 5]
VEI: VEI:
unit: 1e-3 unit: 1e-3
name: "Logger (V)" name: "Datalogger (V)"
ticks: [9, 15, 1] ticks: [9, 15, 1]
warn: ["low_volt", "high_volt"] warn: ["low_volt", "high_volt"]
fail: 10.5 fail: 10.5
VM1: VM1:
unit: 1e-6 unit: 1e-6
name: "Mass 1 (V)" name: "Mass position W (V)"
ticks: [-2.5, 2.5, 1] ticks: [-2.5, 2.5, 1]
warn: [-1.5, 1.5] warn: [-1.5, 1.5]
fail: [-2.5, 2.5] fail: [-2.5, 2.5]
VM2: VM2:
unit: 1e-6 unit: 1e-6
name: "Mass 2 (V)" name: "Mass position V (V)"
ticks: [-2.5, 2.5, 1] ticks: [-2.5, 2.5, 1]
warn: [-1.5, 1.5] warn: [-1.5, 1.5]
fail: [-2.5, 2.5] fail: [-2.5, 2.5]
VM3: VM3:
unit: 1e-6 unit: 1e-6
name: "Mass 3 (V)" name: "Mass position U (V)"
ticks: [-2.5, 2.5, 1] ticks: [-2.5, 2.5, 1]
warn: [-1.5, 1.5] warn: [-1.5, 1.5]
fail: [-2.5, 2.5] fail: [-2.5, 2.5]
LCQ: LCQ:
name: "Clock Q (%)" name: "Clock quality (%)"
ticks: [0, 100, 20] ticks: [0, 100, 20]
warn: "clockquality_warn" warn: "clockquality_warn"
fail: "clockquality_fail" fail: "clockquality_fail"

View File

@ -19,7 +19,7 @@ from obspy.clients.filesystem.sds import Client
from write_utils import write_html_text, write_html_row, write_html_footer, write_html_header, get_print_title_str, \ from write_utils import write_html_text, write_html_row, write_html_footer, write_html_header, get_print_title_str, \
init_html_table, finish_html_table init_html_table, finish_html_table
from utils import get_bg_color, modify_stream_for_plot, trace_yticks, trace_thresholds from utils import get_bg_color, modify_stream_for_plot, set_axis_yticks, set_axis_color, plot_axis_thresholds
try: try:
import smtplib import smtplib
@ -350,9 +350,10 @@ class SurveillanceBot(object):
try: try:
st = modify_stream_for_plot(st, parameters=self.parameters) st = modify_stream_for_plot(st, parameters=self.parameters)
st.plot(fig=fig, show=False, draw=False, block=False, equal_scale=False, method='full') st.plot(fig=fig, show=False, draw=False, block=False, equal_scale=False, method='full')
# trace_ylabels(fig, self.parameters, self.verbosity) # set_axis_ylabels(fig, self.parameters, self.verbosity)
trace_yticks(fig, self.parameters, self.verbosity) set_axis_yticks(fig, self.parameters, self.verbosity)
trace_thresholds(fig, self.parameters, self.verbosity) set_axis_color(fig)
plot_axis_thresholds(fig, self.parameters, self.verbosity)
except Exception as e: except Exception as e:
print(f'Could not generate plot for {nwst_id}:') print(f'Could not generate plot for {nwst_id}:')
print(traceback.format_exc()) print(traceback.format_exc())

View File

@ -34,7 +34,7 @@ from obspy import UTCDateTime
from survBot import SurveillanceBot from survBot import SurveillanceBot
from write_utils import * from write_utils import *
from utils import get_bg_color, modify_stream_for_plot, trace_yticks, trace_thresholds from utils import get_bg_color, modify_stream_for_plot, set_axis_yticks, set_axis_color, plot_axis_thresholds
try: try:
from rest_api.utils import get_station_iccid from rest_api.utils import get_station_iccid
@ -316,9 +316,10 @@ class MainWindow(QtWidgets.QMainWindow):
self.plot_widget.setWindowTitle(nwst_id) self.plot_widget.setWindowTitle(nwst_id)
st = modify_stream_for_plot(st, parameters=self.parameters) st = modify_stream_for_plot(st, parameters=self.parameters)
st.plot(equal_scale=False, method='full', block=False, fig=self.plot_widget.canvas.fig) st.plot(equal_scale=False, method='full', block=False, fig=self.plot_widget.canvas.fig)
# trace_ylabels(fig=self.plot_widget.canvas.fig, parameters=self.parameters) # set_axis_ylabels(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
trace_yticks(fig=self.plot_widget.canvas.fig, parameters=self.parameters) set_axis_yticks(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
trace_thresholds(fig=self.plot_widget.canvas.fig, parameters=self.parameters) set_axis_color(fig=self.plot_widget.canvas.fig)
plot_axis_thresholds(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
self.plot_widget.show() self.plot_widget.show()
def notification(self, text): def notification(self, text):

View File

@ -110,7 +110,7 @@ def modify_stream_for_plot(input_stream, parameters):
# modify trace id to maintain plotting order # modify trace id to maintain plotting order
name = channel_dict.get('name') name = channel_dict.get('name')
tr.id = f'trace {index + 1}: {name} - {tr.id}' tr.id = f'{index + 1}: {name} - {tr.id}'
st.append(tr) st.append(tr)
@ -139,7 +139,7 @@ def transform_trace(data, transf):
return data return data
def trace_ylabels(fig, parameters, verbosity=0): def set_axis_ylabels(fig, parameters, verbosity=0):
""" """
Adds channel names to y-axis if defined in parameters. Adds channel names to y-axis if defined in parameters.
""" """
@ -155,7 +155,16 @@ def trace_ylabels(fig, parameters, verbosity=0):
ax.set_ylabel(channel_name) ax.set_ylabel(channel_name)
def trace_yticks(fig, parameters, verbosity=0): def set_axis_color(fig, color='grey'):
"""
Set all axes of figure to specific color
"""
for ax in fig.axes:
for key in ['bottom', 'top', 'right', 'left']:
ax.spines[key].set_color(color)
def set_axis_yticks(fig, parameters, verbosity=0):
""" """
Adds channel names to y-axis if defined in parameters. Adds channel names to y-axis if defined in parameters.
""" """
@ -176,7 +185,7 @@ def trace_yticks(fig, parameters, verbosity=0):
ax.set_ylim(ymin - 0.33 * step, ymax + 0.33 * step) ax.set_ylim(ymin - 0.33 * step, ymax + 0.33 * step)
def trace_thresholds(fig, parameters, verbosity=0): def plot_axis_thresholds(fig, parameters, verbosity=0):
""" """
Adds channel thresholds (warn, fail) to y-axis if defined in parameters. Adds channel thresholds (warn, fail) to y-axis if defined in parameters.
""" """