Commit 5213bd6c authored by Edward Andò's avatar Edward Andò
Browse files

spam-ddic working, ldmax needs implementing

parent aa6f0a70
Pipeline #59851 failed with stages
in 12 minutes and 4 seconds
This diff is collapsed.
......@@ -21,17 +21,18 @@ this program. If not, see <http://www.gnu.org/licenses/>.
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import spam.DIC
import spam.deformation
import spam.helpers
import argparse
import numpy
import scipy.ndimage
import tifffile
import multiprocessing
import progressbar
import numpy
import scipy.ndimage
import spam.DIC
import spam.deformation
import spam.helpers
......@@ -256,19 +257,16 @@ for im2number in range(1, len(args.inFiles)):
# Check if we've hit the same point in the two grids
if numpy.any(distance == 0):
# Copy F of that point to the F in the current grid point
PhiField[node] = fieldValues[indices][numpy.where(distance == 0)].copy()
# If not, consider the closest neighbours
else:
# Compute the "Inverse Distance Weighting" since the closest points should have the major influence
weightSumInv = sum(1/distance)
# Loop over each neighbour
for neighbour in range(nNeighbours):
# Calculate it's weight
weightInv = (1/distance[neighbour])/float(weightSumInv)
......
......@@ -25,18 +25,19 @@ this program. If not, see <http://www.gnu.org/licenses/>.
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import argparse
import spam.DIC
import spam.deformation
import spam.helpers
#import spam.mesh
import spam.label
import numpy
import multiprocessing
import progressbar
import argparse
import tifffile
import numpy
import spam.helpers
#import spam.mesh
import spam.label
import spam.DIC
import spam.deformation
......@@ -381,9 +382,9 @@ if args.TIFF:
# Collect data into VTK output
if args.VTK:
if args.VTK and args.LAB1 is None:
cellData = {}
cellData['displacements'] = PhiField[:, :-1, 3].reshape((nodesDim[0], nodesDim[1], nodesDim[2], 3))
cellData['displacements'] = PhiField[:, :-1, 3].reshape((nodesDim[0], nodesDim[1], nodesDim[2], 3))
cellData['pixelSearchCC'] = pixelSearchCC.reshape(nodesDim)
# Overwrite nans and infs with 0, rubbish I know
......@@ -396,3 +397,15 @@ if args.VTK:
# If you insist on overlapping, then perhaps it's better to save each point as a cube glyph
# and actually *have* overlapping
spam.helpers.writeStructuredVTK(origin=nodePositions[0]-args.HWS, aspectRatio=args.NS, cellData=cellData, fileName=args.OUT_DIR+"/"+args.PREFIX+".vtk")
elif args.VTK and args.LAB1 is not None:
# Redundant output for VTK visualisation
magDisp = numpy.zeros(numberOfNodes)
for node in range(numberOfNodes):
magDisp[node] = numpy.linalg.norm(PhiField[node][0:3,-1])
VTKglyphDict = {'displacements': PhiField[:, 0:3, -1],
'mag(displacements)': magDisp,
'pixelSearchCC': pixelSearchCC}
spam.helpers.writeGlyphsVTK(nodePositions, VTKglyphDict, fileName=args.OUT_DIR + "/" + args.PREFIX + ".vtk")
......@@ -356,6 +356,13 @@ def ddicParser(parser):
type=argparse.FileType('r'),
help="Greyscale image of deformed state for correlation")
parser.add_argument('-np',
'--number-of-processes',
default=None,
type=int,
dest='PROCESSES',
help="Number of parallel processes to use. Default = multiprocessing.cpu_count()")
parser.add_argument('-ld',
'--label-dilate',
type=int,
......@@ -532,9 +539,13 @@ def ddicParser(parser):
args.LABEL_DILATE_MAX = args.LABEL_DILATE
if args.LABEL_DILATE_MAX < args.LABEL_DILATE:
print("spam-ddic: Warining \"label dilate max\" is less than \"label dilate\" setting them equal")
print("spam-ddic: Warning \"label dilate max\" is less than \"label dilate\" setting them equal")
args.LABEL_DILATE_MAX = args.LABEL_DILATE
if args.DEBUG:
print("spam-ddic: DEBUG mode activated, forcing number of processes to 1")
args.PROCESSES = 1
return args
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment