Sample IPython Notebook

Setup

  1. Import Libraries
  2. Tell Matplotlib to Put Plots Inline in this Notebook

In [2]:
# Tell notebook to put plots inline
%matplotlib inline
import numpy as np  # numerics library
import matplotlib.pyplot as plt # plotting library

In [3]:
# Sample plot
x = np.arange(1024)
plt.plot(x)


Out[3]:
[<matplotlib.lines.Line2D at 0x7fe2f804ef90>]

In [4]:
import pysample
p = pysample.pysample()


############## LOADING LIBRARY ####################

############# CREATING INSTANCE ###################

In [5]:
print help(p)


Help on instance of pysample in module pysample:

class pysample
 |  Methods defined here:
 |  
 |  __init__(self)
 |  
 |  add(self, x, y)
 |  
 |  cleanup(self)
 |  
 |  init_library(self)

None

In [6]:
x = np.arange(12, dtype=np.double)
y = np.arange(12, dtype=np.double)

In [7]:
z = p.add(x,y)


############# CALLING FUNCTIONS ###################

In [8]:
print x


[  0.   1.   2.   3.   4.   5.   6.   7.   8.   9.  10.  11.]

In [9]:
print y


[  0.   1.   2.   3.   4.   5.   6.   7.   8.   9.  10.  11.]

In [10]:
print z


[  0.   2.   4.   6.   8.  10.  12.  14.  16.  18.  20.  22.]

In [11]:
p.cleanup()


############# DELETING INSTANCE ###################

In [11]: