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 5e2ac8fb authored by Edward Andò's avatar Edward Andò
Browse files

resolves #205. Quiet numpy output in scripts, remove...

resolves #205. Quiet numpy output in scripts, remove interpolateDisplacementsOnGrid and add checkSurrounded to interpolatePhiField
parent 03a4b6be
Pipeline #67475 passed with stages
in 42 minutes and 52 seconds
......@@ -66,6 +66,8 @@ Changelog
+-----------------+------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Version | Date | Notes |
+=================+============+======================================================================================================================================+
| Version 0.6.0.1 | 2021-05-20 | Small fixes to spam-filterPhifield and spam-regularStrain |
+-----------------+------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Version 0.6.0 | 2021-05-04 | Massive rewrite of image correlation scripts, introduction of spam-pixelSearchPropagate, spam-filterPhiField, spam-passPhiField. |
| | | The spam-pixelSearch is now separate from spam-ldic and spam-ddic, and works both in grid and labelled mode. |
| | | Please check out new script documentation for a flowchart of how these should be used in series. |
......
......@@ -18,13 +18,13 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
from __future__ import print_function
import tifffile
import numpy
import spam.label
import spam.helpers
import spam.mesh
import tifffile
import numpy
numpy.seterr(all='ignore')
import scipy.ndimage
import argparse
......
......@@ -17,15 +17,17 @@ more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import spam.DIC
import spam.label
import spam.deformation
import spam.helpers
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import scipy.ndimage
import tifffile
import multiprocessing
......
......@@ -28,13 +28,15 @@ We don't use the more accurate `spam.DIC.deformationFunction.applyPhiField` whic
"""
import numpy
import argparse
import spam.helpers
import spam.mesh
import spam.label
import spam.DIC
import spam.deformation
import numpy
numpy.seterr(all='ignore')
import argparse
import tifffile
# Define argument parser object
......
......@@ -30,20 +30,21 @@ either projected back to grains (whereby the value at each grain is a weighted l
...or projected onto a regular grid.
"""
import spam.helpers
import spam.DIC
import spam.deformation
import spam.mesh
import spam.label
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import argparse
import numpy
numpy.seterr(all='ignore')
import multiprocessing
import spam.helpers
import spam.DIC
import spam.deformation
import spam.mesh
import spam.label
# Define argument parser object
parser = argparse.ArgumentParser(description="spam-discreteStrain "+spam.helpers.optionsParser.GLPv3descriptionHeader +\
......
......@@ -18,13 +18,15 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import spam.visual.visualClass as visual
import spam.helpers
import sys
import os
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog, QGridLayout
import spam.visual.visualClass as visual
import numpy
numpy.seterr(all='ignore')
import tifffile
import spam.helpers
def main():
app = QApplication(sys.argv)
......
......@@ -19,14 +19,16 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import spam.visual.visualClass as visual
import os
import sys
import subprocess
import spam.helpers
import spam.label
import numpy
numpy.seterr(all='ignore')
import tifffile
import spam.visual.visualClass as visual
import argparse
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog, QGridLayout, QPushButton
......
......@@ -40,16 +40,17 @@ You should have received a copy of the GNU General Public License along with
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 spam.mesh
import spam.label
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import multiprocessing
import scipy.spatial
import scipy.ndimage
......
......@@ -18,19 +18,20 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import tifffile
import numpy
import argparse
import pickle
import scipy.ndimage
import spam.datasets
import spam.mesh
import spam.DIC
import spam.deformation
import spam.label
import spam.helpers
import numpy
numpy.seterr(all='ignore')
import tifffile
import argparse
import pickle
import scipy.ndimage
# parser
import spam.helpers.optionsParser
parser = argparse.ArgumentParser(description="spam-gdic "+spam.helpers.optionsParser.GLPv3descriptionHeader +\
......
......@@ -20,13 +20,12 @@ this program. If not, see <http://www.gnu.org/licenses/>.
"""
import spam.mesh
import spam.helpers
from __future__ import print_function
import tifffile
import numpy
import spam.mesh
import spam.helpers
numpy.seterr(all='ignore')
import argparse
# Define argument parser object
......
......@@ -18,15 +18,16 @@ You should have received a copy of the GNU General Public License along with
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 os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import argparse
import scipy.ndimage
import tifffile
import multiprocessing
......
......@@ -23,6 +23,7 @@ import spam.DIC
#import pickle
import tifffile
import numpy
numpy.seterr(all='ignore')
# import scipy.ndimage
import argparse
......
......@@ -23,6 +23,7 @@ import spam.label as ltk
import spam.DIC
import spam.deformation
import numpy
numpy.seterr(all='ignore')
import sys, os
import tifffile
#import matplotlib.pyplot as plt
......
......@@ -55,16 +55,17 @@ You should have received a copy of the GNU General Public License along with
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 spam.mesh
import spam.label
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import multiprocessing
import scipy.spatial
import progressbar
......@@ -251,6 +252,7 @@ else:
nNeighbours=args.NUMBER_OF_NEIGHBOURS,
neighbourRadius=args.NEIGHBOUR_RADIUS,
interpolateF=args.APPLY_F,
checkPointSurrounded=args.CHECK_POINT_SURROUNDED,
nProcesses=args.PROCESSES,
verbose=True)
......
......@@ -22,8 +22,6 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import spam.DIC
import spam.deformation
......@@ -31,7 +29,11 @@ import spam.helpers
#import spam.mesh
import spam.label
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import multiprocessing
import progressbar
import argparse
......
......@@ -22,14 +22,16 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import spam.DIC
import spam.mesh
import spam.helpers
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
import numpy
numpy.seterr(all='ignore')
import progressbar
import argparse
import tifffile
......
......@@ -25,11 +25,14 @@ This script is a good initial starting point for a the measurement of a displace
field, if there is a homogeneous background movement to measure
"""
import numpy
import argparse
import spam.helpers
import spam.DIC
import spam.deformation
import numpy
numpy.seterr(all='ignore')
import argparse
import tifffile
import os
......
......@@ -18,6 +18,11 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
"""
import spam.helpers
import spam.DIC
import spam.deformation
import spam.mesh
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
......@@ -28,10 +33,6 @@ import multiprocessing
import numpy
numpy.seterr(all='ignore')
import spam.helpers
import spam.DIC
import spam.deformation
import spam.mesh
# Define argument parser object
......
......@@ -99,7 +99,7 @@ name = 'spam'
description = 'Software for the Practical Analysis of Materials'
long_description = readReadMe('README.rst')
long_description_content_type = 'text/x-rst'
version = '0.6.0.0'
version = '0.6.0.1'
author = 'SPAM authors'
author_email = 'edward.ando@3sr-grenoble.fr'
copyright = 'SPAM authors 2020'
......
......@@ -23,7 +23,7 @@ import scipy.ndimage
###########################################################
# Take an Phi and apply it (C++) to an image
###########################################################
def applyPhi(im, Phi=None, PhiPoint=None, interpolationOrder=1):
def applyPhi(im, Phi=None, PhiCentre=None, interpolationOrder=1):
"""
Deform a 3D image using a deformation function "Phi", applied using spam's C++ interpolator.
Only interpolation order = 1 is implemented.
......@@ -37,7 +37,7 @@ def applyPhi(im, Phi=None, PhiPoint=None, interpolationOrder=1):
"Phi" deformation function.
Highly recommended additional argument (why are you calling this function otherwise?)
PhiPoint : 3x1 array of floats, optional
PhiCentre : 3x1 array of floats, optional
Centre of application of Phi.
Default = (numpy.array(im1.shape)-1)/2.0
i.e., the centre of the image
......@@ -70,21 +70,21 @@ def applyPhi(im, Phi=None, PhiPoint=None, interpolationOrder=1):
# print( "\tapplyPhi(): Can't inverse Phi, setting it to identity matrix. Phi is:\n{}".format( Phi ) )
PhiInv = numpy.eye(4, dtype='<f4')
if PhiPoint is None:
PhiPoint = (numpy.array(im.shape) - 1) / 2.0
if PhiCentre is None:
PhiCentre = (numpy.array(im.shape) - 1) / 2.0
if interpolationOrder > 1:
print("DIC.deformationFunction.applyPhi(): interpolation Order > 1 not implemented")
return
im = im.astype('<f4')
PhiPoint = numpy.array(PhiPoint).astype('<f4')
PhiCentre = numpy.array(PhiCentre).astype('<f4')
# We need to inverse Phi for question of direction
imDef = numpy.zeros_like(im, dtype='<f4')
DICToolkit.applyPhi(im.astype('<f4'),
imDef,
PhiInv.astype('<f4'),
PhiPoint.astype('<f4'),
PhiCentre.astype('<f4'),
int(interpolationOrder))
return imDef
......@@ -92,7 +92,7 @@ def applyPhi(im, Phi=None, PhiPoint=None, interpolationOrder=1):
###########################################################
# Take an Phi and apply it to an image
###########################################################
def applyPhiPython(im, Phi=None, PhiPoint=None, interpolationOrder=3):
def applyPhiPython(im, Phi=None, PhiCentre=None, interpolationOrder=3):
"""
Deform a 3D image using a deformation function "Phi", applied using scipy.ndimage.map_coordinates
Can have orders > 1 but is hungry in memory.
......@@ -106,7 +106,7 @@ def applyPhiPython(im, Phi=None, PhiPoint=None, interpolationOrder=3):
"Phi" linear deformation function.
Highly recommended additional argument (why are you calling this function otherwise?)
PhiPoint : 3x1 array of floats, optional
PhiCentre : 3x1 array of floats, optional
Centre of application of Phi.
Default = (numpy.array(im1.shape)-1)/2.0
i.e., the centre of the image
......@@ -130,8 +130,8 @@ def applyPhiPython(im, Phi=None, PhiPoint=None, interpolationOrder=3):
# print( "\tapplyPhiPython(): Can't inverse Phi, setting it to identity matrix. Phi is:\n{}".format( Phi ) )
PhiInv = numpy.eye(4)
if PhiPoint is None:
PhiPoint = (numpy.array(im.shape) - 1) / 2.0
if PhiCentre is None:
PhiCentre = (numpy.array(im.shape) - 1) / 2.0
imDef = numpy.zeros_like(im, dtype='<f4')
......@@ -142,16 +142,16 @@ def applyPhiPython(im, Phi=None, PhiPoint=None, interpolationOrder=3):
0:im.shape[2]]
# Copy into coordinatesInitial
coordinatesInitial[0, :] = coordinates_mgrid[0].ravel() - PhiPoint[0]
coordinatesInitial[1, :] = coordinates_mgrid[1].ravel() - PhiPoint[1]
coordinatesInitial[2, :] = coordinates_mgrid[2].ravel() - PhiPoint[2]
coordinatesInitial[0, :] = coordinates_mgrid[0].ravel() - PhiCentre[0]
coordinatesInitial[1, :] = coordinates_mgrid[1].ravel() - PhiCentre[1]
coordinatesInitial[2, :] = coordinates_mgrid[2].ravel() - PhiCentre[2]
# Apply Phi to coordinates
coordinatesDef = numpy.dot(PhiInv, coordinatesInitial)
coordinatesDef[0, :] += PhiPoint[0]
coordinatesDef[1, :] += PhiPoint[1]
coordinatesDef[2, :] += PhiPoint[2]
coordinatesDef[0, :] += PhiCentre[0]
coordinatesDef[1, :] += PhiCentre[1]
coordinatesDef[2, :] += PhiCentre[2]
imDef += scipy.ndimage.map_coordinates(im,
coordinatesDef[0:3],
......
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