Added scatter plots from Cor van Wandelen

This commit is contained in:
Bill Cox
2015-01-26 03:14:14 -08:00
parent 2f7727da1e
commit 32ffea35d0
11 changed files with 109 additions and 1 deletions

View File

@@ -570,11 +570,17 @@ are added to a signal already saturated with thermal noise, making it in no less
Every cycle, a new thermal noise sample is added to the state, causing less correlation
with previous states.
Cor van Wandelen was kind enough to create these scatter plots showing the non-randomness
in the raw output.
![color plot of raw data](plots/plots/infnoise-raw.bin-colormap.png?raw=true "Color plot"
![scatter plot of raw data](plots/plots/plots/infnoise-raw-notraw-scatter.gif?raw=true "Scatter plot"
### Credits
Peter Allan has been very helpful in moving this project forward. The github user known
as EagleWorks did an _amazing_ job redoing the board layout. Somehow, my ameraturish work
just wasn't good enough for him :-) Thanks, EagleWorks!
just wasn't good enough for him :-) Thanks, EagleWorks! Cor van Wandelen created the
color and scatter plots.
### Free As in Freedom

12
plots/README Normal file
View File

@@ -0,0 +1,12 @@
Thanks to Cor van Wandelen for writing these two programs, colormap.py and scatterplot.py.
He used these to create these png files from his inifinite noise TRNG.
To recreate similar plots, you can use data in the samples directory, and these commands:
$ cp ../samples/infnoise_raw.bin infnoise.bin
$ python colormap.py
$ python scatterplot.py
I created the raw data files with:
$ sudo ../software/infnoise --debug --raw > infnoise_raw.bin

28
plots/colormap.py Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
filename='infnoise.bin'
nx = 1000
ny = 1000
data = np.fromfile(open(filename,'rb'), dtype=np.uint8, count=nx*nx)
data.resize(nx,ny)
plt.xlim(0, nx)
plt.ylim(0, ny)
plt.xlabel('samples')
plt.ylabel('samples')
plt.title('TRNG ' + filename)
#cax = plt.imshow(data, interpolation='nearest', cmap=cm.coolwarm)
cax = plt.imshow(data, interpolation='nearest', cmap=cm.afmhot)
cbar = plt.colorbar(cax, ticks=[255, 127, 0])
cbar.ax.set_yticklabels(['255', '127', '0'])
plt.savefig(filename + '-colormap.png')
plt.show()

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

28
plots/scatterplot.py Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
filename='infnoise.bin'
bp = np.dtype([('byte1',np.uint8),('byte2',np.uint8)]) # 'struct' byte pairs
Z = np.fromfile(filename, dtype=bp, count=2000) # read 2000 byte pairs from binary file
x, y = zip(*Z) # unpack Z pairs into lists
plt.grid(True)
plt.xlim(0, 255)
plt.ylim(0, 255)
plt.xlabel('bytes')
plt.ylabel('bytes')
plt.title('TRNG ' + filename)
plt.scatter(x[:1000],y[:1000])
plt.savefig(filename + '-scatter.png')
plt.show()

34
samples/infnoise_raw.bin Normal file
View File

File diff suppressed because one or more lines are too long

View File

Binary file not shown.