将datalogger记录文件转换为canalyser可读取.asc文件

import os
import time
# New add feature, use this to list all *.mel file in current folder, Ver 0.80 2014-1-21 by Homer
import glob


# Redirection the work space path.
path_cwd = os.getcwd()
os.chdir(path_cwd)


# Use a list content all *.mel, Ver 0.80 2014-1-21 by Homer
filelist = glob.glob("090003.mel")


# Need new for each_line in filelist .......... Do it!
print(filelist)


# Use the same CANalyzer ASC file head & tail
# Modify the routine to get the real measurement time. Homer 2014/8/11
CANalyzer_ASC_file_time = ""
CANalyzer_ASC_file_Head1 = "date "
CANalyzer_ASC_file_Head2 = "base hex  timestamps absolute"
CANalyzer_ASC_file_Head3 = "internal events logged"
CANalyzer_ASC_file_Head4 = "// version 7.2.0"
CANalyzer_ASC_file_Head5 = "Begin Triggerblock "
CANalyzer_ASC_file_Tail = "End TriggerBlock"


# Start get the PGN list
# New modify here, ergodic whole folder do all convert in one time.
try:
    for file_selected_name in filelist:
        # Create new folder for split data. Of couse, this folder name use system time as part of it.
        folder_curr = time.strftime("%Y%m%d_%H%M%S")+"_Split_Data_"+os.path.splitext(file_selected_name)[0]
        # Define new sub-folder "Split_Data" if it is not exist
        if not os.path.exists(folder_curr):
            os.mkdir(folder_curr)
        
        #
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值