{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "605c6d64",
   "metadata": {},
   "source": [
    "#  Getting Started with Jupyter Notebooks"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "36a1cf38",
   "metadata": {},
   "source": [
    "In this notebook, you will find:\n",
    "\n",
    "1. Information about running ShapeWorks Jupyter notebook tutorials\n",
    "2. Basics shortcuts for Jupyter notebooks\n",
    "3. Resources to help you with notebooks"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "52974586",
   "metadata": {},
   "source": [
    "## ShapeWorks Jupyter Notebook Tutorials"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d64631ad",
   "metadata": {},
   "source": [
    "### What is Jupyter Notebook?\n",
    "\n",
    "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.\n",
    "\n",
    "The Jupyter Notebook combines three components:\n",
    "\n",
    "- **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. \n",
    "- **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. \n",
    "- **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 are `json` data with binary output encoded."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "994ee7f3",
   "metadata": {},
   "source": [
    "### Running a Jupyter notebook tutorial\n",
    "\n",
    "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.\n",
    "\n",
    "ShapeWorks also installs and enables for you \n",
    "- a spell checker extension for the text cells\n",
    "- a table of content extension to easily navigate notebooks\n",
    "\n",
    "To get the server started, all you need to do is \n",
    "- open up your terminal  \n",
    "- go to the folder where you would like to save your notebooks in\n",
    "- activate `shapeworks` environment by running `conda activate shapeworks`\n",
    "- launch the notebook server by running `jupyter notebook`\n",
    "\n",
    "**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.\n",
    "\n",
    "\n",
    "<p><video src=\"https://sci.utah.edu/~shapeworks/doc-resources/mp4s/jupyter-command.mp4\" autoplay muted loop controls style=\"width:100%\"></p>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3230354f",
   "metadata": {},
   "source": [
    "### Importing ShapeWorks\n",
    "\n",
    "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:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5e510752",
   "metadata": {},
   "outputs": [],
   "source": [
    "import shapeworks"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb718e4c",
   "metadata": {},
   "source": [
    "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?](http://sciinstitute.github.io/ShapeWorks/users/install.html) for more information. \n",
    "\n",
    "If you believe ShapeWorks is installed correctly but you are still unable to import it please [contact us.]( http://sciinstitute.github.io/ShapeWorks/about/contact.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7888dd41",
   "metadata": {},
   "source": [
    "## Notebook keyboard shortcuts\n",
    "\n",
    "- `Esc + H`: displays a complete list of keyboard shortcuts\n",
    "- `Esc + A`: insert new cell above the current cell\n",
    "- `Esc + B`: insert new cell below the current cell\n",
    "- `Esc + D + D`: delete current cell\n",
    "- `Esc + Z`: undo\n",
    "- `Shift + enter`: run current cell and move to next\n",
    "- To show a function's argument list (i.e., signature), use `(` then `shift-tab`\n",
    "- Use `shift-tab-tab` to show more help for a function\n",
    "- To show the help of a function, use `help(function)` or `function?`\n",
    "- To show all functions supported by an object, use `dot-tab` after the variable name"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8ad0389",
   "metadata": {},
   "source": [
    "## Jupyter Notebook Resources\n",
    "\n",
    "1. [Documentation provided by Jupyter Notebook](https://jupyter-notebook.readthedocs.io/en/stable/notebook.html)-Here you find all a comprehensive user documentation provided by the developers\n",
    "2. 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 :<br>\n",
    "    (a) [Stack Overflow](https://stackoverflow.com/questions/tagged/jupyter-notebook)<br>\n",
    "    (b) [Discourse](https://discourse.jupyter.org/)<br>\n",
    "    (c) [Stack Exchange](https://datascience.stackexchange.com/questions/tagged/jupyter)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "885a8b4b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
