successfactory / aqdef-reader

Python module to read DFQ files in the Q-DAS ASCII transfer format
Apache License 2.0
4 stars 3 forks source link

Incompatibility to characteristics with index "0" #3

Open PanAmFlo opened 1 month ago

PanAmFlo commented 1 month ago

Snippet from DFQ file:

K0100 75 K1001 F444010250_Foerdermodul K1002 K1003 K1004 K1007 K1041 K1053 F444010250_439_0023 K1081 K1086 K1101 QMM3 K1201 531458 K1202 CON_2014_G2 K1900 K2004/0 0 K2005/0 3 K2007/0 K2011/0 K2013/0 0.0001 K2022/0 4 K2142/0 mm K2301/0 K2302/0 K2303/0 QMM3 K2306/0 QMM3 K2342/0 F444010250_Foerdermodul K2343/0 2. Oktober 2019 13 K2344/0 Max Muster K2401/0 531458 K2402/0 CON_2014_G2 K2406/0 Carl Zeiss Oberkochen K8500/0 3 K2001/1 1 K2002/1 1_21±0,3_Z K2003/1 Distanz K2008/1 K2009/1 200 K2030/1 K2031/1 K2100/1 21.000000 ...

Error output when reading this file:

Count of characteristics in DFQ file: 75 Traceback (most recent call last): File "C:\Users\max\Documents\Visual Studio Code\AQDEF-reader.py", line 37, in dfq = aqdefreader.read_dfq_file(rpath) File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\aqdefreader\operations.py", line 23, in read_dfq_file return DfqFile(lines) File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\aqdefreader\file.py", line 28, in init self.get_lines(lines) File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\aqdefreader\file.py", line 36, in __get_lines self.parse_uncoded_measurements(line) File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\aqdefreader\file.py", line 105, in parse_uncoded_measurements in self.parts[self.part_index] File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\aqdefreader\part.py", line 26, in get_characteristic_by_index return self.__characteristic[index - 1] IndexError: list index out of range

What roughly could happen: parse_coded_line(line) quits work when trying to read characteristics with index 0 (eg. K2004/0). That means, only the first few lines (without index) got read. After that, when calling parse_uncoded_measurements(line) -> get_characteristic_by_index(index), the count of measurements and the count of characteristics missmatch and the error occurs.

MartinN711 commented 1 month ago

Same issue here.

A fix would be very appreciated!