Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • software_public/passoft/sohstationviewer
1 result
Show changes
Commits on Source (8)
...@@ -160,7 +160,6 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): ...@@ -160,7 +160,6 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
""" """
self.bit_weight_opt: str = '' # currently only need one option self.bit_weight_opt: str = '' # currently only need one option
self.get_channel_prefer() self.get_channel_prefer()
self.yyyy_mm_dd_action.triggered.emit()
""" """
waveform_dlg: widget to display waveform channels' plotting waveform_dlg: widget to display waveform channels' plotting
...@@ -196,6 +195,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): ...@@ -196,6 +195,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.read_config() self.read_config()
self.validate_config() self.validate_config()
self.apply_config() self.apply_config()
self.yyyy_mm_dd_action.trigger()
@QtCore.Slot() @QtCore.Slot()
def save_plot(self): def save_plot(self):
...@@ -364,6 +364,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): ...@@ -364,6 +364,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.time_to_date_edit.setDisplayFormat(qt_format) self.time_to_date_edit.setDisplayFormat(qt_format)
self.time_from_date_edit.setDisplayFormat(qt_format) self.time_from_date_edit.setDisplayFormat(qt_format)
self.date_format = display_format self.date_format = display_format
self.tps_dlg.date_format = self.date_format
self.waveform_dlg.date_format = self.date_format
@QtCore.Slot() @QtCore.Slot()
def open_files_list_item_double_clicked(self, item: FileListItem): def open_files_list_item_double_clicked(self, item: FileListItem):
...@@ -814,7 +816,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): ...@@ -814,7 +816,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
self.is_plotting_tps = True self.is_plotting_tps = True
peer_plotting_widgets.append(self.tps_dlg.plotting_widget) peer_plotting_widgets.append(self.tps_dlg.plotting_widget)
self.tps_dlg.set_data( self.tps_dlg.set_data(
self.data_type, ','.join([str(d) for d in self.dir_names])) self.data_type,
','.join([str(d) for d in self.dir_names]))
self.tps_dlg.show() self.tps_dlg.show()
# The waveform and TPS plots is being stopped at the same time, so # The waveform and TPS plots is being stopped at the same time, so
# we can't simply reset all flags. Instead, we use an intermediate # we can't simply reset all flags. Instead, we use an intermediate
...@@ -835,7 +838,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): ...@@ -835,7 +838,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
# waveformPlot # waveformPlot
peer_plotting_widgets.append(self.waveform_dlg.plotting_widget) peer_plotting_widgets.append(self.waveform_dlg.plotting_widget)
self.waveform_dlg.set_data( self.waveform_dlg.set_data(
self.data_type, ','.join([str(d) for d in self.dir_names])) self.data_type,
','.join([str(d) for d in self.dir_names]))
self.waveform_dlg.show() self.waveform_dlg.show()
waveform_widget = self.waveform_dlg.plotting_widget waveform_widget = self.waveform_dlg.plotting_widget
waveform_widget.stopped.connect(self.reset_is_plotting_waveform) waveform_widget.stopped.connect(self.reset_is_plotting_waveform)
......
...@@ -269,13 +269,14 @@ class Plotting: ...@@ -269,13 +269,14 @@ class Plotting:
obj, c = cStr.split(':') obj, c = cStr.split(':')
colors[obj] = c colors[obj] = c
l_color = 'G' l_color = 'G'
d_color = 'W'
has_dot = False has_dot = False
if 'L' in colors: if 'L' in colors:
l_color = colors['L'] l_color = colors['L']
if 'D' in colors: if 'D' in colors:
d_color = colors['D'] d_color = colors['D']
has_dot = True has_dot = True
else:
d_color = l_color
if chan_id == 'GPS Lk/Unlk': if chan_id == 'GPS Lk/Unlk':
sample_no_list = [] sample_no_list = []
...@@ -291,7 +292,7 @@ class Plotting: ...@@ -291,7 +292,7 @@ class Plotting:
info=info, y_list=y_list, linked_ax=linked_ax) info=info, y_list=y_list, linked_ax=linked_ax)
for x, y in zip(x_list, y_list): for x, y in zip(x_list, y_list):
if not has_dot: if not has_dot and sample_no_list[0] > 1:
# set marker to be able to click point for info # set marker to be able to click point for info
# but marker's size is small to not show dot. # but marker's size is small to not show dot.
ax.myPlot = ax.plot(x, y, marker='o', markersize=0.01, ax.myPlot = ax.plot(x, y, marker='o', markersize=0.01,
......
...@@ -586,12 +586,13 @@ class PlottingWidget(QtWidgets.QScrollArea): ...@@ -586,12 +586,13 @@ class PlottingWidget(QtWidgets.QScrollArea):
if tr_min_ys != []: if tr_min_ys != []:
new_min_y = min(tr_min_ys) new_min_y = min(tr_min_ys)
new_max_y = max(tr_max_ys) new_max_y = max(tr_max_ys)
# in case total_points == 1, y lim shouldn't be set
# again or the plot would be collapsed to one line
if total_points > 1:
self.plotting_axes.set_axes_ylim(
ax, new_min_y, new_max_y)
ax.center_total_point_lbl.set_text(total_points) ax.center_total_point_lbl.set_text(total_points)
if new_min_y is not None:
self.plotting_axes.set_axes_ylim(
ax, new_min_y, new_max_y, ax.chan_db_info)
def draw(self): def draw(self):
""" """
Update drawing on the widget. Update drawing on the widget.
......
...@@ -498,6 +498,11 @@ class TimePowerSquaredDialog(QtWidgets.QWidget): ...@@ -498,6 +498,11 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
data_type: str - type of data being plotted data_type: str - type of data being plotted
""" """
self.data_type = None self.data_type = None
"""
date_format: format for date
"""
self.date_format: str = 'YYYY-MM-DD'
self.setGeometry(50, 50, 1200, 700) self.setGeometry(50, 50, 1200, 700)
self.setWindowTitle("TPS Plot") self.setWindowTitle("TPS Plot")
...@@ -577,16 +582,16 @@ class TimePowerSquaredDialog(QtWidgets.QWidget): ...@@ -577,16 +582,16 @@ class TimePowerSquaredDialog(QtWidgets.QWidget):
self.connect_signals() self.connect_signals()
self.color_range_changed() self.color_range_changed()
def set_data(self, data_type, file_name): def set_data(self, data_type: str, folder_name: str):
""" """
Set data_type and the window's title. Set data_type and the window's title.
:param data_type: str - data type of data being plotted :param data_type: data type of data being plotted
:param file_name: str - name of the file/folder of the data set to be :param folder_name: name of the folder of the data set to be
displayed displayed
""" """
self.data_type = data_type self.data_type = data_type
self.setWindowTitle("TPS Plot %s - %s" % (data_type, file_name)) self.setWindowTitle("TPS Plot %s - %s" % (data_type, folder_name))
def resizeEvent(self, event): def resizeEvent(self, event):
""" """
......
...@@ -74,6 +74,10 @@ class WaveformDialog(QtWidgets.QWidget): ...@@ -74,6 +74,10 @@ class WaveformDialog(QtWidgets.QWidget):
data_type: str - type of data being plotted data_type: str - type of data being plotted
""" """
self.data_type = None self.data_type = None
"""
date_format: format for date
"""
self.date_format: str = 'YYYY-MM-DD'
self.setGeometry(50, 10, 1600, 700) self.setGeometry(50, 10, 1600, 700)
self.setWindowTitle("Raw Data Plot") self.setWindowTitle("Raw Data Plot")
...@@ -107,12 +111,12 @@ class WaveformDialog(QtWidgets.QWidget): ...@@ -107,12 +111,12 @@ class WaveformDialog(QtWidgets.QWidget):
self.info_text_browser.setFixedHeight(60) self.info_text_browser.setFixedHeight(60)
bottom_layout.addWidget(self.info_text_browser) bottom_layout.addWidget(self.info_text_browser)
def set_data(self, data_type, folder_name): def set_data(self, data_type: str, folder_name: str):
""" """
Set data_type and the window's title. Set data_type and the window's title.
:param data_type: str - data type of data being plotted :param data_type: data type of data being plotted
:param folder_name: str - name of the folder of the data set to be :param folder_name: name of the folder of the data set to be
displayed displayed
""" """
self.data_type = data_type self.data_type = data_type
......
...@@ -721,7 +721,6 @@ class UIMainWindow(object): ...@@ -721,7 +721,6 @@ class UIMainWindow(object):
lambda: main_window.set_date_format('YYYYMMMDD')) lambda: main_window.set_date_format('YYYYMMMDD'))
self.yyyy_doy_action.triggered.connect( self.yyyy_doy_action.triggered.connect(
lambda: main_window.set_date_format('YYYY:DOY')) lambda: main_window.set_date_format('YYYY:DOY'))
self.yyyy_mm_dd_action.trigger()
# Database # Database
self.add_edit_data_type_action.triggered.connect( self.add_edit_data_type_action.triggered.connect(
......
...@@ -254,12 +254,8 @@ def get_total_miny_maxy( ...@@ -254,12 +254,8 @@ def get_total_miny_maxy(
if new_x.size == 0: if new_x.size == 0:
return 0, None, None return 0, None, None
new_min_x = min(new_x) new_min_x_index = min(new_x_indexes)
new_max_x = max(new_x) new_max_x_index = max(new_x_indexes)
new_min_x_index = np.where(x == new_min_x)[0][0]
new_max_x_index = np.where(x == new_max_x)[0][0]
new_y = y[new_min_x_index:new_max_x_index + 1] new_y = y[new_min_x_index:new_max_x_index + 1]
new_min_y = min(new_y) new_min_y = min(new_y)
new_max_y = max(new_y) new_max_y = max(new_y)
......