pytme 0.2.9__cp311-cp311-macosx_15_0_arm64.whl → 0.3b0__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 (63) hide show
  1. pytme-0.2.9.data/scripts/estimate_ram_usage.py → pytme-0.3b0.data/scripts/estimate_memory_usage.py +16 -33
  2. {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/match_template.py +224 -223
  3. {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/postprocess.py +283 -163
  4. {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/preprocess.py +11 -8
  5. {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/preprocessor_gui.py +10 -9
  6. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/METADATA +11 -9
  7. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/RECORD +61 -58
  8. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/entry_points.txt +1 -1
  9. scripts/{estimate_ram_usage.py → estimate_memory_usage.py} +16 -33
  10. scripts/extract_candidates.py +224 -0
  11. scripts/match_template.py +224 -223
  12. scripts/postprocess.py +283 -163
  13. scripts/preprocess.py +11 -8
  14. scripts/preprocessor_gui.py +10 -9
  15. scripts/refine_matches.py +626 -0
  16. tests/preprocessing/test_frequency_filters.py +9 -4
  17. tests/test_analyzer.py +143 -138
  18. tests/test_matching_cli.py +85 -29
  19. tests/test_matching_exhaustive.py +1 -2
  20. tests/test_matching_optimization.py +4 -9
  21. tests/test_orientations.py +0 -1
  22. tme/__version__.py +1 -1
  23. tme/analyzer/__init__.py +2 -0
  24. tme/analyzer/_utils.py +25 -17
  25. tme/analyzer/aggregation.py +385 -220
  26. tme/analyzer/base.py +138 -0
  27. tme/analyzer/peaks.py +150 -88
  28. tme/analyzer/proxy.py +122 -0
  29. tme/backends/__init__.py +4 -3
  30. tme/backends/_cupy_utils.py +25 -24
  31. tme/backends/_jax_utils.py +4 -3
  32. tme/backends/cupy_backend.py +4 -13
  33. tme/backends/jax_backend.py +6 -8
  34. tme/backends/matching_backend.py +4 -3
  35. tme/backends/mlx_backend.py +4 -3
  36. tme/backends/npfftw_backend.py +7 -5
  37. tme/backends/pytorch_backend.py +14 -4
  38. tme/cli.py +126 -0
  39. tme/density.py +4 -3
  40. tme/filters/__init__.py +1 -1
  41. tme/filters/_utils.py +4 -3
  42. tme/filters/bandpass.py +6 -4
  43. tme/filters/compose.py +5 -4
  44. tme/filters/ctf.py +426 -214
  45. tme/filters/reconstruction.py +58 -28
  46. tme/filters/wedge.py +139 -61
  47. tme/filters/whitening.py +36 -36
  48. tme/matching_data.py +4 -3
  49. tme/matching_exhaustive.py +17 -16
  50. tme/matching_optimization.py +5 -4
  51. tme/matching_scores.py +4 -3
  52. tme/matching_utils.py +6 -4
  53. tme/memory.py +4 -3
  54. tme/orientations.py +9 -6
  55. tme/parser.py +5 -4
  56. tme/preprocessor.py +4 -3
  57. tme/rotations.py +10 -7
  58. tme/structure.py +4 -3
  59. tests/data/Maps/.DS_Store +0 -0
  60. tests/data/Structures/.DS_Store +0 -0
  61. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/WHEEL +0 -0
  62. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/licenses/LICENSE +0 -0
  63. {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,21 @@
1
1
  #!python
2
- """ Estimate RAM requirements for template matching jobs.
2
+ """Estimate memory requirements for template matching jobs.
3
3
 
4
- Copyright (c) 2023 European Molecular Biology Laboratory
4
+ Copyright (c) 2023 European Molecular Biology Laboratory
5
5
 
6
- Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
6
+ Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
7
7
  """
8
8
  import numpy as np
9
9
  import argparse
10
10
  from tme import Density
11
- from tme.matching_utils import estimate_ram_usage
11
+ from tme.memory import estimate_memory_usage
12
12
  from tme.matching_exhaustive import MATCHING_EXHAUSTIVE_REGISTER
13
13
 
14
14
 
15
15
  def parse_args():
16
16
  parser = argparse.ArgumentParser(
17
- description="Estimate RAM usage for template matching."
17
+ description="Estimate memory usage for template matching.",
18
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
18
19
  )
19
20
  parser.add_argument(
20
21
  "-m",
@@ -32,14 +33,9 @@ def parse_args():
32
33
  required=True,
33
34
  help="Path to a template in PDB/MMCIF or CCP4/MRC format.",
34
35
  )
35
- parser.add_argument(
36
- "--matching_method",
37
- required=False,
38
- default=None,
39
- help="Analyzer method to use.",
40
- )
41
36
  parser.add_argument(
42
37
  "-s",
38
+ "--score",
43
39
  dest="score",
44
40
  type=str,
45
41
  default="FLCSphericalMask",
@@ -50,21 +46,12 @@ def parse_args():
50
46
  "--ncores", type=int, help="Number of cores for parallelization.", required=True
51
47
  )
52
48
  parser.add_argument(
53
- "--no_edge_padding",
54
- dest="no_edge_padding",
49
+ "--pad_edges",
50
+ dest="pad_edges",
55
51
  action="store_true",
56
52
  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.",
53
+ help="Whether to pad the edges of the target. Useful if the target does not "
54
+ "a well-defined bounding box. Defaults to True if splitting is required.",
68
55
  )
69
56
  args = parser.parse_args()
70
57
  return args
@@ -72,19 +59,15 @@ def parse_args():
72
59
 
73
60
  def main():
74
61
  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)
62
+ target = Density.from_file(args.target, use_memmap=True)
63
+ template = Density.from_file(args.template, use_memmap=True)
81
64
 
82
65
  template_box = template.shape
83
- if args.no_fourier_padding:
66
+ if not args.pad_edges:
84
67
  template_box = np.ones(len(template_box), dtype=int)
85
68
 
86
- result = estimate_ram_usage(
87
- shape1=target_box,
69
+ result = estimate_memory_usage(
70
+ shape1=target.shape,
88
71
  shape2=template_box,
89
72
  matching_method=args.score,
90
73
  ncores=args.ncores,