Skip to content

Commit

Permalink
Update ascii doc link, fixed empty data in measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
JLipp committed Mar 11, 2024
1 parent 6eb1493 commit 6ce225b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parts (Teiletyp) and characteristics (Merkmale). As the ASCII files might alread
them as part of the characteristics described in the transfer file.

The package `aqdefreader` is based on the official
[Q-DAS ASCII transfer format manual](https://www.q-das.com/fileadmin/mediamanager/Datenformat_Dokumente/Q-DAS_ASCII-Transfer-Format_ENG_V12_ec.pdf) tranfer format released by Q-DAS GmbH.
[Q-DAS ASCII transfer format manual](https://training.q-das.de/fileadmin/mediamanager/Datenformat_Dokumente/Q-DAS_ASCII-Transfer-Format_ENG_V12_ec.pdf) tranfer format released by Q-DAS GmbH.

## Installation
The source code is currently hosted on GitHub at:
Expand Down
12 changes: 7 additions & 5 deletions aqdefreader/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(self, lines):
self.__error_count = 0

self.__get_lines(lines)
print("something")

def __get_lines(self, lines):
for line in lines:
Expand All @@ -46,8 +45,11 @@ def __parse_coded_line(self, line):
index = int(index)
has_id = True

# characterictics for all characteristics
if index == 0:
pass
# header - number of characteristics in file
if code[0:5] == "K0100":
elif code[0:5] == "K0100":
print(f"Count of characteristics in DFQ file: {value}")
# part information
elif code[0:2] == "K1":
Expand Down Expand Up @@ -115,7 +117,7 @@ def __parse_uncoded_measurements(self, line):

elements = data.split("\x14")
self.__characteristic = 0
if len(elements) >= 2:
if len(elements) >= 2 and str(elements[1]).strip():
self.__characteristic = int(elements[1])
if attributed == 1 and len(elements) >= 4:
self.__characteristic = int(elements[3])
Expand Down Expand Up @@ -149,9 +151,9 @@ def __extract_measurement_info(self, attributed, elements):

if len(elements) >= 1 + offset:
self.__value = float(elements[0 + offset])
if len(elements) >= 2 + offset:
if len(elements) >= 2 + offset and str(elements[1 + offset]).strip():
self.__characteristic = int(elements[1 + offset])
if len(elements) >= 3 + offset:
if len(elements) >= 3 + offset and str(elements[2 + offset]).strip():
self.__datetime = datetime.strptime(
elements[2 + offset], "%d.%m.%Y/%H:%M:%S"
)
Expand Down

0 comments on commit 6ce225b

Please sign in to comment.