diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index 80fc129f5..182a3df0a 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -64,10 +64,10 @@ for name in filenames: errors = [] remarks = [] - if table.label_dimension(options.pos) != 3: errors.append('coordinates {} are not a vector.'.format(options.pos)) + if table.label_dimension(options.pos) != 3: errors.append('coordinates "{}" are not a vector.'.format(options.pos)) else: colCoord = table.label_index(options.pos) - if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient {} is not a tensor.'.format(options.defgrad)) + if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad)) else: colF = table.label_index(options.defgrad) if remarks != []: damask.util.croak(remarks) @@ -96,16 +96,16 @@ for name in filenames: N = grid.prod() # --------------- figure out columns to process --------------------------------------------------- - key = '1_%s'%options.defgrad - if key not in table.labels: - file['croak'].write('column %s not found...\n'%key) + key = '1_'+options.defgrad + if table.label_index(key) == -1: + damask.util.croak('column "{}" not found...'.format(key)) continue else: - column = table.labels.index(key) # remember columns of requested data + column = table.label_index(key) # remember columns of requested data # ------------------------------------------ assemble header --------------------------------------- - if options.shape: table.labels_append(['shapeMismatch(%s)' %options.defgrad]) - if options.volume: table.labels_append(['volMismatch(%s)'%options.defgrad]) + if options.shape: table.labels_append(['shapeMismatch({})'.format(options.defgrad)]) + if options.volume: table.labels_append(['volMismatch({})'.format(options.defgrad)]) table.head_write() # ------------------------------------------ read deformation gradient field ----------------------- diff --git a/processing/post/binXY.py b/processing/post/binXY.py index dffcc0749..693b71e59 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -165,7 +165,8 @@ for name in filenames: table.info_clear() table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels = ['bin_%s'%options.data[0],'bin_%s'%options.data[1],'z'] + table.labels_clear() + table.labels_append(['bin_%s'%options.data[0],'bin_%s'%options.data[1],'z']) table.head_write() # --- output result --------------------------------------------------------------------------------- diff --git a/processing/post/blowUp.py b/processing/post/blowUp.py index 73a72e7c8..430a4f388 100755 --- a/processing/post/blowUp.py +++ b/processing/post/blowUp.py @@ -63,7 +63,7 @@ for name in filenames: errors = [] remarks = [] - if table.label_dimension(options.pos) != 3: errors.append('coordinates {} are not a vector.'.format(options.pos)) + if table.label_dimension(options.pos) != 3: errors.append('coordinates "{}" are not a vector.'.format(options.pos)) else: colCoord = table.label_index(options.pos) colElem = table.label_index('elem') @@ -96,7 +96,7 @@ for name in filenames: # ------------------------------------------ process data ------------------------------------------- - data = np.zeros(outSize.tolist()+[len(table.labels)]) + data = np.zeros(outSize.tolist()+[len(table.labels(raw = True))]) p = np.zeros(3,'i') for p[2] in xrange(grid[2]): diff --git a/processing/post/filterTable.py b/processing/post/filterTable.py index eac9d3132..41a0634f3 100755 --- a/processing/post/filterTable.py +++ b/processing/post/filterTable.py @@ -79,7 +79,7 @@ for name in filenames: labels = [] positions = [] - for position,label in enumerate(table.labels): + for position,label in enumerate(table.labels(raw = True)): if (options.whitelist is None or any([ position in table.label_indexrange(needle) \ or fnmatch.fnmatch(label,needle) for needle in options.whitelist])) \ and (options.blacklist is None or not any([ position in table.label_indexrange(needle) \ @@ -103,17 +103,17 @@ for name in filenames: condition = options.condition # copy per file, might be altered for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups condition = condition.replace('#'+operand[0]+'#', - { '': '{%i}'%position, - 's#':'"{%i}"'%position}[operand[1]]) + { '': '{{{}}}' .format(position), + 's#':'"{{{}}}"'.format(position)}[operand[1]]) if operand[2] in specials: # special label ? - interpolator += ['specials["%s"]'%operand[2]] + interpolator += ['specials["{}"]'.format(operand[2])] else: try: - interpolator += ['%s(table.data[%i])'%({ '':'float', - 's#':'str'}[operand[1]], - table.labels.index(operand[2]))] + interpolator += ['{}(table.data[{}])'.format({ '':'float', + 's#':'str'}[operand[1]], + table.label_index(operand[2]))] except: - parser.error('column %s not found...\n'%operand[2]) + parser.error('column "{}" not found...\n'.format(operand[2])) evaluator = "'" + condition + "'.format(" + ','.join(interpolator) + ")" diff --git a/processing/post/reLabel.py b/processing/post/reLabel.py index f8c5d0530..b704a2ee5 100755 --- a/processing/post/reLabel.py +++ b/processing/post/reLabel.py @@ -64,11 +64,11 @@ for name in filenames: indices = table.label_index (options.label) dimensions = table.label_dimension(options.label) for i,index in enumerate(indices): - if index == -1: remarks.append('label {} not present...'.format(options.label[i])) + if index == -1: remarks.append('label "{}" not present...'.format(options.label[i])) else: - m = pattern[dimensions[i]>1].match(table.labels[index]) # isolate label name + m = pattern[dimensions[i]>1].match(table.tags[index]) # isolate label name for j in xrange(dimensions[i]): - table.labels[index+j] = table.labels[index+j].replace(m.group(2),options.substitute[i]) # replace name with substitute + table.tags[index+j] = table.tags[index+j].replace(m.group(2),options.substitute[i]) # replace name with substitute if remarks != []: damask.util.croak(remarks) if errors != []: diff --git a/processing/post/sortTable.py b/processing/post/sortTable.py index 027ec31d8..f1298af86 100755 --- a/processing/post/sortTable.py +++ b/processing/post/sortTable.py @@ -56,7 +56,7 @@ for name in filenames: table.data_readArray() - keys = table.labels[::-1] if options.keys is None else options.keys[::-1] # numpy sorts with most significant column as last + keys = table.labels(raw = True)[::-1] if options.keys is None else options.keys[::-1] # numpy sorts with most significant column as last cols = [] remarks = []