Skip to content
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

Missing data after .to_dataframe() call, interference in plotting signals with matplotlib.pyplot and mdf4 #362

Closed
RobinSaam opened this issue May 6, 2020 · 7 comments

Comments

@RobinSaam
Copy link

Python version 3.8

from asammdf import MDF
import matplotlib.pyplot as plt

data = MDF(filename)
pandas = data.to_dataframe()

#plot1
plt.plot(pandas["ESP_v_Signal"].index, pandas["ESP_v_Signal"].values)
plt.show()

pandas = data.get_group(1)

#plot2
plt.plot(pandas["ESP_v_Signal"].index, pandas["ESP_v_Signal"].values)
plt.show()

#plot3
plt.plot(pandas["ESP_v_Signal"].values)
plt.show()

#plot4
plt.plot(data.get("ESP_v_Signal").timestamps, data.get("ESP_v_Signal").samples)
plt.show()

#plot5
plt.plot(data.get("ESP_v_Signal").samples)
plt.show()

Code

MDF version

MDF4 File: 4.10
MDF3 File: 3.30

Description

Hello guys! My problem is that I want to extract the data out of a mdf file. After that I convert them to a pandas dataframe object with .to_dataframe()-function.

My mdf file consist of two groups with a sample rate of 100Hz and 1000Hz. If I chose a *.mdf4 file all of the date after around 100s will be the same as the previous. Example: speed at 80s: 0 km/h, all the values after that point in time will be 0 km/h as well even do the measurement goes on for 30 minutes or so (see Photos/MDF4 File/plot1). The correct output would be Photos/MDF4 File/plot3 or plot5. With Vector Canape I get the same results as plot3 and plot5. If I then extract the samples with data.get(signal)
the values will not be 10 km/h and represent the actual value at that time.

Also I get that weird interference at plot 2 and 4.

If I do the same with a *.mdf3 file, I will not get that “error” at all with the same approach.

Photos

MDF4 File

Plot3 and Plot5 should be the output for the rest as well.

plot1 complete view

plot1_complete

plot1 zoomed view

plot1_zoom

plot2 complete view

plot2

plot3 complete view

plot3

plot4 complete view

plot4

plot5 complete view

plot5

MDF3 File

plot1 complete view

mdf3_plot1_complete

plot2 complete view

mdf3_plot2

plot3 complete view

mdf3_plot3

plot4 complete view

mdf3_plot4

plot5 complete view

mdf3_plot5

@danielhrisca
Copy link
Owner

can you run this first

mdf = MDF(filename)
for i, gp in enumerate(mdf.groups):
    print(i, mdf.get_master(i))

@RobinSaam
Copy link
Author

0 [-1.41525000e-01 -1.31525000e-01 -1.21525000e-01 ... 4.02530848e+03
4.02531848e+03 4.02532848e+03]
1 [0.00000e+00 1.00000e-02 2.00000e-02 ... 4.02545e+03 4.02546e+03
4.02547e+03]

This is the output for the mdf4 file, each containing nearly 400.000 values.

@danielhrisca
Copy link
Owner

what is you asammdf version?

import asammdf
print(asammdf.__version__)

@RobinSaam
Copy link
Author

5.19.1

@danielhrisca
Copy link
Owner

I'm afraid I'm unable to reproduce the error with my synthetic file.

Can you scramble and send the file for analysis? See https://asammdf.readthedocs.io/en/latest/api.html#asammdf.mdf.MDF.scramble

@RobinSaam
Copy link
Author

I send you an e-mail with the link to a repository.

@danielhrisca
Copy link
Owner

Thank you for the file Robin. I was able to find the error source quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants