-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Jupyter Tutorials #1640
Jupyter Tutorials #1640
Conversation
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
ipynb filter
…tdout; also added context manager for verbosity level
Some notebooks do not work because of missing files (fountain). Do I have to download them somewhere? |
@benjaminum Yes, it is stated in the |
OK, then it is just me too lazy to read the instructions. |
…ries; moved some examples to ipynb files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was able to build all the sphinx docs. Visually they look OK. Having the console output in the notebook is good but sometimes the output is way too long. Generating a scrollbox in the html output would help but I did not find a simple solution online. It feels like we should cope with that but maybe not in this PR.
Reviewed 65 of 85 files at r4, 39 of 39 files at r5.
Reviewable status: 103 of 108 files reviewed, 1 unresolved discussion (waiting on @benjaminum, @griegler, and @yxlao)
docs/conf.py, line 212 at r5 (raw file):
autodoc_member_order = "groupwise" # Copy jupyter notebooks and test data to tutorial folder
Just a question: do you think it is possible to do without copy such that notebooks don't need to be rebuild?
The build times are quite long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually implemented the context manager to only have debug output for selected statements. But yes, sometimes it could still get a bit long. I think we could capture the output and then strip it in another PR.
Regarding build times. If you build the jupyter notebooks first in the examples, then they are not executed in the sphinx script (after copying). Do you have another idea, something else in your mind?
Reviewable status: 103 of 108 files reviewed, 1 unresolved discussion (waiting on @griegler and @yxlao)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think now I understand the workflow for building the notebooks.
Reviewable status: 103 of 108 files reviewed, 1 unresolved discussion (waiting on @griegler and @yxlao)
limit text output in html files generated from notebooks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "It is hosted on a Google drive, and I would need to add another Python package to automatically download it, but it would be possible to automate it."
- To make it more robust, let's host the datasets in our google cloud bucket under
- The fountain dataset has been uploaded to
- I've sent the bucket instructions via Discord to @griegler
- "However, those settings are not yet available in the native
draw_geometries
because I do not know yet how to handle defaultNone
parameters inpybind11
. @yxlao any ideas."- Your current approach looks pretty reasonable. To take it a step further, we can bind the C++ code to
o3d.visualization._internal_draw_geometries
, and then write ao3d.visualization.draw_geometries
in pure Python, similar to what you did forjupyter_draw_geometries
.o3d.visualization.draw_geometries
can takeNone
and it callso3d.visualization._internal_draw_geometries
- Your current approach looks pretty reasonable. To take it a step further, we can bind the C++ code to
- Consider adding
matplotlib
as global default dependency insrc/Python/requirements.txt
, as many notebooks require it. - (can be done in future PR) Consider adding a
build
directory, such that the executed notebooks with outputs are stored in thebuild
directory, where the entire directory is ignored by git. In this way.- building docs won't change git status,
- and, we can potentially simplify the git logic in
git_enable_ipynb_filter.sh
- Looks like
TriangleMesh.CreateMeshCoordinateFrame
is failing the unit test - It may be useful to add
visible
parameter toDrawGeometries
, and hide the visualizer window during jupyter execution - It maybe useful to convert the
.sh
files to.py
files, so that the scripts can be run on windows - Regarding the broken examples, would it be OK to keep a list of them and exclude them in the current build? This PR is already quite big. I can help to address them together in a separate PR.
Reviewed 1 of 108 files at r6, 100 of 108 files at r7, 24 of 24 files at r8.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @griegler)
examples/Python/jupyter_run_all.sh, line 1 at r8 (raw file):
#!/bin/env bash
chmod +x
this file and add to git
Or, shall we convert this to .py
file, to enable this script on windows
examples/Python/jupyter_strip_output.sh, line 1 at r8 (raw file):
#!/bin/env bash
chmod +x
this file and add to git
Or, shall we convert this to .py
file, to enable this script on windows
src/Open3D/Visualization/Utility/DrawGeometry.cpp, line 53 at r8 (raw file):
bool mesh_show_back_face /* = false */) { Visualizer visualizer; if (visualizer.CreateVisualizerWindow(window_name, width, height, left,
it may be useful to add visible
parameter here, and hide the visualizer window during jupyter execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I changed the
color_map_optimization.ipynb
tutorial so that it automatically downloads the dataset if needed - Yes, it would be possible to change
draw_geometries
to a Python implementation, but this would break the compatibility with the C++ API? - Done
- Can be done in another PR. However, I am not sure how practical this solution is. We can discuss this separately.
- Fixed
- Done. It is now coupled with the
interactive
flag - Done
- Ok for me.
Reviewable status: 120 of 127 files reviewed, 4 unresolved discussions (waiting on @griegler and @yxlao)
examples/Python/jupyter_run_all.sh, line 1 at r8 (raw file):
Previously, yxlao (Yixing Lao) wrote…
chmod +x
this file and add to git
Or, shall we convert this to.py
file, to enable this script on windows
Done.
examples/Python/jupyter_strip_output.sh, line 1 at r8 (raw file):
Previously, yxlao (Yixing Lao) wrote…
chmod +x
this file and add to git
Or, shall we convert this to.py
file, to enable this script on windows
Done.
src/Open3D/Visualization/Utility/DrawGeometry.cpp, line 53 at r8 (raw file):
Previously, yxlao (Yixing Lao) wrote…
it may be useful to add
visible
parameter here, and hide the visualizer window during jupyter execution
Done.
@yxlao @germanros1987 @benjaminum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, can we skip those failing examples and keep its original docs? Later when those examples are fixed, we then create new ipynb docs.
Reviewed 9 of 9 files at r9.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @griegler and @yxlao)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My previous comment is not optimal since most tutorials require visualization. Does this work https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-services ?
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @griegler and @yxlao)
@yxlao the last link looks useful. Would you mind to try it out? |
Sure, I can give it a try |
hi @griegler , you may check out my PR at griegler#3 and merge here to trigger the CI if appropriate.
Example commands:
This PR also tries to enable |
More control over jupyter execution, enable xvfb
@yxlao Running it with |
1df7e8a
to
a5a4ab9
Compare
Issues
======
+ Solved 1
- Added 6
Complexity increasing per file
==============================
- examples/Python/open3d_tutorial.py 8
Clones added
============
- examples/Python/open3d_tutorial.py 8
- examples/Python/jupyter_run_all.py 1
- examples/Python/jupyter_strip_output.py 1
- examples/Python/Misc/meshes.py 6
See the complete overview on Codacy |
I changed most existing
Basic
andAdvanced
tutorials to Jupyter notebooks and integrated them vianbsphinx
. This builds up on #1640.Currently, this has three issues:
The stdout of the open3dI did improve theLog*
functions is not visualized in the cell outputs, but is only printed in the terminal running the jupyter instance.Logger
such that it can redirect the output to Python'sstdout
. In addition, I added a context manager to simply change the verbosity level for a code block.For some visualizations the default view point is very bad. I will have to extend theI added a customization to thedraw_geometries
function to directly pass a view point for that.draw_geometries
function in the jupyter notebooks. However, those settings are not yet available in the nativedraw_geometries
because I do not know yet how to handle defaultNone
parameters inpybind11
. @yxlao any ideas.I have moved/written tutorials for most existing examples in
examples/Python/Basic
andexamples/Python/Advanced
. There exist still a few.py
files in those folders without proper jupyter notebook tutorials. This can have a few reasons:.rst
files, e.g.,Advanced/*visualization*.py
Advanced/trajectory_io.py
Maybe @yxlao @qianyizh @germanros1987 can have a look at the remaining Python examples and add tutorials as needed.
This change is