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
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
@@ -161,26 +162,33 @@ def score_to_cart(
161
162
  targetshape = be.to_backend_array(targetshape)
162
163
  templateshape = be.to_backend_array(templateshape)
163
164
 
165
+ valid_positions = be.ones((positions.shape[0],)) == 1
166
+
164
167
  # Wrap peaks around score space
165
168
  if fourier_shift is not None:
166
169
  fourier_shift = be.to_backend_array(fourier_shift)
167
170
  positions = be.add(positions, fourier_shift)
168
171
  positions = be.mod(positions, fast_shape)
169
172
 
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)
173
+ if convolution_mode is not None:
174
+ output_shape = _convmode_to_shape(
175
+ convolution_mode=convolution_mode,
176
+ targetshape=targetshape,
177
+ templateshape=templateshape,
178
+ convolution_shape=convolution_shape,
179
+ )
180
+ starts = be.astype(
181
+ be.divide(be.subtract(convolution_shape, output_shape), 2),
182
+ be._int_dtype,
183
+ )
184
+ stops = be.add(starts, output_shape)
181
185
 
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)
186
+ valid_positions = be.multiply(positions >= starts, positions < stops)
187
+ valid_positions = be.sum(valid_positions, axis=1) == positions.shape[1]
188
+ positions = be.subtract(positions, starts)
185
189
 
190
+ # Get rid of -1 position peaks used to keep GPU happy
191
+ valid_positions = be.multiply(
192
+ be.sum(positions >= 0, axis=1) == positions.shape[1], valid_positions
193
+ )
186
194
  return positions, valid_positions