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

Handle streamtube coordinates in string format and handle different data orders in isosurface and volume #4431

Merged
merged 11 commits into from
Dec 30, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 18, 2019

Fixes #4427:
Whereas raw x, y and z values were used in streamtube calc step, in order to find the order of data, it was necessary to ensure casting to numbers before comparing two values.
Before
After

And fixes #4440:
Similar to #4271, this PR fixed the data cube order issue so that the value as well as x, y and z arrays could be filled in different orders.
Before
After

@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable regression this used to work labels Dec 18, 2019
@@ -206,6 +206,9 @@ function distinctVals(col) {
function filter(arr, len) {
if(len === undefined) len = arr.length;

// no need for casting typed arrays to numbers
if(Lib.isTypedArray(arr)) return arr.slice(0, len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use arr.subarray() for typed arrays, as .slice isn't supported in older browsers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.
Wondering if we need to slice the array at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slice (or subarry) is needed for distictVals to work correctly.
But it may be better not to slice if the length is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it may be better not to slice if the length is correct.

that could be a nice optimisation for typed arrays, but for regular arrays we'll need to slice in general to cast numerical-strings items w/o mutating.

- computed trace._len and process grid at the start of calc
- apply subarray instead of slice for typed arrays
- improve streamtube jasmine test
- add image tests for various grid fill orders
- add jasmine tests for various grid fill orders and data types
@archmoj archmoj changed the title Handle streamtube coordinates in string format Handle streamtube coordinates in string format and handle different data orders in isosurface and volume Dec 24, 2019
@archmoj archmoj added this to the v1.52.0 milestone Dec 25, 2019
…re them at trace._x etc.

- rename previous trace._x, _y, _z & _intensity as well as trace._i, _j & _k to trace._meshX, etc. to avoid name conflicts
@etpinard
Copy link
Contributor

Nice job @archmoj - this PR is looking very nice now, one commit away from merging.

@etpinard
Copy link
Contributor

Beautiful fix!! Thanks very much for bringing some sanity into streamtube-land

💃 💃 💃

@archmoj archmoj merged commit ed26d23 into master Dec 30, 2019
@archmoj archmoj deleted the fix4427-streamtube-string-coords branch December 30, 2019 16:11
@jdamiba jdamiba mentioned this pull request Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken regression this used to work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Isosurface and volume expecting certain input data order Streamtube problem input string numbers
2 participants