Skip to content

FIX: Fix set_range#735

Merged
prabhuramachandran merged 2 commits into
enthought:masterfrom
larsoner:set_range
Nov 16, 2018
Merged

FIX: Fix set_range#735
prabhuramachandran merged 2 commits into
enthought:masterfrom
larsoner:set_range

Conversation

@larsoner
Copy link
Copy Markdown
Collaborator

In my scripts I kept seeing things like:

ERROR: In /work/standalone-x64-build/VTK-source/Common/Core/vtkLookupTable.cxx, line 143                                                                                            
vtkLookupTable (0x5a21890): Bad table range: [6.42653e-11, 2.01495e-11]

Turns out it's because internally the code somewhere does essentially:

self.vmin = vmin
self.vmax = vmax

The problem is that the first set causes a trait notification, and can lead to the condition in _vmin_changed that self.vmin is not None but self.vmax is None; and if the max of the data is less than self.vmin you end up in lut_manager trying to set things incorrectly.

This puts some sort of fix in both places just to be safe.

@larsoner
Copy link
Copy Markdown
Collaborator Author

Pushed a test that fails if the changes from mayavi/tools/modules.py are omitted (it fails at the assert value[0] <= value[1] line)

@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 13, 2018

Codecov Report

Merging #735 into master will increase coverage by 0.04%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #735      +/-   ##
==========================================
+ Coverage   51.77%   51.81%   +0.04%     
==========================================
  Files         259      259              
  Lines       23424    23429       +5     
  Branches     3200     3202       +2     
==========================================
+ Hits        12127    12139      +12     
+ Misses      10509    10502       -7     
  Partials      788      788
Impacted Files Coverage Δ
mayavi/core/lut_manager.py 56.58% <100%> (+0.86%) ⬆️
mayavi/tools/modules.py 79.94% <50%> (+1.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3fc352...e409f7f. Read the comment docs.

Copy link
Copy Markdown
Member

@prabhuramachandran prabhuramachandran left a comment

Choose a reason for hiding this comment

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

Thanks, just a few minor questions that would be nice to have answered before this is merged.

Comment thread mayavi/core/lut_manager.py
Comment thread mayavi/tests/test_mlab_integration.py
@prabhuramachandran prabhuramachandran merged commit 7f28229 into enthought:master Nov 16, 2018
@larsoner larsoner deleted the set_range branch November 16, 2018 19:55
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.

3 participants