adjusted to new table style and naming of output
This commit is contained in:
parent
f363d81de5
commit
fbfa55e910
|
@ -250,31 +250,29 @@ Add columns listing Schmid factors (and optional trace vector of selected system
|
|||
parser.add_option('-l','--lattice', dest='lattice', type='choice', choices=('fcc','bcc','hex'), metavar='string',
|
||||
help="type of lattice structure [%default] {fcc,bcc',hex}")
|
||||
parser.add_option('--direction', dest='forcedirection', type='int', nargs=3, metavar='int int int',
|
||||
help='force direction in lab coordinates %default')
|
||||
help='force direction in lab coordinates %default')
|
||||
parser.add_option('-n','--normal', dest='stressnormal', type='int', nargs=3, metavar='int int int',
|
||||
help='stress plane normal in lab coordinates ')
|
||||
help='stress plane normal in lab coordinates ')
|
||||
parser.add_option('--trace', dest='traceplane', type='int', nargs=3, metavar='int int int',
|
||||
help='normal (in lab coordinates) of plane on which the plane trace of the Schmid factor(s) is reported')
|
||||
help='normal (in lab coordinates) of plane on which the plane trace of the Schmid factor(s) is reported')
|
||||
parser.add_option('--covera', dest='CoverA', type='float', metavar='float',
|
||||
help='C over A ratio for hexagonal systems')
|
||||
help='C over A ratio for hexagonal systems')
|
||||
parser.add_option('-r','--rank', dest='rank', type='int', nargs=3, metavar='int int int',
|
||||
help="report trace of r'th highest Schmid factor [%default]")
|
||||
help="report trace of r'th highest Schmid factor [%default]")
|
||||
parser.add_option('-e', '--eulers', dest='eulers', metavar='string',
|
||||
help='Euler angles label')
|
||||
help='Euler angles label')
|
||||
parser.add_option('-d', '--degrees', dest='degrees', action='store_true',
|
||||
help='Euler angles are given in degrees [%default]')
|
||||
help='Euler angles are given in degrees [%default]')
|
||||
parser.set_defaults(lattice = 'fcc')
|
||||
parser.set_defaults(forcedirection = (0, 0, 1))
|
||||
parser.set_defaults(forcedirection = [0, 0, 1])
|
||||
parser.set_defaults(stressnormal = None)
|
||||
parser.set_defaults(traceplane = None)
|
||||
parser.set_defaults(rank = 0)
|
||||
parser.set_defaults(CoverA = 1.587)
|
||||
parser.set_defaults(eulers = 'eulerangles')
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if options.lattice=='hex' and options.CoverA == None:
|
||||
parser.error('hex lattice needs c over a ration...')
|
||||
|
||||
options.forcedirection = normalize(options.forcedirection)
|
||||
if options.stressnormal:
|
||||
if abs(sum([options.forcedirection[i] * options.stressnormal[i] for i in range(3)])) < 1e-3:
|
||||
|
|
|
@ -19,16 +19,14 @@ Permute all values in given column(s).
|
|||
""", version = scriptID)
|
||||
|
||||
parser.add_option('-l','--label', dest='label', action='extend', metavar='<string LIST>',
|
||||
help='heading(s) of column to permute')
|
||||
help='heading(s) of column to permute')
|
||||
parser.add_option('-r', '--rnd', dest='randomSeed', type='int', metavar='int',
|
||||
help='seed of random number generator [%default]')
|
||||
|
||||
parser.set_defaults(label = [])
|
||||
help='seed of random number generator [%default]')
|
||||
parser.set_defaults(randomSeed = None)
|
||||
|
||||
(options,filenames) = parser.parse_args()
|
||||
|
||||
if len(options.label)== 0:
|
||||
if options.label == None:
|
||||
parser.error('no data column specified...')
|
||||
|
||||
datainfo = { # list of requested labels per datatype
|
||||
|
@ -36,9 +34,8 @@ datainfo = {
|
|||
'label':[]},
|
||||
}
|
||||
|
||||
if options.label != None: datainfo['scalar']['label'] += options.label
|
||||
datainfo['scalar']['label'] += options.label
|
||||
np.random.seed(options.randomSeed)
|
||||
|
||||
# --- loop over input files -------------------------------------------------------------------------
|
||||
for name in filenames:
|
||||
if not os.path.exists(name): continue
|
||||
|
@ -65,8 +62,9 @@ for name in filenames:
|
|||
|
||||
# ------------------------------------------ process data ------------------------------------------
|
||||
permutation = {}
|
||||
table.data_readArray([column[label] for label in active])
|
||||
table.data_readArray(active)
|
||||
for i,label in enumerate(active):
|
||||
|
||||
mySeed = np.random.randint(9999999)
|
||||
np.random.seed(mySeed)
|
||||
unique = list(set(table.data[:,i]))
|
||||
|
@ -74,6 +72,7 @@ for name in filenames:
|
|||
permutation[label] = dict(zip(unique,permutated))
|
||||
|
||||
table.data_rewind()
|
||||
table.head_read() # read ASCII header info again to get the completed data
|
||||
outputAlive = True
|
||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||
for label in active: # loop over all requested stiffnesses
|
||||
|
|
|
@ -81,6 +81,3 @@ for geomtype in ['nodebased','ipbased']:
|
|||
for idx,label in enumerate(table.labels): # write data
|
||||
vtkfile.write('\nSCALARS '+label+' double 1\nLOOKUP_TABLE default\n') # all scalar data
|
||||
vtkfile.write('\n'.join(map(str,myData[idx])))
|
||||
|
||||
|
||||
# --------------------------- DONE --------------------------------
|
||||
|
|
Loading…
Reference in New Issue