adaptivepy-sampling 0.1.2__tar.gz → 0.2.0__tar.gz

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 (45) hide show
  1. adaptivepy_sampling-0.2.0/LICENSE +21 -0
  2. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/PKG-INFO +33 -5
  3. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/README.md +6 -2
  4. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/__init__.py +1 -1
  5. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/api.py +37 -5
  6. adaptivepy_sampling-0.2.0/adaptivepy/config/schema.py +497 -0
  7. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/output/writer.py +110 -0
  8. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/policies/__init__.py +2 -0
  9. adaptivepy_sampling-0.2.0/adaptivepy/policies/fast.py +296 -0
  10. adaptivepy_sampling-0.2.0/adaptivepy/policies/ma_reap.py +430 -0
  11. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/PKG-INFO +33 -5
  12. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/SOURCES.txt +3 -0
  13. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/requires.txt +1 -0
  14. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/pyproject.toml +4 -3
  15. adaptivepy_sampling-0.2.0/tests/test_adaptivepy.py +505 -0
  16. adaptivepy_sampling-0.1.2/adaptivepy/config/schema.py +0 -196
  17. adaptivepy_sampling-0.1.2/tests/test_adaptivepy.py +0 -95
  18. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/cli/__init__.py +0 -0
  19. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/cli/run.py +0 -0
  20. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/clustering/__init__.py +0 -0
  21. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/clustering/base.py +0 -0
  22. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/clustering/regular_space.py +0 -0
  23. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/clustering/sklearn_kmeans.py +0 -0
  24. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/clustering/sklearn_minibatch.py +0 -0
  25. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/config/__init__.py +0 -0
  26. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/io/__init__.py +0 -0
  27. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/io/loader.py +0 -0
  28. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/io/trajectory.py +0 -0
  29. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/models.py +0 -0
  30. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/output/__init__.py +0 -0
  31. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/output/pdb_writer.py +0 -0
  32. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/policies/base.py +0 -0
  33. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/policies/least_counts.py +0 -0
  34. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/policies/random.py +0 -0
  35. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/selection/__init__.py +0 -0
  36. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/selection/frame_selector.py +0 -0
  37. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/stats/__init__.py +0 -0
  38. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/stats/cluster_stats.py +0 -0
  39. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/utils/__init__.py +0 -0
  40. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/utils/io_utils.py +0 -0
  41. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy/utils/logging.py +0 -0
  42. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/dependency_links.txt +0 -0
  43. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/entry_points.txt +0 -0
  44. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/adaptivepy_sampling.egg-info/top_level.txt +0 -0
  45. {adaptivepy_sampling-0.1.2 → adaptivepy_sampling-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hassan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,22 +1,46 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: adaptivepy-sampling
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Adaptive sampling on MD trajectories via clustering and policy-driven seed selection
5
- Author: AdaptivePy Contributors
6
- License: MIT
5
+ Author: Hassan
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Hassan
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
7
28
  Requires-Python: >=3.9
8
29
  Description-Content-Type: text/markdown
30
+ License-File: LICENSE
9
31
  Requires-Dist: numpy>=1.20
10
32
  Requires-Dist: scikit-learn>=1.0
11
33
  Requires-Dist: pyyaml>=6.0
12
34
  Requires-Dist: click>=8.0
13
35
  Requires-Dist: joblib>=1.0
14
36
  Requires-Dist: mdtraj>=1.9
37
+ Requires-Dist: scipy>=1.7
15
38
  Provides-Extra: dev
16
39
  Requires-Dist: pytest>=7.0; extra == "dev"
17
40
  Provides-Extra: docs
18
41
  Requires-Dist: mkdocs-material>=9.0; extra == "docs"
19
42
  Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
43
+ Dynamic: license-file
20
44
 
21
45
  # AdaptivePy
22
46
 
@@ -40,7 +64,7 @@ AdaptivePy helps you identify under-sampled regions of conformational space and
40
64
  |---|---|
41
65
  | **Input** | Feature arrays (`.npy` / `.pkl`), optional coordinate trajectories |
42
66
  | **Clustering** | KMeans, MiniBatch KMeans, regular-space |
43
- | **Policies** | Least counts, random (extensible) |
67
+ | **Policies** | Least counts, random, FAST, MA-REAP (extensible) |
44
68
  | **Output** | Seeds, cluster assignments, model, logs, optional PDBs |
45
69
 
46
70
  ## Installation
@@ -103,6 +127,10 @@ results = run_adaptive_sampling("config.yaml")
103
127
  | [Policies](https://hnadeem2.github.io/AdaptivePy/policies/) | Seed selection strategies |
104
128
  | [API Reference](https://hnadeem2.github.io/AdaptivePy/reference/api/) | Module documentation |
105
129
 
130
+ ## Contributors
131
+
132
+ - Hassan
133
+
106
134
  ## License
107
135
 
108
- MIT
136
+ MIT. See [LICENSE](LICENSE) for details.
@@ -20,7 +20,7 @@ AdaptivePy helps you identify under-sampled regions of conformational space and
20
20
  |---|---|
21
21
  | **Input** | Feature arrays (`.npy` / `.pkl`), optional coordinate trajectories |
22
22
  | **Clustering** | KMeans, MiniBatch KMeans, regular-space |
23
- | **Policies** | Least counts, random (extensible) |
23
+ | **Policies** | Least counts, random, FAST, MA-REAP (extensible) |
24
24
  | **Output** | Seeds, cluster assignments, model, logs, optional PDBs |
25
25
 
26
26
  ## Installation
@@ -83,6 +83,10 @@ results = run_adaptive_sampling("config.yaml")
83
83
  | [Policies](https://hnadeem2.github.io/AdaptivePy/policies/) | Seed selection strategies |
84
84
  | [API Reference](https://hnadeem2.github.io/AdaptivePy/reference/api/) | Module documentation |
85
85
 
86
+ ## Contributors
87
+
88
+ - Hassan
89
+
86
90
  ## License
87
91
 
88
- MIT
92
+ MIT. See [LICENSE](LICENSE) for details.
@@ -1,6 +1,6 @@
1
1
  """AdaptivePy: adaptive sampling for molecular dynamics trajectories."""
2
2
 
3
- __version__ = "0.1.2"
3
+ __version__ = "0.2.0"
4
4
 
5
5
  from adaptivepy.api import run_adaptive_sampling
6
6
 
@@ -9,7 +9,7 @@ from typing import Dict, List, Optional
9
9
  import numpy as np
10
10
 
11
11
  from adaptivepy.clustering import create_clusterer, fit_clusterer
12
- from adaptivepy.config.schema import RunConfig, load_config
12
+ from adaptivepy.config.schema import RunConfig, build_policy_kwargs, load_config
13
13
  from adaptivepy.io.loader import (
14
14
  list_feature_files,
15
15
  list_trajectory_files,
@@ -28,6 +28,8 @@ from adaptivepy.output.writer import (
28
28
  write_cluster_model,
29
29
  write_cluster_statistics,
30
30
  write_combined_metadata,
31
+ write_fast_scores,
32
+ write_ma_reap_outputs,
31
33
  write_policy_outputs,
32
34
  write_run_config,
33
35
  )
@@ -121,6 +123,7 @@ def run_adaptive_sampling(
121
123
 
122
124
  cluster_stats = compute_cluster_stats(dataset)
123
125
  centers = clusterer.cluster_centers_
126
+ n_features = dataset.feature_matrix.shape[1]
124
127
 
125
128
  logger.info(
126
129
  "Clustering complete: %d clusters, %d total frames",
@@ -139,9 +142,15 @@ def run_adaptive_sampling(
139
142
 
140
143
  for policy_name in config.policies:
141
144
  logger.info("Applying policy: %s", policy_name)
142
- policy_kwargs = {}
143
- if policy_name == "random":
144
- policy_kwargs["random_state"] = config.random_seed
145
+ policy_kwargs = build_policy_kwargs(
146
+ policy_name,
147
+ config,
148
+ n_features=n_features,
149
+ traj_names=dataset.traj_names,
150
+ n_clusters=len(cluster_stats),
151
+ )
152
+ if policy_name == "ma_reap":
153
+ policy_kwargs["cluster_centers"] = centers
145
154
 
146
155
  policy = get_policy(policy_name, **policy_kwargs)
147
156
  selected_clusters = policy.select_clusters(
@@ -161,6 +170,20 @@ def run_adaptive_sampling(
161
170
  policy_name, seeds, cluster_stats, output_dir
162
171
  )
163
172
 
173
+ if policy_name == "fast" and hasattr(policy, "last_scores"):
174
+ write_fast_scores(policy.last_scores, policy_dir)
175
+
176
+ if policy_name == "ma_reap" and hasattr(policy, "last_scores"):
177
+ write_ma_reap_outputs(
178
+ scores=policy.last_scores,
179
+ weights=policy.last_weights,
180
+ stakes=policy.last_stakes,
181
+ executors=policy.last_executors,
182
+ agent_names=policy.agent_names,
183
+ seeds=seeds,
184
+ output_dir=policy_dir,
185
+ )
186
+
164
187
  if (
165
188
  config.write_pdbs
166
189
  and trajectory_map is not None
@@ -209,6 +232,7 @@ def validate_config(config_path: str | Path) -> RunConfig:
209
232
 
210
233
  dataset = load_features(config.features_dir)
211
234
  validate_dataset(dataset, trajectory_files)
235
+ n_features = dataset.feature_matrix.shape[1]
212
236
 
213
237
  if config.trajectories_dir is not None and config.topology is not None:
214
238
  trajectory_map = build_trajectory_map(
@@ -223,6 +247,14 @@ def validate_config(config_path: str | Path) -> RunConfig:
223
247
  )
224
248
 
225
249
  for policy_name in config.policies:
226
- get_policy(policy_name)
250
+ get_policy(
251
+ policy_name,
252
+ **build_policy_kwargs(
253
+ policy_name,
254
+ config,
255
+ n_features=n_features,
256
+ traj_names=dataset.traj_names,
257
+ ),
258
+ )
227
259
 
228
260
  return config