Getting Started with Jupyter Notebooks¶
In this notebook, you will find:
- Information about running ShapeWorks Jupyter notebook tutorials
- Basics shortcuts for Jupyter notebooks
- Resources to help you with notebooks
ShapeWorks Jupyter Notebook Tutorials¶
What is Jupyter Notebook?¶
The Jupyter Notebook is a powerful tool to interactively prototype and present ideas and workflows. The Jupyter Notebook is an open source web application that enables you to create documents that contain runnable code, text, equations, and visualizations. Jupyter supports IPython kernel to allow you to write/prototype programs in Python. You can also use other kernels (e.g., R and Julia .. etc) with Jupyter notebooks.
The Jupyter Notebook combines three components:
- Notebook web app: An interactive web application to edit code in the browser, run code from the browser, see the results of running the code in the browser, create and use interactive widgets, and author narrative text and equations.
- Kernels: Processes launched by the notebook web app that runs code in a specific language and handles interactive widgets and tab completion. The default kernel runs Python code.
- Notebook documents: Documents that contain visible content in the notebook web app, including inputs and outputs of an interactive session, narrative text, equations, and images, and rich media representations of objects. Each notebook document has its own kernel. Notebook documents are files with a
.ipynb
extension Internally, notebook documents arejson
data with binary output encoded.
Running a Jupyter notebook tutorial¶
ShapeWorks installs Jupyter for you. The Jupyter Notebook is not included with Python. The install_shapeworks
script the comes with ShapeWorks (install_shapeworks.sh
for Mac OS and Linux and install_shapeworks.bat
for Window) installs Jupyter Notebook for you.
ShapeWorks also installs and enables for you
- a spell checker extension for the text cells
- a table of content extension to easily navigate notebooks
To get the server started, all you need to do is
- open up your terminal
- go to the folder where you would like to save your notebooks in
- activate
shapeworks
environment by runningconda activate shapeworks
- launch the notebook server by running
jupyter notebook
Note: Notebooks for demonstrating ShapeWorks tools are located in Examples/Python/notebooks/tutorials
. We recommend that you create a folder in Examples/Python/notebooks/
directory for your own notebooks.
Importing ShapeWorks¶
The Jupyter notebook tutorials require ShapeWorks to be installed so that it can be imported at the beginning of every notebook. Try running the following code cell to make sure ShapeWorks can be imported:
import shapeworks
If the cell above gave an error make sure you have run install_shapeworks
and have the shapeworks
conda environment activated. See How to Install ShapeWorks? for more information.
If you believe ShapeWorks is installed correctly but you are still unable to import it please contact us.
Notebook keyboard shortcuts¶
Esc + H
: displays a complete list of keyboard shortcutsEsc + A
: insert new cell above the current cellEsc + B
: insert new cell below the current cellEsc + D + D
: delete current cellEsc + Z
: undoShift + enter
: run current cell and move to next- To show a function's argument list (i.e., signature), use
(
thenshift-tab
- Use
shift-tab-tab
to show more help for a function - To show the help of a function, use
help(function)
orfunction?
- To show all functions supported by an object, use
dot-tab
after the variable name
Jupyter Notebook Resources¶
- Documentation provided by Jupyter Notebook-Here you find all a comprehensive user documentation provided by the developers
- Jupyter notebooks are widely used by the python community and you can find many videos and blogs for new users.If you are facing any specific errors while starting and running the notebooks, please check out the following resources :
(a) Stack Overflow
(b) Discourse
(c) Stack Exchange