desktop--dataclass

desktop
esea_info 2 years ago
parent d4ff77b88e
commit 038ab27778
  1. 150
      RamsesData.py
  2. 1551
      awrams.py
  3. 1126
      awrams.py.bk
  4. BIN
      data/2/2022/8/17/51/0.bin
  5. BIN
      data/2/2022/8/17/51/1.bin
  6. BIN
      data/2/2022/8/17/51/2.bin
  7. 6
      data/2/2022/8/17/51/2022_8_17_12_20_13.csv
  8. BIN
      data/2/2022/8/17/51/3.bin
  9. BIN
      data/2/2022/8/17/51/4.bin
  10. BIN
      data/2/2022/8/17/51/info.bin
  11. BIN
      data/2/2022/8/17/51/pic.jpg
  12. 786
      myRamses.py
  13. 179
      yiwinframe.py

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

File diff suppressed because one or more lines are too long

@ -4,6 +4,7 @@ import time
import threading import threading
from pathlib import PurePath,Path from pathlib import PurePath,Path
from pubsub import pub from pubsub import pub
# from configobj import ConfigObj # from configobj import ConfigObj
from listctrl import Listctrl from listctrl import Listctrl
@ -16,11 +17,12 @@ from uiconfig.uiabout import About
from uiconfig.uihelp import Help from uiconfig.uihelp import Help
from uiconfig.ui_plot_setting import UI_Plot_Setting from uiconfig.ui_plot_setting import UI_Plot_Setting
from myconfig import TOKEN,DeviceType,YAML_FILE_NAME,RETRIEVE_CFG_FILE from myconfig import TOKEN,DeviceType,YAML_FILE_NAME,RETRIEVE_CFG_FILE,DATA_DIR
from myconfig import MyConfig,RamsesFunc from myconfig import MyConfig,RamsesFunc
from mythread import Mythead from mythread import Mythead
from configuration import Configuration from configuration import Configuration
from awrams import AWRAMS,HandHeldBuf # from awrams import AWRAMS,HandHeldBuf
from awrams import AWRAMS,AwramsHandle
from tools.myexception import MyException from tools.myexception import MyException
from tools.mylogger import log from tools.mylogger import log
@ -54,6 +56,7 @@ class YiwinFrame(wx.Frame):
self.title = title self.title = title
self.path = PurePath() self.path = PurePath()
# self.save_fname:Path = Path(self.path.joinpath(DATA_FNAME)) # self.save_fname:Path = Path(self.path.joinpath(DATA_FNAME))
self.error_result = []
self.result = '' self.result = ''
self.displayData:list =[] self.displayData:list =[]
self.interval = 0 self.interval = 0
@ -94,7 +97,7 @@ class YiwinFrame(wx.Frame):
self.__setTimer() self.__setTimer()
log.info(f"system init....",__name__, "__init__") log.info(f"system init....",__name__, "__init__")
self.mycfg = MyConfig() self.mycfg = MyConfig()
self.awrams = AWRAMS() # self.awrams = AWRAMS()
self.mythread = Mythead() self.mythread = Mythead()
pub.subscribe( self.updateDisplay, "update") pub.subscribe( self.updateDisplay, "update")
@ -166,32 +169,29 @@ class YiwinFrame(wx.Frame):
pass pass
def updateDisplay(self, msg): def updateDisplay(self, msg):
log.warning(f" updateDisplay 。。 {msg['data']}") log.warning(f" msg : {msg['data']}",__name__,"updateDisplay")
if msg['flag'] == "notice": if msg['flag'] == "notice":
self.__update_notice(msg['data']) self.__update_notice(msg['data'])
pass pass
if msg['flag'] == "data": if msg['flag'] == "data":
# log.info(f" ... update .{msg['data']}........... " )
self.__update_data(msg['data']) self.__update_data(msg['data'])
pass pass
pass pass
def __update_notice(self,msg): def __update_notice( self, msg ):
log.info(f" .......{msg}... ",__name__,'__update_notice') log.info(f" .......{msg}... ",__name__,'__update_notice')
self.alterStatus_0( msg) self.alterStatus_0( msg )
self.popDialog( msg ) # self.popDialog( msg )
pass pass
def __update_data(self,data ): def __update_data(self,data ):
log.info(f" .......... ",__name__,'__update_data') log.info(f" .......... ", __name__, '__update_data')
self.plotpanel.set_axes_title( data['tm']) self.plotpanel.set_axes_title( data[0])
res = data['res']
x = self.awrams.wavelength.tolist()
length = len(data)
self.plotpanel.clear_past() self.plotpanel.clear_past()
for display in RamsesFunc: self.plotpanel.plot_one( "Rs", data[1], data[2], color= LineColor(1).name )
self.plotpanel.plot_one(display.name, x, res[display.name],color= LineColor(display.value).name ) # for display in RamsesFunc:
pass # self.plotpanel.plot_one(display.name, x, res[display.name],color= LineColor(display.value).name )
# pass
pass pass
def OnStart( self, event ): def OnStart( self, event ):
@ -231,55 +231,53 @@ class YiwinFrame(wx.Frame):
self.statusBar.SetStatusText("Pls get the cal info, and try again",0) self.statusBar.SetStatusText("Pls get the cal info, and try again",0)
pass pass
self.awrams.getDataFileList() ## 调用 AwramsHandle 的函数
self.awrams.setDeviceID(self.device_id) self.myhandle:AwramsHandle = self.awrams_handle[self.device_id]
self.awrams.setRetrieve(self.retrieve)
if self.syscfg != {}:
self.awrams.setSyscfg(self.syscfg)
else:
log.warning(f"Pls get the cal info, and try again", __name__, "OnDealData","setCfg")
MyException( f"System Configuration is empty." )
pass
# 处理数据 # 处理数据
self.alterStatus_0(" 正在处理数据...." ) self.alterStatus_0(" 正在处理数据...." )
try: try:
self.mythread.set_task( self.awrams.dealAllMeasurements ) self.mythread.set_task( self.read_folders_from_sd )
self.mythread.start() self.mythread.start()
except Exception as e: except Exception as e:
log.error(e) log.error(e)
pass pass
def read_folders_from_sd(self,):
# myhandle:AwramsHandle = self.awrams_handle[self.device_id]
self.myhandle.read_folders_from_SD( DATA_DIR )
pass
def OnDealServer(self, e)-> None: def OnDealServer(self, e)-> None:
'''对服务器数据进行再次处理,''' '''对服务器数据进行再次处理,'''
log.info(f"OnDealServer: 处理服务器数据", __name__, "", "") log.info(f"OnDealServer: 处理服务器数据", __name__, "", "")
if not self.calinfo_is_ok: # if not self.calinfo_is_ok:
self.onNotify("Pls get the cal info, and try again" ) # self.onNotify("Pls get the cal info, and try again" )
log.warning(f"Pls get the cal info, and try again", __name__, "OnDealData") # log.warning(f"Pls get the cal info, and try again", __name__, "OnDealData")
self.statusBar.SetStatusText("Pls get the cal info, and try again",0) # self.statusBar.SetStatusText("Pls get the cal info, and try again",0)
pass # pass
self.awrams.getDataFiles_server( ) # self.awrams.getDataFiles_server( )
self.awrams.setDeviceID(self.device_id) # self.awrams.setDeviceID(self.device_id)
self.awrams.setRetrieve(self.retrieve) # self.awrams.setRetrieve(self.retrieve)
if self.syscfg != {}: # if self.syscfg != {}:
self.awrams.setSyscfg(self.syscfg) # self.awrams.setSyscfg(self.syscfg)
else: # else:
log.warning(f"Pls get the cal info, and try again", __name__, "OnDealData","setCfg") # log.warning(f"Pls get the cal info, and try again", __name__, "OnDealData","setCfg")
MyException( f"System Configuration is empty." ) # MyException( f"System Configuration is empty." )
pass # pass
# 处理数据 # # 处理数据
self.alterStatus_0(" 正在处理数据...." ) # self.alterStatus_0(" 正在处理数据...." )
try: # try:
self.mythread.set_task( self.awrams.dealAllMeasurements_Server ) # self.mythread.set_task( self.awrams.dealAllMeasurements_Server )
self.mythread.start() # self.mythread.start()
except Exception as e: # except Exception as e:
log.error(e) # log.error(e)
pass # pass
pass # pass
def OnCalInfo(self,e): def OnCalInfo(self,e):
'''依据传感器获取标定文件信息''' '''依据传感器获取标定文件信息'''
@ -299,20 +297,20 @@ class YiwinFrame(wx.Frame):
self.popDialog("没有发现retrieve.yml文件") self.popDialog("没有发现retrieve.yml文件")
pass pass
init_para = self.mycfg.read_yaml() self.sensor_cfg = self.mycfg.read_yaml()
log.info(f"Current Device: {device_type} ", __name__, "", "") log.info(f"Current Device: {device_type} ", __name__, "", "")
log.info(f"Sensor: {init_para}", __name__, "", "") log.info(f"Sensor: {self.sensor_cfg}", __name__, "", "")
# 配置反演需要的参数 波长 间隔 # 配置反演需要的参数 波长 间隔
self.retrieve = self.mycfg.get_retrieve() self.retrieve = self.mycfg.get_retrieve()
log.warning(f"Retrieve: {self.retrieve}", __name__, "", "") log.warning(f"Retrieve: {self.retrieve}", __name__, "", "")
self.syscfg = {} self.cal_cfg = {}
cfgr = Configuration( ) cfgr = Configuration( )
cfgr.setDeviceType(device_type) cfgr.setDeviceType(device_type)
cfgr.setSystemCfgDict(init_para) cfgr.setSystemCfgDict(self.sensor_cfg)
for k,v in init_para.items(): for k,v in self.sensor_cfg.items():
cfgr.setSystemCfgDict(v) cfgr.setSystemCfgDict(v)
try: try:
cfgr.getCalConfiguration() cfgr.getCalConfiguration()
@ -320,18 +318,77 @@ class YiwinFrame(wx.Frame):
log.error(f"读取配置文件失败. \n {e}",__name__, "", "" ) log.error(f"读取配置文件失败. \n {e}",__name__, "", "" )
raise raise
log.info(f"v: {cfgr.configuration}", __name__, "", "") log.info(f"v: {cfgr.configuration}", __name__, "", "")
self.syscfg.update({k:cfgr.cal_configuration}) self.cal_cfg.update({k:cfgr.cal_configuration})
# log.warning(f"self.syscfg: {self.syscfg}", __name__, "", "") # log.warning(f"self.cal_cfg: {self.cal_cfg}", __name__, "", "")
log.warning(f"self.syscfg 2: {self.syscfg[2].keys()}", __name__, "", "") log.warning(f"self.syscfg 2: {self.cal_cfg[2].keys()}", __name__, "", "")
# log.warning(f"self.syscfg 3: {self.syscfg[3].keys()}", __name__, "", "") # log.warning(f"self.cal_cfg 3: {self.cal_cfg[3].keys()}", __name__, "", "")
log.info(f"传感器配置文件读取成功", __name__, "", "") log.info(f"传感器配置文件读取成功", __name__, "", "")
self.alterStatus_0("传感器配置文件读取成功") self.alterStatus_0("传感器配置文件读取成功")
self.onNotify("获取标定信息成功") self.onNotify("获取标定信息成功")
self.calinfo_is_ok = True self.calinfo_is_ok = True
self.__init_data_process()
pass pass
def __init_data_process(self, mode = 0):
''' 多个handle AwramsHandle'''
self.awrams_handle = { }
for k,v in self.cal_cfg.items():
ah = AwramsHandle( deviceid=k, cfg=self.sensor_cfg[k], calcfg=v, rtv=self.retrieve)
self.awrams_handle.update( {k:ah } )
# def OnCalInfo(self,e):
# '''依据传感器获取标定文件信息'''
# #######################################
# self.onNotify("正在获取标定信息")
# device_id = self.device_id # 多个设备
# device_type = DeviceType.SURFACE.name
# self.mycfg = MyConfig()
# self.mycfg.setDeviceType(DeviceType.SURFACE)
# # 检查配置文件是否存在,不存在报错 config.yml retrieve.yml
# if not self.mycfg.check_config_yml():
# self.popDialog("没有发现config.yml文件")
# pass
# if not self.mycfg.check_retrieve_yml():
# self.popDialog("没有发现retrieve.yml文件")
# pass
# init_para = self.mycfg.read_yaml()
# log.info(f"Current Device: {device_type} ", __name__, "", "")
# log.info(f"Sensor: {init_para}", __name__, "", "")
# # 配置反演需要的参数 波长 间隔
# self.retrieve = self.mycfg.get_retrieve()
# log.warning(f"Retrieve: {self.retrieve}", __name__, "", "")
# self.syscfg = {}
# cfgr = Configuration( )
# cfgr.setDeviceType(device_type)
# cfgr.setSystemCfgDict(init_para)
# for k,v in init_para.items():
# cfgr.setSystemCfgDict(v)
# try:
# cfgr.getCalConfiguration()
# except Exception as e:
# log.error(f"读取配置文件失败. \n {e}",__name__, "", "" )
# raise
# log.info(f"v: {cfgr.configuration}", __name__, "", "")
# self.syscfg.update({k:cfgr.cal_configuration})
# # log.warning(f"self.syscfg: {self.syscfg}", __name__, "", "")
# log.warning(f"self.syscfg 2: {self.syscfg[2].keys()}", __name__, "", "")
# # log.warning(f"self.syscfg 3: {self.syscfg[3].keys()}", __name__, "", "")
# log.info(f"传感器配置文件读取成功", __name__, "", "")
# self.alterStatus_0("传感器配置文件读取成功")
# self.onNotify("获取标定信息成功")
# self.calinfo_is_ok = True
# pass
def alterStatus_0(self,msg): def alterStatus_0(self,msg):
self.statusBar.SetStatusText( msg, 0 ) self.statusBar.SetStatusText( msg, 0 )

Loading…
Cancel
Save