From 3842722d0e565b7c6ca3eb3daf641766f5cf8425 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Tue, 25 Feb 2025 16:35:07 -0700 Subject: [PATCH 1/7] increase size of help --- sohstationviewer/view/help_view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sohstationviewer/view/help_view.py b/sohstationviewer/view/help_view.py index a2c63c1d4..d90adb3f5 100644 --- a/sohstationviewer/view/help_view.py +++ b/sohstationviewer/view/help_view.py @@ -71,8 +71,8 @@ class HelpBrowser(QtWidgets.QWidget): screen size. """ - SCREEN_SIZE_SCALAR_X = 0.50 - SCREEN_SIZE_SCALAR_Y = 0.50 + SCREEN_SIZE_SCALAR_X = 0.75 + SCREEN_SIZE_SCALAR_Y = 0.75 TREE_VIEW_SCALAR = 0.25 def __init__( -- GitLab From 7be016677ab4c43e8ecbe33b784413d7b6d27045 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Wed, 26 Feb 2025 10:28:22 -0700 Subject: [PATCH 2/7] Add MasPos ABC option to UI --- sohstationviewer/view/ui/main_ui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sohstationviewer/view/ui/main_ui.py b/sohstationviewer/view/ui/main_ui.py index bf796eae7..1784637c5 100755 --- a/sohstationviewer/view/ui/main_ui.py +++ b/sohstationviewer/view/ui/main_ui.py @@ -375,7 +375,7 @@ class UIMainWindow(object): left_widget = QWidget(self.central_widget) h_layout.addWidget(left_widget) - left_widget.setFixedWidth(240) + left_widget.setFixedWidth(255) # left_widget.setMinimumHeight(650) left_layout = QVBoxLayout() left_layout.setContentsMargins(0, 0, 0, 0) @@ -526,9 +526,10 @@ class UIMainWindow(object): mass_pos_layout = QHBoxLayout() left_layout.addLayout(mass_pos_layout) - mass_pos_layout.addWidget(QLabel('Mass Pos ')) + mass_pos_layout.addWidget(QLabel('MassPos ')) self.mass_pos_123zne_check_box = QCheckBox( - '123/ZNE', self.central_widget) + '123/ZNE/ABC', self.central_widget) + self.mass_pos_123zne_check_box.setMinimumWidth(120) mass_pos_layout.addWidget(self.mass_pos_123zne_check_box) self.mass_pos_456uvw_check_box = QCheckBox( '456/UVW', self.central_widget) -- GitLab From 0a66e5adcba54dcdce516f2c367ff0cfd7808210 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Wed, 26 Feb 2025 10:29:51 -0700 Subject: [PATCH 3/7] Add A,B,C option to check_chan() --- sohstationviewer/controller/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sohstationviewer/controller/util.py b/sohstationviewer/controller/util.py index b68469620..a46f6d391 100644 --- a/sohstationviewer/controller/util.py +++ b/sohstationviewer/controller/util.py @@ -349,7 +349,7 @@ def check_chan(chan_id: str, req_soh_chans: List[str], req_wf_chans: List[str], """ if chan_id.startswith('VM'): if (not include_mp123zne and - chan_id[-1] in ['1', '2', '3', 'Z', 'N', 'E']): + chan_id[-1] in ['1', '2', '3', 'Z', 'N', 'E', 'A', 'B', 'C']): return False if (not include_mp456uvw and chan_id[-1] in ['4', '5', '6', 'U', 'V', 'W']): -- GitLab From 5266cebabda05f73c67bdd255de38052a2ca8263 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Wed, 26 Feb 2025 10:33:05 -0700 Subject: [PATCH 4/7] separate in to group 123, enz, abc; 456, uvw to give warning if there's some channels not in the group --- sohstationviewer/view/util/functions.py | 28 +++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sohstationviewer/view/util/functions.py b/sohstationviewer/view/util/functions.py index 3eae9a6e5..3efa22588 100644 --- a/sohstationviewer/view/util/functions.py +++ b/sohstationviewer/view/util/functions.py @@ -223,9 +223,33 @@ def check_masspos(mp_data: Dict[str, Dict], req_mp = [] if include_mp123: - req_mp += ['1', '2', '3'] + req_mp123 = [] # represent 123/zne/abc + mp123 = ['1', '2', '3'] + mpzne = ['E', 'N', 'Z'] + mpabc = ['A', 'B', 'C'] + if any(chan in mpzne for chan in included_mp): + req_mp123 += mpzne + if any(chan in mpzne for chan in included_mp): + req_mp123 += mpabc + if any(chan in mp123 for chan in included_mp): + req_mp123 += mp123 + if req_mp123 == []: + # if none of 123/zne/abc, just report 123 + req_mp123 += mp123 + req_mp += req_mp123 + if include_mp456: - req_mp += ['4', '5', '6'] + req_mp456 = [] # represent 456/uvw + mp456 = ['4', '5', '6'] + mpuvw = ['U', 'V', 'W'] + if any(chan in mp456 for chan in included_mp): + req_mp456 += mp456 + if any(chan in mpuvw for chan in included_mp): + req_mp456 += mpuvw + if req_mp456 == []: + # if none of 456/uvw, just report 456 + req_mp456 += mp456 + req_mp += req_mp456 not_included_mp = [mp for mp in req_mp if mp not in included_mp] -- GitLab From 44495bea67626b679ef9b341bec46b677a7a3bea Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Wed, 26 Feb 2025 11:19:17 -0700 Subject: [PATCH 5/7] fix bug using mpzne in place for mpabc in check_masspos() --- sohstationviewer/view/util/functions.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sohstationviewer/view/util/functions.py b/sohstationviewer/view/util/functions.py index 3efa22588..75d54dc72 100644 --- a/sohstationviewer/view/util/functions.py +++ b/sohstationviewer/view/util/functions.py @@ -225,14 +225,15 @@ def check_masspos(mp_data: Dict[str, Dict], if include_mp123: req_mp123 = [] # represent 123/zne/abc mp123 = ['1', '2', '3'] - mpzne = ['E', 'N', 'Z'] + mpzne = ['Z', 'N', 'E'] mpabc = ['A', 'B', 'C'] + if any(chan in mp123 for chan in included_mp): + req_mp123 += mp123 if any(chan in mpzne for chan in included_mp): req_mp123 += mpzne - if any(chan in mpzne for chan in included_mp): + if any(chan in mpabc for chan in included_mp): req_mp123 += mpabc - if any(chan in mp123 for chan in included_mp): - req_mp123 += mp123 + if req_mp123 == []: # if none of 123/zne/abc, just report 123 req_mp123 += mp123 -- GitLab From b7e55b718494add61e0f5326dd4697a4d2d33e91 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Wed, 26 Feb 2025 11:20:27 -0700 Subject: [PATCH 6/7] add test to unittest for check_masspos() --- tests/view/util/test_functions.py | 96 +++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 19 deletions(-) diff --git a/tests/view/util/test_functions.py b/tests/view/util/test_functions.py index 1e2855cdb..12e6b95c3 100644 --- a/tests/view/util/test_functions.py +++ b/tests/view/util/test_functions.py @@ -383,38 +383,96 @@ class TestCheckChanWildcardsFormat(BaseTestCase): class TestCheckMassPos(BaseTestCase): @classmethod def setUpClass(cls) -> None: - cls.mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, - 'MP3': {'chan_id': 'MP3', 'samplerate': 1}, - 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} cls.sel_key = '1378' - def test_include_mp123(self): - with self.assertRaises(Exception) as context: - check_masspos(self.mp_data, self.sel_key, - include_mp123=True, include_mp456=False) - self.assertEqual( - str(context.exception), - f"Data set {self.sel_key} doesn't include mass position 2") + def test_include_mp123_not_include_mp456(self): + with self.subTest("Consist of MP1,MP3"): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MP3': {'chan_id': 'MP3', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=True, include_mp456=False) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position 2") + with self.subTest("Consist of MP1,MP3,MPE"): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MP3': {'chan_id': 'MP3', 'samplerate': 1}, + 'MPE': {'chan_id': 'MPE', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=True, include_mp456=False) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position " + f"2,Z,N") + with self.subTest("Consist of MPB"): + mp_data = {'MPB': {'chan_id': 'MPB', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=True, include_mp456=False) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position " + f"A,C") + with self.subTest("No MP 123/ZNE/ABC"): + mp_data = {'MP4': {'chan_id': 'MP4', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=True, include_mp456=False) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position " + f"1,2,3") - def test_include_mp456(self): - with self.assertRaises(Exception) as context: - check_masspos(self.mp_data, self.sel_key, - include_mp123=False, include_mp456=True) - self.assertEqual( - str(context.exception), - f"Data set {self.sel_key} doesn't include mass position 5,6") + def test_include_mp456_not_include456(self): + with self.subTest("Consist of MP4"): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=False, include_mp456=True) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position 5,6") + with self.subTest("Consist of MPW"): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MPW': {'chan_id': 'MPW', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=False, include_mp456=True) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position U,V") + with self.subTest("No MP 456/UVW"): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}} + with self.assertRaises(Exception) as context: + check_masspos(mp_data, self.sel_key, + include_mp123=False, include_mp456=True) + self.assertEqual( + str(context.exception), + f"Data set {self.sel_key} doesn't include mass position " + f"4,5,6") def test_include_mp123456(self): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MP3': {'chan_id': 'MP3', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} with self.assertRaises(Exception) as context: - check_masspos(self.mp_data, self.sel_key, + check_masspos(mp_data, self.sel_key, include_mp123=True, include_mp456=True) self.assertEqual( str(context.exception), f"Data set {self.sel_key} doesn't include mass position 2,5,6") def test_not_include_mp(self): + mp_data = {'MP1': {'chan_id': 'MP1', 'samplerate': 1}, + 'MP4': {'chan_id': 'MP4', 'samplerate': 1}} try: - check_masspos(self.mp_data, self.sel_key, + check_masspos(mp_data, self.sel_key, include_mp123=False, include_mp456=False) except Exception: self.fail("check_masspos() raise Exception unexpectedly") -- GitLab From be2cdd1f567a295d8e2b4bef2d5fc9202bf480ab Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Thu, 6 Mar 2025 15:08:37 -0700 Subject: [PATCH 7/7] add description for checking masspos channel for missing --- sohstationviewer/view/util/functions.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sohstationviewer/view/util/functions.py b/sohstationviewer/view/util/functions.py index 75d54dc72..4e56d329a 100644 --- a/sohstationviewer/view/util/functions.py +++ b/sohstationviewer/view/util/functions.py @@ -223,6 +223,16 @@ def check_masspos(mp_data: Dict[str, Dict], req_mp = [] if include_mp123: + """ + If the MassPos 123/ZNE/ABC checkbox is checked, the included_mp list + will be compared against 3 predefined lists: 123, ZNE, ABC. + If any channel in included_mp matches a channel from one of these + lists, the entire list (123, ZNE, or ABC) will be used for checking + missing channels. + If no channel in included_mp matches any of the channels from these + lists, only the 123 list will be included in the warning message + regarding missing channels. + """ req_mp123 = [] # represent 123/zne/abc mp123 = ['1', '2', '3'] mpzne = ['Z', 'N', 'E'] @@ -240,6 +250,16 @@ def check_masspos(mp_data: Dict[str, Dict], req_mp += req_mp123 if include_mp456: + """ + If the MassPos 456/UVW checkbox is checked, the included_mp list + will be compared against 2 predefined lists: 456, UVW. + If any channel in included_mp matches a channel from one of these + lists, the entire list (123, ZNE, or ABC) will be used for checking + missing channels. + If no channel in included_mp matches any of the channels from these + lists, only the 456 list will be included in the warning message + regarding missing channels. + """ req_mp456 = [] # represent 456/uvw mp456 = ['4', '5', '6'] mpuvw = ['U', 'V', 'W'] -- GitLab