Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ミリ秒を修正 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ dmypy.json

/.idea
.vscode/settings.json
input
output
10 changes: 6 additions & 4 deletions txtToCsv.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2021. 楊鵬. All Rights Reserved.
#!/usr/bin/env python3
# Copyright (c) 2023. 楊鵬. All Rights Reserved.

from datetime import datetime
import sys
Expand Down Expand Up @@ -97,7 +98,7 @@ def create_data_from_file(file_name, keyword, device_code):
data_json = {'TIME': []}
keys = []
i = 0
index = KEYWORD_LIST.index(keyword);
index = KEYWORD_LIST.index(keyword)

if index == -1:
print('can not found keyword from file name...')
Expand All @@ -112,7 +113,7 @@ def create_data_from_file(file_name, keyword, device_code):
if (key == 'ABS_MT_PRESSURE' and row[VALUE_FROM:VALUE_TO] == '00000000') or (
key == 'ABS_MT_TRACKING_ID' and row[VALUE_FROM:VALUE_TO] == 'ffffffff'):
continue
data_json['TIME'].append(str.strip(row[TIMESTAMP_FROM:TIMESTAMP_TO]))

# 生データに項目名及び順番を取得
if not (key in keys):
keys.append(key)
Expand Down Expand Up @@ -141,6 +142,7 @@ def create_data_from_file(file_name, keyword, device_code):
i += 1

if i == len(keys) and key == EVENT_STOP_FLAG:
data_json['TIME'].append(str.strip(row[TIMESTAMP_FROM:TIMESTAMP_TO]))
i = 0
if len(keys) == 0:
print('device_code:', device_code, 'is missed...')
Expand Down Expand Up @@ -168,7 +170,7 @@ def data_convert(data_json, keys, user_id):
# 行データ
row_data = []
rows = []
max_len = 0;
max_len = 0
for i in range(event_count_all):
event_count_in_row += 1
for col in COLUMNS:
Expand Down