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
5213bd6c
Commit
5213bd6c
authored
Feb 11, 2021
by
Edward Andò
Browse files
spam-ddic working, ldmax needs implementing
parent
aa6f0a70
Pipeline
#59851
failed with stages
in 12 minutes and 4 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
scripts/spam-ddic
View file @
5213bd6c
This diff is collapsed.
Click to expand it.
scripts/spam-ldic
View file @
5213bd6c
...
...
@@ -21,17 +21,18 @@ 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
numpy
import
scipy.ndimage
import
tifffile
import
multiprocessing
import
progressbar
import
numpy
import
scipy.ndimage
import
spam.DIC
import
spam.deformation
import
spam.helpers
...
...
@@ -256,19 +257,16 @@ for im2number in range(1, len(args.inFiles)):
# Check if we've hit the same point in the two grids
if
numpy
.
any
(
distance
==
0
):
# Copy F of that point to the F in the current grid point
PhiField
[
node
]
=
fieldValues
[
indices
][
numpy
.
where
(
distance
==
0
)].
copy
()
# If not, consider the closest neighbours
else
:
# Compute the "Inverse Distance Weighting" since the closest points should have the major influence
weightSumInv
=
sum
(
1
/
distance
)
# Loop over each neighbour
for
neighbour
in
range
(
nNeighbours
):
# Calculate it's weight
weightInv
=
(
1
/
distance
[
neighbour
])
/
float
(
weightSumInv
)
...
...
scripts/spam-pixelSearch
View file @
5213bd6c
...
...
@@ -25,18 +25,19 @@ this program. If not, see <http://www.gnu.org/licenses/>.
import
os
os
.
environ
[
'OPENBLAS_NUM_THREADS'
]
=
'1'
import
argparse
import
spam.DIC
import
spam.deformation
import
spam.helpers
#import spam.mesh
import
spam.label
import
numpy
import
multiprocessing
import
progressbar
import
argparse
import
tifffile
import
numpy
import
spam.helpers
#import spam.mesh
import
spam.label
import
spam.DIC
import
spam.deformation
...
...
@@ -381,9 +382,9 @@ if args.TIFF:
# Collect data into VTK output
if
args
.
VTK
:
if
args
.
VTK
and
args
.
LAB1
is
None
:
cellData
=
{}
cellData
[
'displacements'
]
=
PhiField
[:,
:
-
1
,
3
].
reshape
((
nodesDim
[
0
],
nodesDim
[
1
],
nodesDim
[
2
],
3
))
cellData
[
'displacements'
]
=
PhiField
[:,
:
-
1
,
3
].
reshape
((
nodesDim
[
0
],
nodesDim
[
1
],
nodesDim
[
2
],
3
))
cellData
[
'pixelSearchCC'
]
=
pixelSearchCC
.
reshape
(
nodesDim
)
# Overwrite nans and infs with 0, rubbish I know
...
...
@@ -396,3 +397,15 @@ if args.VTK:
# If you insist on overlapping, then perhaps it's better to save each point as a cube glyph
# and actually *have* overlapping
spam
.
helpers
.
writeStructuredVTK
(
origin
=
nodePositions
[
0
]
-
args
.
HWS
,
aspectRatio
=
args
.
NS
,
cellData
=
cellData
,
fileName
=
args
.
OUT_DIR
+
"/"
+
args
.
PREFIX
+
".vtk"
)
elif
args
.
VTK
and
args
.
LAB1
is
not
None
:
# Redundant output for VTK visualisation
magDisp
=
numpy
.
zeros
(
numberOfNodes
)
for
node
in
range
(
numberOfNodes
):
magDisp
[
node
]
=
numpy
.
linalg
.
norm
(
PhiField
[
node
][
0
:
3
,
-
1
])
VTKglyphDict
=
{
'displacements'
:
PhiField
[:,
0
:
3
,
-
1
],
'mag(displacements)'
:
magDisp
,
'pixelSearchCC'
:
pixelSearchCC
}
spam
.
helpers
.
writeGlyphsVTK
(
nodePositions
,
VTKglyphDict
,
fileName
=
args
.
OUT_DIR
+
"/"
+
args
.
PREFIX
+
".vtk"
)
tools/helpers/optionsParser.py
View file @
5213bd6c
...
...
@@ -356,6 +356,13 @@ def ddicParser(parser):
type
=
argparse
.
FileType
(
'r'
),
help
=
"Greyscale image of deformed state for correlation"
)
parser
.
add_argument
(
'-np'
,
'--number-of-processes'
,
default
=
None
,
type
=
int
,
dest
=
'PROCESSES'
,
help
=
"Number of parallel processes to use. Default = multiprocessing.cpu_count()"
)
parser
.
add_argument
(
'-ld'
,
'--label-dilate'
,
type
=
int
,
...
...
@@ -532,9 +539,13 @@ def ddicParser(parser):
args
.
LABEL_DILATE_MAX
=
args
.
LABEL_DILATE
if
args
.
LABEL_DILATE_MAX
<
args
.
LABEL_DILATE
:
print
(
"spam-ddic: War
i
ning
\"
label dilate max
\"
is less than
\"
label dilate
\"
setting them equal"
)
print
(
"spam-ddic: Warning
\"
label dilate max
\"
is less than
\"
label dilate
\"
setting them equal"
)
args
.
LABEL_DILATE_MAX
=
args
.
LABEL_DILATE
if
args
.
DEBUG
:
print
(
"spam-ddic: DEBUG mode activated, forcing number of processes to 1"
)
args
.
PROCESSES
=
1
return
args
...
...
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