In [2]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [3]:
path = "/PATH/lfw/Aaron_Eckhart/Aaron_Eckhart_0001.jpg"
ae = imread(path)
imshow(ae)


Out[3]:
<matplotlib.image.AxesImage at 0x1086525d0>

In [5]:
tmpPath = "/tmp/aeGray.jpg"
aeGary = imread(tmpPath)
imshow(aeGary, cmap=plt.cm.gray)


Out[5]:
<matplotlib.image.AxesImage at 0x108d3e650>

In [7]:
pc = np.loadtxt("/tmp/pc.csv", delimiter=",")
print(pc.shape)


(2500, 10)

In [8]:
def plot_gallery(images, h, w, n_row=2, n_col=5):
    """Helper function to plot a gallery of portraits"""
    plt.figure(figsize=(1.8 * n_col, 2.4 * n_row))
    plt.subplots_adjust(bottom=0, left=.01, right=.99, top=.90, hspace=.35)
    for i in range(n_row * n_col):
        plt.subplot(n_row, n_col, i + 1)
        plt.imshow(images[:, i].reshape((h, w)), cmap=plt.cm.gray)
        plt.title("Eigenface %d" % (i + 1), size=12)
        plt.xticks(())
        plt.yticks(())

In [9]:
plot_gallery(pc, 50, 50)



In [19]:
s = np.loadtxt("/tmp/s.csv", delimiter=",")
print(s.shape)
plot(s)


(300,)
Out[19]:
[<matplotlib.lines.Line2D at 0x108fe74d0>]

In [23]:
plot(cumsum(s))
plt.yscale('log')