[minor] visual tweaks
This commit is contained in:
parent
c90b430fa8
commit
bf000fe042
@ -62,7 +62,7 @@ THRESHOLDS:
|
||||
CHANNELS:
|
||||
EX1:
|
||||
unit: 1e-6
|
||||
name: "Temperature (°C)"
|
||||
name: "PowBox Temperature (°C)"
|
||||
ticks: [-10, 50, 10]
|
||||
transform:
|
||||
- ["*", 20]
|
||||
@ -70,40 +70,40 @@ CHANNELS:
|
||||
warn: "max_temp"
|
||||
EX2:
|
||||
unit: 1e-6
|
||||
name: "230V/12V (V)"
|
||||
name: "PowBox 230V/12V (V)"
|
||||
ticks: [1, 5, 1]
|
||||
warn: [2, 3, 4, 4.5, 5]
|
||||
EX3:
|
||||
unit: 1e-6
|
||||
name: "Rout/Charge (V)"
|
||||
name: "PowBox Router/Charger (V)"
|
||||
ticks: [1, 5, 1]
|
||||
warn: [2, 2.5, 3, 4, 5]
|
||||
VEI:
|
||||
unit: 1e-3
|
||||
name: "Logger (V)"
|
||||
name: "Datalogger (V)"
|
||||
ticks: [9, 15, 1]
|
||||
warn: ["low_volt", "high_volt"]
|
||||
fail: 10.5
|
||||
VM1:
|
||||
unit: 1e-6
|
||||
name: "Mass 1 (V)"
|
||||
name: "Mass position W (V)"
|
||||
ticks: [-2.5, 2.5, 1]
|
||||
warn: [-1.5, 1.5]
|
||||
fail: [-2.5, 2.5]
|
||||
VM2:
|
||||
unit: 1e-6
|
||||
name: "Mass 2 (V)"
|
||||
name: "Mass position V (V)"
|
||||
ticks: [-2.5, 2.5, 1]
|
||||
warn: [-1.5, 1.5]
|
||||
fail: [-2.5, 2.5]
|
||||
VM3:
|
||||
unit: 1e-6
|
||||
name: "Mass 3 (V)"
|
||||
name: "Mass position U (V)"
|
||||
ticks: [-2.5, 2.5, 1]
|
||||
warn: [-1.5, 1.5]
|
||||
fail: [-2.5, 2.5]
|
||||
LCQ:
|
||||
name: "Clock Q (%)"
|
||||
name: "Clock quality (%)"
|
||||
ticks: [0, 100, 20]
|
||||
warn: "clockquality_warn"
|
||||
fail: "clockquality_fail"
|
||||
|
@ -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, \
|
||||
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:
|
||||
import smtplib
|
||||
@ -350,9 +350,10 @@ class SurveillanceBot(object):
|
||||
try:
|
||||
st = modify_stream_for_plot(st, parameters=self.parameters)
|
||||
st.plot(fig=fig, show=False, draw=False, block=False, equal_scale=False, method='full')
|
||||
# trace_ylabels(fig, self.parameters, self.verbosity)
|
||||
trace_yticks(fig, self.parameters, self.verbosity)
|
||||
trace_thresholds(fig, self.parameters, self.verbosity)
|
||||
# set_axis_ylabels(fig, self.parameters, self.verbosity)
|
||||
set_axis_yticks(fig, self.parameters, self.verbosity)
|
||||
set_axis_color(fig)
|
||||
plot_axis_thresholds(fig, self.parameters, self.verbosity)
|
||||
except Exception as e:
|
||||
print(f'Could not generate plot for {nwst_id}:')
|
||||
print(traceback.format_exc())
|
||||
|
@ -34,7 +34,7 @@ from obspy import UTCDateTime
|
||||
|
||||
from survBot import SurveillanceBot
|
||||
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:
|
||||
from rest_api.utils import get_station_iccid
|
||||
@ -316,9 +316,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
self.plot_widget.setWindowTitle(nwst_id)
|
||||
st = modify_stream_for_plot(st, parameters=self.parameters)
|
||||
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)
|
||||
trace_yticks(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
|
||||
trace_thresholds(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
|
||||
# set_axis_ylabels(fig=self.plot_widget.canvas.fig, parameters=self.parameters)
|
||||
set_axis_yticks(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()
|
||||
|
||||
def notification(self, text):
|
||||
|
17
utils.py
17
utils.py
@ -110,7 +110,7 @@ def modify_stream_for_plot(input_stream, parameters):
|
||||
|
||||
# modify trace id to maintain plotting order
|
||||
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)
|
||||
|
||||
@ -139,7 +139,7 @@ def transform_trace(data, transf):
|
||||
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.
|
||||
"""
|
||||
@ -155,7 +155,16 @@ def trace_ylabels(fig, parameters, verbosity=0):
|
||||
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.
|
||||
"""
|
||||
@ -176,7 +185,7 @@ def trace_yticks(fig, parameters, verbosity=0):
|
||||
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.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user