A test notebook by Nathan Whitehead Copyright 2015
This notebook is designed to test the styling and functionality of Pineapple. You are reading introductory text right now.
Pineapple is a customized build of Jupyter (formerly known as IPython) designed as an easy way to get started with scientific computing.
It has a list of features:
Currently Pineapple runs on:
There are other markdown features you can use, for example you can do inline code to indicate that x is a variable. The function get_ready is set to True until it gets reset to false.
You can also put code within markdown (will not be runnable). Here is the broken version:
def f(x):
return f(x)
to do f:
f
Do not run this code, it will smash your stack.
You can also include links to http://news.ycombinator.com places with or without descriptive text.
In [11]:
asdfasdfasdsdssfsdssdfsdf
Out[11]:
Are you impressed yet?
Maybe the next one will be more impressive.
In [2]:
%cd
Notice that the working directory is set to your home directory by default.
In [5]:
from IPython.display import Image
Image(filename='projects/pineapple/data/images/Pineapple-256.png')
Out[5]:
Of course you can also do inline markdown images if you want.
Using special markdown syntax.
Or just good ol' HTML5.
Here it is different, the URL is relative to the notebook file. Much nicer in my opinion.
Let's see what versions of libraries we have.
In [7]:
import sys
print(sys.version)
In [11]:
from numpy import *
a = arange(9).reshape(3, 3); a
Out[11]:
In [13]:
a.dot(a)
Out[13]:
In [1]:
print('hello')
In [6]:
from IPython.core.display import HTML
HTML('<b>hello</b>')
Out[6]:
In [18]:
def f(x):
return HTML("<i>{}</i> waa".format(x))
f('Simon')
Out[18]:
In [1]:
%%html
<i>This is italics</i>
In [6]:
class Fancy(object):
def __init__(self, text):
self.text = text
def __repr_html__(self):
return "<h3>{}</h3>".format(self.text)
Fancy("Nathan")
Out[6]:
In [8]:
import numpy as np
maxtime = 3
f1 = 220.0
f2 = 224.0
rate = 8000.0
L = 3
times = np.linspace(0, L, rate*L)
signal = np.sin(2*np.pi*f1*times) + np.sin(2*np.pi*f2*times)
from IPython.display import Audio
Audio(data=signal, rate=rate)
Out[8]:
In [10]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['figure.figsize'] = (10.0, 8.0)
plt.figure()
x = np.linspace(0, 3*np.pi, 500)
plt.plot(x,np.sin(np.sin(1.0*x) + x))
plt.title('Phase Modulation plot')
plt.show()
In [ ]: