In this session we will talk about the Jupiter notebook application.
When you install the latest version of Titan from the anaconda distribution Web site it includes Python
The Jupiter notebook and a number of useful packages.
Let us now discuss about the Jupiter notebook application a Jupiter notebook application is a solver
client application that allows us to edit and run notebook documents via a web browser.
And what is a notebook document a notebook.
Document is just like a file that letters write and execute Python code in a web browser.
And a Jupiter notebook app can be executed on a local desktop requiring no internet access.
Odd it can be installed on a remote cell but and access through the Internet the Jupiter notebook web
application combines three components.
One is the notebook web application and then we have a Kernan and notebook dock.
When you launch the Jupiter notebook application the first component that we see in the web browser
is the Jupiter notebook dashboard and the dashboard is like a control panel showing local files.
Say we have files like data types dot IP why and B and then list dot IP why and.
The Notebook dashboard allows us to open the notebook documents here or shutting down the kernels.
So what is a cone in a notebook kernel is a computational engine that executes decode contained in a
notebook document.
So the notebook document is a file whereas the Kernan is a process.
The kernel performs the computation and produces the results so the kernel it just seems snippet of
code from the notebook interface executes them and sent the output or possible errors back to the notebook
interface and the Jupiter notebook is not only for Python.
It can be used for other programming languages like odd Julia matlab and other languages as well.
And all the files the notebook documents are saved in Jason formatted text file with this extension.
Dot IP y and be next.
I'm going to now show how to launch the Jupiter notebook server from the command line.
So at the command prompt you need to type Jupiter space notebook and then hit enter in your Windows
system.
If this is your first time it is going to take a while after you give this command your browser will
open to the notebook dashboard automatically.
If this does not happen automatically.
So as you can see here the highlighted text.
Copy and paste this you are well into your browser when you connect for the first time.
So I'm gonna copy this you order along with the token key and paste it in the browser and after I have
pasted there you are all provided in the command line.
Here is the notebook dashboard and the notebook dashboard serves as a home page for the notebook.
As we have discussed before its main purpose is to display the notebooks and the files in the current
directory.
By default the files tab here is open and when you are in this tab you can display the different files
that you have done.
As we can see here next is the running tab and the running tab is used to see all of the running notebooks
along with their directories so currently I have no notebook open and so there are no files that are
running.
Create a notebook or a file to start working.
So for that click on the button you here and I have two kernels installed.
One is for Python 2 and the other is for Python 3 and I want to create a file for Python 3.
So let's choose Python 3.
And here is the notebook document and the notebook document contains the menu but the tool but and since
the cells that we see here so let us first give a title to our notebook document.
So I'm going to see Jupiter notebook class and then click on green name.
So here we have a title for the notebook.
Next coming to the court in here.
These courses are where you place your python code that you want to run.
And mark down cells are used for providing descriptions of the code and the steps that we are taking
and the type of discipline.
If you want to enter code that is Python caught in a cell by default decode type would be code.
If you want to enter text into your code sir you can choose the type.
Mark down so let's choose the type as code for this cell and all code that you write in a notebook will
be in this quarter.
We can write single lines or entire loops to complete functions let us write a print function in this
code.
Hello world is the text that I want to display using the print function.
So in order to execute the code in this cell you can go to the menu bird here and click on say and then
run cells.
So here you have your output displayed just below the input set.
So here we have output displayed.
We can change the code in an input cell and read on the cell as often as we like.
So for example I want to print the sum of two and three and then run this cell go to cell here at the
top and run choose run cells.
So here we have the output displayed in the output set.
And if you want to create a new cell you can click on shift and enter together to create a new set and
you can also use the buttons shift and enter in order to execute decode innocent.
I want to print the text in the cell.
I can use this shift and enter buttons to execute the code in the cell next in the notebook document
each of the codes has a line number assigned to it next.
Apart from typing your code in a code cell you can also add descriptions or text in a code set by changing
the type of the cell to mark down say for example if you want to add a title to the code that you're
going to enter you can use the single hash tag like this and then give a space and then enter your text.
Say I'm going to add the text title and then hit shift and enter.
So here's your title.
Say for example you want to add major headings in your notebook document.
You can use double hash tags and for that you first need to change the decode code type to mark down
and then use double hash tags and enter your text lunacy major headings and then execute this.
So you have your major headings beginning with two hash tags and if you want to have some subheadings
in your notebook document you can use three hash tags like this and then have your text your subheading
change your code typed or marked down and execute.
So this is how you can enter descriptive text into your notebook document.
Then you execute the code in a cell.
The code is executed within a cone and any output is returned back to the Senate which is to be displayed.
So every notebook runs a kernel.
Next the Jupiter notebook gives us several options to export our notebook say for example you can go
to the file menu here choose download as and weaken can board our Jupiter dot IP y and b notebook file
in two and not this static format including each daemon latex PDA of Mark down and so on.
Another function of the Jupiter notebook is the ability to create checkpoints by creating a checkpoint.
We are storing the current state of the notebook so that we can later on go back to this check point
and reward the changes which have been made to the notebook.
In the meantime so in order to create a checkpoint go to file and then and choose safe and checkpoint.
So here we have a text display last checkpoint.
A few seconds ago for this notebook document and if you want to shut down the Jupiter notebook app closing
the browser will not close the Jupiter notebook app in order to completely shut it down.
You can go to Y and then choose clothes and hide or alternately you can go to the notebook dashboard
in the notebook dashboard go to the tab running and here you have the list of notebook documents that
are running so we have the Jupiter notebook class dot IP y N.B. file that we were working on and if
you want to close the corner associated with this notebook you can click on shut down button as you
can see here for example if you want to interrupt a code that is taking too long you can use the Kernan
and click on the interrupt option in order to shut down a cone.