Added a nan handling for network kpis and an scaler. (#568)

Added a nan handling for network kpis and an scaler.
This commit is contained in:
Philipp Horstenkamp 2024-01-16 17:38:28 +01:00 committed by GitHub
commit 2f0fe65b59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -128,7 +128,14 @@ def create_2d_graph( # noqa PLR0913
# Highlight the Node Size with regard to the selected Metric. # Highlight the Node Size with regard to the selected Metric.
if metric not in ("None", "Ohne"): if metric not in ("None", "Ohne"):
node_trace.marker.size = list(np.sqrt(metrics[metric]) * 200) sqrt = np.sqrt(metrics[metric].fillna(0))
min_value = sqrt.min()
max_value = sqrt.max()
if min_value == max_value or min_value is max_value:
min_value = 0
max_value = 0.5
results = (((sqrt - min_value) / (max_value - min_value)) + 0.25) * 20
node_trace.marker.size = list(results)
# Add Relation_Type as a Description for the edges. # Add Relation_Type as a Description for the edges.
if edge_annotation is True: # this code be moved and used as hover data if edge_annotation is True: # this code be moved and used as hover data

View File

@ -174,7 +174,14 @@ def create_3d_graph( # noqa : PLR0913
# Highlight the Node Size with regard to the selected Metric. # Highlight the Node Size with regard to the selected Metric.
if metric not in ("None", "Ohne"): if metric not in ("None", "Ohne"):
node_trace.marker.size = list(np.cbrt(metrics[metric]) * 200) sqrt = np.cbrt(metrics[metric].fillna(0))
min_value = sqrt.min()
max_value = sqrt.max()
if min_value == max_value or min_value is max_value:
min_value = 0
max_value = 1
results = (((sqrt - min_value) / (max_value - min_value)) + 0.25) * 20
node_trace.marker.size = list(results)
# Set the Color and width of Edges for better highlighting. # Set the Color and width of Edges for better highlighting.
edge_trace.line = {"color": "rgb(255,105,180)", "width": edge_thickness} edge_trace.line = {"color": "rgb(255,105,180)", "width": edge_thickness}