Philip's corrections

This commit is contained in:
Martin Diehl 2020-04-28 22:19:09 +02:00
parent 9e79935add
commit 763ccc077b
2 changed files with 5 additions and 8 deletions

@ -1 +1 @@
Subproject commit 3c52c31ca3272e0afe7967d2e59e0819f92e85c9
Subproject commit c595994cd8880acadf50b5dedb79156d04d35b91

View File

@ -50,15 +50,12 @@ for name in filenames:
table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
randomSeed = int(os.urandom(4).hex(), 16) if options.randomSeed is None else options.randomSeed # random seed per file
np.random.seed(randomSeed)
rng = np.random.default_rng(randomSeed)
for label in options.label:
data = table.get(label)
if options.unique:
uniques,inverse = np.unique(data,return_inverse=True,axis=0)
np.random.shuffle(uniques)
uniques,inverse = np.unique(data,return_inverse=True,axis=0) if options.unique else (data,np.arange(len(data)))
rng.shuffle(uniques)
table.set(label,uniques[inverse], scriptID+' '+' '.join(sys.argv[1:]))
else:
table.set(label,np.random.permutation(data), scriptID+' '+' '.join(sys.argv[1:]))
table.to_ASCII(sys.stdout if name is None else name)