In [12]:
# this is a notebook

In [13]:
# we can write code
print("hello world")


hello world

markdown

with links and formatting

  • and more formatting
  • and more formatting

Plotting


In [62]:
import numpy as np
import matplotlib.pyplot as plt

In [63]:
x = np.linspace(0,3, num=100)

In [64]:
y = x + np.random.normal(loc=0, scale=1, size=100)

In [65]:
plt.plot(x, y, 'k.')


Out[65]:
[<matplotlib.lines.Line2D at 0x7f40b7378c10>]

Help


In [68]:
np.linspace


Out[68]:
<function numpy.core.function_base.linspace>

In [69]:
np.linspace?

In [70]:
np.linspace??

In [73]:
#np.linspa#tab

In [72]:
#np.linspace(#shift tab)

Data


In [76]:
import pandas
import requests
import io

In [83]:
response = requests.get('http://publicwiki.deltares.nl/download/attachments/90415361/RondeHoep.csv')
response.text[:20]


Out[83]:
u'"","Date","Period","'

In [84]:
df = pandas.read_csv(io.StringIO(response.text))

In [87]:
df.head()


Out[87]:
Unnamed: 0 Date Period Month Location EC IR
0 1 25/10/2010 Autumn 10 RH1 47.862614 44.478155
1 2 14/2/2011 Winter 2 RH1 35.134578 51.520307
2 3 4/4/2011 Spring 4 RH1 43.660839 45.420540
3 4 2/5/2011 Spring 5 RH1 56.480512 45.802499
4 5 7/6/2011 Summer 6 RH1 219.040737 22.484707

5 rows × 7 columns


In [104]:
_ = df.groupby('Period').plot('EC', 'IR', style='.')
# http://publicwiki.deltares.nl/display/VWD/Home


System


In [107]:
!ls


calc.py		diskless.ipynb	   G0113773.JPG       gopro.ipynb      nearest.ipynb		    peopledetect.ipynb	README.md	   test.py
checkers.ipynb	esmf regrid.ipynb  gabor.ipynb	      idiomatic.ipynb  notebookdemo.ipynb	    __pycache__		seaice.ipynb	   widgets.ipynb
cropped.jpg	fluid.ipynb	   geos regrid.ipynb  LICENSE	       people_comfort_forces.ipynb  ravensburger.ipynb	soapexample.ipynb

In [111]:
files = !ls

In [112]:
[f for f in files if not f.endswith('.ipynb')]


Out[112]:
['calc.py',
 'cropped.jpg',
 'G0113773.JPG',
 'LICENSE',
 '__pycache__',
 'README.md',
 'test.py']

In [114]:
!less cropped.jpg


cropped.jpg JPEG 1448x1048 1448x1048+0+0 8-bit DirectClass 230KB 0.000u 0:00.000
(END)

Images


In [125]:
import IPython.display

In [135]:
IPython.display.Image('cropped.jpg', width=300)


Out[135]:

In [130]:
img = plt.imread('cropped.jpg')
plt.imshow(img)


Out[130]:
<matplotlib.image.AxesImage at 0x7f40a7f390d0>

In [124]:
import skimage.filter


Could not import matplotlib -- skimage.viewer not available.
/home/fedor/.virtualenvs/main/local/lib/python2.7/site-packages/skimage/viewer/qt/__init__.py:18: UserWarning: Could not import PyQt4: ImageViewer not available!
  warnings.warn("Could not import PyQt4: ImageViewer not available!")

In [134]:
# detect areas that are lighter than their surroundings
plt.imshow(skimage.filter.gaussian_filter(img, 6) - skimage.filter.gaussian_filter(img, 5))


Out[134]:
<matplotlib.image.AxesImage at 0x7f40a7cfec90>

In [141]:
from IPython.html.widgets import interact

def plot(sigma):
    plt.imshow(skimage.filter.gaussian_filter(img, sigma) - skimage.filter.gaussian_filter(img, sigma-1))

interact(plot, sigma=(3,7))



In [ ]: