pytme 0.2.4__tar.gz → 0.2.5__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 (116) hide show
  1. {pytme-0.2.4 → pytme-0.2.5}/PKG-INFO +1 -1
  2. {pytme-0.2.4 → pytme-0.2.5}/pyproject.toml +1 -1
  3. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_optimization.py +0 -50
  4. pytme-0.2.5/tme/__version__.py +1 -0
  5. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/jax_backend.py +2 -9
  6. {pytme-0.2.4 → pytme-0.2.5}/tme/density.py +7 -10
  7. {pytme-0.2.4 → pytme-0.2.5}/tme/matching_data.py +3 -3
  8. {pytme-0.2.4 → pytme-0.2.5}/tme/matching_exhaustive.py +7 -7
  9. {pytme-0.2.4 → pytme-0.2.5}/tme/matching_optimization.py +215 -208
  10. {pytme-0.2.4 → pytme-0.2.5}/tme/matching_utils.py +1 -1
  11. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/tilt_series.py +10 -13
  12. {pytme-0.2.4 → pytme-0.2.5}/tme/structure.py +8 -8
  13. pytme-0.2.4/tme/__version__.py +0 -1
  14. {pytme-0.2.4 → pytme-0.2.5}/LICENSE +0 -0
  15. {pytme-0.2.4 → pytme-0.2.5}/MANIFEST.in +0 -0
  16. {pytme-0.2.4 → pytme-0.2.5}/README.md +0 -0
  17. {pytme-0.2.4 → pytme-0.2.5}/pytme.egg-info/SOURCES.txt +0 -0
  18. {pytme-0.2.4 → pytme-0.2.5}/scripts/__init__.py +0 -0
  19. {pytme-0.2.4 → pytme-0.2.5}/scripts/estimate_ram_usage.py +0 -0
  20. {pytme-0.2.4 → pytme-0.2.5}/scripts/eval.py +0 -0
  21. {pytme-0.2.4 → pytme-0.2.5}/scripts/extract_candidates.py +0 -0
  22. {pytme-0.2.4 → pytme-0.2.5}/scripts/match_template.py +0 -0
  23. {pytme-0.2.4 → pytme-0.2.5}/scripts/match_template_filters.py +0 -0
  24. {pytme-0.2.4 → pytme-0.2.5}/scripts/postprocess.py +0 -0
  25. {pytme-0.2.4 → pytme-0.2.5}/scripts/preprocess.py +0 -0
  26. {pytme-0.2.4 → pytme-0.2.5}/scripts/preprocessor_gui.py +0 -0
  27. {pytme-0.2.4 → pytme-0.2.5}/scripts/refine_matches.py +0 -0
  28. {pytme-0.2.4 → pytme-0.2.5}/setup.cfg +0 -0
  29. {pytme-0.2.4 → pytme-0.2.5}/setup.py +0 -0
  30. {pytme-0.2.4 → pytme-0.2.5}/tests/__init__.py +0 -0
  31. {pytme-0.2.4 → pytme-0.2.5}/tests/data/.DS_Store +0 -0
  32. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/.DS_Store +0 -0
  33. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/blob_width18.npy +0 -0
  34. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/edgegaussian_sigma3.npy +0 -0
  35. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/gaussian_sigma2.npy +0 -0
  36. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/hamming_width6.npy +0 -0
  37. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/kaiserb_width18.npy +0 -0
  38. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/localgaussian_sigma0510.npy +0 -0
  39. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/mean_size5.npy +0 -0
  40. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/ntree_sigma0510.npy +0 -0
  41. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Blurring/rank_rank3.npy +0 -0
  42. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Maps/.DS_Store +0 -0
  43. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Maps/emd_8621.mrc.gz +0 -0
  44. {pytme-0.2.4 → pytme-0.2.5}/tests/data/README.md +0 -0
  45. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Raw/.DS_Store +0 -0
  46. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Raw/em_map.map +0 -0
  47. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/.DS_Store +0 -0
  48. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/1pdj.cif +0 -0
  49. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/1pdj.pdb +0 -0
  50. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/5khe.cif +0 -0
  51. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/5khe.ent +0 -0
  52. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/5khe.pdb +0 -0
  53. {pytme-0.2.4 → pytme-0.2.5}/tests/data/Structures/5uz4.cif +0 -0
  54. {pytme-0.2.4 → pytme-0.2.5}/tests/preprocessing/__init__.py +0 -0
  55. {pytme-0.2.4 → pytme-0.2.5}/tests/preprocessing/test_compose.py +0 -0
  56. {pytme-0.2.4 → pytme-0.2.5}/tests/preprocessing/test_frequency_filters.py +0 -0
  57. {pytme-0.2.4 → pytme-0.2.5}/tests/preprocessing/test_preprocessor.py +0 -0
  58. {pytme-0.2.4 → pytme-0.2.5}/tests/preprocessing/test_utils.py +0 -0
  59. {pytme-0.2.4 → pytme-0.2.5}/tests/test_analyzer.py +0 -0
  60. {pytme-0.2.4 → pytme-0.2.5}/tests/test_backends.py +0 -0
  61. {pytme-0.2.4 → pytme-0.2.5}/tests/test_density.py +0 -0
  62. {pytme-0.2.4 → pytme-0.2.5}/tests/test_extensions.py +0 -0
  63. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_cli.py +0 -0
  64. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_data.py +0 -0
  65. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_exhaustive.py +0 -0
  66. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_memory.py +0 -0
  67. {pytme-0.2.4 → pytme-0.2.5}/tests/test_matching_utils.py +0 -0
  68. {pytme-0.2.4 → pytme-0.2.5}/tests/test_orientations.py +0 -0
  69. {pytme-0.2.4 → pytme-0.2.5}/tests/test_packaging.py +0 -0
  70. {pytme-0.2.4 → pytme-0.2.5}/tests/test_parser.py +0 -0
  71. {pytme-0.2.4 → pytme-0.2.5}/tests/test_structure.py +0 -0
  72. {pytme-0.2.4 → pytme-0.2.5}/tme/__init__.py +0 -0
  73. {pytme-0.2.4 → pytme-0.2.5}/tme/analyzer.py +0 -0
  74. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/__init__.py +0 -0
  75. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/_jax_utils.py +0 -0
  76. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/cupy_backend.py +0 -0
  77. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/matching_backend.py +0 -0
  78. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/mlx_backend.py +0 -0
  79. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/npfftw_backend.py +0 -0
  80. {pytme-0.2.4 → pytme-0.2.5}/tme/backends/pytorch_backend.py +0 -0
  81. {pytme-0.2.4 → pytme-0.2.5}/tme/data/__init__.py +0 -0
  82. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48n309.npy +0 -0
  83. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48n527.npy +0 -0
  84. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48n9.npy +0 -0
  85. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u1.npy +0 -0
  86. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u1153.npy +0 -0
  87. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u1201.npy +0 -0
  88. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u1641.npy +0 -0
  89. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u181.npy +0 -0
  90. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u2219.npy +0 -0
  91. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u27.npy +0 -0
  92. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u2947.npy +0 -0
  93. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u3733.npy +0 -0
  94. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u4749.npy +0 -0
  95. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u5879.npy +0 -0
  96. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u7111.npy +0 -0
  97. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u815.npy +0 -0
  98. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u83.npy +0 -0
  99. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c48u8649.npy +0 -0
  100. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c600v.npy +0 -0
  101. {pytme-0.2.4 → pytme-0.2.5}/tme/data/c600vc.npy +0 -0
  102. {pytme-0.2.4 → pytme-0.2.5}/tme/data/metadata.yaml +0 -0
  103. {pytme-0.2.4 → pytme-0.2.5}/tme/data/quat_to_numpy.py +0 -0
  104. {pytme-0.2.4 → pytme-0.2.5}/tme/data/scattering_factors.pickle +0 -0
  105. {pytme-0.2.4 → pytme-0.2.5}/tme/external/bindings.cpp +0 -0
  106. {pytme-0.2.4 → pytme-0.2.5}/tme/matching_scores.py +0 -0
  107. {pytme-0.2.4 → pytme-0.2.5}/tme/memory.py +0 -0
  108. {pytme-0.2.4 → pytme-0.2.5}/tme/orientations.py +0 -0
  109. {pytme-0.2.4 → pytme-0.2.5}/tme/parser.py +0 -0
  110. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/__init__.py +0 -0
  111. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/_utils.py +0 -0
  112. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/composable_filter.py +0 -0
  113. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/compose.py +0 -0
  114. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessing/frequency_filters.py +0 -0
  115. {pytme-0.2.4 → pytme-0.2.5}/tme/preprocessor.py +0 -0
  116. {pytme-0.2.4 → pytme-0.2.5}/tme/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytme
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Python Template Matching Engine
5
5
  Author: Valentin Maurer
6
6
  Author-email: Valentin Maurer <valentin.maurer@embl-hamburg.de>
@@ -7,7 +7,7 @@ name="pytme"
7
7
  authors = [
8
8
  { name = "Valentin Maurer", email = "valentin.maurer@embl-hamburg.de" },
9
9
  ]
10
- version="0.2.4"
10
+ version="0.2.5"
11
11
  description="Python Template Matching Engine"
12
12
  readme="README.md"
13
13
  requires-python = ">=3.11"
@@ -101,56 +101,6 @@ class TestMatchDensityToCoordinates:
101
101
  score = instance()
102
102
  assert isinstance(score, float)
103
103
 
104
- def test_map_coordinates_to_array(self):
105
- ret = _MatchCoordinatesToDensity.map_coordinates_to_array(
106
- coordinates=self.coordinates.astype(np.float32),
107
- array_shape=self.target.shape,
108
- array_origin=np.zeros(self.target.ndim),
109
- sampling_rate=np.ones(self.target.ndim),
110
- )
111
- assert len(ret) == 2
112
-
113
- in_vol, in_vol_mask = ret
114
-
115
- assert in_vol_mask is None
116
- assert np.allclose(in_vol.shape, self.coordinates.shape[1])
117
-
118
- def test_map_coordinates_to_array_mask(self):
119
- ret = _MatchCoordinatesToDensity.map_coordinates_to_array(
120
- coordinates=self.coordinates.astype(np.float32),
121
- array_shape=self.target.shape,
122
- array_origin=self.origin,
123
- sampling_rate=self.sampling_rate,
124
- coordinates_mask=self.coordinates.astype(np.float32),
125
- )
126
- assert len(ret) == 2
127
-
128
- in_vol, in_vol_mask = ret
129
- assert np.allclose(in_vol, in_vol_mask)
130
-
131
- def test_array_from_coordinates(self):
132
- ret = _MatchCoordinatesToDensity.array_from_coordinates(
133
- coordinates=self.coordinates,
134
- weights=self.coordinates_weights,
135
- sampling_rate=self.sampling_rate,
136
- )
137
- assert len(ret) == 3
138
- arr, positions, origin = ret
139
- assert arr.ndim == self.coordinates.shape[0]
140
- assert positions.shape == self.coordinates.shape
141
- assert origin.shape == (self.coordinates.shape[0],)
142
-
143
- assert np.allclose(origin, self.coordinates.min(axis=1))
144
-
145
- ret = _MatchCoordinatesToDensity.array_from_coordinates(
146
- coordinates=self.coordinates,
147
- weights=self.coordinates_weights,
148
- sampling_rate=self.sampling_rate,
149
- origin=self.origin,
150
- )
151
- arr, positions, origin = ret
152
- assert np.allclose(origin, self.origin)
153
-
154
104
 
155
105
  class TestMatchCoordinateToCoordinates:
156
106
  def setup_method(self):
@@ -0,0 +1 @@
1
+ __version__ = "0.2.5"
@@ -208,13 +208,6 @@ class JaxBackend(NumpyFFTWBackend):
208
208
  # Applying the filter leads to more FFTs
209
209
  fastt_shape = matching_data._template.shape
210
210
  if create_template_filter:
211
- # _, fastt_shape, _, tshift = matching_data._fourier_padding(
212
- # target_shape=self.to_numpy_array(matching_data._template.shape),
213
- # template_shape=self.to_numpy_array(
214
- # [1 for _ in matching_data._template.shape]
215
- # ),
216
- # pad_fourier=False,
217
- # )
218
211
  fastt_shape = matching_data._template.shape
219
212
 
220
213
  ret, template_filter, target_filter = [], 1, 1
@@ -260,8 +253,8 @@ class JaxBackend(NumpyFFTWBackend):
260
253
  base, targets = None, self._array_backend.stack(targets)
261
254
  scores, rotations = scan_inner(
262
255
  targets,
263
- self.topleft_pad(matching_data.template, fastt_shape),
264
- self.topleft_pad(matching_data.template_mask, fastt_shape),
256
+ matching_data.template,
257
+ matching_data.template_mask,
265
258
  matching_data.rotations,
266
259
  template_filter,
267
260
  target_filter,
@@ -697,8 +697,7 @@ class Density:
697
697
  References
698
698
  ----------
699
699
  .. [1] Sorzano, Carlos et al (Mar. 2015). Fast and accurate conversion
700
- of atomic models into electron density maps. AIMS Biophysics
701
- 2, 8–20.
700
+ of atomic models into electron density maps. AIMS Biophysics 2, 8–20.
702
701
 
703
702
  Examples
704
703
  --------
@@ -743,17 +742,16 @@ class Density:
743
742
  >>> filter_by_residues = {"SER", "THR", "CYS", "ASN", "GLN", "TYR"}
744
743
  >>> )
745
744
 
746
- :py:meth:`Density.from_structure` supports a variety of methods to convert
747
- atoms into densities
745
+ In addtion, :py:meth:`Density.from_structure` supports a variety of methods
746
+ to convert atoms into densities, such as Gaussians
748
747
 
749
748
  >>> density = Density.from_structure(
750
749
  >>> filename_or_structure = path_to_structure,
751
750
  >>> weight_type = "gaussian",
752
- >>> weight_type_args={"resolution": "20"}
751
+ >>> weight_type_args={"resolution": 20}
753
752
  >>> )
754
753
 
755
- In addition its possible to use experimentally determined scattering factors
756
- from various sources:
754
+ experimentally determined scattering factors
757
755
 
758
756
  >>> density = Density.from_structure(
759
757
  >>> filename_or_structure = path_to_structure,
@@ -1688,11 +1686,10 @@ class Density:
1688
1686
  Resampling method to use, defaults to `spline`. Availabe options are:
1689
1687
 
1690
1688
  +---------+----------------------------------------------------------+
1691
- | spline | Smooth spline interpolation via :obj:`scipy.ndimage.zoom`|
1689
+ | spline | Spline interpolation using :obj:`scipy.ndimage.zoom` |
1692
1690
  +---------+----------------------------------------------------------+
1693
- | fourier | Frequency preserving Fourier cropping |
1691
+ | fourier | Fourier cropping |
1694
1692
  +---------+----------------------------------------------------------+
1695
-
1696
1693
  order : int, optional
1697
1694
  Order of spline used for interpolation, by default 1. Ignored when
1698
1695
  ``method`` is `fourier`.
@@ -478,7 +478,8 @@ class MatchingData:
478
478
  shape_diff = np.multiply(
479
479
  np.subtract(target_shape, template_shape), 1 - batch_mask
480
480
  )
481
- if np.sum(shape_diff < 0):
481
+ shape_mask = shape_diff < 0
482
+ if np.sum(shape_mask):
482
483
  shape_shift = np.divide(shape_diff, 2)
483
484
  offset = np.mod(shape_diff, 2)
484
485
  if pad_fourier:
@@ -491,8 +492,7 @@ class MatchingData:
491
492
  "Template is larger than target and padding is turned off. Consider "
492
493
  "swapping them or activate padding. Correcting the shift for now."
493
494
  )
494
-
495
- shape_shift = np.add(shape_shift, offset)
495
+ shape_shift = np.multiply(np.add(shape_shift, offset), shape_mask)
496
496
  fourier_shift = np.subtract(fourier_shift, shape_shift).astype(int)
497
497
 
498
498
  fourier_shift = tuple(fourier_shift.astype(int))
@@ -90,12 +90,12 @@ def _setup_template_filter_apply_target_filter(
90
90
  # pad_fourier=False,
91
91
  # )
92
92
  fastt_shape = matching_data._template.shape
93
- matching_data.template = be.reverse(
94
- be.topleft_pad(matching_data.template, fastt_shape)
95
- )
96
- matching_data.template_mask = be.reverse(
97
- be.topleft_pad(matching_data.template_mask, fastt_shape)
98
- )
93
+ # matching_data.template = be.reverse(
94
+ # be.topleft_pad(matching_data.template, fastt_shape)
95
+ # )
96
+ # matching_data.template_mask = be.reverse(
97
+ # be.topleft_pad(matching_data.template_mask, fastt_shape)
98
+ # )
99
99
  matching_data._set_matching_dimension(
100
100
  target_dims=matching_data._target_dims,
101
101
  template_dims=matching_data._template_dims,
@@ -208,7 +208,7 @@ def scan(
208
208
 
209
209
  Examples
210
210
  --------
211
- Schematically, using :py:meth:`scan` is similar to :py:meth:`scan_subsets`,
211
+ Schematically, :py:meth:`scan` is identical to :py:meth:`scan_subsets`,
212
212
  with the distinction that the objects contained in ``matching_data`` are not
213
213
  split and the search is only parallelized over angles.
214
214
  Assuming you have followed the example in :py:meth:`scan_subsets`, :py:meth:`scan`