From 4ee24db40f998606199e211adaa9fb6a3ed88abd Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Tue, 29 Aug 2023 19:46:48 -0600 Subject: [PATCH] collect all channels start with one of channels in no_question_req_soh_chans --- sohstationviewer/model/reftek_data/log_info.py | 13 ++++++++----- .../model/reftek_data/log_info_helper.py | 8 ++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 sohstationviewer/model/reftek_data/log_info_helper.py diff --git a/sohstationviewer/model/reftek_data/log_info.py b/sohstationviewer/model/reftek_data/log_info.py index 70e5a111f..1ba6f822e 100644 --- a/sohstationviewer/model/reftek_data/log_info.py +++ b/sohstationviewer/model/reftek_data/log_info.py @@ -1,10 +1,12 @@ 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_mark) 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_mark(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, diff --git a/sohstationviewer/model/reftek_data/log_info_helper.py b/sohstationviewer/model/reftek_data/log_info_helper.py new file mode 100644 index 000000000..282ca5cb2 --- /dev/null +++ b/sohstationviewer/model/reftek_data/log_info_helper.py @@ -0,0 +1,8 @@ +def remove_question_mark(req_soh_chan): + 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 \ No newline at end of file -- GitLab