ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

Python 3.6 exception #147

Closed MontyTHall closed 5 years ago

MontyTHall commented 6 years ago

Pyhton version Please write here the output of printing sys.version '3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]'

Platform information

Please write here the output of printing platform.platform() 'Windows-7-6.1.7601-SP1'

Numpy version

Please write here the output of printing numpy.__version__ 1.14.3

mdfreader version

Please write here the output of printing mdfreader.__version__ 2.7.5

Description

Please describe the issue here and eventually script used to use mdfreader

C:\Python36\python.exe C:/Users/xzcjml/PycharmProjects/untitled/main.py
Traceback (most recent call last):
  File "C:/Users/xzcjml/PycharmProjects/untitled/main.py", line 12, in <module>
    mdf = mdfreader.mdf(fileName)
  File "C:\Python36\lib\site-packages\mdfreader\mdf.py", line 155, in __init__
    compression=compression)
  File "C:\Python36\lib\site-packages\mdfreader\mdfreader.py", line 398, in read
    convertAfterRead, filterChannelNames, compression)
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1340, in read4
    self._convertAllChannel4()
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1455, in _convertAllChannel4
    [self._convertChannel4(channelName) for channelName in self]
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1455, in <listcomp>
    [self._convertChannel4(channelName) for channelName in self]
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1443, in _convertChannel4
    self.setChannelData(channelName, self._getChannelData4(channelName))
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1370, in _getChannelData4
    channelName, self.convert_tables)[channelName]
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1421, in _convertChannelData4
    vect = valueToTextConv(vect, conversion_parameter['cc_val'], conversion_parameter['cc_ref'])
  File "C:\Python36\lib\site-packages\mdfreader\mdf4reader.py", line 1905, in valueToTextConv
    if vect[Lindex] == vect[Lindex - 1]:  # same value as before, no need to look further
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Also mentionning version of mdf file will be helpfull (using mdfvalidator or mdfreader if functionnal for reading) 4.1. Generated by dSPACE control desk. print of issue related variables at the errors location and eventually mdfvalidator screenshots can help troubleshooting complicated issues

ratal commented 6 years ago

Hi, According to the error, vect seems not to be 1D array. Can you print vect when you have this issue ? (you can put a try: if.... except: print(vect)) Or find which channel is failing and confirm its structure/content with MDFValidator

MontyTHall commented 6 years ago

I'll get you the data. This works fine in python 2.7.

ratal commented 5 years ago

There is long time no feedback, closing the issue but you can still send the data, I will then reopen this issue.