In [1]:
%matplotlib inline
In [2]:
import matplotlib.pyplot as plt
import csv
import numpy as np
In [3]:
WIDTH = 128
HEIGHT = 64
print WIDTH*HEIGHT
In [91]:
# list the csv files we can import
import os
[filename for filename in os.listdir('./') if filename.find('.csv') >= 0 ]
Out[91]:
In [93]:
with open('simplecpy.csv','r') as csvfile_simplecpy:
plot_simplecpy = csv.reader(csvfile_simplecpy, delimiter=',')
simplecpy_list = list( list(rec) for rec in plot_simplecpy )
with open('addr01.csv','r') as csvfile_addr01:
plot_addr01 = csv.reader(csvfile_addr01, delimiter=',')
addr01_list = list( list(rec) for rec in plot_addr01 )
with open('addlrin.csv','r') as csvfile_addlrin:
plot_addlrin = csv.reader(csvfile_addlrin, delimiter=',')
addlrin_list = list( list(rec) for rec in plot_addlrin )
with open('addlrout.csv','r') as csvfile_addlrout:
plot_addlrout = csv.reader(csvfile_addlrout, delimiter=',')
addlrout_list = list( list(rec) for rec in plot_addlrout )
with open('addr_p.csv','r') as csvfile_addr_p:
plot_addr_p = csv.reader(csvfile_addr_p, delimiter=',')
addr_p_list = list( list(rec) for rec in plot_addr_p )
with open('addrxyf2_u_x.csv','r') as csvfile_addrxyf2_u_x:
plot_addrxyf2_u_x = csv.reader(csvfile_addrxyf2_u_x, delimiter=',')
addrxyf2_u_x_list = list( list(rec) for rec in plot_addrxyf2_u_x )
with open('addrxyf2_u_y.csv','r') as csvfile_addrxyf2_u_y:
plot_addrxyf2_u_y = csv.reader(csvfile_addrxyf2_u_y, delimiter=',')
addrxyf2_u_y_list = list( list(rec) for rec in plot_addrxyf2_u_y )
with open('addrxyf2_u_out_x.csv','r') as csvfile_addrxyf2_u_out_x:
plot_addrxyf2_u_out_x = csv.reader(csvfile_addrxyf2_u_out_x, delimiter=',')
addrxyf2_u_out_x_list = list( list(rec) for rec in plot_addrxyf2_u_out_x )
with open('addrxyf2_u_out_y.csv','r') as csvfile_addrxyf2_u_out_y:
plot_addrxyf2_u_out_y = csv.reader(csvfile_addrxyf2_u_out_y, delimiter=',')
addrxyf2_u_out_y_list = list( list(rec) for rec in plot_addrxyf2_u_out_y )
In [94]:
csvfile_simplecpy.close()
csvfile_addr01.close()
csvfile_addlrin.close()
csvfile_addlrout.close()
csvfile_addr_p.close()
csvfile_addrxyf2_u_x.close()
csvfile_addrxyf2_u_y.close()
csvfile_addrxyf2_u_out_x.close()
csvfile_addrxyf2_u_out_y.close()
In [95]:
# convert the strings in the list of lists into floats
simplecpy_list = [[float(ele) for ele in row] for row in simplecpy_list]
addr01_list = [[float(ele) for ele in row] for row in addr01_list]
addlrin_list = [[float(ele) for ele in row] for row in addlrin_list]
addlrout_list = [[float(ele) for ele in row] for row in addlrout_list]
addr_p_list = [[float(ele) for ele in row] for row in addr_p_list]
addrxyf2_u_x_list = [[float(ele) for ele in row] for row in addrxyf2_u_x_list]
addrxyf2_u_y_list = [[float(ele) for ele in row] for row in addrxyf2_u_y_list]
addrxyf2_u_out_x_list = [[float(ele) for ele in row] for row in addrxyf2_u_out_x_list]
addrxyf2_u_out_y_list = [[float(ele) for ele in row] for row in addrxyf2_u_out_y_list]
In [96]:
# convert the list of lists of floats into numpy arrays
simplecpy_list = np.array( simplecpy_list )
addr01_list = np.array( addr01_list)
addlrin_list = np.array( addlrin_list)
addlrout_list = np.array( addlrout_list)
addr_p_list = np.array( addr_p_list)
addrxyf2_u_x_list = np.array( addrxyf2_u_x_list)
addrxyf2_u_y_list = np.array( addrxyf2_u_y_list)
addrxyf2_u_out_x_list = np.array( addrxyf2_u_out_x_list)
addrxyf2_u_out_y_list = np.array( addrxyf2_u_out_y_list)
In [97]:
print simplecpy_list.shape; print addr01_list.shape; print addlrin_list.shape; print addlrout_list.shape;
print addr_p_list.shape; print addrxyf2_u_x_list.shape; print addrxyf2_u_y_list.shape;
print addrxyf2_u_out_x_list.shape; print addrxyf2_u_out_y_list.shape;
In [90]:
# np.array_str from
# cf. http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array
print np.array_str(simplecpy_list, precision=3, suppress_small=True);
print np.array_str(addr01_list, precision=3, suppress_small=True);
print np.array_str(addlrin_list, precision=3, suppress_small=True);
print np.array_str(addlrout_list, precision=3, suppress_small=True);
print np.array_str(addr_p_list, precision=3, suppress_small=True);
result of NITERS=2
(a single for
loop run of addlrKernels_launch)
[[ 0.1 1.1 2.1 ..., 125.1 126.1 127.1]
[ 128.1 129.1 130.1 ..., 253.1 254.1 255.1]
[ 256.1 257.1 258.1 ..., 381.1 382.1 383.1]
...,
[ 7808.1 7809.1 7810.1 ..., 7933.1 7934.1 7935.1]
[ 7936.1 7937.1 7938.1 ..., 8061.1 8062.1 8063.1]
[ 8064.1 8065.1 8066.1 ..., 8189.1 8190.1 8191.1]]
[[ 1.2 3.2 5.2 ..., 251.2 253.2 254.2]
[ 257.2 259.2 261.2 ..., 507.2 509.2 510.2]
[ 513.2 515.2 517.2 ..., 763.2 765.2 766.2]
...,
[ 15617.2 15619.2 15621.2 ..., 15867.2 15869.2 15870.2]
[ 15873.2 15875.2 15877.2 ..., 16123.2 16125.2 16126.2]
[ 16129.2 16131.2 16133.2 ..., 16379.2 16381.2 16382.2]]
[[ 2.4 4.4 8.4 ..., 500.4 504.4 507.4]
[ 514.4 516.4 520.4 ..., 1012.4 1016.4 1019.4]
[ 1026.4 1028.4 1032.4 ..., 1524.4 1528.4 1531.4]
...,
[ 31234.4 31236.4 31240.4 ..., 31732.4 31736.4 31739.4]
[ 31746.4 31748.4 31752.4 ..., 32244.4 32248.4 32251.4]
[ 32258.4 32260.4 32264.4 ..., 32756.4 32760.4 32763.4]]
[[ 1.2 3.2 5.2 ..., 251.2 253.2 254.2]
[ 257.2 259.2 261.2 ..., 507.2 509.2 510.2]
[ 513.2 515.2 517.2 ..., 763.2 765.2 766.2]
...,
[ 15617.2 15619.2 15621.2 ..., 15867.2 15869.2 15870.2]
[ 15873.2 15875.2 15877.2 ..., 16123.2 16125.2 16126.2]
[ 16129.2 16131.2 16133.2 ..., 16379.2 16381.2 16382.2]]
In [98]:
# np.array_str from
# cf. http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array
print np.array_str(addrxyf2_u_x_list, precision=3, suppress_small=True);
print np.array_str(addrxyf2_u_y_list, precision=3, suppress_small=True);
print np.array_str(addrxyf2_u_out_x_list, precision=3, suppress_small=True);
print np.array_str(addrxyf2_u_out_y_list, precision=3, suppress_small=True);
In [ ]: