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 2e1c7d9c authored by Edward's avatar Edward
Browse files

small updated, spam-filterPhiField with filterF option, ereg-discrete output prefix

parent 7dd523c5
Pipeline #67114 passed with stages
in 26 minutes and 57 seconds
......@@ -12,7 +12,7 @@ On Windows 10 an Ubuntu Linux subsystem can installed via WSL, which should offe
.. .. _Riot room: https://riot.im/app/#/room/#spam:matrix.org
``Spam`` works on **Python 3.5+**, but if you need **python** 2.7 support the *git* install still works correctly.
``Spam`` works on **Python 3.6+**.
The install process is in two steps: installing **system dependencies**, then **installing spam**.
......@@ -72,7 +72,7 @@ System dependencies for Debian/Ubuntu Linux
$ sudo apt upgrade
$ sudo apt install git python3-dev python3-virtualenv python3-tk gcc g++ libeigen3-dev r-base libicu-dev libgmp-dev libmpfr-dev mpi-default-bin mpi-default-dev libcgal-dev gmsh libfreetype6-dev libxml2-dev libxslt-dev
$ sudo apt install git python3-dev python3-virtualenv python3-tk gcc g++ libeigen3-dev r-base libicu-dev libgmp-dev libmpfr-dev libcgal-dev gmsh libfreetype6-dev libxml2-dev libxslt-dev
Now you're ready to go to: :ref:`installVenv`
......@@ -95,7 +95,7 @@ System dependencies for Scientific Linux 6.9
$ sudo sh -c 'wget -qO- http://people.redhat.com/bkabrda/scl_python27.repo >> /etc/yum.repos.d/scl.repo'
$ sudo yum install git swig python27 python27-python-libs python27-runtime python27-python-devel python-pip python-virtualenv gcc eigen3-devel R gmp-devel mpfr-devel openmpi openmpi-devel mpich-devel mpich-autoload
$ sudo yum install git swig python27 python27-python-libs python27-runtime python27-python-devel python-pip python-virtualenv gcc eigen3-devel R gmp-devel mpfr-devel
Now you're ready to go to: :ref:`installVenv`
......@@ -122,7 +122,6 @@ Compilation dependencies:
External programs we call:
- R
- gmsh
- mpi (optional)
Dependencies of the pip packages we use:
- libfreetype6-dev (for matplotlib)
......@@ -150,7 +149,6 @@ System dependencies for OSX 10.14
* **cmake**
* **eigen3**
* **openMPI**
* **gmsh** 4.4.1
* **gmp**
* **mpfr**
......
......@@ -45,7 +45,7 @@ argsDict = vars(args)
for key in sorted(argsDict):
print("\t{}: {}".format(key, argsDict[key]))
outFile = args.OUT_DIR+"/"+args.PREFIX+".tsv"
outFile = args.OUT_DIR+"/"+args.PREFIX+"-ereg-discrete.tsv"
REFlab = tifffile.imread(args.lab1.name)
REFlabBB = spam.label.boundingBoxes(REFlab)
......@@ -61,8 +61,14 @@ DEFstr = os.path.basename(args.im2.name)
if args.PHIFILE is not None:
DDIC = spam.helpers.readCorrelationTSV(args.PHIFILE.name)
DDIC['error'] = numpy.genfromtxt(args.PHIFILE.name, delimiter='\t', names=True)['error']
DDIC['LabelDilate'] = numpy.genfromtxt(args.PHIFILE.name, delimiter='\t', names=True)['LabelDilate']
DDIC['PSCC'] = numpy.genfromtxt(args.PHIFILE.name, delimiter='\t', names=True)['PSCC']
try:
DDIC['LabelDilate'] = numpy.genfromtxt(args.PHIFILE.name, delimiter='\t', names=True)['LabelDilate']
except:
DDIC['LabelDilate'] = numpy.zeros(DDIC['error'].shape[0])
try:
DDIC['PSCC'] = numpy.genfromtxt(args.PHIFILE.name, delimiter='\t', names=True)['PSCC']
except:
DDIC['PSCC'] = numpy.zeros(DDIC['error'].shape[0])
else:
labMax = REFlab.max()
DDIC = {}
......@@ -90,7 +96,7 @@ class MainWindow(QWidget):
# In the very unlucky case that there is a nax numbered nonConverged grain that is not present at all:
if REFlabBB.shape[0] < len(nonConvergedGrains):
print("Warning: there are higher-numbered labels in your TSV file that are not in the labelled image, discarding them")
print(numpy.where(nonConvergedGrains), presentGrains)
self.nonConvergedGrains = numpy.where(numpy.logical_and(nonConvergedGrains, presentGrains))[0][0:]
......
......@@ -170,8 +170,8 @@ elif args.SLQC:
nNeighbours=args.NUMBER_OF_NEIGHBOURS,
nProcesses=args.PROCESSES,
verbose=True)
print(LQC.shape)
print(inputGood[~inputIgnore].shape)
#print(LQC.shape)
#print(inputGood[~inputIgnore].shape)
inputGood[~inputIgnore] = LQC < 0.1
inputBad[~inputIgnore] = LQC >= 0.1
......@@ -193,17 +193,20 @@ if (args.CINT + args.CLQF) > 0 and numpy.sum(inputBad) == 0:
print("No points to correct, exiting")
exit()
else:
print(f"\n\nCorrecting {numpy.sum(inputBad)} points ({100*numpy.sum(inputBad)/numpy.sum(inputGood):03.1f}%)")
###############################################################
### Correct those bad points
###############################################################
if args.CINT:
print(f"\n\nCorrection based on local interpolation (mode = {args.MODE})")
print(f"\n\nCorrection based on local interpolation (filterF = {args.FILTER_F})")
PhiFieldCorrected = spam.DIC.interpolatePhiField(inputNodePositions[inputGood],
inputPhiField[inputGood],
inputNodePositions[inputBad],
nNeighbours=args.NUMBER_OF_NEIGHBOURS,
neighbourRadius=args.NEIGHBOUR_RADIUS,
mode=args.MODE,
interpolateF=args.FILTER_F,
nProcesses=args.PROCESSES,
verbose=True)
outputPhiField[inputBad] = PhiFieldCorrected
......@@ -212,6 +215,9 @@ if args.CINT:
print("\tYou asked to correct with local QC fitting with -clqf, but only one correciton mode is supported")
elif args.CLQF:
if args.FILTER_F is not 'disp':
print("WARNING: non-displacement quadratic coherency correction not implemented, only doing displacements, and returning F=eye(3)\n")
print("\n\nCorrection based on local quadratic coherency")
dispLQC = spam.DIC.estimateDisplacementFromQuadraticFit(inputNodePositions[inputGood],
inputDisplacements[inputGood],
......@@ -239,11 +245,11 @@ if args.FILTER_MEDIAN:
if args.MASK:
inputPhiField[inputIgnore] = numpy.nan
if args.MODE == 'rigid':
if args.FILTER_F == 'rigid':
print("Rigid mode not well defined for overall median filtering, exiting")
exit()
if args.MODE == 'all':
if args.FILTER_F == 'all':
# Filter F components
print("Filtering F components...")
print("\t1/9")
......@@ -265,7 +271,7 @@ if args.FILTER_MEDIAN:
print("\t9/9")
outputPhiField[:, 2, 2] = scipy.ndimage.generic_filter(inputPhiField[:, 2, 2].reshape(inputNodesDim), numpy.nanmedian, size=(2 * filterPointsRadius + 1)).ravel()
if args.MODE == 'disp':
if args.FILTER_F == 'disp':
for n in range(inputNodePositions.shape[0]):
outputPhiField[n] = numpy.eye(4)
......
......@@ -487,7 +487,7 @@ def interpolatePhiField(fieldCoords, PhiField, pointsToInterpolate, nNeighbours=
if verbose:
print("\n\tStarting Phi field interpolation (with {} process{})".format(nProcesses, 'es' if nProcesses > 1 else ''))
print("\nStarting Phi field interpolation (with {} process{})".format(nProcesses, 'es' if nProcesses > 1 else ''))
widgets = [progressbar.Bar(), ' ', progressbar.AdaptiveETA()]
pbar = progressbar.ProgressBar(widgets=widgets, maxval=numberOfPointsToInterpolate)
pbar.start()
......
......@@ -2739,13 +2739,12 @@ def filterPhiField(parser):
dest='CINT',
help='Correct with a local interpolation with weights equal to the inverse of the distance? -mode applies')
parser.add_argument('-m',
'-mode',
'--mode',
parser.add_argument('-F',
'-filterF',
type=str,
default='all',
dest='MODE',
help="What do you want to interpolate/filter? Options: 'all': the full Phi, 'rigid': Rigid body motion, 'disp': Only displacements (faster). Default = 'all'.")
dest='FILTER_F',
help="What do you want to interpolate/filter? Options: 'all': the full Phi, 'rigid': Rigid body motion, 'no': Only displacements (faster). Default = 'all'.")
parser.add_argument('-clqf',
'--correct-by-local-quadratic-fit',
......
......@@ -711,8 +711,13 @@ def getImagettesLabelled(lab1, label, Phi, im1, im2, searchRange, boundingBoxes,
imagette1 = spam.helpers.slicePadded(im1, gottenLabel['boundingBox'] + numpy.array([0,1,0,1,0,1]))
if applyF == "all" or applyF == "rigid":
imagette1 = spam.DIC.applyPhi(imagette1, PhiNoDisp, PhiPoint=gottenLabel['centreOfMassREL'])
imagette1mask = spam.DIC.applyPhi(gottenLabel['subvol'], PhiNoDisp, PhiPoint=gottenLabel['centreOfMassREL'], interpolationOrder=0)
imagette1 = spam.DIC.applyPhi(imagette1,
PhiNoDisp,
PhiPoint=gottenLabel['centreOfMassREL'])
imagette1mask = spam.DIC.applyPhi(gottenLabel['subvol'] > 0,
PhiNoDisp,
PhiPoint=gottenLabel['centreOfMassREL'],
interpolationOrder=0) > 0
elif applyF == "no":
imagette1mask = gottenLabel['subvol']
else:
......
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