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
Jayant Khatkar
tempaware
Commits
698fbeb4
Commit
698fbeb4
authored
Nov 01, 2021
by
Jayant Khatkar
Browse files
visualise to check areas, need workaround for stray voxels
parent
2974c4ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
voxelise.py
View file @
698fbeb4
...
...
@@ -117,10 +117,14 @@ def check_data(mesh_file_name, csv_fname, from_inches=False):
pl
.
show
()
def
visualise_voxels
(
fname
):
data
=
pd
.
read_csv
(
fname
)
def
visualise_voxels
(
fname
,
stresses
=
None
):
if
type
(
fname
)
is
str
:
data
=
pd
.
read_csv
(
fname
)
else
:
data
=
fname
locs
=
data
.
iloc
[:,
1
:
4
].
to_numpy
()
stresses
=
np
.
sum
(
data
.
iloc
[:,
4
:].
to_numpy
()
**
2
,
axis
=
1
)
**
0.5
if
stresses
is
None
:
stresses
=
np
.
sum
(
data
.
iloc
[:,
4
:].
to_numpy
()
**
2
,
axis
=
1
)
**
0.5
locs_pv
=
pv
.
PolyData
(
locs
)
locs_pv
[
'stress_mag'
]
=
stresses
locs_pv
.
plot
()
...
...
@@ -136,7 +140,7 @@ def vox_section_area(voxels, mesh_file_name, vox_dim=3):
tu
.
transform_to_z0
(
mesh
)
tm_mesh
=
to_trimesh
(
mesh
)
SecArea
=
np
.
zeros
(
len
(
voxels
))
default_high
=
1e7
default_high
=
-
1
z
=
0
i
=
0
...
...
@@ -185,6 +189,7 @@ def vox_section_area(voxels, mesh_file_name, vox_dim=3):
# print(set(SecArea))
# break
print
(
"Unlinked Voxels: {}/{}"
.
format
(
sum
(
SecArea
==
default_high
),
len
(
SecArea
)))
visualise_voxels
(
voxels
,
stresses
=
SecArea
)
if
__name__
==
'__main__'
:
...
...
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