CGO 01-1: Introduction to Jupyter

Jupyter Notebookのファイルをここからダウンロードしてください。

CGO 01-1: Introduction to Jupyter

Small example showing off some things that are possible with python and jupyter notebook as an introduction to the class.

# This sets the matplotlib figures to be inline
%matplotlib inline
# Include some important libraries
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import convolve2d
# Create a random 50 by 50 pixel image and show it
I = np.random.randn(50,50)
plt.imshow(I)
# We convolve it with a 3 by 3 all one filter. This is a simple blur filter.
F = np.ones((3,3))
F /= F.sum() # normalize it to sum 1
O = convolve2d( I, F ) # convolve the original image with it
plt.imshow(O) # show the convolved image
# List all the programs and libraries in the conda installation
%system conda list
# Example of getting the help for a function from python
help( np.ones )