Welcome to the T32 Statistics Demos. These demos are all written using Jupyter/Python which runs "Notebooks" in your web browser. A notebook consists of "cells" containing text, Python code, or output.
If you look above, you will see a row consisting of buttons and pull-down menus. The most important button is the play button. Each time you press this button, you will step from cell to cell in the Notebook. This may include executing code and generating output.
Python code is represented by grey cells, like the one below. Click on the "run cell" button, until you step through the cell and you see the "Hello World" output.
print('Hello world')
Hello world
You can generally ignore the code in these cells, unless you're interested in using it as the basis for your own code (see Working Locally below). However, you may still need to run the cells to see the example output.
If you want to play all cells with one press, look for the right-most button that looks like two downward arrows, Clicking on this button will reset the notebook and run all cells. Alternatively, or if you don't have that button in your tool-bar, use the "Cell" pull-down menu and select "Run All".
Some cells can have interactive code in it. When run, it may create a graph with slides, buttons, or other widgets you can use to interact with it. Try the cell below...
%matplotlib inline
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
import matplotlib.pyplot as plt
import numpy as np
import math
t = np.arange(0, 2*math.pi, 0.01)
def showSinWave(frequency):
y = np.sin(frequency * t)
plt.plot(t,y)
plt.show()
interact(showSinWave, frequency=widgets.FloatSlider(min=1.0, max=20.0, step=0.1, value=2.0));
interactive(children=(FloatSlider(value=2.0, description='frequency', max=20.0, min=1.0), Output()), _dom_clas…
You can also click on the small "x" above the graph to close the output. This can save resources if the interactive graph does a lot of work.
You can use the "File" pull-down menu to download a notebook to your computer. You can then run it on your machine with your data, or make changes to the notebook and not lose them when you end your session.