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 (12)
......@@ -240,8 +240,13 @@ class RT130(GeneralData):
trace = {'startTmEpoch': times[0], 'endTmEpoch': times[-1],
'data': data, 'times': times}
if masspos_chan not in self.mass_pos_data[data_set_id]:
if masspos_chan[-1] in ['1', '2', '3']:
is_visible = self.include_mp123zne
else:
is_visible = self.include_mp456uvw
self.mass_pos_data[data_set_id][masspos_chan] = (
{'tracesInfo': []}
{'tracesInfo': [],
'visible': is_visible}
)
self.mass_pos_data[data_set_id][masspos_chan]['samplerate'] = 0
trace['startTmEpoch'] = times[0]
......
......@@ -480,6 +480,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
if self.mseed_wildcard_edit.text().strip() != "":
req_mseed_wildcards = self.mseed_wildcard_edit.text(
).split(",")
req_mseed_wildcards = [
req.strip() for req in req_mseed_wildcards]
if self.data_type == 'RT130':
req_wf_chans = req_dss
......@@ -554,6 +556,10 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
# each item.file_path is a rt130 das name for this case
self.selected_rt130_paths += self.rt130_das_dict[
item.file_path]
# Checking size of files using list of dir
self.list_of_dir = self.selected_rt130_paths
if self.selected_rt130_paths == []:
msg = "No RT130s have been selected."
raise Exception(msg)
......@@ -610,6 +616,14 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
if self.list_of_dir == []:
msg = "No directories have been selected."
raise Exception(msg)
try:
self.req_wf_chans = self.get_requested_wf_chans()
except Exception as e:
QMessageBox.information(self, "Waveform Selection", str(e))
self.cancel_loading()
return
if self.warn_big_file_sizes.isChecked():
# call check_folder_size() here b/c it requires list_of_dir and it
# is before the called for detect_data_type() which sometimes take
......@@ -747,12 +761,6 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
if self.req_soh_chans is None:
self.cancel_loading()
return
try:
self.req_wf_chans = self.get_requested_wf_chans()
except Exception as e:
QMessageBox.information(self, "Waveform Selection", str(e))
self.cancel_loading()
return
start_tm_str = self.time_from_date_edit.date().toString(
QtCore.Qt.DateFormat.ISODate
......
......@@ -504,6 +504,9 @@ class PlottingWidget(QtWidgets.QScrollArea):
if self.tps_t is None:
return
xdata = self.tps_t
# Reset tps_t here because the reset in on_pick_event won't be
# reach when no point is clicked.
self.tps_t = None
else:
xdata = self.get_timestamp(event)
......@@ -842,14 +845,20 @@ class PlottingWidget(QtWidgets.QScrollArea):
msg = f"Graph is saved at {save_file_path}"
display_tracking_info(self.tracking_box, msg)
def clear(self):
def clear(self, do_reset_size: bool = True):
"""
Clear the figure, reset attributes and initiate size if it is requested
:param do_reset_size: flag to know if reset_size is requested.
"""
try:
self.plotting_axes.fig.clear()
except AttributeError:
pass
self.axes = []
self.plot_total = 0
self.init_size()
if do_reset_size:
self.init_size()
try:
self.draw()
except AttributeError:
......
......@@ -69,7 +69,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
tps_t: float - prompt's time on tps's chart to help rulers on other
plotting widgets to identify their location
"""
self.tps_t = 0
self.tps_t = None
"""
display_top_ticks: flag to display time ticks on top of ax or not
"""
......@@ -116,7 +116,6 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
:param start_msg: the starting message to show user that new plotting
has been started.
"""
self.fig_height_in = self.init_fig_height_in()
self.plotting_bot = const.BOTTOM
self.processed_channels = []
self.channels = []
......@@ -146,6 +145,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
self.is_working = True
self.display_top_ticks = True
self.plotting_data1 = data_dict
self.fig_height_in = self.init_fig_height_in()
self.min_x = min_x
self.max_x = max_x
self.plot_total = len(self.plotting_data1)
......@@ -190,13 +190,12 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
"""
for chan_id in self.plotting_data1:
c_data = self.plotting_data1[chan_id]
if 'tps_data' not in c_data:
total_days = (len(self.start_5min_blocks) /
const.NUMBER_OF_5M_IN_DAY)
c_data['height_ratio'] = total_days/1.7
chan_height_ratio = \
c_data['height_ratio'] + const.TPS_SEPARATOR_SIZE_FACTOR
self.fig_height_in += chan_height_ratio * const.BASIC_HEIGHT_IN
total_days = (len(self.start_5min_blocks) /
const.NUMBER_OF_5M_IN_DAY)
c_data['height_ratio'] = total_days/1.7
chan_height_ratio = \
c_data['height_ratio'] + const.TPS_SEPARATOR_SIZE_FACTOR
self.fig_height_in += chan_height_ratio * const.BASIC_HEIGHT_IN
def plotting_preset(self):
"""
......@@ -614,7 +613,9 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
Reuse tps_data calculated in the first plotting to replot
with new color range selected.
"""
self.clear()
# Not reset the size of main_widget so the size from original plotting
# that fit all channels will be maintain.
self.clear(do_reset_size=False)
self.start_message_and_reset_processing_states(
f'RePlotting {self.get_plot_name()} ...')
self.set_colors(self.main_window.color_mode)
......
......@@ -193,7 +193,11 @@ def _get_size_of_non_multiplex_waveform_file(
def _get_size_rt130(dir_path: str, req_ds: List[int]):
"""
Get size of RT130's requested datas treams which is inside folder that has
data stream number as name.
data stream number as name.
If the data set has no data stream selected, its size will be zero for the
processing of SOH messages is insignificant.
:param dir_path: absolute path to directory
:param req_ds: list of requested data streams
:return total_size: total size of requested data streams up to where it
......@@ -362,6 +366,11 @@ def check_folders_size(dir_paths: List[str],
except Exception as e:
QMessageBox.information(None, "Error", str(e))
return False
if final_result == {'data_size': 0, 'text_count': 0, 'binary_count': 0}:
# When both text_count and binary count are zero, it means data type
# has been identified but data size isn't calculated (0) because
# it is considered small enough.
return True
if final_result['data_size'] > BIG_FILE_SIZE:
msg = ('The selected data set is greater than 2GB. It '
'might take a while to finish reading '
......