Skip to content

Commit 6de1af6

Browse files
committed
WIP FIX first round of corrections based on PR
1 parent 2909407 commit 6de1af6

File tree

13 files changed

+3471
-1043
lines changed

13 files changed

+3471
-1043
lines changed

src/gh/components/DF_cloud_cloud_distance/code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def RunScript(self,
2929
:param i_cloud_target: a list of target point cloud to calculate distances to
3030
3131
:return o_distances : list of calculated distances for each point
32-
:return o_mse: the average squared difference between corresponding points of source and target
32+
:return o_rmse: the root mean squared error between corresponding points of source and target
3333
:return o_max_deviation: the max deviation between source and target
3434
:return o_min_deviation: the min deviation between source and target
3535
:return o_std_deviation: the standard deviation between source and target
@@ -53,12 +53,12 @@ def RunScript(self,
5353
# calculate distances
5454
o_results = df_error_estimation.cloud_2_cloud_comparison(df_cloud_source_list, df_cloud_target_list)
5555

56-
return o_results.distances, o_results.distances_mse, o_results.distances_max_deviation, o_results.distances_min_deviation, o_results.distances_sd_deviation, o_results
56+
return o_results.distances, o_results.distances_rmse, o_results.distances_max_deviation, o_results.distances_min_deviation, o_results.distances_sd_deviation, o_results
5757

5858

5959
# if __name__ == "__main__":
6060
# com = CloudCloudDistance()
61-
# o_distances, o_mse, o_max_deviation, o_min_deviation, o_std_deviation, o_results = com.RunScript(
61+
# o_distances, o_rmse, o_max_deviation, o_min_deviation, o_std_deviation, o_results = com.RunScript(
6262
# i_cloud_source,
6363
# i_cloud_target,
6464
# i_swap

src/gh/components/DF_cloud_cloud_distance/metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
"graft": false
6161
},
6262
{
63-
"name": "o_mse",
64-
"nickname": "o_mse",
65-
"description": "average squared difference between source and target.",
63+
"name": "o_rmse",
64+
"nickname": "o_rmse",
65+
"description": "root mean squared error between source and target.",
6666
"optional": false,
6767
"sourceCount": 0,
6868
"graft": false

src/gh/components/DF_cloud_mesh_distance/code.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,44 @@
1919
class CloudMeshDistance(component):
2020
def RunScript(self,
2121
i_cloud_source: typing.List[rg.PointCloud],
22-
i_beam: typing.List[DFBeam],
22+
i_beams: typing.List[DFBeam],
2323
i_signed_flag: bool,
2424
i_swap: bool,
2525
i_analysis_resolution):
2626

2727
"""
28-
The cloud-to-cloud component computes the distance between each point in the source point cloud and its nearest neighbour in thr target point cloud.
28+
The cloud-to-mesh component computes the distance between a point cloud and a mesh
2929
3030
:param i_cloud_source: a list of point clouds
31-
:param i_beam: a list of DF beams
31+
:param i_beams: a list of DF beams
3232
:param i_signed_flag: calculate the sign of the distances
3333
:param i_swap: swap source and target
3434
3535
:return o_distances : list of calculated distances for each point
36-
:return o_mse: the average squared difference between corresponding points of source and target
36+
:return o_rmse: the root mean square error between corresponding points of source and target
3737
:return o_max_deviation: the max deviation between source and target
3838
:return o_min_deviation: the min deviation between source and target
39-
:returns o_resluts: the results of the comparison all in one object
39+
:returns o_results: the results of the comparison all in one object
4040
"""
4141
if i_analysis_resolution is None:
4242
scalef = diffCheck.df_util.get_doc_2_meters_unitf()
4343
i_analysis_resolution = 0.1 / scalef
4444

4545
# conversion
4646
df_cloud_source_list = [df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cl_s) for i_cl_s in i_cloud_source]
47-
df_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_beam]
47+
df_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_beams]
4848

4949
# calculate distances
50-
o_results = df_error_estimation.cloud_2_rhino_mesh_comparison(df_cloud_source_list, df_mesh_target_list, i_signed_flag, i_swap)
50+
o_result = df_error_estimation.cloud_2_rhino_mesh_comparison(df_cloud_source_list, df_mesh_target_list, i_signed_flag, i_swap)
5151

52-
return o_results.distances, o_results.distances_mse, o_results.distances_max_deviation, o_results.distances_min_deviation, o_results.distances_sd_deviation, o_results
52+
return o_result.distances, o_result.distances_mse, o_result.distances_max_deviation, o_result.distances_min_deviation, o_result.distances_sd_deviation, o_result
5353

5454

5555
# if __name__ == "__main__":
5656
# com = CloudMeshDistance()
5757
# o_distances, o_mse, o_max_deviation, o_min_deviation, o_std_deviation, o_results = com.RunScript(
5858
# i_cloud_source,
59-
# i_beam,
59+
# i_beams,
6060
# i_signed_flag,
6161
# i_swap,
6262
# i_analysis_resolution

src/gh/components/DF_cloud_mesh_distance/metadata.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
"typeHintID": "pointcloud"
2727
},
2828
{
29-
"name": "i_beam",
30-
"nickname": "i_beam",
31-
"description": "The target DFbeam",
29+
"name": "i_beams",
30+
"nickname": "i_beams",
31+
"description": "The target DFbeams",
3232
"optional": false,
3333
"allowTreeAccess": true,
3434
"showTypeHints": true,
@@ -84,8 +84,8 @@
8484
"graft": false
8585
},
8686
{
87-
"name": "o_mse",
88-
"nickname": "o_mse",
87+
"name": "o_rmse",
88+
"nickname": "o_rmse",
8989
"description": "average squared difference between source and target.",
9090
"optional": false,
9191
"sourceCount": 0,
@@ -116,8 +116,8 @@
116116
"graft": false
117117
},
118118
{
119-
"name": "o_results",
120-
"nickname": "o_results",
119+
"name": "o_result",
120+
"nickname": "o_result",
121121
"description": "The result of the distance calculation.",
122122
"optional": false,
123123
"sourceCount": 0,

src/gh/components/DF_vizualization/code.py renamed to src/gh/components/DF_visualization/code.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,55 @@
1010
import Grasshopper as gh
1111
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
1212

13-
from diffCheck import diffcheck_bindings
1413
from diffCheck import df_cvt_bindings
15-
from diffCheck import df_vizualization
14+
from diffCheck import df_visualization
15+
from diffCheck.df_visualization import DFVizSettings
16+
from diffCheck.df_error_estimation import DFVizResults
1617

17-
18-
class Vizualization(component):
18+
class Visualization(component):
1919
def RunScript(self,
20-
i_results,
21-
i_viz_settings):
20+
i_result: DFVizResults,
21+
i_viz_settings: DFVizSettings):
22+
2223
"""
23-
Adds color to the mesh or point cloud
24-
and generates a corresponding legend and histogram
24+
Adds color to the mesh or point cloud
25+
and generates a corresponding legend and histogram
26+
27+
:param i_result: a list of point clouds
28+
:param i_viz_settings: a list of DF beams
29+
30+
:return o_colored_geo: the colored mesh or point cloud
31+
:return o_legend : the correesponding legend of the coloring
32+
:return o_histogram : a histogram that represents the frequency of the values
2533
"""
2634

27-
values, min_value, max_value = df_vizualization.filter_values_based_on_valuetype(i_results, i_viz_settings)
35+
values, min_value, max_value = i_result.filter_values_based_on_valuetype(i_viz_settings)
2836

29-
# check if i_results.source is a list of pointclouds or a mesh
30-
if type(i_results.source[0]) is diffcheck_bindings.dfb_geometry.DFPointCloud:
37+
# check if i_result.source is a list of pointclouds or a mesh
38+
if type(i_result.source[0]) is diffcheck_bindings.dfb_geometry.DFPointCloud:
3139

3240
# convert to Rhino PCD
33-
o_source = [df_cvt_bindings.cvt_dfcloud_2_rhcloud(src) for src in i_results.source]
41+
o_source = [df_cvt_bindings.cvt_dfcloud_2_rhcloud(src) for src in i_result.source]
3442

3543
# color geometry
36-
o_colored_geo = [df_vizualization.color_pcd(src, dist, min_value, max_value, i_viz_settings.palette) for src, dist in zip(o_source, values)]
44+
o_colored_geo = [df_visualization.color_rh_pcd(src, dist, min_value, max_value, i_viz_settings.palette) for src, dist in zip(o_source, values)]
3745

38-
elif type(i_results.source[0]) is rg.Mesh:
46+
elif type(i_result.source[0]) is rg.Mesh:
3947
# convert to Rhino Mesh
40-
o_source = i_results.source
48+
o_source = i_result.source
4149

4250
# color geometry
43-
o_colored_geo = [df_vizualization.color_mesh(src, dist, min_value, max_value, i_viz_settings.palette) for src, dist in zip(o_source, values)]
51+
o_colored_geo = [df_visualization.color_rh_mesh(src, dist, min_value, max_value, i_viz_settings.palette) for src, dist in zip(o_source, values)]
4452

45-
o_legend = df_vizualization.create_legend(min_value,
53+
o_legend = df_visualization.create_legend(min_value,
4654
max_value,
4755
i_viz_settings.palette,
4856
steps=10,
4957
plane=i_viz_settings.legend_plane,
5058
width=i_viz_settings.legend_width,
5159
total_height=i_viz_settings.legend_height)
5260

53-
o_histogram = df_vizualization.create_histogram(values,
61+
o_histogram = df_visualization.create_histogram(values,
5462
min_value,
5563
max_value,
5664
steps=100,
@@ -62,8 +70,8 @@ def RunScript(self,
6270

6371

6472
# if __name__ == "__main__":
65-
# com = Vizualization()
73+
# com = Visualization()
6674
# o_colored_geo, o_legend, o_histogram = com.RunScript(
67-
# i_results,
75+
# i_result,
6876
# i_viz_settings
6977
# )
File renamed without changes.

src/gh/components/DF_vizualization/metadata.json renamed to src/gh/components/DF_visualization/metadata.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "DFVizualization",
2+
"name": "DFVisualization",
33
"nickname": "DFViz",
44
"category": "diffCheck",
5-
"subcategory": "Vizualization",
5+
"subcategory": "Visualization",
66
"description": "Color input geometry according to the results of the distance calculation and settings",
77
"exposure": 4,
8-
"instanceGuid": "46b7026f-f453-4f27-979d-916af633b324",
8+
"instanceGuid": "3d20b6d2-fc3d-4faf-a554-fa4ae3ddcde9",
99
"ghpython": {
1010
"hideOutput": true,
1111
"hideInput": true,
@@ -14,8 +14,8 @@
1414
"iconDisplay": 2,
1515
"inputParameters": [
1616
{
17-
"name": "i_results",
18-
"nickname": "i_results",
17+
"name": "i_result",
18+
"nickname": "i_result",
1919
"description": "The result of the distance calculation",
2020
"optional": true,
2121
"allowTreeAccess": true,
@@ -28,7 +28,7 @@
2828
{
2929
"name": "i_viz_settings",
3030
"nickname": "i_viz_settings",
31-
"description": "The settings of the vizualization",
31+
"description": "The settings of the visualization",
3232
"optional": false,
3333
"allowTreeAccess": true,
3434
"showTypeHints": true,
@@ -50,7 +50,7 @@
5050
{
5151
"name": "o_legend",
5252
"nickname": "_legend",
53-
"description": "The legend of the vizualization",
53+
"description": "The legend of the visualization",
5454
"optional": false,
5555
"sourceCount": 0,
5656
"graft": false

src/gh/components/DF_vizualization_settings/code.py renamed to src/gh/components/DF_visualization_settings/code.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,32 @@
1010
import Grasshopper as gh
1111
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
1212

13-
from diffCheck import df_vizualization
13+
from diffCheck import df_visualization
1414

1515
class VisualizationSettings(component):
1616
def RunScript(self,
17-
i_value_type,
18-
i_upper_threshold,
19-
i_lower_threshold,
20-
i_palette,
21-
i_legend_height,
22-
i_legend_width,
23-
i_legend_plane,
24-
i_histogram_scale_factor):
17+
i_value_type: str,
18+
i_upper_threshold: float,
19+
i_lower_threshold: float,
20+
i_palette: str,
21+
i_legend_height: float,
22+
i_legend_width: float,
23+
i_legend_plane: rg.Plane,
24+
i_histogram_scale_factor: float):
2525

2626
"""
27-
Compiles all the vizualization settings to feed to the vizualization component
27+
Compiles all the visualization settings to feed to the visualization component
28+
29+
:param i_value_type: selected type indicates Which values to display. Possible values: "dist", "RMSE", "MAX", "MIN", "STD"
30+
:param i_upper_threshold: Thresholds the values with a maximum value
31+
:param i_lower_threshold: Thresholds the values with a minimum value
32+
:param i_palette: Select a color palette to map the values to. Possible values: "Jet", "Rainbow", "RdPu", "Viridis"
33+
:param i_legend_height: the total height of the legend
34+
:param i_legend_width: the total width of the legend
35+
:param i_legend_plane: the construction plane of the legend
36+
:param i_histogram_scale_factor: Scales the height of the histogram with a factor
37+
38+
:returns o_viz_settings: the results of the comparison all in one object
2839
"""
2940

3041
# set default values
@@ -35,7 +46,7 @@ def RunScript(self,
3546
if i_histogram_scale_factor is None: i_histogram_scale_factor = 0.01
3647

3748
# pack settings
38-
o_viz_settings = df_vizualization.DFVizSettings(i_value_type,
49+
o_viz_settings = df_visualization.DFVizSettings(i_value_type,
3950
i_upper_threshold,
4051
i_lower_threshold,
4152
i_palette,
File renamed without changes.

src/gh/components/DF_vizualization_settings/metadata.json renamed to src/gh/components/DF_visualization_settings/metadata.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "DFVizualizationSettings",
2+
"name": "DFVisualizationSettings",
33
"nickname": "DFVizSettings",
44
"category": "diffCheck",
5-
"subcategory": "Vizualization",
6-
"description": "Compiles all the settings to feed to the vizualization component.",
5+
"subcategory": "Visualization",
6+
"description": "Compiles all the settings to feed to the visualization component.",
77
"exposure": 4,
88
"instanceGuid": "22325eeb-07ec-4f15-a1e0-dc01741d5464",
99
"ghpython": {
@@ -114,7 +114,7 @@
114114
{
115115
"name": "o_viz_settings",
116116
"nickname": "o_viz_settings",
117-
"description": "Settings to be passed to the Vizualization component",
117+
"description": "Settings to be passed to the Visualization component",
118118
"optional": false,
119119
"sourceCount": 0,
120120
"graft": false

0 commit comments

Comments
 (0)