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',
|
parser.add_option('-l','--lattice', dest='lattice', type='choice', choices=('fcc','bcc','hex'), metavar='string',
|
||||||
help="type of lattice structure [%default] {fcc,bcc',hex}")
|
help="type of lattice structure [%default] {fcc,bcc',hex}")
|
||||||
parser.add_option('--direction', dest='forcedirection', type='int', nargs=3, metavar='int int int',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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',
|
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(lattice = 'fcc')
|
||||||
parser.set_defaults(forcedirection = (0, 0, 1))
|
parser.set_defaults(forcedirection = [0, 0, 1])
|
||||||
parser.set_defaults(stressnormal = None)
|
parser.set_defaults(stressnormal = None)
|
||||||
parser.set_defaults(traceplane = None)
|
parser.set_defaults(traceplane = None)
|
||||||
parser.set_defaults(rank = 0)
|
parser.set_defaults(rank = 0)
|
||||||
|
parser.set_defaults(CoverA = 1.587)
|
||||||
parser.set_defaults(eulers = 'eulerangles')
|
parser.set_defaults(eulers = 'eulerangles')
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(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)
|
options.forcedirection = normalize(options.forcedirection)
|
||||||
if options.stressnormal:
|
if options.stressnormal:
|
||||||
if abs(sum([options.forcedirection[i] * options.stressnormal[i] for i in range(3)])) < 1e-3:
|
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)
|
""", version = scriptID)
|
||||||
|
|
||||||
parser.add_option('-l','--label', dest='label', action='extend', metavar='<string LIST>',
|
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',
|
parser.add_option('-r', '--rnd', dest='randomSeed', type='int', metavar='int',
|
||||||
help='seed of random number generator [%default]')
|
help='seed of random number generator [%default]')
|
||||||
|
|
||||||
parser.set_defaults(label = [])
|
|
||||||
parser.set_defaults(randomSeed = None)
|
parser.set_defaults(randomSeed = None)
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
if len(options.label)== 0:
|
if options.label == None:
|
||||||
parser.error('no data column specified...')
|
parser.error('no data column specified...')
|
||||||
|
|
||||||
datainfo = { # list of requested labels per datatype
|
datainfo = { # list of requested labels per datatype
|
||||||
|
@ -36,9 +34,8 @@ datainfo = {
|
||||||
'label':[]},
|
'label':[]},
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.label != None: datainfo['scalar']['label'] += options.label
|
datainfo['scalar']['label'] += options.label
|
||||||
np.random.seed(options.randomSeed)
|
np.random.seed(options.randomSeed)
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
if not os.path.exists(name): continue
|
if not os.path.exists(name): continue
|
||||||
|
@ -65,8 +62,9 @@ for name in filenames:
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
permutation = {}
|
permutation = {}
|
||||||
table.data_readArray([column[label] for label in active])
|
table.data_readArray(active)
|
||||||
for i,label in enumerate(active):
|
for i,label in enumerate(active):
|
||||||
|
|
||||||
mySeed = np.random.randint(9999999)
|
mySeed = np.random.randint(9999999)
|
||||||
np.random.seed(mySeed)
|
np.random.seed(mySeed)
|
||||||
unique = list(set(table.data[:,i]))
|
unique = list(set(table.data[:,i]))
|
||||||
|
@ -74,6 +72,7 @@ for name in filenames:
|
||||||
permutation[label] = dict(zip(unique,permutated))
|
permutation[label] = dict(zip(unique,permutated))
|
||||||
|
|
||||||
table.data_rewind()
|
table.data_rewind()
|
||||||
|
table.head_read() # read ASCII header info again to get the completed data
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
for label in active: # loop over all requested stiffnesses
|
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
|
for idx,label in enumerate(table.labels): # write data
|
||||||
vtkfile.write('\nSCALARS '+label+' double 1\nLOOKUP_TABLE default\n') # all scalar data
|
vtkfile.write('\nSCALARS '+label+' double 1\nLOOKUP_TABLE default\n') # all scalar data
|
||||||
vtkfile.write('\n'.join(map(str,myData[idx])))
|
vtkfile.write('\n'.join(map(str,myData[idx])))
|
||||||
|
|
||||||
|
|
||||||
# --------------------------- DONE --------------------------------
|
|
||||||
|
|
Loading…
Reference in New Issue