filename as optional parameter for plot-scripts

This commit is contained in:
Manuel Domke
2018-02-26 14:08:57 +01:00
parent 2c0c07dc0d
commit 88a8acf84f
2 changed files with 12 additions and 3 deletions

View File

@@ -2,9 +2,13 @@
import numpy as np
import matplotlib.pyplot as plt
import sys
from matplotlib import cm
filename='infnoise.bin'
if sys.argv[1]:
filename=sys.argv[1]
else:
filename='infnoise.bin'
nx = 1000
ny = 1000
@@ -25,4 +29,4 @@ cbar = plt.colorbar(cax, ticks=[255, 127, 0])
cbar.ax.set_yticklabels(['255', '127', '0'])
plt.savefig(filename + '-colormap.png')
plt.show()
plt.show()

View File

@@ -2,8 +2,13 @@
import matplotlib.pyplot as plt
import numpy as np
import sys
if sys.argv[1]:
filename=sys.argv[1]
else:
filename='infnoise.bin'
filename='infnoise.bin'
bp = np.dtype([('byte1',np.uint8),('byte2',np.uint8)]) # 'struct' byte pairs