Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttk
spam
Commits
ecd72cda
Commit
ecd72cda
authored
Jan 22, 2021
by
Edward Andò
Browse files
Fix PhiFile interpolation for spam-ddic
parent
00ba57c3
Pipeline
#59766
passed with stages
in 25 minutes and 41 seconds
Changes
3
Pipelines
21
Hide whitespace changes
Inline
Side-by-side
scripts/spam-ddic
View file @
ecd72cda
...
...
@@ -261,6 +261,9 @@ if mpiRank == boss or not mpi:
# Loop over each point of the current grid
for
label
in
range
(
numberOfLabels
):
# reset F to zero, since we'll be doing an additive interpolation at the bottom here
PhiField
[
label
][
0
:
3
,
0
:
3
]
=
0
# Calculate the distance of the point of the current grid to the points of the input F field
distance
,
indices
=
fieldTree
.
query
(
centresOfMass
[
label
],
k
=
nNeighbours
)
#print(label, distance, indices)
...
...
scripts/spam-deformImageFromField
View file @
ecd72cda
...
...
@@ -48,6 +48,12 @@ parser = argparse.ArgumentParser(description="spam-deformImageFromField "+spam.h
# Parse arguments with external helper function
args
=
spam
.
helpers
.
optionsParser
.
deformImageFromFieldParser
(
parser
)
print
(
"spam-deformImageFromField: Current Settings:"
)
argsDict
=
vars
(
args
)
for
key
in
sorted
(
argsDict
):
print
(
"
\t
{}: {}"
.
format
(
key
,
argsDict
[
key
]))
print
()
# Read displacements file
TSV
=
spam
.
helpers
.
readCorrelationTSV
(
args
.
PHIFILE
.
name
,
fieldBinRatio
=
args
.
PHIFILE_BIN_RATIO
,
readConvergence
=
True
)
...
...
tests/test_scripts.py
View file @
ecd72cda
...
...
@@ -42,7 +42,9 @@ class testAll(unittest.TestCase):
try
:
rm
(
testFolder
+
"snow-ref.tif"
)
rm
(
testFolder
+
"snow-def.tif"
)
rm
(
testFolder
+
"snow-def-zoom.tif"
)
rm
(
testFolder
+
"snow-def-cgs.tif"
)
rm
(
testFolder
+
"snow-def-cgs-zoom.tif"
)
rm
(
testFolder
+
"snow-ref-lab-displaced.tif"
)
rm
(
testFolder
+
"snow-ref-lab.tif"
)
rm
(
testFolder
+
"snow-ref-snow-def-bin1-registration.tsv"
)
...
...
@@ -347,22 +349,22 @@ class testAll(unittest.TestCase):
"PSCC
\t
error
\t
iterations
\t
returnStatus
\t
deltaPhiNorm"
)
exitCode
=
subprocess
.
call
([
"spam-deformImageFromField"
,
"-pf"
,
testFolder
+
"zoom.tsv"
,
testFolder
+
"snow-ref.tif"
,
'-pre'
,
'snow-def'
],
'-pre'
,
'snow-def
-zoom
'
],
stdout
=
FNULL
,
stderr
=
FNULL
)
self
.
assertEqual
(
exitCode
,
0
)
imDefScript
=
tifffile
.
imread
(
'snow-def.tif'
)
imDefScript
=
tifffile
.
imread
(
'snow-def
-zoom
.tif'
)
# Except for the boundaries, should be same as imDef:
self
.
assertAlmostEqual
(
numpy
.
mean
((
imDefScript
-
imDef
)[
10
:
-
10
,
10
:
-
10
,
10
:
-
10
])
/
numpy
.
mean
(
im
),
0
,
places
=
3
)
exitCode
=
subprocess
.
call
([
"spam-deformImageFromField"
,
"-pf"
,
testFolder
+
"zoom.tsv"
,
testFolder
+
"snow-ref.tif"
,
'-pre'
,
'snow-def-cgs'
,
'-cgs'
],
'-pre'
,
'snow-def-cgs
-zoom
'
,
'-cgs'
],
stdout
=
FNULL
,
stderr
=
FNULL
)
self
.
assertEqual
(
exitCode
,
0
)
imDefScriptCGS
=
tifffile
.
imread
(
'snow-def-cgs.tif'
)
imDefScriptCGS
=
tifffile
.
imread
(
'snow-def-cgs
-zoom
.tif'
)
self
.
assertEqual
(
numpy
.
mean
(
imDefScript
[
10
:
-
10
,
10
:
-
10
,
10
:
-
10
])
>
numpy
.
mean
(
imDefScriptCGS
[
10
:
-
10
,
10
:
-
10
,
10
:
-
10
]),
True
)
...
...
Write
Preview
Supports
Markdown
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