From 3cfe2a061832031ac74d21bfe5d353088b4c93e2 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Tue, 25 Apr 2023 09:30:56 +0200 Subject: [PATCH] Renames hardware and measure --- doc/mux_2024_rev_0_0.py | 2 +- hardware/__init__.py | 1 - hardware_components/__init__.py | 1 + .../abstract_hardware_components.py | 0 {hardware => hardware_components}/dummy_controller.py | 2 +- {hardware => hardware_components}/dummy_mux.py | 2 +- {hardware => hardware_components}/dummy_rx.py | 2 +- {hardware => hardware_components}/dummy_tx.py | 2 +- {hardware => hardware_components}/mb_2024_rev_0_0.py | 2 +- {hardware => hardware_components}/ohmpi_card_3_15.py | 2 +- {hardware => hardware_components}/raspberry_pi.py | 2 +- measure.py => hardware_system.py | 0 ohmpi.py | 2 +- test_dummy.py | 4 ++-- test_measure_with_ohmpi_card_3_15.py | 2 +- test_ohmpi_card_3_15.py | 4 ++-- 16 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 hardware/__init__.py create mode 100644 hardware_components/__init__.py rename hardware/abstract_hardware.py => hardware_components/abstract_hardware_components.py (100%) rename {hardware => hardware_components}/dummy_controller.py (78%) rename {hardware => hardware_components}/dummy_mux.py (83%) rename {hardware => hardware_components}/dummy_rx.py (95%) rename {hardware => hardware_components}/dummy_tx.py (98%) rename {hardware => hardware_components}/mb_2024_rev_0_0.py (99%) rename {hardware => hardware_components}/ohmpi_card_3_15.py (99%) rename {hardware => hardware_components}/raspberry_pi.py (85%) rename measure.py => hardware_system.py (100%) diff --git a/doc/mux_2024_rev_0_0.py b/doc/mux_2024_rev_0_0.py index 7845820f..0627326f 100644 --- a/doc/mux_2024_rev_0_0.py +++ b/doc/mux_2024_rev_0_0.py @@ -1,6 +1,6 @@ from OhmPi.config import HARDWARE_CONFIG import os -from OhmPi.hardware import MuxAbstract +from OhmPi.hardware_components import MuxAbstract MUX_CONFIG = HARDWARE_CONFIG['mux'] class Mux(MuxAbstract): diff --git a/hardware/__init__.py b/hardware/__init__.py deleted file mode 100644 index 471af3cc..00000000 --- a/hardware/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .abstract_hardware import TxAbstract, RxAbstract, MuxAbstract, ControllerAbstract \ No newline at end of file diff --git a/hardware_components/__init__.py b/hardware_components/__init__.py new file mode 100644 index 00000000..bdc78fd8 --- /dev/null +++ b/hardware_components/__init__.py @@ -0,0 +1 @@ +from .abstract_hardware_components import TxAbstract, RxAbstract, MuxAbstract, ControllerAbstract \ No newline at end of file diff --git a/hardware/abstract_hardware.py b/hardware_components/abstract_hardware_components.py similarity index 100% rename from hardware/abstract_hardware.py rename to hardware_components/abstract_hardware_components.py diff --git a/hardware/dummy_controller.py b/hardware_components/dummy_controller.py similarity index 78% rename from hardware/dummy_controller.py rename to hardware_components/dummy_controller.py index 7de5aefd..829881f3 100644 --- a/hardware/dummy_controller.py +++ b/hardware_components/dummy_controller.py @@ -1,6 +1,6 @@ from OhmPi.config import HARDWARE_CONFIG import os -from OhmPi.hardware import ControllerAbstract +from OhmPi.hardware_components import ControllerAbstract CONTROLLER_CONFIG = HARDWARE_CONFIG['controller'] diff --git a/hardware/dummy_mux.py b/hardware_components/dummy_mux.py similarity index 83% rename from hardware/dummy_mux.py rename to hardware_components/dummy_mux.py index 626faff9..eb07b97e 100644 --- a/hardware/dummy_mux.py +++ b/hardware_components/dummy_mux.py @@ -1,6 +1,6 @@ from OhmPi.config import HARDWARE_CONFIG import os -from OhmPi.hardware import MuxAbstract +from OhmPi.hardware_components import MuxAbstract MUX_CONFIG = HARDWARE_CONFIG['mux'] class Mux(MuxAbstract): diff --git a/hardware/dummy_rx.py b/hardware_components/dummy_rx.py similarity index 95% rename from hardware/dummy_rx.py rename to hardware_components/dummy_rx.py index 7e26c87f..eb7dd132 100644 --- a/hardware/dummy_rx.py +++ b/hardware_components/dummy_rx.py @@ -1,7 +1,7 @@ from OhmPi.config import HARDWARE_CONFIG import numpy as np import os -from OhmPi.hardware import RxAbstract +from OhmPi.hardware_components import RxAbstract RX_CONFIG = HARDWARE_CONFIG['rx'] # hardware characteristics and limitations diff --git a/hardware/dummy_tx.py b/hardware_components/dummy_tx.py similarity index 98% rename from hardware/dummy_tx.py rename to hardware_components/dummy_tx.py index 09a270a4..fcf00918 100644 --- a/hardware/dummy_tx.py +++ b/hardware_components/dummy_tx.py @@ -2,7 +2,7 @@ from OhmPi.config import HARDWARE_CONFIG import time import os import numpy as np -from OhmPi.hardware import TxAbstract +from OhmPi.hardware_components import TxAbstract TX_CONFIG = HARDWARE_CONFIG['tx'] diff --git a/hardware/mb_2024_rev_0_0.py b/hardware_components/mb_2024_rev_0_0.py similarity index 99% rename from hardware/mb_2024_rev_0_0.py rename to hardware_components/mb_2024_rev_0_0.py index 790c7893..d3bb269c 100644 --- a/hardware/mb_2024_rev_0_0.py +++ b/hardware_components/mb_2024_rev_0_0.py @@ -8,7 +8,7 @@ import minimalmodbus # noqa import time import numpy as np import os -from OhmPi.hardware import TxAbstract, RxAbstract +from OhmPi.hardware_components import TxAbstract, RxAbstract controller_module = importlib.import_module(f'OhmPi.hardware.{HARDWARE_CONFIG["hardware"]["controller"]["model"]}') TX_CONFIG = HARDWARE_CONFIG['tx'] diff --git a/hardware/ohmpi_card_3_15.py b/hardware_components/ohmpi_card_3_15.py similarity index 99% rename from hardware/ohmpi_card_3_15.py rename to hardware_components/ohmpi_card_3_15.py index 1d7cafdf..4e099f62 100644 --- a/hardware/ohmpi_card_3_15.py +++ b/hardware_components/ohmpi_card_3_15.py @@ -8,7 +8,7 @@ import minimalmodbus # noqa import time import numpy as np import os -from OhmPi.hardware import TxAbstract, RxAbstract +from OhmPi.hardware_components import TxAbstract, RxAbstract controller_name = HARDWARE_CONFIG['controller'].pop('board_name', 'raspberry_pi') controller_module = importlib.import_module(f'OhmPi.hardware.{controller_name}') diff --git a/hardware/raspberry_pi.py b/hardware_components/raspberry_pi.py similarity index 85% rename from hardware/raspberry_pi.py rename to hardware_components/raspberry_pi.py index c40e553c..dd3680e1 100644 --- a/hardware/raspberry_pi.py +++ b/hardware_components/raspberry_pi.py @@ -1,4 +1,4 @@ -from OhmPi.hardware import ControllerAbstract +from OhmPi.hardware_components import ControllerAbstract import board # noqa import busio # noqa import os diff --git a/measure.py b/hardware_system.py similarity index 100% rename from measure.py rename to hardware_system.py diff --git a/ohmpi.py b/ohmpi.py index 8efdc605..6c38c1e2 100644 --- a/ohmpi.py +++ b/ohmpi.py @@ -24,7 +24,7 @@ import threading from OhmPi.logging_setup import setup_loggers from OhmPi.config import MQTT_CONTROL_CONFIG, OHMPI_CONFIG, EXEC_LOGGING_CONFIG from logging import DEBUG -from measure import OhmPiHardware +from hardware_system import OhmPiHardware # finish import (done only when class is instantiated as some libs are only available on arm64 platform) try: diff --git a/test_dummy.py b/test_dummy.py index b1b3c0ca..0ba2e474 100644 --- a/test_dummy.py +++ b/test_dummy.py @@ -1,7 +1,7 @@ import sys sys.path.extend(['/home/su530201/PycharmProjects/ohmpi_reversaal/OhmPi']) -from OhmPi.hardware.dummy_tx import Tx -from OhmPi.hardware.dummy_rx import Rx +from OhmPi.hardware_components.dummy_tx import Tx +from OhmPi.hardware_components.dummy_rx import Rx from OhmPi.logging_setup import create_stdout_logger exec_logger = create_stdout_logger(name='exec') diff --git a/test_measure_with_ohmpi_card_3_15.py b/test_measure_with_ohmpi_card_3_15.py index c676f2d0..3c863dac 100644 --- a/test_measure_with_ohmpi_card_3_15.py +++ b/test_measure_with_ohmpi_card_3_15.py @@ -3,7 +3,7 @@ import logging import matplotlib.pyplot as plt from utils import change_config change_config('config_ohmpi_card_3_15.py', verbose=False) -from OhmPi.measure import OhmPiHardware +from OhmPi.hardware_system import OhmPiHardware k = OhmPiHardware() k.exec_logger.setLevel(logging.INFO) diff --git a/test_ohmpi_card_3_15.py b/test_ohmpi_card_3_15.py index bbceaad4..9ca144e7 100644 --- a/test_ohmpi_card_3_15.py +++ b/test_ohmpi_card_3_15.py @@ -1,7 +1,7 @@ # import sys # sys.path.extend(['/home/su530201/PycharmProjects/ohmpi_reversaal/OhmPi']) -from OhmPi.hardware.ohmpi_card_3_15 import Tx -from OhmPi.hardware.ohmpi_card_3_15 import Rx +from OhmPi.hardware_components.ohmpi_card_3_15 import Tx +from OhmPi.hardware_components.ohmpi_card_3_15 import Rx from OhmPi.logging_setup import create_stdout_logger import numpy as np -- GitLab