polishing

This commit is contained in:
Martin Diehl 2020-03-21 17:59:00 +01:00
parent f961f3590c
commit 67f64b7a7a
3 changed files with 28 additions and 30 deletions

View File

@ -13,13 +13,14 @@ from scipy import spatial
import damask
def findClosestSeed(seeds, weights, point):
return np.argmin(np.sum((np.broadcast_to(point,(len(seeds),3))-seeds)**2,axis=1) - weights)
scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version])
def findClosestSeed(seeds, weights, point):
return np.argmin(np.sum((np.broadcast_to(point,(len(seeds),3))-seeds)**2,axis=1) - weights)
def Laguerre_tessellation(grid, seeds, grains, size, periodic, weights, cpus):
if periodic:

View File

@ -2,7 +2,6 @@
import os
import sys
import random
from optparse import OptionParser,OptionGroup
import numpy as np
@ -139,8 +138,8 @@ for name in filenames:
i = 1
progress = damask.util._ProgressBar(options.N,'',50)
while i < options.N:
candidates = np.random.choice(unpicked[unpicked.mask==False],replace=False,
size=min(len(unpicked[unpicked.mask==False]),options.numCandidates))
candidates = np.random.choice(unpicked[not unpicked.mask],replace=False,
size=min(len(unpicked[not unpicked.mask]),options.numCandidates))
tree = spatial.cKDTree(seeds[:i])
distances, dev_null = tree.query(coords[candidates])
best = distances.argmax()

View File

@ -1,5 +1,3 @@
# -*- coding: UTF-8 no BOM -*-
"""Aggregator for configuration file handling"""
"""Aggregator for configuration file handling."""
from .material import Material # noqa