diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index d46302913..0bb1f874b 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -115,7 +115,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addCauchy.py b/processing/post/addCauchy.py index 14bfc0afe..6d3bb081c 100755 --- a/processing/post/addCauchy.py +++ b/processing/post/addCauchy.py @@ -92,7 +92,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index b26653f64..26d44f81c 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -129,6 +129,6 @@ for file in files: # ------------------------------------------ output result --------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addCurl.py b/processing/post/addCurl.py index 90a4f93d0..6cf137cba 100755 --- a/processing/post/addCurl.py +++ b/processing/post/addCurl.py @@ -149,6 +149,6 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addDeformedConfiguration.py b/processing/post/addDeformedConfiguration.py index 8a4df6f92..92d564e80 100755 --- a/processing/post/addDeformedConfiguration.py +++ b/processing/post/addDeformedConfiguration.py @@ -124,6 +124,6 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addDeterminant.py b/processing/post/addDeterminant.py index ff72298ae..ea07b6b77 100755 --- a/processing/post/addDeterminant.py +++ b/processing/post/addDeterminant.py @@ -88,7 +88,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addDeviator.py b/processing/post/addDeviator.py index f8e8041b7..da9dcc173 100755 --- a/processing/post/addDeviator.py +++ b/processing/post/addDeviator.py @@ -94,7 +94,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addDivergence.py b/processing/post/addDivergence.py index e2e8a769c..aa93bdc8f 100755 --- a/processing/post/addDivergence.py +++ b/processing/post/addDivergence.py @@ -172,6 +172,6 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addEhkl.py b/processing/post/addEhkl.py index 4acd0377d..3e6505473 100755 --- a/processing/post/addEhkl.py +++ b/processing/post/addEhkl.py @@ -104,7 +104,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index 5bdb423ce..9b9adbed5 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -199,6 +199,6 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index 844d164cc..a17320286 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -148,7 +148,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addMapped.py b/processing/post/addMapped.py index 409212add..ae43a3c28 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addMapped.py @@ -120,7 +120,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 82fb9cec2..7ff7f3100 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -100,7 +100,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addNorm.py b/processing/post/addNorm.py index 9e2199688..2c89e1fdb 100755 --- a/processing/post/addNorm.py +++ b/processing/post/addNorm.py @@ -111,7 +111,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index f78eb43d7..a88eb78f1 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -168,7 +168,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addPK2.py b/processing/post/addPK2.py index 8448491cf..d5e8326fb 100755 --- a/processing/post/addPK2.py +++ b/processing/post/addPK2.py @@ -93,7 +93,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 872d98f31..4e0f07468 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -375,7 +375,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index 692ee1fcf..78653efb1 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -80,7 +80,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 0896ac6c2..463eb69db 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -138,7 +138,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/averageDown.py b/processing/post/averageDown.py index 07de8573a..535754484 100755 --- a/processing/post/averageDown.py +++ b/processing/post/averageDown.py @@ -133,7 +133,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',\ os.path.join(os.path.dirname(file['name']),prefix+os.path.basename(file['name']))) diff --git a/processing/post/binXY.py b/processing/post/binXY.py index e1cf90ade..6da17c076 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -72,7 +72,7 @@ for file in files: skip = int(file['input'].readline().split()[0]) for i in xrange(skip): headers = file['input'].readline().split() data = np.loadtxt(file['input'],usecols=np.array(options.data+((options.weight,) if options.weight != None else ()))-1) - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table for i in (0,1): # check data range for x and y if (range[i] == 0.0).all(): range[i] = [data[:,i].min(),data[:,i].max()] @@ -113,7 +113,7 @@ for file in files: file['output'].write('1\thead\n') file['output'].write('bin_%s\tbin_%s\tz\n'%(headers[options.data[0]-1],headers[options.data[1]-1])) np.savetxt(file['output'],result) - file['output'].close() # close output ASCII table + table.output_close() # close output ASCII table if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',\ os.path.join(os.path.dirname(file['name']),prefix+os.path.basename(file['name']))) diff --git a/processing/post/blowUp.py b/processing/post/blowUp.py index 9d88ff627..c7688ca3e 100755 --- a/processing/post/blowUp.py +++ b/processing/post/blowUp.py @@ -125,7 +125,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',\ os.path.join(os.path.dirname(file['name']),prefix+os.path.basename(file['name']))) diff --git a/processing/post/deleteColumn.py b/processing/post/deleteColumn.py index 8f3592e19..4ae55c3f3 100755 --- a/processing/post/deleteColumn.py +++ b/processing/post/deleteColumn.py @@ -98,7 +98,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/deleteInfo.py b/processing/post/deleteInfo.py index c807a75e8..7628cd539 100755 --- a/processing/post/deleteInfo.py +++ b/processing/post/deleteInfo.py @@ -48,7 +48,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/filterTable.py b/processing/post/filterTable.py index e7f59acc3..8515e098d 100755 --- a/processing/post/filterTable.py +++ b/processing/post/filterTable.py @@ -95,7 +95,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/nodesFromCentroids.py b/processing/post/nodesFromCentroids.py index 41d8f424d..f8402730d 100755 --- a/processing/post/nodesFromCentroids.py +++ b/processing/post/nodesFromCentroids.py @@ -148,7 +148,7 @@ for file in files: undeformedCentroids[x,y,z] = numpy.array(map(float,table.data[columnUndeformed:columnUndeformed+3]),'d') defgrad[x,y,z] = numpy.array(map(float,table.data[columnDefgrad:columnDefgrad+9]),'d').reshape(3,3) - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table # ------------------------------------------ process value field ---------------------------- diff --git a/processing/post/perceptualUniformColorMap.py b/processing/post/perceptualUniformColorMap.py index 0cc742d7a..b09acaead 100755 --- a/processing/post/perceptualUniformColorMap.py +++ b/processing/post/perceptualUniformColorMap.py @@ -166,4 +166,4 @@ myColormap = Colormap(leftColor,rightColor) for file in files: outColormap = myColormap.export(file['name'],file['outtype'],options.steps,list(options.trim)) file['output'].write(outColormap) - file['output'].close() + table.output_close() diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py index 19328a29e..33033569c 100755 --- a/processing/post/permuteData.py +++ b/processing/post/permuteData.py @@ -90,6 +90,6 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table - file['output'].close() # close output ASCII table + table.input_close() # close input ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 3fa36a843..6bb62815c 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -110,7 +110,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/scaleData.py b/processing/post/scaleData.py index 242e0702f..1815c2b0a 100755 --- a/processing/post/scaleData.py +++ b/processing/post/scaleData.py @@ -103,7 +103,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/shiftData.py b/processing/post/shiftData.py index 2ce1a7044..51be9e177 100755 --- a/processing/post/shiftData.py +++ b/processing/post/shiftData.py @@ -103,7 +103,7 @@ for file in files: # ------------------------------------------ output result ----------------------------------------- outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table (works for stdin) - file['output'].close() # close output ASCII table (works for stdout) + table.input_close() # close input ASCII table (works for stdin) + table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/showTable.py b/processing/post/showTable.py index 01f6f0a7d..63bf63adf 100755 --- a/processing/post/showTable.py +++ b/processing/post/showTable.py @@ -59,4 +59,4 @@ for file in files: outputAlive and table.output_flush() if file['name'] != 'STDIN': - file['input'].close() + table.input_close() diff --git a/processing/post/sortTable.py b/processing/post/sortTable.py index b7002f7fb..e157fc5e0 100755 --- a/processing/post/sortTable.py +++ b/processing/post/sortTable.py @@ -98,7 +98,7 @@ for file in files: table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': - file['output'].close() # close output ASCII table + table.output_close() # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/stddevDown.py b/processing/post/stddevDown.py index 103323437..39fc45843 100755 --- a/processing/post/stddevDown.py +++ b/processing/post/stddevDown.py @@ -188,6 +188,6 @@ for file in files: # ------------------------------------------ close file handles --------------------------------------- for file in files: - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': - file['output'].close() # close output ASCII table + table.output_close() # close output ASCII table diff --git a/processing/post/tagLabel.py b/processing/post/tagLabel.py index a5a40575b..cffef4c42 100755 --- a/processing/post/tagLabel.py +++ b/processing/post/tagLabel.py @@ -119,7 +119,7 @@ for file in files: outputAlive and table.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': file['output'].close # close output ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 9faae392e..d6b34a2c5 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -127,7 +127,7 @@ for file in files: elif datatype == 'scalar': array[datatype][label].InsertNextValue(float(theData[0])) - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table # ------------------------------------------ add data --------------------------------------- diff --git a/processing/post/vtk_addVoxelcloudData.py b/processing/post/vtk_addVoxelcloudData.py index 342afe5e9..56dbbecfb 100755 --- a/processing/post/vtk_addVoxelcloudData.py +++ b/processing/post/vtk_addVoxelcloudData.py @@ -136,7 +136,7 @@ for file in files: elif datatype == 'scalar': array[datatype][label].InsertNextValue(float(theData[0])) - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table # ------------------------------------------ add data --------------------------------------- diff --git a/processing/post/vtk_pointcloud.py b/processing/post/vtk_pointcloud.py index 1c4f16509..8ddd5e6e9 100755 --- a/processing/post/vtk_pointcloud.py +++ b/processing/post/vtk_pointcloud.py @@ -112,4 +112,4 @@ for file in files: writer.SetInputData(Polydata) writer.Write() - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table diff --git a/processing/post/vtk_voxelcloud.py b/processing/post/vtk_voxelcloud.py index 921b75dbc..5cd03f118 100755 --- a/processing/post/vtk_voxelcloud.py +++ b/processing/post/vtk_voxelcloud.py @@ -134,4 +134,4 @@ for file in files: writer.SetInputData(uGrid) writer.Write() - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table diff --git a/processing/pre/geom_addPrimitive.py b/processing/pre/geom_addPrimitive.py index 1982ecc4c..f80999d0c 100755 --- a/processing/pre/geom_addPrimitive.py +++ b/processing/pre/geom_addPrimitive.py @@ -223,6 +223,6 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',file['name']) diff --git a/processing/pre/geom_canvas.py b/processing/pre/geom_canvas.py index 10b0d77a7..c2806e5a8 100755 --- a/processing/pre/geom_canvas.py +++ b/processing/pre/geom_canvas.py @@ -217,6 +217,6 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',file['name']) diff --git a/processing/pre/geom_fromAng.py b/processing/pre/geom_fromAng.py index 95a96031a..de83c5870 100755 --- a/processing/pre/geom_fromAng.py +++ b/processing/pre/geom_fromAng.py @@ -208,7 +208,7 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['output'].close() + table.output_close() os.rename(file['name']+'_tmp',os.path.splitext(file['name'])[0] + \ {True: '_material.config', False:'.geom'}[options.config]) diff --git a/processing/pre/geom_fromEuclideanDistance.py b/processing/pre/geom_fromEuclideanDistance.py index 1eedeac07..1844e4d7e 100755 --- a/processing/pre/geom_fromEuclideanDistance.py +++ b/processing/pre/geom_fromEuclideanDistance.py @@ -284,4 +284,4 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() + table.input_close() diff --git a/processing/pre/geom_fromOsteonGeometry.py b/processing/pre/geom_fromOsteonGeometry.py index a73500a14..1ddda949e 100755 --- a/processing/pre/geom_fromOsteonGeometry.py +++ b/processing/pre/geom_fromOsteonGeometry.py @@ -192,4 +192,4 @@ else: #--- output finalization -------------------------------------------------------------------------- -file['output'].close() +table.output_close() diff --git a/processing/pre/geom_fromVPSC.py b/processing/pre/geom_fromVPSC.py index bede40fce..9219a0ce7 100755 --- a/processing/pre/geom_fromVPSC.py +++ b/processing/pre/geom_fromVPSC.py @@ -143,7 +143,7 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['output'].close() + table.output_close() os.rename(file['name']+'_tmp',os.path.splitext(file['name'])[0] + \ {True: '_material.config', False:'.geom'}[options.config]) diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index f410bda13..a7c29afae 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -266,8 +266,8 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',os.path.splitext(file['name'])[0] + \ {True: '_material.config', False:'.geom'}[options.config]) diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 14d414fa0..f2cfd01ff 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -1,31 +1,14 @@ #!/usr/bin/env python # -*- coding: UTF-8 no BOM -*- -import os,sys,string,re,math,numpy +import os,sys,string,re,math +import numpy as np +from optparse import OptionParser import damask -from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP scriptID = '$Id$' scriptName = scriptID.split()[1] -#-------------------------------------------------------------------------------------------------- -class extendedOption(Option): -#-------------------------------------------------------------------------------------------------- -# used for definition of new option parser action 'extend', which enables to take multiple option arguments -# taken from online tutorial http://docs.python.org/library/optparse.html - - ACTIONS = Option.ACTIONS + ("extend",) - STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",) - TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",) - ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "extend": - lvalue = value.split(",") - values.ensure_value(dest, []).extend(lvalue) - else: - Option.take_action(self, action, dest, opt, value, values, parser) - #-------------------------------------------------------------------------------------------------- # MAIN @@ -47,29 +30,20 @@ mappings = { 'microstructures': lambda x: int(x), } -parser = OptionParser(option_class=extendedOption, usage='%prog options [file[s]]', description = """ +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ compress geometry files with ranges "a to b" and/or multiples "n of x". -""" + string.replace(scriptID,'\n','\\n') -) +""", version = scriptID) (options, filenames) = parser.parse_args() -#--- setup file handles --------------------------------------------------------------------------- +# ------------------------------------------ setup file handles --------------------------------------- files = [] if filenames == []: - files.append({'name':'STDIN', - 'input':sys.stdin, - 'output':sys.stdout, - 'croak':sys.stderr, - }) + files.append({'name':'STDIN', 'input':sys.stdin, 'output':sys.stdout, 'croak':sys.stderr}) else: for name in filenames: if os.path.exists(name): - files.append({'name':name, - 'input':open(name), - 'output':open(name+'_tmp','w'), - 'croak':sys.stdout, - }) + files.append({'name':name, 'input':open(name), 'output':open(name+'_tmp','w'), 'croak':sys.stderr}) #--- loop over input files ------------------------------------------------------------------------ for file in files: @@ -82,9 +56,9 @@ for file in files: #--- interpret header ---------------------------------------------------------------------------- info = { - 'grid': numpy.zeros(3,'i'), - 'size': numpy.zeros(3,'d'), - 'origin': numpy.zeros(3,'d'), + 'grid': np.zeros(3,'i'), + 'size': np.zeros(3,'d'), + 'origin': np.zeros(3,'d'), 'homogenization': 0, 'microstructures': 0, } @@ -111,10 +85,10 @@ for file in files: 'homogenization: %i\n'%info['homogenization'] + \ 'microstructures: %i\n'%info['microstructures']) - if numpy.any(info['grid'] < 1): + if np.any(info['grid'] < 1): file['croak'].write('invalid grid a b c.\n') continue - if numpy.any(info['size'] <= 0.0): + if np.any(info['size'] <= 0.0): file['croak'].write('invalid size x y z.\n') continue @@ -179,11 +153,10 @@ for file in files: # ------------------------------------------ output result --------------------------------------- - outputAlive and theTable.output_flush() # just in case of buffered ASCII table #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() # close input ASCII table - file['output'].close() # close input ASCII table + table.input_close() # close input ASCII table + table.output_close() # close input ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/pre/geom_rescale.py b/processing/pre/geom_rescale.py index bb99afd81..86d5949f8 100755 --- a/processing/pre/geom_rescale.py +++ b/processing/pre/geom_rescale.py @@ -219,7 +219,7 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',file['name']) diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index 5e529aab9..e8f477a2d 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -188,6 +188,6 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',file['name']) diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 9683d1d6a..27af0bde0 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -162,6 +162,6 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() # close input ASCII table - file['output'].close() # close input ASCII table + table.input_close() # close input ASCII table + table.output_close() # close input ASCII table os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/pre/geom_vicinityOffset.py b/processing/pre/geom_vicinityOffset.py index 05caa2c87..42d675e7f 100755 --- a/processing/pre/geom_vicinityOffset.py +++ b/processing/pre/geom_vicinityOffset.py @@ -181,7 +181,7 @@ for file in files: #--- output finalization -------------------------------------------------------------------------- if file['name'] != 'STDIN': - file['input'].close() - file['output'].close() + table.input_close() + table.output_close() os.rename(file['name']+'_tmp',file['name']) diff --git a/processing/pre/seeds_fromGeom.py b/processing/pre/seeds_fromGeom.py index 1980c3a92..0cc7d50bb 100755 --- a/processing/pre/seeds_fromGeom.py +++ b/processing/pre/seeds_fromGeom.py @@ -189,6 +189,6 @@ for file in files: outputDead or theTable.output_flush() # just in case of buffered ASCII table - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': - file['output'].close() # close output ASCII table \ No newline at end of file + table.output_close() # close output ASCII table \ No newline at end of file diff --git a/processing/pre/seeds_fromTable.py b/processing/pre/seeds_fromTable.py index 29ae119f4..ab0149c3c 100755 --- a/processing/pre/seeds_fromTable.py +++ b/processing/pre/seeds_fromTable.py @@ -177,6 +177,6 @@ for file in files: theTable.data_writeArray() theTable.output_flush() - file['input'].close() # close input ASCII table + table.input_close() # close input ASCII table if file['name'] != 'STDIN': - file['output'].close() # close output ASCII table + table.output_close() # close output ASCII table