pytme 0.3.1.post1__cp311-cp311-macosx_15_0_arm64.whl → 0.3.2.dev0__cp311-cp311-macosx_15_0_arm64.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 (69) hide show
  1. pytme-0.3.2.dev0.data/scripts/estimate_ram_usage.py +97 -0
  2. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/match_template.py +213 -196
  3. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/postprocess.py +40 -78
  4. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/preprocess.py +4 -5
  5. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/preprocessor_gui.py +50 -103
  6. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/pytme_runner.py +46 -69
  7. {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/METADATA +2 -1
  8. pytme-0.3.2.dev0.dist-info/RECORD +136 -0
  9. scripts/estimate_ram_usage.py +97 -0
  10. scripts/match_template.py +213 -196
  11. scripts/match_template_devel.py +1339 -0
  12. scripts/postprocess.py +40 -78
  13. scripts/preprocess.py +4 -5
  14. scripts/preprocessor_gui.py +50 -103
  15. scripts/pytme_runner.py +46 -69
  16. scripts/refine_matches.py +5 -7
  17. tests/preprocessing/test_compose.py +31 -30
  18. tests/preprocessing/test_frequency_filters.py +17 -32
  19. tests/preprocessing/test_preprocessor.py +0 -19
  20. tests/preprocessing/test_utils.py +13 -1
  21. tests/test_analyzer.py +2 -10
  22. tests/test_backends.py +47 -18
  23. tests/test_density.py +72 -13
  24. tests/test_extensions.py +1 -0
  25. tests/test_matching_cli.py +23 -9
  26. tests/test_matching_exhaustive.py +5 -5
  27. tests/test_matching_utils.py +3 -3
  28. tests/test_rotations.py +13 -23
  29. tests/test_structure.py +1 -7
  30. tme/__version__.py +1 -1
  31. tme/analyzer/aggregation.py +47 -16
  32. tme/analyzer/base.py +34 -0
  33. tme/analyzer/peaks.py +26 -13
  34. tme/analyzer/proxy.py +14 -0
  35. tme/backends/_jax_utils.py +124 -71
  36. tme/backends/cupy_backend.py +6 -19
  37. tme/backends/jax_backend.py +110 -105
  38. tme/backends/matching_backend.py +0 -17
  39. tme/backends/mlx_backend.py +0 -29
  40. tme/backends/npfftw_backend.py +100 -97
  41. tme/backends/pytorch_backend.py +65 -78
  42. tme/cli.py +2 -2
  43. tme/density.py +102 -58
  44. tme/extensions.cpython-311-darwin.so +0 -0
  45. tme/filters/_utils.py +52 -24
  46. tme/filters/bandpass.py +99 -105
  47. tme/filters/compose.py +133 -39
  48. tme/filters/ctf.py +51 -102
  49. tme/filters/reconstruction.py +67 -122
  50. tme/filters/wedge.py +296 -325
  51. tme/filters/whitening.py +39 -75
  52. tme/mask.py +2 -2
  53. tme/matching_data.py +87 -15
  54. tme/matching_exhaustive.py +70 -120
  55. tme/matching_optimization.py +9 -63
  56. tme/matching_scores.py +261 -100
  57. tme/matching_utils.py +150 -91
  58. tme/memory.py +1 -0
  59. tme/orientations.py +28 -8
  60. tme/preprocessor.py +0 -239
  61. tme/rotations.py +102 -70
  62. tme/structure.py +601 -631
  63. tme/types.py +1 -0
  64. pytme-0.3.1.post1.dist-info/RECORD +0 -133
  65. {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/estimate_memory_usage.py +0 -0
  66. {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/WHEEL +0 -0
  67. {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/entry_points.txt +0 -0
  68. {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/licenses/LICENSE +0 -0
  69. {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,97 @@
1
+ #!python
2
+ """ Estimate RAM requirements for template matching jobs.
3
+
4
+ Copyright (c) 2023 European Molecular Biology Laboratory
5
+
6
+ Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
7
+ """
8
+ import numpy as np
9
+ import argparse
10
+ from tme import Density
11
+ from tme.matching_utils import estimate_ram_usage
12
+ from tme.matching_exhaustive import MATCHING_EXHAUSTIVE_REGISTER
13
+
14
+
15
+ def parse_args():
16
+ parser = argparse.ArgumentParser(
17
+ description="Estimate RAM usage for template matching."
18
+ )
19
+ parser.add_argument(
20
+ "-m",
21
+ "--target",
22
+ dest="target",
23
+ type=str,
24
+ required=True,
25
+ help="Path to a target in CCP4/MRC format.",
26
+ )
27
+ parser.add_argument(
28
+ "-i",
29
+ "--template",
30
+ dest="template",
31
+ type=str,
32
+ required=True,
33
+ help="Path to a template in PDB/MMCIF or CCP4/MRC format.",
34
+ )
35
+ parser.add_argument(
36
+ "--matching_method",
37
+ required=False,
38
+ default=None,
39
+ help="Analyzer method to use.",
40
+ )
41
+ parser.add_argument(
42
+ "-s",
43
+ dest="score",
44
+ type=str,
45
+ default="FLCSphericalMask",
46
+ help="Template matching scoring function.",
47
+ choices=MATCHING_EXHAUSTIVE_REGISTER.keys(),
48
+ )
49
+ parser.add_argument(
50
+ "--ncores", type=int, help="Number of cores for parallelization.", required=True
51
+ )
52
+ parser.add_argument(
53
+ "--no_edge_padding",
54
+ dest="no_edge_padding",
55
+ action="store_true",
56
+ default=False,
57
+ help="Whether to pad the edges of the target. This is useful, if the target"
58
+ " has a well defined bounding box, e.g. a density map.",
59
+ )
60
+ parser.add_argument(
61
+ "--no_fourier_padding",
62
+ dest="no_fourier_padding",
63
+ action="store_true",
64
+ default=False,
65
+ help="Whether input arrays should be zero-padded to the full convolution shape"
66
+ " for numerical stability. When working with very large targets such as"
67
+ " tomograms it is safe to use this flag and benefit from the performance gain.",
68
+ )
69
+ args = parser.parse_args()
70
+ return args
71
+
72
+
73
+ def main():
74
+ args = parse_args()
75
+ target = Density.from_file(args.target)
76
+ template = Density.from_file(args.template)
77
+
78
+ target_box = target.shape
79
+ if not args.no_edge_padding:
80
+ target_box = np.add(target_box, template.shape)
81
+
82
+ template_box = template.shape
83
+ if args.no_fourier_padding:
84
+ template_box = np.ones(len(template_box), dtype=int)
85
+
86
+ result = estimate_ram_usage(
87
+ shape1=target_box,
88
+ shape2=template_box,
89
+ matching_method=args.score,
90
+ ncores=args.ncores,
91
+ analyzer_method="MaxScoreOverRotations",
92
+ )
93
+ print(result)
94
+
95
+
96
+ if __name__ == "__main__":
97
+ main()