Notebook support #415

Merged
merged 8 commits into from Jul 21, 2016

Conversation

Projects
None yet
4 participants
@prabhuramachandran
Member

prabhuramachandran commented Jul 19, 2016

Adds support for displaying Mayavi images or x3d scenes on the notebook. The x3d scenes allow one to fully interact with the scene in the notebook.

prabhuramachandran added some commits Jul 19, 2016

First cut of notebook support.
There are two modes supported, one is to dump PNG images for the scene
and the second (the default) is to use x3d output and x3dom.js to
render the scene.  This works very well.  This also adds the x3dom.js
file to Mayavi so users can view the data even when disconnected from
the internet.
@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 20, 2016

Member

Thanks @prabhuramachandran! Works like a charm.

screen shot 2016-07-20 at 16 47 09

Member

kitchoi commented Jul 20, 2016

Thanks @prabhuramachandran! Works like a charm.

screen shot 2016-07-20 at 16 47 09

mayavi/tools/notebook.py
+ yield count
+ count += 1
+
+counter = _counter()

This comment has been minimized.

@kitchoi

kitchoi Jul 20, 2016

Member
from itertools import counter as _counter
counter = _counter()

does the same thing

@kitchoi

kitchoi Jul 20, 2016

Member
from itertools import counter as _counter
counter = _counter()

does the same thing

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 20, 2016

Member

Good point, will use this instead, thanks.

@prabhuramachandran

prabhuramachandran Jul 20, 2016

Member

Good point, will use this instead, thanks.

mayavi/tools/notebook.py
+counter = _counter()
+
+def _fix_x3d_header(x3d):
+ id = 'scene_%d'%counter.next()

This comment has been minimized.

@kitchoi

kitchoi Jul 20, 2016

Member

Can counter be local to this function?

@kitchoi

kitchoi Jul 20, 2016

Member

Can counter be local to this function?

This comment has been minimized.

@prabhuramachandran

prabhuramachandran Jul 20, 2016

Member

Not sure it can in the way it is currently implemented.

@prabhuramachandran

prabhuramachandran Jul 20, 2016

Member

Not sure it can in the way it is currently implemented.

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 20, 2016

Member

On Mac, if I set backend to 'png' I get black images...but that's a separate issue #257
screen shot 2016-07-20 at 16 59 01

Member

kitchoi commented Jul 20, 2016

On Mac, if I set backend to 'png' I get black images...but that's a separate issue #257
screen shot 2016-07-20 at 16 59 01

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 20, 2016

Member

If the backend is not set correctly in the middle, the behaviour is also appropriate. 👍
screen shot 2016-07-20 at 17 02 23

Member

kitchoi commented Jul 20, 2016

If the backend is not set correctly in the middle, the behaviour is also appropriate. 👍
screen shot 2016-07-20 at 17 02 23

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 20, 2016

Member

One super minor comment on counter, which can be left as is. This PR looks good to merge to me. Thanks @prabhuramachandran

Member

kitchoi commented Jul 20, 2016

One super minor comment on counter, which can be left as is. This PR looks good to merge to me. Thanks @prabhuramachandran

@prabhuramachandran

This comment has been minimized.

Show comment
Hide comment
@prabhuramachandran

prabhuramachandran Jul 20, 2016

Member

@kitchoi -- thanks for the review and comments, as regards changing the backend, the recommended way to do it is to call mlab.init_notebook('png') and not directly set the _backend module global. It is safe to call it multiple times. I will update the docs about this as well.

Member

prabhuramachandran commented Jul 20, 2016

@kitchoi -- thanks for the review and comments, as regards changing the backend, the recommended way to do it is to call mlab.init_notebook('png') and not directly set the _backend module global. It is safe to call it multiple times. I will update the docs about this as well.

@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Jul 20, 2016

Current coverage is 45.99%

Merging #415 into master will increase coverage by 0.30%

@@             master       #415   diff @@
==========================================
  Files           255        256     +1   
  Lines         23213      23292    +79   
  Methods           0          0          
  Messages          0          0          
  Branches       3067       3074     +7   
==========================================
+ Hits          10606      10714   +108   
+ Misses        11886      11880     -6   
+ Partials        721        698    -23   

Powered by Codecov. Last updated by 6896aeb...9709f5a

codecov-io commented Jul 20, 2016

Current coverage is 45.99%

Merging #415 into master will increase coverage by 0.30%

@@             master       #415   diff @@
==========================================
  Files           255        256     +1   
  Lines         23213      23292    +79   
  Methods           0          0          
  Messages          0          0          
  Branches       3067       3074     +7   
==========================================
+ Hits          10606      10714   +108   
+ Misses        11886      11880     -6   
+ Partials        721        698    -23   

Powered by Codecov. Last updated by 6896aeb...9709f5a

prabhuramachandran added some commits Jul 21, 2016

@kitchoi

This comment has been minimized.

Show comment
Hide comment
@kitchoi

kitchoi Jul 21, 2016

Member

Thanks @prabhuramachandran! Merging.

Member

kitchoi commented Jul 21, 2016

Thanks @prabhuramachandran! Merging.

@kitchoi kitchoi merged commit 39397fb into enthought:master Jul 21, 2016

3 checks passed

codecov/project 45.99% (+0.30%) compared to 6896aeb
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@prabhuramachandran prabhuramachandran deleted the prabhuramachandran:notebook-support branch Jul 21, 2016

@nicoguaro

This comment has been minimized.

Show comment
Hide comment
@nicoguaro

nicoguaro Sep 27, 2016

Can you add that the Jupyter inclusion started with version 4.5? Also, can you specify what version of Jupyter did you use? I tried installing it but got an error

[InstallNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[InstallNBExtensionApp] CRITICAL | Unrecognized flag: '--py'

Can you add that the Jupyter inclusion started with version 4.5? Also, can you specify what version of Jupyter did you use? I tried installing it but got an error

[InstallNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[InstallNBExtensionApp] CRITICAL | Unrecognized flag: '--py'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment