risk-network 0.0.7b2__py3-none-any.whl → 0.0.7b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- risk/__init__.py +1 -1
- risk/network/graph.py +10 -3
- {risk_network-0.0.7b2.dist-info → risk_network-0.0.7b3.dist-info}/METADATA +1 -1
- {risk_network-0.0.7b2.dist-info → risk_network-0.0.7b3.dist-info}/RECORD +7 -7
- {risk_network-0.0.7b2.dist-info → risk_network-0.0.7b3.dist-info}/LICENSE +0 -0
- {risk_network-0.0.7b2.dist-info → risk_network-0.0.7b3.dist-info}/WHEEL +0 -0
- {risk_network-0.0.7b2.dist-info → risk_network-0.0.7b3.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/network/graph.py
CHANGED
@@ -306,6 +306,7 @@ def _get_colors(
|
|
306
306
|
Returns:
|
307
307
|
List[Tuple]: List of RGBA colors.
|
308
308
|
"""
|
309
|
+
# Set random seed for reproducibility
|
309
310
|
random.seed(random_seed)
|
310
311
|
# Determine the number of colors to generate based on the number of domains
|
311
312
|
num_colors_to_generate = len(domain_id_to_node_ids_map)
|
@@ -321,15 +322,21 @@ def _get_colors(
|
|
321
322
|
# Step 2: Calculate pairwise distances between centroids
|
322
323
|
centroid_array = np.array(centroids)
|
323
324
|
dist_matrix = np.linalg.norm(centroid_array[:, None] - centroid_array, axis=-1)
|
325
|
+
|
324
326
|
# Step 3: Generate positions in the colormap, with a focus on centroids that are close
|
325
327
|
remaining_indices = set(range(num_colors_to_generate))
|
326
328
|
# Assign distant colors to close centroids
|
327
329
|
color_positions = _assign_distant_colors(
|
328
330
|
remaining_indices, dist_matrix, colormap, num_colors_to_generate
|
329
331
|
)
|
330
|
-
|
331
|
-
|
332
|
-
|
332
|
+
|
333
|
+
# Step 4: Randomly shuffle color positions to generate a new color palette
|
334
|
+
# while maintaining the dissimilarity between neighboring colors. This shuffling
|
335
|
+
# preserves the relative distances between centroids, ensuring that close centroids
|
336
|
+
# remain visually distinct while introducing randomness into the overall color arrangement.
|
337
|
+
random.shuffle(color_positions)
|
338
|
+
# Ensure that all positions remain between 0 and 1
|
339
|
+
color_positions = np.clip(color_positions, 0, 1)
|
333
340
|
|
334
341
|
# Step 5: Generate colors based on positions
|
335
342
|
return [colormap(pos) for pos in color_positions]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=Yoz9l74qVwPoFeWtUKqy_dgQZlDTZtaNIvtmzNx5G78,112
|
2
2
|
risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
|
3
3
|
risk/risk.py,sha256=jhfOv60iZdOssCF35tAjJ_br9w8aIqPFT2owVTehgtA,20648
|
4
4
|
risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
|
@@ -13,7 +13,7 @@ risk/neighborhoods/domains.py,sha256=bxJUxqFTynzX0mf3E8-AA4_Rfccje1reeVVhfzb1-pE
|
|
13
13
|
risk/neighborhoods/neighborhoods.py,sha256=cEk4gDvIkBky5POZhtHnO78iV-NXu4BeV-e5XdhYOkM,17508
|
14
14
|
risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
|
15
15
|
risk/network/geometry.py,sha256=H1yGVVqgbfpzBzJwEheDLfvGLSA284jGQQTn612L4Vc,6759
|
16
|
-
risk/network/graph.py,sha256=
|
16
|
+
risk/network/graph.py,sha256=_ZCyT2b9RtKAYzwul-Kp9__uQwTcagECf-mPMiAmP8U,16977
|
17
17
|
risk/network/io.py,sha256=gG50kOknO-D3HkW1HsbHMkTMvjUtn3l4W4Jwd-rXNr8,21202
|
18
18
|
risk/network/plot.py,sha256=F6KPjmBYWrThKZScHs9SuzoKQiytBvzrmGhGberHjwo,62063
|
19
19
|
risk/stats/__init__.py,sha256=e-BE_Dr_jgiK6hKM-T-tlG4yvHnId8e5qjnM0pdwNVc,230
|
@@ -23,8 +23,8 @@ risk/stats/stats.py,sha256=kvShov-94W6ffgDUTb522vB9hDJQSyTsYif_UIaFfSM,7059
|
|
23
23
|
risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
|
24
24
|
risk/stats/permutation/permutation.py,sha256=qLWdwxEY6nmkYPxpM8HLDcd2mbqYv9Qr7CKtJvhLqIM,9220
|
25
25
|
risk/stats/permutation/test_functions.py,sha256=HuDIM-V1jkkfE1rlaIqrWWBSKZt3dQ1f-YEDjWpnLSE,2343
|
26
|
-
risk_network-0.0.
|
27
|
-
risk_network-0.0.
|
28
|
-
risk_network-0.0.
|
29
|
-
risk_network-0.0.
|
30
|
-
risk_network-0.0.
|
26
|
+
risk_network-0.0.7b3.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
27
|
+
risk_network-0.0.7b3.dist-info/METADATA,sha256=6D_1SuZdpPYaUQLLzctNrVLC_gdzsTrx7V1leqBvcio,43142
|
28
|
+
risk_network-0.0.7b3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
29
|
+
risk_network-0.0.7b3.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
30
|
+
risk_network-0.0.7b3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|