adopted philips changes for reporting, using pyflakes to clean up

This commit is contained in:
Martin Diehl 2015-09-24 09:24:42 +00:00
parent 2e70e6fded
commit f4d4a8e1ec
56 changed files with 163 additions and 216 deletions

View File

@ -1,10 +1,9 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,threading,re,time,string,fnmatch,vtk
import os,sys,re,string,fnmatch,vtk
import numpy as np
from optparse import OptionParser
from vtk.util import numpy_support
import damask
scriptID = string.replace('$Id$','\n','\\n')

View File

@ -1,26 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
# Copyright 2011-14 Max-Planck-Institut für Eisenforschung GmbH
#
# This file is part of DAMASK,
# the Düsseldorf Advanced Material Simulation Kit.
#
# DAMASK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DAMASK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
import os,sys,math,string,numpy as np
from collections import defaultdict
import os,sys,string
import numpy as np
from optparse import OptionParser
import damask

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,math,string
import os,re,sys,string
import numpy as np
from optparse import OptionParser
import damask
@ -55,7 +55,7 @@ for name in filenames:
table = damask.ASCIItable(name = name, buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header -------------------------------------------
@ -81,7 +81,7 @@ for name in filenames:
elif dim > 1: # multidimensional input (vector, tensor, etc.)
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
else:
table.croak('column {} not found...'.format(column))
damask.util.croak('column {} not found...'.format(column))
brokenFormula[label] = True
break

View File

@ -42,7 +42,7 @@ for name in filenames:
table = damask.ASCIItable(name = name, buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -61,7 +61,7 @@ for name in filenames:
column[tensor] = table.label_index(tensor)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -53,7 +53,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -70,9 +70,9 @@ for name in filenames:
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 != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,string
import os,sys,string
import numpy as np
from optparse import OptionParser
import damask
@ -39,7 +39,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -61,9 +61,9 @@ for name in filenames:
table.labels_append('cum({})'.format(what) if dim == 1 else
['{}_cum({})'.format(i+1,what) for i in xrange(dim)] ) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,math,operator
import os,sys,string,math
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -14,7 +13,6 @@ def curlFFT(geomdim,field):
grid = np.array(np.shape(field)[0:3])
N = grid.prod() # field size
n = np.array(np.shape(field)[3:]).prod() # data size
wgt = 1.0/N
if n == 3:
dataType = 'vector'
@ -107,7 +105,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -134,9 +132,9 @@ for name in filenames:
items[type]['active'].append(what)
items[type]['column'].append(table.label_index(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -49,7 +48,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -66,9 +65,9 @@ for name in filenames:
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 != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue
@ -87,7 +86,7 @@ for name in filenames:
if N != len(table.data): errors.append('data count {} does not match grid {}x{}x{}.'.format(N,*grid))
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -2,7 +2,6 @@
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
from collections import defaultdict
from optparse import OptionParser
import damask
@ -45,7 +44,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -67,9 +66,9 @@ for name in filenames:
items[type]['column'].append(table.label_index(what))
table.labels_append('det({})'.format(what)) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -2,7 +2,6 @@
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
from collections import defaultdict
from optparse import OptionParser
import damask
@ -52,7 +51,7 @@ for name in filenames:
table = damask.ASCIItable(name = name, buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -75,9 +74,9 @@ for name in filenames:
items[type]['active'].append(what)
items[type]['column'].append(table.label_index(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,math,operator
import os,sys,string,math
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -14,7 +13,6 @@ def divFFT(geomdim,field):
grid = np.array(np.shape(field)[0:3])
N = grid.prod() # field size
n = np.array(np.shape(field)[3:]).prod() # data size
wgt = 1.0/N
field_fourier = np.fft.fftpack.rfftn(field,axes=(0,1,2))
div_fourier = np.zeros(field_fourier.shape[0:len(np.shape(field))-1],'c16') # size depents on whether tensor or vector
@ -92,7 +90,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -119,9 +117,9 @@ for name in filenames:
items[type]['active'].append(what)
items[type]['column'].append(table.label_index(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -61,7 +60,7 @@ for name in filenames:
table = damask.ASCIItable(name = name, buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -78,7 +77,7 @@ for name in filenames:
columns.append(column)
table.labels_append(['E{}{}{}({arg2})'.format(*options.hkl,arg2=options.stiffness[i])]) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
# ------------------------------------------ assemble header --------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,math,itertools
import os,sys,string,itertools
import numpy as np
from scipy import ndimage
from optparse import OptionParser
@ -129,7 +129,7 @@ for name in filenames:
table = damask.ASCIItable(name = name, buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -147,9 +147,9 @@ for name in filenames:
if table.label_dimension(options.id) != 1: errors.append('grain identifier {} not found.'.format(options.id))
else: idCol = table.label_index(options.id)
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,11 +1,11 @@
#!/usr/bin/env python
import os,sys,string,itertools,re,time,copy,operator
import os,sys,string,time,copy
import numpy as np
import damask
from optparse import OptionParser
from scipy import spatial
from collections import defaultdict
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
scriptID = string.replace('$Id$','\n','\\n')
scriptName = os.path.splitext(scriptID.split()[1])[0]
@ -13,8 +13,8 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Add grain index based on similiarity of crystal lattice orientation.
""" + string.replace(scriptID,'\n','\\n')
)
""", version = scriptID)
parser.add_option('-r', '--radius',
dest = 'radius',
@ -98,7 +98,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header -------------------------------------------
@ -113,9 +113,9 @@ for name in filenames:
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
else: column = table.label_index(label)
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -90,7 +90,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -99,7 +99,7 @@ for name in filenames:
# ------------------------------------------ sanity checks ----------------------------------------
if not np.all(table.label_dimension(label) == dim):
table.croak('input {} has wrong dimension {}.'.format(label,dim))
damask.util.croak('input {} has wrong dimension {}.'.format(label,dim))
table.close(dismiss = True) # close ASCIItable and remove empty file
continue

View File

@ -68,7 +68,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -82,7 +82,7 @@ for name in filenames:
if mappedColumn < 0: errors.append('mapping column {} not found.'.format(options.map))
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,math,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -56,7 +55,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -80,9 +79,9 @@ for name in filenames:
items[type]['column'].append(table.label_index(what))
table.labels_append('Mises({})'.format(what)) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -2,7 +2,6 @@
# -*- coding: UTF-8 no BOM -*-
import os,sys,math,string
from collections import defaultdict
from optparse import OptionParser
import damask
@ -56,7 +55,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -77,9 +76,9 @@ for name in filenames:
columns.append(table.label_index(what))
table.labels_append('norm{}({})'.format(options.norm.capitalize(),what)) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,itertools,math
import os,sys,string,math
import numpy as np
from optparse import OptionParser
import damask
@ -101,7 +101,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -115,9 +115,9 @@ for name in filenames:
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
else: column = table.label_index(label)
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -43,7 +42,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -62,7 +61,7 @@ for name in filenames:
column[tensor] = table.label_index(tensor)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
import os,sys,string,math
import numpy as np
from optparse import OptionParser
import damask
@ -90,7 +90,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -104,9 +104,9 @@ for name in filenames:
if not np.all(table.label_dimension(label) == dim): errors.append('input {} has wrong dimension {}.'.format(label,dim))
else: column = table.label_index(label)
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,30 +1,11 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
# Copyright 2011-14 Max-Planck-Institut für Eisenforschung GmbH
#
# This file is part of DAMASK,
# the Düsseldorf Advanced Material Simulation Kit.
#
# DAMASK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DAMASK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
#
import os,sys,math,string,numpy as np
from collections import defaultdict
import os,sys,string,numpy as np
from optparse import OptionParser
import damask
scriptID = string.replace('$Id: addQuaternions.py 3828M 2015-05-15 07:28:21Z (local) $','\n','\\n')
scriptID = string.replace('$Id$','\n','\\n')
scriptName = os.path.splitext(scriptID.split()[1])[0]
@ -63,7 +44,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
table.head_read() # read ASCII header info
@ -77,7 +58,7 @@ for name in filenames:
active.append(label)
column[label] = table.labels.index(key) # remember columns of requested data
else:
table.croak('column %s not found...'%label)
damask.util.croak('column %s not found...'%label)
# ------------------------------------------ assemble header ---------------------------------------

View File

@ -308,7 +308,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
table.head_read() # read ASCII header info
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))

View File

@ -3,7 +3,6 @@
import os,sys,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -38,7 +37,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -61,9 +60,9 @@ for name in filenames:
table.labels_append(['{}_eigval({})'.format(i+1,what) for i in xrange(3)]) # extend ASCII header with new labels
table.labels_append(['{}_eigvec({})'.format(i+1,what) for i in xrange(9)]) # extend ASCII header with new labels
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,string
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -88,7 +87,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -115,9 +114,9 @@ for name in filenames:
theStretch,
what if what != 'f' else '') for i in xrange(9)])
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -34,7 +34,7 @@ for name in filenames:
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
tables = []
for addTable in options.table:
try:

View File

@ -65,7 +65,7 @@ for name in filenames:
prefix+os.path.basename(name)) if name else name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -80,9 +80,9 @@ for name in filenames:
if table.label_dimension(options.coords) != 3: errors.append('coordinates {} are not a vector.'.format(options.coords))
else: colCoord = table.label_index(options.coords)
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,string
import os,sys,string
import numpy as np
from optparse import OptionParser
import damask
@ -42,13 +42,13 @@ for name in filenames:
outname = options.label+'_averaged_'+name if name else name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ sanity checks ---------------------------------------
table.head_read()
if table.label_dimension(options.label) != 1:
table.croak('column {} is not of scalar dimension.'.format(options.label))
damask.util.croak('column {} is not of scalar dimension.'.format(options.label))
table.close(dismiss = True) # close ASCIItable and remove empty file
continue

View File

@ -97,7 +97,7 @@ for name in filenames:
buffered = False)
except:
continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -108,7 +108,7 @@ for name in filenames:
missing_labels = table.data_readArray(labels)
if len(missing_labels) > 0:
table.croak('column{} {} not found.'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels)))
damask.util.croak('column{} {} not found.'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels)))
table.close(dismiss = True)
continue
@ -142,7 +142,7 @@ for name in filenames:
minmax[2,0] -= 1.
minmax[2,1] += 1.
if (minmax[2] == 0.0).all(): # no data in grid?
table.croak('no data found on grid...')
damask.util.croak('no data found on grid...')
minmax[2,:] = np.array([0.0,1.0]) # making up arbitrary z minmax
if options.type[2].lower() == 'log':
grid = np.log(grid)

View File

@ -50,7 +50,7 @@ for name in filenames:
os.path.basename(name)) if name else name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,string,fnmatch,math,random,numpy as np
import os,re,sys
from optparse import OptionParser
import damask
@ -58,7 +58,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ assemble info -----------------------------------------
@ -108,7 +108,7 @@ for name in filenames:
elif dim > 1: # multidimensional input (vector, tensor, etc.)
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
else:
table.croak('column {} not found...'.format(column))
damask.util.croak('column {} not found...'.format(column))
brokenFormula[label] = True
break
formula = formula.replace('#'+column+'#',replacement)

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,string,fnmatch,math,random,numpy as np
import os,re,sys,fnmatch
import numpy as np
from optparse import OptionParser
import damask
@ -63,7 +64,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ assemble info ---------------------------------------

View File

@ -4,7 +4,7 @@
import os,sys,string
import numpy as np
from optparse import OptionParser
from PIL import Image, ImageDraw, ImageOps
from PIL import Image
import damask
scriptID = string.replace('$Id$','\n','\\n')
@ -118,7 +118,7 @@ for name in filenames:
labeled = options.label != None,
readonly = True)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -128,7 +128,7 @@ for name in filenames:
missing_labels = table.data_readArray(options.label)
if len(missing_labels) > 0:
table.croak('column {} not found.'.format(options.label))
damask.util.croak('column {} not found.'.format(options.label))
table.close(dismiss = True) # close ASCIItable and remove empty file
continue
@ -143,7 +143,7 @@ for name in filenames:
if np.all(np.array(options.range) == 0.0):
options.range = [table.data[mask].min(),
table.data[mask].max()]
table.croak('data range: {0} {1}'.format(*options.range))
damask.util.croak('data range: {0} {1}'.format(*options.range))
delta = max(options.range) - min(options.range)
avg = 0.5*(max(options.range) + min(options.range))
@ -163,7 +163,7 @@ for name in filenames:
repeat(options.pixelsizey,axis = 0)
(height,width) = table.data.shape
table.croak('image dimension: {0} x {1}'.format(width,height))
damask.util.croak('image dimension: {0} x {1}'.format(width,height))
im = Image.fromarray(np.dstack((theColors[np.array(255*table.data,dtype = np.uint8)],
255*mask.astype(np.uint8))), 'RGBA').\

View File

@ -4,7 +4,7 @@
import os,sys,string
import numpy as np
from optparse import OptionParser
from PIL import Image, ImageDraw
from PIL import Image
import damask
scriptID = string.replace('$Id$','\n','\\n')
@ -83,7 +83,7 @@ for name in filenames:
labeled = options.label != None,
readonly = True)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -101,7 +101,7 @@ for name in filenames:
errors.append('column {} has wrong dimension'.format(options.label))
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True) # close ASCII table file handles and delete output file
continue
@ -116,7 +116,7 @@ for name in filenames:
table.data *= 1. if np.any(table.data > 1.0) else 255.0 # ensure 8 bit data range
(height,width,bands) = table.data.shape
table.croak('image dimension: {0} x {1}'.format(width,height))
damask.util.croak('image dimension: {0} x {1}'.format(width,height))
im = Image.fromarray(table.data.astype('uint8'), 'RGB').\
crop(( options.crop[0],

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os, sys, math, string, numpy, shutil
import os,sys,shutil
import numpy as np
import damask
from optparse import OptionParser
@ -119,7 +120,7 @@ for incCount,position in enumerate(locations): # walk through locations
for n in range(Nnodes):
if p.node_displacements():
node_displacement[n] = map(lambda x:x*unitlength,list(p.node_displacement(n)))
c = damask.core.mesh.mesh_build_cellnodes(numpy.array(node_displacement).T,Ncellnodes)
c = damask.core.mesh.mesh_build_cellnodes(np.array(node_displacement).T,Ncellnodes)
cellnode_displacement = [[c[i][n] for i in range(3)] for n in range(Ncellnodes)]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os, sys, math, string, re, time
import os,sys,string,re,time
from optparse import OptionParser, OptionGroup
import damask

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,math,string,numpy,damask
import os,sys,string,numpy,damask
from optparse import OptionParser, Option
# -----------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import math, string, sys, os
import string,sys,os
import damask
from optparse import OptionParser

View File

@ -45,7 +45,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -66,9 +66,9 @@ for name in filenames:
columns.append(index)
dims.append(dimensions[i])
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import pdb, os, sys, gc, math, re, threading, time, struct, string
import os,sys,math,re,threading,time,struct,string
import damask
from optparse import OptionParser, OptionGroup
@ -260,7 +260,6 @@ class MPIEspectral_result: # mimic py_post result object
def element(self,e):
a = self.grid[0]+1
b = self.grid[1]+1
c = self.grid[2]+1
basenode = 1 + e+e/self.grid[0] + e/self.grid[0]/self.grid[1]*a
basenode2 = basenode+a*b
return (element([basenode ,basenode +1,basenode +a+1,basenode +a,

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,math,string
import os,sys,string
import damask
from optparse import OptionParser
@ -41,7 +41,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -66,9 +66,9 @@ for name in filenames:
for j in xrange(dimensions[i]):
table.labels[index+j] = table.labels[index+j].replace(options.label[i],options.substitute[i])
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -3,7 +3,6 @@
import os,sys,string,math
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -58,7 +57,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -82,9 +81,9 @@ for name in filenames:
items[type]['active'].append(what)
items[type]['column'].append(table.label_index(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
import os,sys
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -45,7 +44,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -65,9 +64,9 @@ for name in filenames:
factors.append(float(factor))
dims.append(table.label_dimension(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
import os,sys
import numpy as np
from collections import defaultdict
from optparse import OptionParser
import damask
@ -45,7 +44,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ read header ------------------------------------------
@ -65,9 +64,9 @@ for name in filenames:
offsets.append(float(offset))
dims.append(table.label_dimension(what))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string
import os
from optparse import OptionParser
import damask
@ -66,7 +66,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, labeled = options.labeled, readonly = True)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ output head ---------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,string
import os,sys,string
import numpy as np
from optparse import OptionParser
import damask
@ -50,7 +50,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False)
except: continue
table.report_name(scriptName,name)
damask.util.report(scriptName,name)
# ------------------------------------------ assemble header ---------------------------------------
@ -68,7 +68,7 @@ for name in filenames:
remarks.append("label {0} not present.".format(options.keys[i]))
else:
cols += [table.data[:,column]]
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
ind = np.lexsort(cols) if cols != [] else np.arange(table.data.shape[0])
if options.reverse: ind = ind[::-1]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,re,sys,math,string,time
import os,sys,string
import numpy as np
import damask
from optparse import OptionParser
@ -15,7 +15,7 @@ scriptName = os.path.splitext(scriptID.split()[1])[0]
parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options] datafile[s]', description = """
Calculates the standard deviation of data in blocks of size 'packing' thus reducing the former resolution
to resolution/packing. (Requires np.)
to resolution/packing.
""", version = scriptID)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os, sys, string, glob, re
import os,string,glob,re
import damask
from optparse import OptionParser

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,string,vtk
import damask
from optparse import OptionParser

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,string,vtk
import damask
from collections import defaultdict
from optparse import OptionParser
@ -83,7 +83,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, readonly = True)
except: continue
table.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
damask.util.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
# --- interpret header ----------------------------------------------------------------------------
@ -103,7 +103,7 @@ for name in filenames:
if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me))
elif dim > dimension: remarks.append('"{}" not of dimension{}...'.format(me,dimension))
else:
table.croak('adding {} {}'.format(datatype,me))
damask.util.croak('adding {} {}'.format(datatype,me))
active[datatype].append(me)
if datatype in ['scalar','vector']:
@ -114,9 +114,9 @@ for name in filenames:
VTKarray[me].SetNumberOfComponents(dimension)
VTKarray[me].SetName(label[i])
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss=True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,string,vtk
import damask
from collections import defaultdict
from optparse import OptionParser
@ -62,7 +62,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, readonly = True)
except: continue
table.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
damask.util.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
# --- interpret header ----------------------------------------------------------------------------
@ -81,7 +81,7 @@ for name in filenames:
if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me))
elif dim > dimension: remarks.append('"{}" not of dimension{}...'.format(me,dimension))
else:
table.croak('adding {} {}'.format(datatype,me))
damask.util.croak('adding {} {}'.format(datatype,me))
active[datatype].append(me)
if datatype in ['scalar']:
@ -92,9 +92,9 @@ for name in filenames:
VTKarray[me].SetNumberOfComponents(dimension)
VTKarray[me].SetName(label[i])
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss=True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,string,vtk
import damask
from collections import defaultdict
from optparse import OptionParser

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,string,vtk
import damask
from optparse import OptionParser
@ -36,7 +36,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, readonly = True)
except: continue
table.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
damask.util.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
# --- interpret header ----------------------------------------------------------------------------
@ -46,9 +46,9 @@ for name in filenames:
remarks = []
if table.label_dimension(options.position) != 3: errors.append('columns "{}" have dimension {}'.format(options.position,
table.label_dimension(options.position)))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss=True)
continue

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,vtk
import numpy as np
from optparse import OptionParser
import damask
@ -42,7 +42,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, readonly = True)
except: continue
table.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
damask.util.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
# --- interpret header ----------------------------------------------------------------------------
@ -55,9 +55,9 @@ for name in filenames:
if table.label_dimension(options.position) != 3: errors.append('coordinates {} are not a vector.'.format(options.position))
if remarks != []: table.croak(remarks)
if remarks != []: damask.util.croak(remarks)
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue
@ -75,7 +75,7 @@ for name in filenames:
if N != len(table.data): errors.append('data count {} does not match grid {}x{}x{}.'.format(N,*(grid - options.mode == 'cell') ))
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue
@ -96,7 +96,7 @@ for name in filenames:
rGrid.SetYCoordinates(coordArray[1])
rGrid.SetZCoordinates(coordArray[2])
table.croak('{} points and {} cells...'.format(rGrid.GetNumberOfPoints(),rGrid.GetNumberOfCells(),))
damask.util.croak('{} points and {} cells...'.format(rGrid.GetNumberOfPoints(),rGrid.GetNumberOfCells(),))
# ------------------------------------------ output result ---------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os, sys, string, re, shutil
import os,sys,string,shutil
import damask
from optparse import OptionParser
from vtk import *

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
import os,sys,string,re,vtk
import os,sys,vtk
import numpy as np
from optparse import OptionParser
import damask
@ -53,7 +53,7 @@ for name in filenames:
table = damask.ASCIItable(name = name,
buffered = False, readonly = True)
except: continue
table.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
damask.util.croak(damask.util.emph(scriptName)+(': '+name if name else ''))
# --- interpret header ----------------------------------------------------------------------------
@ -62,7 +62,7 @@ for name in filenames:
if options.geom:
info,extra_header = table.head_getGeom()
table.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))),
damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))),
'size x y z: %s'%(' x '.join(map(str,info['size']))),
'origin x y z: %s'%(' : '.join(map(str,info['origin']))),
'homogenization: %i'%info['homogenization'],
@ -80,7 +80,7 @@ for name in filenames:
if np.any(info['grid'] < 1): errors.append('invalid grid a b c.')
if np.any(info['size'] <= 0.0): errors.append('invalid size x y z.')
if errors != []:
table.croak(errors)
damask.util.croak(errors)
table.close(dismiss = True)
continue