SURE-tools 2.1.1__py3-none-any.whl → 2.1.2__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.
Potentially problematic release.
This version of SURE-tools might be problematic. Click here for more details.
- SURE/flow/__init__.py +2 -1
- SURE/flow/flow_stats.py +78 -0
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/METADATA +1 -1
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/RECORD +8 -7
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/WHEEL +0 -0
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/entry_points.txt +0 -0
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/licenses/LICENSE +0 -0
- {sure_tools-2.1.1.dist-info → sure_tools-2.1.2.dist-info}/top_level.txt +0 -0
SURE/flow/__init__.py
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
from .plot_quiver import plot_quiver
|
|
1
|
+
from .plot_quiver import plot_quiver
|
|
2
|
+
from .flow_stats import calculate_direction_stats,calculate_movement_stats,calculate_movement_energy,calculate_movement_divergence
|
SURE/flow/flow_stats.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.spatial.distance import pdist, squareform
|
|
3
|
+
|
|
4
|
+
def calculate_movement_stats(vectors):
|
|
5
|
+
"""
|
|
6
|
+
计算移动矢量的基本统计量
|
|
7
|
+
"""
|
|
8
|
+
# 计算每个矢量的模长(移动距离)
|
|
9
|
+
distances = np.linalg.norm(vectors, axis=1)
|
|
10
|
+
|
|
11
|
+
stats = {
|
|
12
|
+
'total_movement': np.sum(distances),
|
|
13
|
+
'mean_distance': np.mean(distances),
|
|
14
|
+
'median_distance': np.median(distances),
|
|
15
|
+
'std_distance': np.std(distances),
|
|
16
|
+
'max_distance': np.max(distances),
|
|
17
|
+
'min_distance': np.min(distances),
|
|
18
|
+
'total_points': len(vectors)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return stats, distances
|
|
22
|
+
|
|
23
|
+
def calculate_direction_stats(vectors):
|
|
24
|
+
"""
|
|
25
|
+
计算移动方向的一致性
|
|
26
|
+
"""
|
|
27
|
+
# 单位向量
|
|
28
|
+
unit_vectors = vectors / np.linalg.norm(vectors, axis=1, keepdims=True)
|
|
29
|
+
|
|
30
|
+
# 平均方向向量
|
|
31
|
+
mean_direction = np.mean(unit_vectors, axis=0)
|
|
32
|
+
mean_direction_norm = np.linalg.norm(mean_direction)
|
|
33
|
+
|
|
34
|
+
# 方向一致性(0-1,1表示完全一致)
|
|
35
|
+
direction_consistency = mean_direction_norm
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
'direction_consistency': direction_consistency,
|
|
39
|
+
'mean_direction': mean_direction,
|
|
40
|
+
'direction_variance': 1 - direction_consistency # 方向分散度
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def calculate_movement_energy(vectors, masses=None):
|
|
44
|
+
"""
|
|
45
|
+
计算移动的能量(假设每个点有质量)
|
|
46
|
+
"""
|
|
47
|
+
if masses is None:
|
|
48
|
+
masses = np.ones(len(vectors)) # 默认单位质量
|
|
49
|
+
|
|
50
|
+
# 动能 = 0.5 * mass * velocity^2
|
|
51
|
+
speeds_squared = np.sum(vectors**2, axis=1)
|
|
52
|
+
kinetic_energy = 0.5 * masses * speeds_squared
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
'total_energy': np.sum(kinetic_energy),
|
|
56
|
+
'mean_energy': np.mean(kinetic_energy),
|
|
57
|
+
'energy_std': np.std(kinetic_energy)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def calculate_movement_divergence(positions, vectors):
|
|
61
|
+
"""
|
|
62
|
+
计算移动的散度(衡量扩张/收缩)
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
# 计算移动前后的位置
|
|
66
|
+
new_positions = positions + vectors
|
|
67
|
+
|
|
68
|
+
# 计算位置变化的协方差
|
|
69
|
+
orig_cov = np.cov(positions.T)
|
|
70
|
+
new_cov = np.cov(new_positions.T)
|
|
71
|
+
|
|
72
|
+
# 体积变化(行列式比值)
|
|
73
|
+
volume_ratio = np.linalg.det(new_cov) / np.linalg.det(orig_cov)
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
'volume_expansion': volume_ratio, # >1扩张, <1收缩
|
|
77
|
+
'expansion_factor': volume_ratio**(1/positions.shape[1])
|
|
78
|
+
}
|
|
@@ -9,16 +9,17 @@ SURE/atac/__init__.py,sha256=3smP8IKHfwNCd1G_sZH3pKHXuLkLpFuLtjUTUSy7_As,34
|
|
|
9
9
|
SURE/atac/utils.py,sha256=m4NYwpy9O5T1pXTzgCOCcmlwrC6GTi-cQ5sm2wZu2O8,4354
|
|
10
10
|
SURE/codebook/__init__.py,sha256=2T5gjp8JIaBayrXAnOJYSebQHsWprOs87difpR1OPNw,243
|
|
11
11
|
SURE/codebook/codebook.py,sha256=ZlN6gRX9Gj2D2u3P5KeOsbZri0MoMAiJo9lNeL-MK-I,17117
|
|
12
|
-
SURE/flow/__init__.py,sha256=
|
|
12
|
+
SURE/flow/__init__.py,sha256=eIcHeeISEOXEB0zRW-uiRlDz5IEUbA7rZZ1htUxhLVU,167
|
|
13
|
+
SURE/flow/flow_stats.py,sha256=wpIxmOpYPU7YcgxqXKS8EDmnZ3oGh-YdBjiBiEmHcoU,2360
|
|
13
14
|
SURE/flow/plot_quiver.py,sha256=spcPC0BDpvC-FBk9XIu6rcJI64bS-U-IVmmKLYHHXgs,1865
|
|
14
15
|
SURE/flow/quiver.py,sha256=_euFqSaRrDoZ_oOabOx20LOoUTJ__XPhLW-vzLNQfAo,1859
|
|
15
16
|
SURE/utils/__init__.py,sha256=Htqv4KqVKcRiaaTBsR-6yZ4LSlbhbzutjNKXGD9-uds,660
|
|
16
17
|
SURE/utils/custom_mlp.py,sha256=07TYX1HgxfEjb_3i5MpiZfNhOhx3dKntuwGkrpteWiM,7036
|
|
17
18
|
SURE/utils/queue.py,sha256=E_5PA5EWcBoGAZj8BkKQnkCK0p4C-4-xcTPqdIXaPXU,1892
|
|
18
19
|
SURE/utils/utils.py,sha256=IUHjDDtYaAYllCWsZyIzqQwaLul6fJRvHRH4vIYcR-c,8462
|
|
19
|
-
sure_tools-2.1.
|
|
20
|
-
sure_tools-2.1.
|
|
21
|
-
sure_tools-2.1.
|
|
22
|
-
sure_tools-2.1.
|
|
23
|
-
sure_tools-2.1.
|
|
24
|
-
sure_tools-2.1.
|
|
20
|
+
sure_tools-2.1.2.dist-info/licenses/LICENSE,sha256=TFHKwmrAViXQbSX5W-NDItkWFjm45HWOeUniDrqmnu0,1065
|
|
21
|
+
sure_tools-2.1.2.dist-info/METADATA,sha256=30k-_5ftI_F5fd76yo792KMd2rjISQy-8PFi-1YuOrI,2650
|
|
22
|
+
sure_tools-2.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
23
|
+
sure_tools-2.1.2.dist-info/entry_points.txt,sha256=-nJI8rVe_qqrR0HmfAODzj-JNfEqCcSsyVh6okSqyHk,83
|
|
24
|
+
sure_tools-2.1.2.dist-info/top_level.txt,sha256=BtFTebdiJeqra4r6mm-uEtwVRFLZ_IjYsQ7OnalrOvY,5
|
|
25
|
+
sure_tools-2.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|