pytme 0.2.9__cp311-cp311-macosx_15_0_arm64.whl → 0.3.0__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 (75) hide show
  1. pytme-0.3.0.data/scripts/estimate_memory_usage.py +76 -0
  2. pytme-0.3.0.data/scripts/match_template.py +1106 -0
  3. {pytme-0.2.9.data → pytme-0.3.0.data}/scripts/postprocess.py +320 -190
  4. {pytme-0.2.9.data → pytme-0.3.0.data}/scripts/preprocess.py +21 -31
  5. {pytme-0.2.9.data → pytme-0.3.0.data}/scripts/preprocessor_gui.py +85 -19
  6. pytme-0.3.0.data/scripts/pytme_runner.py +771 -0
  7. {pytme-0.2.9.dist-info → pytme-0.3.0.dist-info}/METADATA +22 -20
  8. pytme-0.3.0.dist-info/RECORD +126 -0
  9. {pytme-0.2.9.dist-info → pytme-0.3.0.dist-info}/entry_points.txt +2 -1
  10. pytme-0.3.0.dist-info/licenses/LICENSE +339 -0
  11. scripts/estimate_memory_usage.py +76 -0
  12. scripts/eval.py +93 -0
  13. scripts/extract_candidates.py +224 -0
  14. scripts/match_template.py +349 -378
  15. pytme-0.2.9.data/scripts/match_template.py → scripts/match_template_filters.py +213 -148
  16. scripts/postprocess.py +320 -190
  17. scripts/preprocess.py +21 -31
  18. scripts/preprocessor_gui.py +85 -19
  19. scripts/pytme_runner.py +771 -0
  20. scripts/refine_matches.py +625 -0
  21. tests/preprocessing/test_frequency_filters.py +28 -14
  22. tests/test_analyzer.py +41 -36
  23. tests/test_backends.py +1 -0
  24. tests/test_matching_cli.py +109 -53
  25. tests/test_matching_data.py +5 -5
  26. tests/test_matching_exhaustive.py +1 -2
  27. tests/test_matching_optimization.py +4 -9
  28. tests/test_matching_utils.py +1 -1
  29. tests/test_orientations.py +0 -1
  30. tme/__version__.py +1 -1
  31. tme/analyzer/__init__.py +2 -0
  32. tme/analyzer/_utils.py +26 -21
  33. tme/analyzer/aggregation.py +396 -222
  34. tme/analyzer/base.py +127 -0
  35. tme/analyzer/peaks.py +189 -201
  36. tme/analyzer/proxy.py +123 -0
  37. tme/backends/__init__.py +4 -3
  38. tme/backends/_cupy_utils.py +25 -24
  39. tme/backends/_jax_utils.py +20 -18
  40. tme/backends/cupy_backend.py +13 -26
  41. tme/backends/jax_backend.py +24 -23
  42. tme/backends/matching_backend.py +4 -3
  43. tme/backends/mlx_backend.py +4 -3
  44. tme/backends/npfftw_backend.py +34 -30
  45. tme/backends/pytorch_backend.py +18 -4
  46. tme/cli.py +126 -0
  47. tme/density.py +9 -7
  48. tme/extensions.cpython-311-darwin.so +0 -0
  49. tme/filters/__init__.py +3 -3
  50. tme/filters/_utils.py +36 -10
  51. tme/filters/bandpass.py +229 -188
  52. tme/filters/compose.py +5 -4
  53. tme/filters/ctf.py +516 -254
  54. tme/filters/reconstruction.py +91 -32
  55. tme/filters/wedge.py +196 -135
  56. tme/filters/whitening.py +37 -42
  57. tme/matching_data.py +28 -39
  58. tme/matching_exhaustive.py +31 -27
  59. tme/matching_optimization.py +5 -4
  60. tme/matching_scores.py +25 -15
  61. tme/matching_utils.py +158 -28
  62. tme/memory.py +4 -3
  63. tme/orientations.py +22 -9
  64. tme/parser.py +114 -33
  65. tme/preprocessor.py +6 -5
  66. tme/rotations.py +10 -7
  67. tme/structure.py +4 -3
  68. pytme-0.2.9.data/scripts/estimate_ram_usage.py +0 -97
  69. pytme-0.2.9.dist-info/RECORD +0 -119
  70. pytme-0.2.9.dist-info/licenses/LICENSE +0 -153
  71. scripts/estimate_ram_usage.py +0 -97
  72. tests/data/Maps/.DS_Store +0 -0
  73. tests/data/Structures/.DS_Store +0 -0
  74. {pytme-0.2.9.dist-info → pytme-0.3.0.dist-info}/WHEEL +0 -0
  75. {pytme-0.2.9.dist-info → pytme-0.3.0.dist-info}/top_level.txt +0 -0
@@ -139,7 +139,7 @@ class TestMatchingUtils:
139
139
  expected_size = np.subtract(
140
140
  self.density.shape, self.structure_density.shape
141
141
  )
142
- expected_size += np.mod(self.structure_density.shape, 2)
142
+ expected_size += 1
143
143
  assert np.allclose(ret.shape, expected_size)
144
144
 
145
145
  def test_apply_convolution_mode_error(self):
@@ -50,7 +50,6 @@ class TestDensity:
50
50
  assert np.issubdtype(orientations.translations.dtype, np.floating)
51
51
  assert np.issubdtype(orientations.rotations.dtype, np.floating)
52
52
  assert np.issubdtype(orientations.scores.dtype, np.floating)
53
- assert np.issubdtype(orientations.details.dtype, np.floating)
54
53
 
55
54
  def test_initialization_error(self):
56
55
  with pytest.raises(ValueError):
tme/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.9"
1
+ __version__ = "0.3.0"
tme/analyzer/__init__.py CHANGED
@@ -1,2 +1,4 @@
1
1
  from .peaks import *
2
2
  from .aggregation import *
3
+ from .proxy import *
4
+ from .base import *
tme/analyzer/_utils.py CHANGED
@@ -1,8 +1,9 @@
1
- """ Analyzer utility functions.
1
+ """
2
+ Analyzer utility functions.
2
3
 
3
- Copyright (c) 2023-2025 European Molecular Biology Laboratory
4
+ Copyright (c) 2023-2025 European Molecular Biology Laboratory
4
5
 
5
- Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
6
+ Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
6
7
  """
7
8
 
8
9
  from typing import Tuple
@@ -46,10 +47,7 @@ def _convmode_to_shape(
46
47
  if convolution_mode == "same":
47
48
  output_shape = targetshape
48
49
  elif convolution_mode == "valid":
49
- output_shape = be.add(
50
- be.subtract(targetshape, templateshape),
51
- be.mod(templateshape, 2),
52
- )
50
+ output_shape = be.subtract(targetshape, templateshape) + 1
53
51
  return be.to_backend_array(output_shape)
54
52
 
55
53
 
@@ -161,26 +159,33 @@ def score_to_cart(
161
159
  targetshape = be.to_backend_array(targetshape)
162
160
  templateshape = be.to_backend_array(templateshape)
163
161
 
162
+ valid_positions = be.ones((positions.shape[0],)) == 1
163
+
164
164
  # Wrap peaks around score space
165
165
  if fourier_shift is not None:
166
166
  fourier_shift = be.to_backend_array(fourier_shift)
167
167
  positions = be.add(positions, fourier_shift)
168
168
  positions = be.mod(positions, fast_shape)
169
169
 
170
- output_shape = _convmode_to_shape(
171
- convolution_mode=convolution_mode,
172
- targetshape=targetshape,
173
- templateshape=templateshape,
174
- convolution_shape=convolution_shape,
175
- )
176
- starts = be.astype(
177
- be.divide(be.subtract(convolution_shape, output_shape), 2),
178
- be._int_dtype,
179
- )
180
- stops = be.add(starts, output_shape)
170
+ if convolution_mode is not None:
171
+ output_shape = _convmode_to_shape(
172
+ convolution_mode=convolution_mode,
173
+ targetshape=targetshape,
174
+ templateshape=templateshape,
175
+ convolution_shape=convolution_shape,
176
+ )
177
+ starts = be.astype(
178
+ be.divide(be.subtract(convolution_shape, output_shape), 2),
179
+ be._int_dtype,
180
+ )
181
+ stops = be.add(starts, output_shape)
181
182
 
182
- valid_positions = be.multiply(positions >= starts, positions < stops)
183
- valid_positions = be.sum(valid_positions, axis=1) == positions.shape[1]
184
- positions = be.subtract(positions, starts)
183
+ valid_positions = be.multiply(positions >= starts, positions < stops)
184
+ valid_positions = be.sum(valid_positions, axis=1) == positions.shape[1]
185
+ positions = be.subtract(positions, starts)
185
186
 
187
+ # Get rid of -1 position peaks used to keep GPU happy
188
+ valid_positions = be.multiply(
189
+ be.sum(positions >= 0, axis=1) == positions.shape[1], valid_positions
190
+ )
186
191
  return positions, valid_positions