Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 26c7350a authored by Edward Andò's avatar Edward Andò
Browse files

Proposal for simple version of the displacement-only regularStrain, dependence...

Proposal for simple version of the displacement-only regularStrain, dependence of mask and correct to be checked
parent f5c53035
Pipeline #43646 passed with stages
in 15 minutes and 34 seconds
......@@ -47,14 +47,17 @@ for key in sorted(argsDict):
print("\t{}: {}".format(key, argsDict[key]))
print("\nspam-regularStrain: Loading data...")
f = spam.helpers.readCorrelationTSV(args.inFile.name, readConvergence=args.MASK)
f = spam.helpers.readCorrelationTSV(args.inFile.name,
readOnlyDisplacements=True,
readConvergence=args.MASK,
readPSCC=args.CORRECT_PIXEL_SEARCH_CC>0.0)
# Get the dimensions and coordinates of the field
dims = f["fieldDims"]
fieldCoords = f["fieldCoords"]
dims = f['fieldDims']
fieldCoords = f['fieldCoords']
# Calculate node spacing for each direction
spaceX = fieldCoords[1,2] - fieldCoords[0,2]
spaceX = fieldCoords[1,2] - fieldCoords[0,2]
spaceY = fieldCoords[dims[2],1] - fieldCoords[0,1]
# Catch 2D case
......@@ -81,7 +84,33 @@ else:
# Check if the correction of the input field is asked
if args.CORRECT_FIELD or args.CORRECT_MEDIAN_FILTER:
print("\nspam-regularStrain: Correcting/filtering field...")
fieldValues = spam.deformation.correctPhiField(fileName = args.inFile.name,
# 2020-05-17 EA: pass the fields to correctPhiField instead of re-reading the file
# However since we read only the displacements above, we need to make a fake PhiField rather
# than a displacement field... for now
if args.MASK:
fieldRS = f['returnStatus'].reshape(dims[0]*dims[1]*dims[2])
fieldDPhi = f['deltaPhiNorm'].reshape(dims[0]*dims[1]*dims[2])
fieldIT = f['iterations'].reshape( dims[0]*dims[1]*dims[2])
if args.CORRECT_PIXEL_SEARCH_CC>0.0:
fieldPSCC = f['PSCC'].reshape( dims[0]*dims[1]*dims[2])
else:
fieldPSCC = numpy.ones_like(fieldRS)
else:
fieldRS = None
fieldDPhi = None
fieldPSCC = None
fieldIT = None
fakePhiField = numpy.zeros([dims[0]*dims[1]*dims[2], 4, 4], dtype='<f4')
# Copy in displacements
fakePhiField[:,0:3,-1] = f['displacements'].reshape(dims[0]*dims[1]*dims[2], 3)
fieldValues = spam.deformation.correctPhiField(fieldCoords = f['fieldCoords'],
fieldValues = fakePhiField,
fieldRS = fieldRS,
fieldDPhi = fieldDPhi,
fieldPSCC = fieldPSCC,
fieldIT = fieldIT,
correctBadPoints = args.CORRECT_FIELD,
ignoreBackGround = ignoreBackGround,
deltaPhiNormMin = args.CORRECT_DELTA_PHI_NORM,
......@@ -89,11 +118,15 @@ if args.CORRECT_FIELD or args.CORRECT_MEDIAN_FILTER:
nNeighbours = args.CORRECT_NEIGHBOURS,
filterPoints = args.CORRECT_MEDIAN_FILTER,
filterPointsRadius = args.CORRECT_MEDIAN_FILTER_RADIUS)
# Extract the corrected displacement field and reshape it
disp = fieldValues[:,:3,-1].reshape(dims[0], dims[1], dims[2], 3)
del fakePhiField
else:
# Directly extract the displacement field without correction/filtering
disp = f["PhiField"][:,:3,-1].reshape(dims[0], dims[1], dims[2], 3)
#disp = f["PhiField"][:,:3,-1].reshape(dims[0], dims[1], dims[2], 3)
disp = f["displacements"].reshape(dims[0], dims[1], dims[2], 3)
# Mask background if asked
if ignoreBackGround:
mask[numpy.where(f["returnStatus"].reshape(dims)<-4)] = numpy.nan
......
......@@ -501,7 +501,7 @@ def correctPhiField(fileName=None, fieldCoords=None, fieldValues=None, fieldRS=N
minimum value of subpixel change in Phi to consider a point with `returnStatus` = 1 as good or bad.
Default = 0.001
picelSearchCCmin: float, optional
pixelSearchCCmin: float, optional
minimum value of pixel search correlation coefficient to consider a point as good or bad.
Default = 0.98
......@@ -601,7 +601,6 @@ def correctPhiField(fileName=None, fieldCoords=None, fieldValues=None, fieldRS=N
# create the k-d tree of the coordinates of good points, we need this to search for the k nearest neighbours easily
# for details see: https://en.wikipedia.org/wiki/K-d_tree &
# https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.spatial.KDTree.query.html
from scipy.spatial import KDTree
treeCoord = KDTree(fieldCoords[goodPoints])
......@@ -629,7 +628,6 @@ def correctPhiField(fileName=None, fieldCoords=None, fieldValues=None, fieldRS=N
# if we have asked for more neighbours
else:
# loop over each bad point
for badPoint in range(badPoints[0].shape[0]):
if verbose:
......
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