Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttk
spam
Commits
bf50a8d5
Commit
bf50a8d5
authored
Sep 25, 2020
by
Edward Andò
Browse files
sketch of spam-ldic with slicePadded but not yet working fine
parent
3713ab91
Pipeline
#49872
failed with stages
in 12 minutes and 32 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/test_scripts.py
View file @
bf50a8d5
...
...
@@ -76,13 +76,16 @@ class testAll(unittest.TestCase):
rm
(
testFolder
+
"zoom.tsv"
)
rm
(
testFolder
+
"snow-ref-bin.tif"
)
rm
(
testFolder
+
"snow-ref-watershed.tif"
)
rm
(
testFolder
+
"extreme-im1.tif"
)
rm
(
testFolder
+
"extreme-im1lab.tif"
)
rm
(
testFolder
+
"extreme-im2.tif"
)
pass
except
OSError
:
pass
pass
def
_
test_ldic_and_regularStrain
(
self
):
def
test_ldic_and_regularStrain
(
self
):
# Make test directory
if
not
os
.
path
.
isdir
(
testFolder
):
os
.
mkdir
(
testFolder
)
...
...
@@ -113,7 +116,7 @@ class testAll(unittest.TestCase):
# Check output results with TSV output, bin1 registration + TIFFs
# Decreasing node spacing in order to have more points for Geers strain calculation
# exitCode = subprocess.call(["spam-ldic", "-Ffile", testFolder+"snow-ref-snow-def-bin2-registration.tsv", "-Ffb", "2", "-hws", "15", testFolder+"snow-ref.tif", testFolder+"snow-def.tif", "-od", testFolder+"", "-tsv"])
exitCode
=
subprocess
.
call
([
"spam-ldic"
,
"-
reg"
,
"-regbb
"
,
"1"
,
"-hws"
,
"10"
,
'-ns'
,
'15'
,
testFolder
+
"snow-ref.tif"
,
testFolder
+
"snow-def.tif"
,
"-od"
,
testFolder
+
""
,
"-tsv"
,
"-tif"
,
'-vtk'
])
exitCode
=
subprocess
.
call
([
"spam-ldic"
,
"-
ps"
,
"off"
,
"-reg"
,
"-regbb"
,
"2"
,
"-regbe
"
,
"1"
,
"-hws"
,
"10"
,
'-ns'
,
'15'
,
testFolder
+
"snow-ref.tif"
,
testFolder
+
"snow-def.tif"
,
"-od"
,
testFolder
+
""
,
"-tsv"
,
"-tif"
,
'-vtk'
,
'-gpmc'
,
'1.0'
])
self
.
assertEqual
(
exitCode
,
0
)
# Check registration
...
...
@@ -141,7 +144,7 @@ class testAll(unittest.TestCase):
# There's Z-rotation so translations need to be decomposed properly... just check Z
self
.
assertAlmostEqual
(
refTranslation
[
0
],
numpy
.
mean
(
Phis
[
converged
,
0
,
-
1
]),
places
=
1
)
for
i
in
range
(
3
):
#
self.assertAlmostEqual(refTranslation[i], numpy.mean(Phis[converged,i,-1]), places=1)
self
.
assertAlmostEqual
(
refTranslation
[
i
],
numpy
.
mean
(
Phis
[
converged
,
i
,
-
1
]),
places
=
1
)
self
.
assertAlmostEqual
(
refRotation
[
i
],
numpy
.
mean
(
decomposedPhisConverged
[
'r'
][
converged
,
i
]),
places
=
1
)
...
...
@@ -190,7 +193,7 @@ class testAll(unittest.TestCase):
for
component
in
[
"U"
,
"e"
,
"vol"
,
"volss"
,
"dev"
,
"devss"
]:
self
.
assertAlmostEqual
(
numpy
.
nanmean
(
strain
[
component
]),
numpy
.
nanmean
(
VTK
[
component
]),
places
=
3
)
def
_
test_ITKwatershed
(
self
):
def
test_ITKwatershed
(
self
):
# make sure it runs the help without error
exitCode
=
subprocess
.
call
([
"spam-ITKwatershed"
,
"--help"
],
stdout
=
FNULL
,
stderr
=
FNULL
)
...
...
@@ -212,12 +215,12 @@ class testAll(unittest.TestCase):
lab
=
tifffile
.
imread
(
testFolder
+
"snow-ref-watershed.tif"
)
self
.
assertEqual
(
lab
.
max
()
>
10
,
True
)
def
_
test_gdic
(
self
):
def
test_gdic
(
self
):
# make sure it runs the help without error
exitCode
=
subprocess
.
call
([
"spam-gdic"
,
"--help"
],
stdout
=
FNULL
,
stderr
=
FNULL
)
self
.
assertEqual
(
exitCode
,
0
)
def
_
test_deformImage
(
self
):
def
test_deformImage
(
self
):
# make sure it runs the help without error
exitCode
=
subprocess
.
call
([
"spam-deformImageFromField"
,
"--help"
],
stdout
=
FNULL
,
stderr
=
FNULL
)
self
.
assertEqual
(
exitCode
,
0
)
...
...
@@ -690,7 +693,7 @@ class testAll(unittest.TestCase):
for
label
in
[
1
,
2
]:
self
.
assertAlmostEqual
(
numpy
.
abs
(
TSVextreme
[
'PhiField'
][
label
,
axis
,
-
1
]
-
4.0
),
0.0
,
places
=
1
)
def
_
test_discreteStrain
(
self
):
def
test_discreteStrain
(
self
):
# make sure it runs the help without error
exitCode
=
subprocess
.
call
([
"spam-discreteStrain"
,
"--help"
],
stdout
=
FNULL
,
...
...
tools/DIC/grid.py
View file @
bf50a8d5
...
...
@@ -460,7 +460,7 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi
if
im1mask
is
not
None
:
# AND masks together, the one coming from the im1mask -- i.e., allowed correlation zones
# and the imagette1sliceMask indicating whether we've gone outside the volume
imagette1mask
=
numpy
.
logical_and
(
imagette1mask
,
spam
.
helpers
.
s
tartStopIm1
(
im1mask
,
startStopIm1
))
imagette1mask
=
numpy
.
logical_and
(
imagette1mask
,
spam
.
helpers
.
s
licePadded
(
im1mask
,
startStopIm1
))
maskVolCondition
=
imagette1mask
.
sum
()
>
minMaskVolume
# Make sure imagette is not 0-dimensional in any dimension
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment