risk-network 0.0.8b26__py3-none-any.whl → 0.0.9b26__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.
Files changed (46) hide show
  1. risk/__init__.py +2 -2
  2. risk/annotations/__init__.py +2 -2
  3. risk/annotations/annotations.py +74 -47
  4. risk/annotations/io.py +47 -31
  5. risk/log/__init__.py +4 -2
  6. risk/log/{config.py → console.py} +5 -3
  7. risk/log/{params.py → parameters.py} +17 -42
  8. risk/neighborhoods/__init__.py +3 -5
  9. risk/neighborhoods/api.py +446 -0
  10. risk/neighborhoods/community.py +255 -77
  11. risk/neighborhoods/domains.py +62 -31
  12. risk/neighborhoods/neighborhoods.py +156 -160
  13. risk/network/__init__.py +1 -3
  14. risk/network/geometry.py +65 -57
  15. risk/network/graph/__init__.py +6 -0
  16. risk/network/graph/api.py +194 -0
  17. risk/network/{graph.py → graph/network.py} +87 -37
  18. risk/network/graph/summary.py +254 -0
  19. risk/network/io.py +56 -47
  20. risk/network/plotter/__init__.py +6 -0
  21. risk/network/plotter/api.py +54 -0
  22. risk/network/{plot → plotter}/canvas.py +7 -4
  23. risk/network/{plot → plotter}/contour.py +22 -19
  24. risk/network/{plot → plotter}/labels.py +69 -74
  25. risk/network/{plot → plotter}/network.py +170 -34
  26. risk/network/{plot/utils/color.py → plotter/utils/colors.py} +104 -112
  27. risk/network/{plot → plotter}/utils/layout.py +8 -5
  28. risk/risk.py +11 -500
  29. risk/stats/__init__.py +8 -4
  30. risk/stats/binom.py +51 -0
  31. risk/stats/chi2.py +69 -0
  32. risk/stats/hypergeom.py +27 -17
  33. risk/stats/permutation/__init__.py +1 -1
  34. risk/stats/permutation/permutation.py +44 -38
  35. risk/stats/permutation/test_functions.py +25 -17
  36. risk/stats/poisson.py +15 -9
  37. risk/stats/stats.py +15 -13
  38. risk/stats/zscore.py +68 -0
  39. {risk_network-0.0.8b26.dist-info → risk_network-0.0.9b26.dist-info}/METADATA +9 -5
  40. risk_network-0.0.9b26.dist-info/RECORD +44 -0
  41. {risk_network-0.0.8b26.dist-info → risk_network-0.0.9b26.dist-info}/WHEEL +1 -1
  42. risk/network/plot/__init__.py +0 -6
  43. risk/network/plot/plotter.py +0 -137
  44. risk_network-0.0.8b26.dist-info/RECORD +0 -37
  45. {risk_network-0.0.8b26.dist-info → risk_network-0.0.9b26.dist-info}/LICENSE +0 -0
  46. {risk_network-0.0.8b26.dist-info → risk_network-0.0.9b26.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,44 @@
1
+ risk/__init__.py,sha256=vcWTNpBnxRYMGh8X2IkLccT4MfT6c0J94_SFHMe66Rk,127
2
+ risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
+ risk/risk.py,sha256=s827_lRknFseOP9O4zW8sP-IcCd2EzrpV_tnVY_tz5s,1104
4
+ risk/annotations/__init__.py,sha256=parsbcux1U4urpUqh9AdzbDWuLj9HlMidycMPkpSQFo,179
5
+ risk/annotations/annotations.py,sha256=XmVuLL5NFAj6F30fZY22N8nb4LK6sig7fE0NXL1iZp8,14497
6
+ risk/annotations/io.py,sha256=z1AJySsU-KL_IYuHa7j3nvuczmOHgK3WfaQ4TRunvrA,10499
7
+ risk/log/__init__.py,sha256=7LxDysQu7doi0LAvlY2YbjN6iJH0fNknqy8lSLgeljo,217
8
+ risk/log/console.py,sha256=PgjyEvyhYLUSHXPUKEqOmxsDsfrjPICIgqo_cAHq0N8,4575
9
+ risk/log/parameters.py,sha256=VtwfMzLU1xI4yji3-Ch5vHjH-KdwTfwaEMmi7hFQTs0,5716
10
+ risk/neighborhoods/__init__.py,sha256=Q74HwTH7okI-vaskJPy2bYwb5sNjGASTzJ6m8V8arCU,234
11
+ risk/neighborhoods/api.py,sha256=KdUouMHJPwvePJGdz7Ck1GWYhN96QDb_SuPyTt3KwAc,23515
12
+ risk/neighborhoods/community.py,sha256=VIDvB-SsMDDvWkUaYXf_E-gcg0HELMVv2MKshPwJAFQ,15480
13
+ risk/neighborhoods/domains.py,sha256=jMJ4-Qzwgmo6Hya8h0E2_IcMaLpbuH_FWlmSjJl2ikc,12832
14
+ risk/neighborhoods/neighborhoods.py,sha256=bBUY7hXqcsOoAEkPdRoRNuj36WsllXicmz_LxZfEuyw,21186
15
+ risk/network/__init__.py,sha256=oVi3FA1XXKD84014Cykq-9bpX4_s0F3aAUfNOU-07Qw,73
16
+ risk/network/geometry.py,sha256=omyb9afSKMUtQ-RKVHUoRyxJifOW0ASenHjyCjg43kg,6836
17
+ risk/network/io.py,sha256=JV5hqf1oIwWUVw07BjhD0qACQGbtIeA8NSMDcFql88k,23465
18
+ risk/network/graph/__init__.py,sha256=ziGJew3yhtqvrb9LUuneDu_LwW2Wa9vd4UuhoL5l1CA,91
19
+ risk/network/graph/api.py,sha256=Ag4PjFTX6BUvmW7ZdfIgwdsr8URigX9jD9yEFRXUxrU,8220
20
+ risk/network/graph/network.py,sha256=KdIBM_-flHMWcBK4RUjU_QRfOZIf_yv9fv4L7AOLkqU,12199
21
+ risk/network/graph/summary.py,sha256=8IenFZfhyzcg5aGNJp7Zjb0Umy0mFNmJlfwXcO7y8MU,10311
22
+ risk/network/plotter/__init__.py,sha256=ixXQxpBVpNIz1y9tUHZ7CiJmGfewvbvjuB1LQ-AIf1s,93
23
+ risk/network/plotter/api.py,sha256=cLZHq-rn_5FJwIWM5hYlQMobPmaxCE-P2iqgxTDIOTQ,1860
24
+ risk/network/plotter/canvas.py,sha256=l-Se86DMDJMHh8Yn-_hsl0_ipoazHLJGRCqXcc9HK4M,13498
25
+ risk/network/plotter/contour.py,sha256=svi76suYlVYq2VoDQxXmun8Hmo0lI2CQRjAyHg0qdhk,15490
26
+ risk/network/plotter/labels.py,sha256=QesD1ybseA6ldLmWMqVaAqSPR34yVEgEzXzg1AKQD6o,45513
27
+ risk/network/plotter/network.py,sha256=wcBf1GaM1wPzW-iXTrLzOmlG2_9wwfll_hJUzUO2u2Y,19917
28
+ risk/network/plotter/utils/colors.py,sha256=EFlIUZ3MGSKoHeZi9cgR6uLKK5GGJ4QzE6lmnrHViLw,18967
29
+ risk/network/plotter/utils/layout.py,sha256=2P4Bqi1dGiX9KsriLYqiq1KlHpsMdZemAUza4WcYoNA,3634
30
+ risk/stats/__init__.py,sha256=1CPRtT1LDwudrvFgkVtSom8cp4cM7b4X6b4fHPaNHw0,405
31
+ risk/stats/binom.py,sha256=8Qwcxnq1u-AycwQs_sQxwuxgkgDpES-A-kIcj4fRc3g,2032
32
+ risk/stats/chi2.py,sha256=MGFNrWP40i9TxnMsZYbDgqdMrN_Fe0xFsnWU8xNsVSs,3046
33
+ risk/stats/hypergeom.py,sha256=VfQBtpgSGG826uBP1WyBMavP3ylZnhponUZ2rHFdGAE,2502
34
+ risk/stats/poisson.py,sha256=_KHe9g8XNRD4-Q486zx2UgHCO2QyvBOiHuX3hRZLEqc,2050
35
+ risk/stats/stats.py,sha256=y2DMJF3uKRIWRyYiCd2Kwxa-EqOzX5HsMBms_Vw6wK8,7322
36
+ risk/stats/zscore.py,sha256=Jx9cLKAHiDnrgW_Su9KZYYQiTVsuyJMC7vXBusnEI-c,2648
37
+ risk/stats/permutation/__init__.py,sha256=OLmYLm2uj96hPsSaUs0vUqFYw6Thwch_aHtpL7L0ZFw,127
38
+ risk/stats/permutation/permutation.py,sha256=BWjgdBpLVcHvmwHy0bmD4aJFccxifNBSrrCBPppyKf4,10569
39
+ risk/stats/permutation/test_functions.py,sha256=D3XMPM8CasUNytWSRce22TI6KK6XulYn5uGG4lWxaHs,3120
40
+ risk_network-0.0.9b26.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
41
+ risk_network-0.0.9b26.dist-info/METADATA,sha256=7nzWmesgQYNnymMbG9WejhChWxobBvbFgQQD0VKd3n0,47627
42
+ risk_network-0.0.9b26.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
43
+ risk_network-0.0.9b26.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
44
+ risk_network-0.0.9b26.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- """
2
- risk/network/plot
3
- ~~~~~~~~~~~~~~~~~
4
- """
5
-
6
- from risk.network.plot.plotter import NetworkPlotter
@@ -1,137 +0,0 @@
1
- """
2
- risk/network/plot/plotter
3
- ~~~~~~~~~~~~~~~~~~~~~~~~~
4
- """
5
-
6
- from typing import List, Tuple, Union
7
-
8
- import matplotlib.pyplot as plt
9
- import numpy as np
10
-
11
- from risk.log import params
12
- from risk.network.graph import NetworkGraph
13
- from risk.network.plot.canvas import Canvas
14
- from risk.network.plot.contour import Contour
15
- from risk.network.plot.labels import Labels
16
- from risk.network.plot.network import Network
17
- from risk.network.plot.utils.color import to_rgba
18
- from risk.network.plot.utils.layout import calculate_bounding_box
19
-
20
-
21
- class NetworkPlotter(Canvas, Network, Contour, Labels):
22
- """A class for visualizing network graphs with customizable options.
23
-
24
- The NetworkPlotter class uses a NetworkGraph object and provides methods to plot the network with
25
- flexible node and edge properties. It also supports plotting labels, contours, drawing the network's
26
- perimeter, and adjusting background colors.
27
- """
28
-
29
- def __init__(
30
- self,
31
- graph: NetworkGraph,
32
- figsize: Tuple = (10, 10),
33
- background_color: Union[str, List, Tuple, np.ndarray] = "white",
34
- background_alpha: Union[float, None] = 1.0,
35
- pad: float = 0.3,
36
- ) -> None:
37
- """Initialize the NetworkPlotter with a NetworkGraph object and plotting parameters.
38
-
39
- Args:
40
- graph (NetworkGraph): The network data and attributes to be visualized.
41
- figsize (Tuple, optional): Size of the figure in inches (width, height). Defaults to (10, 10).
42
- background_color (str, List, Tuple, np.ndarray, optional): Background color of the plot. Defaults to "white".
43
- background_alpha (float, None, optional): Transparency level of the background color. If provided, it overrides
44
- any existing alpha values found in background_color. Defaults to 1.0.
45
- pad (float, optional): Padding value to adjust the axis limits. Defaults to 0.3.
46
- """
47
- self.graph = graph
48
- # Initialize the plot with the specified parameters
49
- self.ax = self._initialize_plot(
50
- graph=graph,
51
- figsize=figsize,
52
- background_color=background_color,
53
- background_alpha=background_alpha,
54
- pad=pad,
55
- )
56
- super().__init__(graph=graph, ax=self.ax)
57
-
58
- def _initialize_plot(
59
- self,
60
- graph: NetworkGraph,
61
- figsize: Tuple,
62
- background_color: Union[str, List, Tuple, np.ndarray],
63
- background_alpha: Union[float, None],
64
- pad: float,
65
- ) -> plt.Axes:
66
- """Set up the plot with figure size and background color.
67
-
68
- Args:
69
- graph (NetworkGraph): The network data and attributes to be visualized.
70
- figsize (Tuple): Size of the figure in inches (width, height).
71
- background_color (str, List, Tuple, or np.ndarray): Background color of the plot. Can be a single color or an array of colors.
72
- background_alpha (float, None, optional): Transparency level of the background color. If provided, it overrides any existing
73
- alpha values found in `background_color`.
74
- pad (float, optional): Padding value to adjust the axis limits.
75
-
76
- Returns:
77
- plt.Axes: The axis object for the plot.
78
- """
79
- # Log the plotter settings
80
- params.log_plotter(
81
- figsize=figsize,
82
- background_color=background_color,
83
- background_alpha=background_alpha,
84
- pad=pad,
85
- )
86
-
87
- # Extract node coordinates from the network graph
88
- node_coordinates = graph.node_coordinates
89
- # Calculate the center and radius of the bounding box around the network
90
- center, radius = calculate_bounding_box(node_coordinates)
91
-
92
- # Create a new figure and axis for plotting
93
- fig, ax = plt.subplots(figsize=figsize)
94
- fig.tight_layout() # Adjust subplot parameters to give specified padding
95
- # Set axis limits based on the calculated bounding box and radius
96
- ax.set_xlim([center[0] - radius - pad, center[0] + radius + pad])
97
- ax.set_ylim([center[1] - radius - pad, center[1] + radius + pad])
98
- ax.set_aspect("equal") # Ensure the aspect ratio is equal
99
-
100
- # Set the background color of the plot
101
- # Convert color to RGBA using the to_rgba helper function
102
- fig.patch.set_facecolor(
103
- to_rgba(color=background_color, alpha=background_alpha, num_repeats=1)
104
- ) # num_repeats=1 for single color
105
- ax.invert_yaxis() # Invert the y-axis to match typical image coordinates
106
- # Remove axis spines for a cleaner look
107
- for spine in ax.spines.values():
108
- spine.set_visible(False)
109
-
110
- # Hide axis ticks and labels
111
- ax.set_xticks([])
112
- ax.set_yticks([])
113
- ax.patch.set_visible(False) # Hide the axis background
114
-
115
- return ax
116
-
117
- @staticmethod
118
- def savefig(*args, pad_inches: float = 0.5, dpi: int = 100, **kwargs) -> None:
119
- """Save the current plot to a file with additional export options.
120
-
121
- Args:
122
- *args: Positional arguments passed to `plt.savefig`.
123
- pad_inches (float, optional): Padding around the figure when saving. Defaults to 0.5.
124
- dpi (int, optional): Dots per inch (DPI) for the exported image. Defaults to 300.
125
- **kwargs: Keyword arguments passed to `plt.savefig`, such as filename and format.
126
- """
127
- plt.savefig(*args, bbox_inches="tight", pad_inches=pad_inches, dpi=dpi, **kwargs)
128
-
129
- @staticmethod
130
- def show(*args, **kwargs) -> None:
131
- """Display the current plot.
132
-
133
- Args:
134
- *args: Positional arguments passed to `plt.show`.
135
- **kwargs: Keyword arguments passed to `plt.show`.
136
- """
137
- plt.show(*args, **kwargs)
@@ -1,37 +0,0 @@
1
- risk/__init__.py,sha256=alJKI-P75Y0Cm9xyrTe0zsvDhyqO_gh50ygLQvzp7hs,113
2
- risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
3
- risk/risk.py,sha256=8GTUpj3TC7XLwEUD22-fDTKXtW7PndzW9TixWaZ23bI,23853
4
- risk/annotations/__init__.py,sha256=kXgadEXaCh0z8OyhOhTj7c3qXGmWgOhaSZ4gSzSb59U,147
5
- risk/annotations/annotations.py,sha256=dHO6kQOQjMA57nYA-yTAU1uB-ieiZ5sknAKvX6vF0Os,13024
6
- risk/annotations/io.py,sha256=powWzeimVdE0WCwlBCXyu5otMyZZHQujC0DS3m5DC0c,9505
7
- risk/log/__init__.py,sha256=aDUz5LMFQsz0UlsQI2EdXtiBKRLfml1UMeZKC7QQIGU,134
8
- risk/log/config.py,sha256=m8pzj-hN4vI_2JdJUfyOoSvzT8_lhoIfBt27sKbnOes,4535
9
- risk/log/params.py,sha256=rvyg86RnkHwotST7x42RgsiYfq2HB-9BZxp6KkT_04o,6415
10
- risk/neighborhoods/__init__.py,sha256=tKKEg4lsbqFukpgYlUGxU_v_9FOqK7V0uvM9T2QzoL0,206
11
- risk/neighborhoods/community.py,sha256=MAgIblbuisEPwVU6mFZd4Yd9NUKlaHK99suw51r1Is0,7065
12
- risk/neighborhoods/domains.py,sha256=3iV0-nRLF2sL9_7epHY5b9AtTU-QQ84hOWO76VwFcrs,11685
13
- risk/neighborhoods/neighborhoods.py,sha256=cT9CCi1uQLn9Kv9Lxt8AN_4s63SKIlOZspvUZnx27nE,21832
14
- risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
15
- risk/network/geometry.py,sha256=gFtYUj9j9aul4paKq_qSGJn39Nazxu_MXv8m-tYYtrk,6840
16
- risk/network/graph.py,sha256=-tslu8nSbuBaqNGf6TQ8ON7C27v-BLH_37J2aC6Ke14,9602
17
- risk/network/io.py,sha256=-NJ9Tg1s-DxhlDbwQGO4o87rbMqO4-BzShgnIgFoRRE,22962
18
- risk/network/plot/__init__.py,sha256=MfmaXJgAZJgXZ2wrhK8pXwzETlcMaLChhWXKAozniAo,98
19
- risk/network/plot/canvas.py,sha256=0A3i4GNMfQcZc--cRlAHoq4tmnDzxbpnaCUFINF_Zro,13269
20
- risk/network/plot/contour.py,sha256=CwX4i3uE5HL0W4kfx34U7YyoTTqMxyb7xaXKRVoNLzY,15265
21
- risk/network/plot/labels.py,sha256=fNccRds6seShMFPN6WX_7M1_qnscBkcWEH3QOJAKalk,45502
22
- risk/network/plot/network.py,sha256=6RURL1OdBFyQ34qNcwM_uH3LSQGYZZ8tZT51dggH1a0,13685
23
- risk/network/plot/plotter.py,sha256=iTPMiTnTTatM_-q1Ox_bjt5Pvv-Lo8gceiYB6TVzDcw,5770
24
- risk/network/plot/utils/color.py,sha256=WSs1ge2oZ8yXwyVk2QqBF-avRd0aYT-sYZr9cxxAn7M,19626
25
- risk/network/plot/utils/layout.py,sha256=RnJq0yODpoheZnDl7KKFPQeXrnrsS3FLIdxupoYVZq4,3553
26
- risk/stats/__init__.py,sha256=WcgoETQ-hS0LQqKRsAMIPtP15xZ-4eul6VUBuUx4Wzc,220
27
- risk/stats/hypergeom.py,sha256=oc39f02ViB1vQ-uaDrxG_tzAT6dxQBRjc88EK2EGn78,2282
28
- risk/stats/poisson.py,sha256=polLgwS08MTCNzupYdmMUoEUYrJOjAbcYtYwjlfeE5Y,1803
29
- risk/stats/stats.py,sha256=6iGi0-oN05mTmupg6X_VEBxEQvi2rujNhfPk4aLjwNI,7186
30
- risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
31
- risk/stats/permutation/permutation.py,sha256=meBNSrbRa9P8WJ54n485l0H7VQJlMSfHqdN4aCKYCtQ,10105
32
- risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
33
- risk_network-0.0.8b26.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
34
- risk_network-0.0.8b26.dist-info/METADATA,sha256=5I2n-fHbP--XuLA-iW4xIzxPKJbNYu0ds3-xOGWEmhw,47498
35
- risk_network-0.0.8b26.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
36
- risk_network-0.0.8b26.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
37
- risk_network-0.0.8b26.dist-info/RECORD,,