move flandre to module
change SOFTWARE_CONFIG
This commit is contained in:
parent
339b38cf87
commit
3a7700df1e
@ -1,7 +1,7 @@
|
||||
import zmq
|
||||
from zmq import Context
|
||||
|
||||
from utils.Msg import Msg
|
||||
from flandre.utils.Msg import Msg
|
||||
|
||||
|
||||
class BusClient:
|
||||
0
flandre/__init__.py
Normal file
0
flandre/__init__.py
Normal file
@ -4,9 +4,9 @@ from typing import Callable
|
||||
import cupy as cp
|
||||
import numpy as np
|
||||
|
||||
from beamformer.dist import refraction_dist, direct_dist
|
||||
from beamformer.kernels import dist_mat_to_yids, dist_mat_to_yids_pwi
|
||||
from utils.Config import DeviceConfig
|
||||
from flandre.beamformer.dist import refraction_dist, direct_dist
|
||||
from flandre.beamformer.kernels import dist_mat_to_yids, dist_mat_to_yids_pwi
|
||||
from flandre.utils.Config import DeviceConfig
|
||||
|
||||
|
||||
def repeat_range_in_axis(shape: tuple, axis: int,p=cp):
|
||||
@ -5,8 +5,8 @@ where f(y,x) is the pixel distance in echo pulse RF signal between point(0,0) an
|
||||
import numpy as np
|
||||
from scipy.optimize import fsolve
|
||||
|
||||
from config import DS
|
||||
from utils.Config import DeviceConfig
|
||||
from flandre.config import DS
|
||||
from flandre.utils.Config import DeviceConfig
|
||||
|
||||
|
||||
def refraction_dist(dev_cfg=DeviceConfig()):
|
||||
@ -7,9 +7,9 @@ xri: x receive index
|
||||
xrs: x receive shape
|
||||
"""
|
||||
import cupy as cp
|
||||
from beamformer.dist import direct_dist
|
||||
from flandre.beamformer.dist import direct_dist
|
||||
|
||||
from utils.Config import DeviceConfig
|
||||
from flandre.utils.Config import DeviceConfig
|
||||
|
||||
|
||||
def dist_mat_to_yids(dist_mat: cp.ndarray, dev_cfg=DeviceConfig()):
|
||||
@ -1,8 +1,8 @@
|
||||
import cupy as cp
|
||||
|
||||
from beamformer.das import TFM
|
||||
from utils.Config import ImagingConfig
|
||||
from utils.ScanData import ScanData
|
||||
from flandre.beamformer.das import TFM
|
||||
from flandre.utils.Config import ImagingConfig
|
||||
from flandre.utils.ScanData import ScanData
|
||||
|
||||
tfm_cache = [None]
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import dataclasses
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PIL.TiffImagePlugin import SOFTWARE
|
||||
|
||||
PLAYBACK_SOCKET_PORT = 5003
|
||||
PLAYBACK_SOCKET = f'127.0.0.1:{PLAYBACK_SOCKET_PORT}'
|
||||
LIVE_SOCKET_IP = '11.6.1.71'
|
||||
@ -12,8 +11,6 @@ LIVE_SOCKET = f'{LIVE_SOCKET_IP}:5555'
|
||||
LIVE_REP_SOCKET = f'{LIVE_SOCKET_IP}:{LIVE_REP_SOCKET_PORT}'
|
||||
MI_REP_SOCKET_PORT = 5557
|
||||
DEVICE_PY_REP_SOCKET_PORT = 5558
|
||||
VIDEO_HEIGHT = 1920
|
||||
VIDEO_WIDTH = 1080
|
||||
|
||||
SWITCH1_IP = 'c1'
|
||||
SWITCH1_TOKEN = '7ad51e0016e7a9d22f753d5110f76c7d'
|
||||
@ -44,24 +41,37 @@ SOFTWARE_CONFIG_PATH = BASE / 'software.json'
|
||||
@dataclasses.dataclass
|
||||
class SoftwareConfig:
|
||||
base_dir: Path = DS
|
||||
video_height = 1920
|
||||
video_width = 1080
|
||||
|
||||
@staticmethod
|
||||
def read_config():
|
||||
j = json.loads(SOFTWARE_CONFIG_PATH.read_text(encoding='utf-8'))
|
||||
sc = SoftwareConfig()
|
||||
sc.base_dir = Path(j['base_dir'])
|
||||
def read_config(path: Path):
|
||||
j = json.loads(path.read_text(encoding='utf-8'))
|
||||
arg_d = dict()
|
||||
for field in dataclasses.fields(SoftwareConfig):
|
||||
match field.type:
|
||||
case Path():
|
||||
arg_d[field.name] = Path(j[field.name])
|
||||
case _:
|
||||
arg_d[field.name] = j[field.name]
|
||||
sc = SoftwareConfig(**arg_d)
|
||||
return sc
|
||||
|
||||
def write_config(self):
|
||||
SOFTWARE_CONFIG_PATH.write_text(json.dumps(dict(
|
||||
base_dir=self.base_dir.__str__(),
|
||||
), indent=4), encoding='utf-8')
|
||||
arg_d = dict()
|
||||
for field in dataclasses.fields(SoftwareConfig):
|
||||
match field.type:
|
||||
case Path():
|
||||
arg_d[field.name] = str(self.__getattribute__(field.name))
|
||||
case _:
|
||||
arg_d[field.name] = self.__getattribute__(field.name)
|
||||
SOFTWARE_CONFIG_PATH.write_text(json.dumps(arg_d, indent=4), encoding='utf-8')
|
||||
|
||||
|
||||
SOFTWARE_CONFIG = SoftwareConfig()
|
||||
C = SoftwareConfig()
|
||||
|
||||
if SOFTWARE_CONFIG_PATH.exists():
|
||||
SOFTWARE_CONFIG = SoftwareConfig.read_config()
|
||||
if SOFTWARE_CONFIG_PATH.exists() and '--debug' not in sys.argv:
|
||||
C = SoftwareConfig.read_config(SOFTWARE_CONFIG_PATH)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(SOFTWARE_CONFIG)
|
||||
print(C)
|
||||
@ -5,12 +5,12 @@ import cupy as cp
|
||||
import cv2
|
||||
import zmq
|
||||
|
||||
from config import VIDEO_WIDTH, VIDEO_HEIGHT
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import BMMsg, ImageArgMsg, SetSeqMetaMsg, Msg, RfFrameWithMetaMsg, BeamformerMsg, RequestRfFrameMsg, \
|
||||
from flandre.config import C.video_width, C.video_height
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import BMMsg, ImageArgMsg, SetSeqMetaMsg, Msg, RfFrameWithMetaMsg, BeamformerMsg, RequestRfFrameMsg, \
|
||||
SeqMetaMsg
|
||||
from utils.RfFile import RfSequenceMeta
|
||||
from utils.RfMat import RfMat
|
||||
from flandre.utils.RfFile import RfSequenceMeta
|
||||
from flandre.utils.RfMat import RfMat
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -35,7 +35,7 @@ class Beamformer(Node):
|
||||
.rotate90()
|
||||
.grey()
|
||||
.cpu()
|
||||
.resize((VIDEO_WIDTH, VIDEO_HEIGHT))
|
||||
.resize((C.video_width, C.video_height))
|
||||
.watermark()
|
||||
.call(cv2.cvtColor, cv2.COLOR_GRAY2RGBA)
|
||||
)
|
||||
@ -3,8 +3,8 @@ import threading
|
||||
import zmq
|
||||
from zmq import ContextTerminated
|
||||
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg
|
||||
|
||||
|
||||
class Broker(Node):
|
||||
@ -7,13 +7,13 @@ from threading import Thread
|
||||
|
||||
import zmq
|
||||
|
||||
from BusClient import BusClient
|
||||
from flandre.BusClient import BusClient
|
||||
from config import LIVE_REP_SOCKET, DEVICE_CONFIG
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import ImageArgMsg, KillMsg, SetDeviceConnectedMsg, SetDeviceEnabledMsg, DeviceEnabledMsg, \
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import ImageArgMsg, KillMsg, SetDeviceConnectedMsg, SetDeviceEnabledMsg, DeviceEnabledMsg, \
|
||||
DeviceConnectedMsg, SetDeviceConfigMsg, DeviceOnlineMsg, DeviceConfigListMsg, RequestRfFrameMsg, RfFrameWithMetaMsg, \
|
||||
DeviceZero, SetDeviceSwitchMsg, DeviceSwitchMsg, SeqMetaMsg, RefreshDeviceMsg
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -4,9 +4,9 @@ import cv2
|
||||
import numpy as np
|
||||
import zmq
|
||||
|
||||
from config import VIDEO_HEIGHT, VIDEO_WIDTH
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import BMMsg, SetWindowVisibleMsg
|
||||
from flandre.config import C
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import BMMsg, SetWindowVisibleMsg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -17,7 +17,7 @@ class ImageCV(Node):
|
||||
def __init__(self, level=logging.INFO):
|
||||
super().__init__(level=level)
|
||||
self.show = True
|
||||
self.buffer = np.zeros((VIDEO_HEIGHT, VIDEO_WIDTH, 3), dtype=np.uint8) + 128
|
||||
self.buffer = np.zeros((C.video_height, C.video_width, 3), dtype=np.uint8) + 128
|
||||
|
||||
def loop(self):
|
||||
cv2.namedWindow('image', cv2.WINDOW_NORMAL)
|
||||
@ -27,7 +27,7 @@ class ImageCV(Node):
|
||||
msg = self.recv()
|
||||
if isinstance(msg, BMMsg):
|
||||
b = np.frombuffer(msg.data, dtype=np.uint8)
|
||||
b = np.reshape(b, (VIDEO_HEIGHT, VIDEO_WIDTH, 4))
|
||||
b = np.reshape(b, (C.video_height, C.video_width, 4))
|
||||
self.buffer = b
|
||||
elif isinstance(msg, SetWindowVisibleMsg):
|
||||
if msg.name == 'bscan' and msg.sender != 'cv':
|
||||
@ -5,10 +5,10 @@ import time
|
||||
import numpy as np
|
||||
import zmq
|
||||
|
||||
from BusClient import BusClient
|
||||
from config import VIDEO_HEIGHT, VIDEO_WIDTH
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import BMMsg, SetWindowVisibleMsg, Msg
|
||||
from flandre.BusClient import BusClient
|
||||
from flandre.config import C.video_height, C.video_width
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import BMMsg, SetWindowVisibleMsg, Msg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -18,7 +18,7 @@ class ImageFFMPEG(Node):
|
||||
|
||||
def __init__(self, level=logging.INFO):
|
||||
super().__init__(level=level)
|
||||
self.buffer = np.zeros((VIDEO_HEIGHT, VIDEO_WIDTH, 3), dtype=np.uint8) + 128
|
||||
self.buffer = np.zeros((C.video_height, C.video_width, 3), dtype=np.uint8) + 128
|
||||
self.buffer = self.buffer.tobytes()
|
||||
|
||||
def loop(self):
|
||||
@ -56,7 +56,7 @@ class ImageFFMPEG(Node):
|
||||
if events:
|
||||
msg: BMMsg = Msg.decode_msg(events[0][0].recv())
|
||||
b = np.frombuffer(msg.data, dtype=np.uint8)
|
||||
b = np.reshape(b, (VIDEO_HEIGHT, VIDEO_WIDTH, 4))[:, :, :3]
|
||||
b = np.reshape(b, (C.video_height, C.video_width, 4))[:, :, :3]
|
||||
self.buffer = b.tobytes()
|
||||
p.stdin.write(self.buffer)
|
||||
# time.sleep(1 / 60)
|
||||
@ -5,11 +5,11 @@ from PyQt6.QtCore import QByteArray
|
||||
from PyQt6.QtGui import QImage, QPixmap
|
||||
from PyQt6.QtWidgets import QMainWindow, QApplication
|
||||
|
||||
from Image import Ui_MainWindow
|
||||
from ZMQReceiver import ZMQReceiver
|
||||
from config import VIDEO_HEIGHT, VIDEO_WIDTH
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg, Msg, ImageArgMsg, BMMsg
|
||||
from flandre.pyqt.Image import Ui_MainWindow
|
||||
from flandre.pyqt.ZMQReceiver import ZMQReceiver
|
||||
from flandre.config import C.video_height, C.video_width
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg, Msg, ImageArgMsg, BMMsg
|
||||
|
||||
|
||||
class Adv(QMainWindow, Ui_MainWindow):
|
||||
@ -31,7 +31,7 @@ class Adv(QMainWindow, Ui_MainWindow):
|
||||
# height, width, channel = cvImg.shape
|
||||
# bytesPerLine = 3 * width
|
||||
# qImg = QImage(cvImg.data, width, height, bytesPerLine, QImage.Format.Format_RGB888).rgbSwapped()
|
||||
qImg = QImage(msg.data, VIDEO_WIDTH, VIDEO_HEIGHT, 4 * VIDEO_WIDTH, QImage.Format.Format_RGB888).rgbSwapped()
|
||||
qImg = QImage(msg.data, C.video_width, C.video_height, 4 * C.video_width, QImage.Format.Format_RGB888).rgbSwapped()
|
||||
self.label.setPixmap(QPixmap(qImg))
|
||||
|
||||
@QtCore.pyqtSlot(int)
|
||||
@ -7,8 +7,8 @@ import zmq
|
||||
from mido.backends.rtmidi import Input, Output
|
||||
from pyjoystick.sdl2 import Key, Joystick, run_event_loop
|
||||
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg, Msg, ImageArgMsg, JoystickMsg
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg, Msg, ImageArgMsg, JoystickMsg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -5,11 +5,11 @@ from pathlib import Path
|
||||
|
||||
import zmq
|
||||
|
||||
from config import PLAYBACK_SOCKET_PORT, SOFTWARE_CONFIG
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import MoveAxisMsg, KillMsg, SetSeqMetaMsg, SeqIdMinMax, SetBaseMsg, SeqListMsg, SeqIdList, \
|
||||
from flandre.config import PLAYBACK_SOCKET_PORT, C
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import MoveAxisMsg, KillMsg, SetSeqMetaMsg, SeqIdMinMax, SetBaseMsg, SeqListMsg, SeqIdList, \
|
||||
SetSidMsg, RfFrameWithMetaMsg
|
||||
from utils.RfFile import RfSequence
|
||||
from flandre.utils.RfFile import RfSequence
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -48,8 +48,8 @@ class Loader(Node):
|
||||
if not seq_list:
|
||||
logger.warning(f'No sequences found in {base}')
|
||||
else:
|
||||
SOFTWARE_CONFIG.base_dir = base
|
||||
SOFTWARE_CONFIG.write_config()
|
||||
C.base_dir = base
|
||||
C.write_config()
|
||||
self.send(SeqListMsg(seq_list))
|
||||
elif isinstance(msg, KillMsg):
|
||||
if msg.name == '':
|
||||
@ -11,16 +11,16 @@ from PyQt6 import QtCore, QtWidgets, QtGui
|
||||
from PyQt6.QtCore import QByteArray
|
||||
from PyQt6.QtWidgets import QMainWindow, QApplication, QFrame, QMessageBox, QFileDialog, QLineEdit
|
||||
|
||||
from Main import Ui_MainWindow
|
||||
from ZMQReceiver import ZMQReceiver
|
||||
from config import DS, SOFTWARE_CONFIG, IMAGING_CONFIG, ASSETS, MI_REP_SOCKET_PORT
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg, Msg, ImageArgMsg, SeqIdMinMax, MoveAxisMsg, SeqListMsg, SetBaseMsg, \
|
||||
from flandre.pyqt.Main import Ui_MainWindow
|
||||
from flandre.pyqt.ZMQReceiver import ZMQReceiver
|
||||
from flandre.config import DS, C, IMAGING_CONFIG, ASSETS, MI_REP_SOCKET_PORT
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg, Msg, ImageArgMsg, SeqIdMinMax, MoveAxisMsg, SeqListMsg, SetBaseMsg, \
|
||||
SetSeqMetaMsg, SetPlayMode, DeviceConnectedMsg, DeviceEnabledMsg, DeviceOnlineMsg, SetDeviceEnabledMsg, \
|
||||
SetDeviceConnectedMsg, DeviceConfigListMsg, SetDeviceConfigMsg, SetRecordMsg, RobotRtsiMsg, RecordFrameMsg, \
|
||||
SeqIdList, SetWindowVisibleMsg, SetSidMsg, ImagingConfigNameListMsg, DeviceZero, DeviceSwitchMsg, \
|
||||
SetDeviceSwitchMsg, SeqMetaMsg, RefreshDeviceMsg
|
||||
from utils.RfMeta import RfSequenceMeta
|
||||
from flandre.utils.RfMeta import RfSequenceMeta
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -99,7 +99,7 @@ class Adv(QMainWindow, Ui_MainWindow):
|
||||
# self.b_device_connected.clicked.connect(lambda: self.p.send(SetDeviceConnectedMsg(not self.device_connected)))
|
||||
# self.c_live_seq_name.currentIndexChanged.connect(self.on_seq_meta)
|
||||
self.b_live_seq_apply.clicked.connect(self.on_seq_meta)
|
||||
self.l_base.setText(SOFTWARE_CONFIG.base_dir.__str__())
|
||||
self.l_base.setText(C.base_dir.__str__())
|
||||
self.l_base.textChanged.connect(lambda e:
|
||||
self.l_base.setStyleSheet("")
|
||||
if Path(e).exists() else
|
||||
@ -7,8 +7,8 @@ import zmq
|
||||
from mido import Message
|
||||
from mido.backends.rtmidi import Input, Output
|
||||
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg, MidiMsg, Msg, ImageArgMsg
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg, MidiMsg, Msg, ImageArgMsg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -5,13 +5,13 @@ import time
|
||||
|
||||
import zmq
|
||||
|
||||
from BusClient import BusClient
|
||||
from config import LIVE_REP_SOCKET, CONFIG, DEVICE_CONFIG
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import ImageArgMsg, KillMsg, SetDeviceConnectedMsg, SetDeviceEnabledMsg, DeviceEnabledMsg, \
|
||||
from flandre.BusClient import BusClient
|
||||
from flandre.config import LIVE_REP_SOCKET, CONFIG, DEVICE_CONFIG
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import ImageArgMsg, KillMsg, SetDeviceConnectedMsg, SetDeviceEnabledMsg, DeviceEnabledMsg, \
|
||||
DeviceConnectedMsg, SetDeviceConfigMsg, DeviceOnlineMsg, DeviceConfigListMsg, RequestRfFrameMsg, RfFrameMsg, \
|
||||
RfFrameWithMetaMsg
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -5,11 +5,11 @@ import time
|
||||
import zmq
|
||||
|
||||
from config import IMAGING_CONFIG
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import ImageArgMsg, KillMsg, SetSeqMetaMsg, SetPlayMode, SetDeviceConfigMsg, \
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import ImageArgMsg, KillMsg, SetSeqMetaMsg, SetPlayMode, SetDeviceConfigMsg, \
|
||||
ImagingConfigNameListMsg, RfFrameWithMetaMsg, BeamformerMsg, RobotRtsiMsg, SeqMetaMsg
|
||||
from utils.RfFile import RfSequenceMeta
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.utils.RfFile import RfSequenceMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -3,8 +3,8 @@ from abc import abstractmethod
|
||||
|
||||
import zmq
|
||||
|
||||
from BusClient import BusClient
|
||||
from utils.Msg import Msg, KillMsg
|
||||
from flandre.BusClient import BusClient
|
||||
from flandre.utils.Msg import Msg, KillMsg
|
||||
|
||||
|
||||
class Node:
|
||||
@ -6,13 +6,12 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import zmq
|
||||
|
||||
from config import IMAGING_CONFIG, LIVE_SOCKET
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import ImageArgMsg, KillMsg, SetSeqMetaMsg, SetPlayMode, SetDeviceConfigMsg, SetRecordMsg, \
|
||||
ImagingConfigNameListMsg, RfFrameWithMetaMsg, BeamformerMsg, RequestRfFrameMsg, RecordFrameMsg, RobotRtsiMsg
|
||||
from utils.RfFile import RfSequenceMeta
|
||||
from utils.RfMat import RfMat
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.config import LIVE_SOCKET
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import ImageArgMsg, KillMsg, SetSeqMetaMsg, SetPlayMode, SetDeviceConfigMsg, SetRecordMsg, \
|
||||
RfFrameWithMetaMsg, RequestRfFrameMsg, RecordFrameMsg, RobotRtsiMsg
|
||||
from flandre.utils.RfFile import RfSequenceMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -3,11 +3,11 @@ import threading
|
||||
|
||||
import zmq
|
||||
|
||||
from nodes.Node import Node
|
||||
from utils.Msg import KillMsg, RobotRtsiMsg, Msg
|
||||
from utils.network import check_port
|
||||
from utils.rtsi import rtsi
|
||||
from utils.rtsi.serialize import DataObject
|
||||
from flandre.nodes.Node import Node
|
||||
from flandre.utils.Msg import KillMsg, RobotRtsiMsg, Msg
|
||||
from flandre.utils.network import check_port
|
||||
from flandre.utils.rtsi import rtsi
|
||||
from flandre.utils.rtsi.serialize import DataObject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -446,7 +446,7 @@ class Ui_MainWindow(object):
|
||||
self.label_15 = QtWidgets.QLabel(parent=self.centralwidget)
|
||||
self.label_15.setObjectName("label_15")
|
||||
self.gridLayout_5.addWidget(self.label_15, 3, 0, 1, 1)
|
||||
self.s_t_start = QtWidgets.QSlider(parent=self.centralwidget)
|
||||
self.s_t_start = QJumpSlider(parent=self.centralwidget)
|
||||
self.s_t_start.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
self.s_t_start.setObjectName("s_t_start")
|
||||
self.gridLayout_5.addWidget(self.s_t_start, 3, 1, 1, 1)
|
||||
@ -614,3 +614,4 @@ class Ui_MainWindow(object):
|
||||
self.label.setText(_translate("MainWindow", "Base Path"))
|
||||
self.b_select_base.setText(_translate("MainWindow", "Select"))
|
||||
self.b_base.setText(_translate("MainWindow", "Open"))
|
||||
from flandre.pyqt.QJumpSlider import QJumpSlider
|
||||
@ -836,7 +836,7 @@ border-radius: 7px;
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="s_t_start">
|
||||
<widget class="QJumpSlider" name="s_t_start">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
@ -1017,6 +1017,13 @@ border-radius: 7px;
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QJumpSlider</class>
|
||||
<extends>QSlider</extends>
|
||||
<header>flandre.pyqt.QJumpSlider.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
15
flandre/pyqt/QJumpSlider.py
Normal file
15
flandre/pyqt/QJumpSlider.py
Normal file
@ -0,0 +1,15 @@
|
||||
from PyQt6.QtWidgets import *
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
|
||||
class ProxyStyle(QProxyStyle):
|
||||
def styleHint(self, hint, opt=None, widget=None, returnData=None):
|
||||
res = super().styleHint(hint, opt, widget, returnData)
|
||||
res |= Qt.MouseButton.LeftButton.value
|
||||
return res
|
||||
|
||||
|
||||
class QJumpSlider(QSlider):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setStyle(ProxyStyle())
|
||||
@ -2,7 +2,7 @@ import threading
|
||||
|
||||
from PyQt6 import QtCore
|
||||
|
||||
from nodes.Node import Node
|
||||
from flandre.nodes.Node import Node
|
||||
|
||||
|
||||
class ZMQReceiver(QtCore.QObject):
|
||||
@ -1,7 +1,7 @@
|
||||
import dataclasses
|
||||
import json
|
||||
|
||||
from config import CONFIG_FOLDER
|
||||
from flandre.config import CONFIG_FOLDER
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
@ -4,7 +4,7 @@ import struct
|
||||
from enum import auto, Enum
|
||||
from pathlib import Path
|
||||
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
|
||||
class BG(Enum):
|
||||
@ -3,7 +3,7 @@ from pathlib import Path
|
||||
import cupy as cp
|
||||
import numpy as np
|
||||
|
||||
from utils.RfMeta import RfFrameMeta, RfSequenceMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta, RfSequenceMeta
|
||||
|
||||
|
||||
class RfFrame:
|
||||
@ -2,8 +2,8 @@ import cv2
|
||||
import numpy as np
|
||||
import cupy as cp
|
||||
|
||||
from utils.RfFile import RfFrame, RfSequenceMeta
|
||||
from utils.RfMeta import RfFrameMeta
|
||||
from flandre.utils.RfFile import RfFrame, RfSequenceMeta
|
||||
from flandre.utils.RfMeta import RfFrameMeta
|
||||
|
||||
|
||||
def bypass(f):
|
||||
@ -1,16 +1,15 @@
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
import cupy as cp
|
||||
import cupyx
|
||||
import cv2
|
||||
import matplotlib
|
||||
import scipy
|
||||
import cupyx.scipy.signal
|
||||
import scipy.signal
|
||||
import cupyx.scipy.fft
|
||||
import cupyx.scipy.ndimage
|
||||
import cupyx.scipy.signal
|
||||
import cv2
|
||||
import matplotlib
|
||||
import numpy as np
|
||||
import scipy
|
||||
import scipy.signal
|
||||
from cupyx.scipy.fft import dctn, idctn
|
||||
from scipy.stats import norm as norms
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import click
|
||||
from miio.miioprotocol import MiIOProtocol
|
||||
|
||||
from config import SWITCH1_IP, SWITCH1_TOKEN, SWITCH2_IP, SWITCH2_TOKEN
|
||||
from flandre.config import SWITCH1_IP, SWITCH1_TOKEN, SWITCH2_IP, SWITCH2_TOKEN
|
||||
|
||||
|
||||
def c1():
|
||||
31
gui.py
Normal file
31
gui.py
Normal file
@ -0,0 +1,31 @@
|
||||
import logging
|
||||
import multiprocessing
|
||||
|
||||
from flandre.BusClient import BusClient
|
||||
|
||||
from flandre.nodes.MainUI import MainUI
|
||||
from flandre.utils.Msg import KillMsg
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
multiprocessing.set_start_method('spawn')
|
||||
multiprocessing.Pool()
|
||||
pps = []
|
||||
ps = [
|
||||
MainUI(),
|
||||
]
|
||||
for p in ps:
|
||||
pps.append(multiprocessing.Process(target=p))
|
||||
for p in pps:
|
||||
p.start()
|
||||
|
||||
c = BusClient(KillMsg)
|
||||
while True:
|
||||
x: KillMsg = c.recv()
|
||||
if x.name == '':
|
||||
break
|
||||
for p in pps:
|
||||
p.kill()
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
@ -1,442 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1177</width>
|
||||
<height>910</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="b_exit">
|
||||
<property name="text">
|
||||
<string>EXIT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_2"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="s_t_end">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1500</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>20</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Imaging</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="spinBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>t_end</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_3"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_12"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="s_t_start">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>t_start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_4"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_6"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_5"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>20</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Probe Position</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>E</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSlider" name="horizontalSlider_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Roll</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Yal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_8"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_9"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_10"/>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_11"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QComboBox" name="c_live_seq_name"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="b_device_enabled">
|
||||
<property name="text">
|
||||
<string>Beam</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="b_device_connected">
|
||||
<property name="text">
|
||||
<string>Connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_online">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: pink;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device Offline</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="l_record_commit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="b_play_playback">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color : red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Playback</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="b_record">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Record</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="s_sid">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Frame ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="b_base">
|
||||
<property name="text">
|
||||
<string>SetBase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="l_base">
|
||||
<property name="text">
|
||||
<string>/mnt/16T/private_dataset/us/</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Base Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="b_play_live">
|
||||
<property name="text">
|
||||
<string>Live</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Unset</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_7"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1177</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
21
test/testpy.py
Normal file
21
test/testpy.py
Normal file
@ -0,0 +1,21 @@
|
||||
import dataclasses
|
||||
import inspect
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class ASD:
|
||||
aaa: int = 1
|
||||
bbb: int = 1
|
||||
ccc: int = 1
|
||||
|
||||
def b(self):
|
||||
return self.aaa
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# print(dir(ASD()))
|
||||
# print(ASD.__dict__)
|
||||
# print(inspect.getmembers(ASD))
|
||||
# print(inspect.getmembers(ASD))
|
||||
for f in dataclasses.fields(ASD):
|
||||
print(f.name, f.type)
|
||||
Loading…
Reference in New Issue
Block a user