Skip to content
Snippets Groups Projects
Commit 5fb4005f authored by Lan Dam's avatar Lan Dam
Browse files

Fix bug in reftek not plot channel with question mark '?' if use preference list

parent 51a64c4d
No related branches found
No related tags found
1 merge request!154Fix bug in reftek not plot channel with question mark '?' if use preference list
from __future__ import annotations
from typing import Callable, Tuple, List, Union, Set, TYPE_CHECKING
from typing import Callable, Tuple, List, Union, Set, Dict, TYPE_CHECKING
from sohstationviewer.conf import constants
from sohstationviewer.controller.util import (
get_time_6, get_time_4, get_val, rtn_pattern)
from sohstationviewer.view.util.enums import LogType
from sohstationviewer.model.reftek_data.log_info_helper import (
remove_question_marks)
if TYPE_CHECKING:
from sohstationviewer.model.reftek_data.reftek import RT130
......@@ -33,7 +35,7 @@ class LogInfo():
self.key = key
self.unit_id, self.exp_no = key
self.req_data_streams = req_data_streams
self.req_soh_chans = req_soh_chans
self.no_question_req_soh_chans = remove_question_marks(req_soh_chans)
self.is_log_file = is_log_file
"""
track_year to add year to time since year time not include year after
......@@ -49,7 +51,7 @@ class LogInfo():
self.model = "72A"
self.max_epoch = 0
self.min_epoch = constants.HIGHEST_INT
self.chans: dict = self.parent.soh_data[self.key]
self.chans: Dict = self.parent.soh_data[self.key]
self.cpu_vers: Set[str] = set()
self.gps_vers: Set[str] = set()
self.extract_info()
......@@ -314,9 +316,10 @@ class LogInfo():
:param d: float - value of data
:param idx: int - index of SOH message line
"""
if self.req_soh_chans and chan_id not in self.req_soh_chans:
if self.no_question_req_soh_chans and not chan_id.startswith(
tuple(self.no_question_req_soh_chans)):
return
if chan_id not in self.chans:
self.chans[chan_id] = {
'reftek': True,
......
def remove_question_marks(req_soh_chan):
"""
Remove the question marks in the channel request list, req_soh_chan
:param req_soh_chan: soh channel request list
:return no_question_req_soh_chan: the channel request list with the
question marks removed
"""
no_question_req_soh_chan = []
for idx, req in enumerate(req_soh_chan):
if req.endswith('?'):
no_question_req_soh_chan.append(req_soh_chan[idx][:-1])
else:
no_question_req_soh_chan.append(req_soh_chan[idx])
return no_question_req_soh_chan
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment