ratal / mdfreader

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

CSV export without empty row between data? #195

Open ecalpy opened 3 years ago

ecalpy commented 3 years ago

To fix this, this line from mdfreader.py needs to change to this:

f = open(filename, "wt", encoding=encoding, newline='')

Originally posted by @cristi-neagu in https://github.com/ratal/mdfreader/issues/135#issuecomment-368018768

Hello, Was trying to reopen this issue from 2018, but I was unsuccessful. I tried the suggested modification to mdfreader.py, but my csv exports still contain empty rows between data points.

Can anyone please assist?

Thanks! Ecalpy

danielhrisca commented 3 years ago

With the latest code (v 4.1) the line is this https://github.com/ratal/mdfreader/blob/master/mdfreader/mdfreader.py#L834

            f = open(file_name, "wt", encoding=encoding, newline="")

This works on my setup

ecalpy commented 3 years ago

Thanks Daniel,

Somehow it worked for me now and it did not the other day. Thanks!

Do you know if there's also a function to start from 0 on the time array (similar to yours?) I'm comparing for mass file conversions, so timing is important.

best, ecalpy

On Tue, Mar 23, 2021 at 9:47 AM Daniel Hrisca @.***> wrote:

With the latest code (v 4.1) the line is this https://github.com/ratal/mdfreader/blob/master/mdfreader/mdfreader.py#L834

        f = open(file_name, "wt", encoding=encoding, newline="")

This works on my setup

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ratal/mdfreader/issues/195#issuecomment-805059334, or unsubscribe https://github.com/notifications/unsubscribe-auth/APKP2DUWEYW7SC2PLRWRUU3TFDA2FANCNFSM4ZVMBIJQ .

-- Best regards,

Ericson Calderon (714) 209-3671

ratal commented 3 years ago

Thanks Daniel :) I do not get this issue for Windows and Linux.. wondering why you need this , newline="" For your time starting at 0, mdfreader is only reading the data that is in your file, but difficult to adjust to what you expect. It seems your logger has some latency with the trigger for recording. Master channel could be based not only on time but also angle, distance, etc. what makes most sense then ? If you want to readjust the starting time to 0, you could add a new row at beginning but you will have to check each channel for what makes sense as initial condition.

ecalpy commented 3 years ago

Thank you both for your AWESOME packages!

I needed to get rid of the empty rows between for those who have to utilize these files (for users without software to look at this data). Simply easier to work with for them.

Good point about the latency regarding the time. It’s not going to be an issue in the end.

Additionally, could my initial problem have been from using single vs. double quotes in that function? Never experienced that but if I recall, I tried single.

Best regards, ecalpy

On Mar 24, 2021, at 13:07, Aymeric Rateau @.***> wrote:

 Thanks Daniel :) I do not get this issue for Windows and Linux.. wondering why you need this , newline="" For your time starting at 0, mdfreader is only reading the data that is in your file, but difficult to adjust to what you expect. It seems your logger has some latency with the trigger for recording. Master channel could be based not only on time but also angle, distance, etc. what makes most sense then ? If you want to readjust the starting time to 0, you could add a new row at beginning but you will have to check each channel for what makes sense as initial condition.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.