-
Notifications
You must be signed in to change notification settings - Fork 75
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
Can not read .mf4 file #77
Comments
Hi Meidland, |
Hi again! Now it worked better :) But I'm still having some issues. Input: from mdfreader import mdf my_object = mdf() Output: C:\code_projects\mdfreader\mdfenv\Scripts\python.exe C:/code_projects/mdfreader/main.py During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Hi Meidland, |
I guess you compiled dataRead and solved your issue (the python backup is not as robust) |
I'm having a similar issue. Don't know the exact problem. Traceback (most recent call last): |
I fixed it myself, but I'm not sure if my solution is correct. For some reason mdfinfo3.py", line 590, in read_tx_block An if condition fixes the problem. def read_tx_block(fid, pointer):
""" reads text block """
if pointer != 0 and pointer is not None:
fid.seek(pointer)
read_bytes = fid.read(4)
if read_bytes: # <--- I added this line
(block_type,block_size) = tx_struct.unpack(read_bytes)
text = unpack('{}s'.format(block_size - 4), fid.read(block_size - 4))[0]
return text.rstrip(b'\x00').decode('latin1', 'replace') # .encode('utf-8') Dunno, if my file is corrupt or not. Could you please clarify. Edit: |
@Nimi42 |
Looking in internet, empty return from read would mean either file is empty or pointer is at end of file. |
First of all, thank you for your quick reply. @ratal I might add that it is possible to open up the file with MDA. Since I could not find your mail address I did not send you the file though. @danielhrisca Edit: |
@ratal |
Well unfortunately I can't change the format in the recording tool, because I am not the one recording Also asammdf could not handle the 2.14 version either. It is possible to use MDA to convert the files, and use asammdf or mdfreader to read I was hoping the libs would be able to handle it. |
@Nimi42 |
My email address is [email protected] |
@ratal @danielhrisca from asammdf import MDF
reader = MDF(src)
reader.select(['VehV_v']) throws an exception with asammdf (2.7.1): File "C:\Users\mousavin\AppData\Roaming\Python\Python36\site-packages\asammdf\mdf.py", line 59, in __init__
raise MdfException(message.format(name, version))
asammdf.utils.MdfException: "C:\AppData\MF_RDE-Bewertung\Daten\20171020_HN-LI8220_Stadt_00001.dat" is not a supported MDF file; " " file version was found Edit: |
@Nimi42 |
Oh yes I see. But the values are still not correct. The same as with my quick fix above. I'm sorry for the trouble. |
np.set_printoptions(threshold=np.nan)
reader = MDF(os.path.join(root, f))
signal = reader.select(['Zeit'])
print(signal[0].samples) Prints: [ 1.08697600e+03 4.26298573e+04 3.08700774e+04 0.00000000e+00
0.00000000e+00 0.00000000e+00 ... ] But it should be: [ 4.246 5.238 6.238 7.238 8.23799 9.23799 ... ] Similarly with mdfreader |
issue reopened |
What application did you use to confirm those values? |
@Nimi42 |
Currently mdfreader is not able to read version 2.x of MDF. As it seems relatively simple from 3.x, it could be implemented but it will require a bit of time. |
Hello, I have a similar Problem that i get an error code when i read my mf4 file. Is there any solution to this? StopIteration Traceback (most recent call last) /usr/local/lib/python3.6/site-packages/asammdf/mdf.py in init(self, name, memory, version, callback) /usr/local/lib/python3.6/site-packages/asammdf/mdf_v4.py in init(self, name, memory, version, callback) /usr/local/lib/python3.6/site-packages/asammdf/mdf_v4.py in _read(self) StopIteration: |
Hi Ratal!
Firstly, thanks for the mdfreader module :)
So, I have an issue. I cannot read a mf4 file. The file has been validated with MDFValidator (Vector).
Tried to run it in Linux environment also.
Code:
from mdfreader import mdf4
my_object = mdf4()
my_object.read4(r'c:\temp\jonas\Epic.mf4')
Output:
Traceback (most recent call last):
File "C:/code_projects/mdfreader/main.py", line 4, in
my_object.read4(r'c:\temp\jonas\Epic.mf4')
File "C:\code_projects\mdfreader\mdfenv\lib\site-packages\mdfreader\mdf4reader.py", line 1393, in read4
buf.read(channelSet) # reads raw data from data block with DATA and DATABlock classes
File "C:\code_projects\mdfreader\mdfenv\lib\site-packages\mdfreader\mdf4reader.py", line 350, in read
self[recordID]['data'] = self.load(record, zip=None, nameList=channelSet, sortedFlag=True)
File "C:\code_projects\mdfreader\mdfenv\lib\site-packages\mdfreader\mdf4reader.py", line 387, in load
temps.loadHeader(self.fid, self.pointerTodata)
File "C:\code_projects\mdfreader\mdfenv\lib\site-packages\mdfreader\mdfinfo4.py", line 93, in loadHeader
fid.seek(pointer)
ValueError: seek of closed file
Thanks in advance!
The text was updated successfully, but these errors were encountered: