Commit 698fbeb4 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

visualise to check areas, need workaround for stray voxels

parent 2974c4ec
......@@ -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__':
......
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