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

Data was not rendering correctly due to low precision rounding in dat… #353

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

tstrutz
Copy link

@tstrutz tstrutz commented Jun 13, 2023

I've been using your library and have been happy with it for the exception of this case. For example with an X vector: [0 , 1e-9... ... 1e-6 - 1e-9, 1e-6] with 1ns steps, all of these coordinates will round to zero instead of keeping their true precise value, due to a hidden rounding feature in the library. This causes my plots to look something like this:

image

To fix, I increased precision of all data strings to 10 digits. Was using data sampled at about 0.8ns and it was putting the first 10000+ points at the zero X value instead of where they should have been placed. This commit fixes the issue (at probably a small performance impact). I imagine a better fix for this would to be making the setprecision usertunable. Is this hard to do with the current implementation?

This is what it looks like with the correct implementation.

image

I am using sampled data at over 1 billion samples per second (requires > 1ns x-axis accuracy), so this precision is potentially needed unless I convert the units, but it broke due to a feature I didn't even know was in the library!

Thanks,

Tim

…a_string. Increased precision of data strings to 10 digits. Was using data sampled at about 0.8ns and it was putting the first 10000+ points at the zero X value instead of where they should have been placed. This commit fixes the issue (at probably a small performance impact)
@alandefreitas
Copy link
Owner

At this point, setting a higher precision seems like a good solution. This is a limitation in the interaction with Gnuplot, but from the POV of the API, the user has already set the precision by providing the data.

@alandefreitas alandefreitas merged commit 62ef6b0 into alandefreitas:master Jun 13, 2023
4 checks passed
@alandefreitas
Copy link
Owner

Thanks ! :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants