pytme 0.2.3__cp311-cp311-macosx_14_0_arm64.whl → 0.2.4__cp311-cp311-macosx_14_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.2.3.data → pytme-0.2.4.data}/scripts/match_template.py +8 -8
  2. {pytme-0.2.3.data → pytme-0.2.4.data}/scripts/preprocess.py +22 -6
  3. {pytme-0.2.3.data → pytme-0.2.4.data}/scripts/preprocessor_gui.py +9 -14
  4. {pytme-0.2.3.dist-info → pytme-0.2.4.dist-info}/METADATA +1 -1
  5. pytme-0.2.4.dist-info/RECORD +119 -0
  6. {pytme-0.2.3.dist-info → pytme-0.2.4.dist-info}/WHEEL +1 -1
  7. {pytme-0.2.3.dist-info → pytme-0.2.4.dist-info}/top_level.txt +1 -0
  8. scripts/match_template.py +8 -8
  9. scripts/preprocess.py +22 -6
  10. scripts/preprocessor_gui.py +9 -14
  11. tests/__init__.py +0 -0
  12. tests/data/.DS_Store +0 -0
  13. tests/data/Blurring/.DS_Store +0 -0
  14. tests/data/Blurring/blob_width18.npy +0 -0
  15. tests/data/Blurring/edgegaussian_sigma3.npy +0 -0
  16. tests/data/Blurring/gaussian_sigma2.npy +0 -0
  17. tests/data/Blurring/hamming_width6.npy +0 -0
  18. tests/data/Blurring/kaiserb_width18.npy +0 -0
  19. tests/data/Blurring/localgaussian_sigma0510.npy +0 -0
  20. tests/data/Blurring/mean_size5.npy +0 -0
  21. tests/data/Blurring/ntree_sigma0510.npy +0 -0
  22. tests/data/Blurring/rank_rank3.npy +0 -0
  23. tests/data/Maps/.DS_Store +0 -0
  24. tests/data/Maps/emd_8621.mrc.gz +0 -0
  25. tests/data/README.md +2 -0
  26. tests/data/Raw/.DS_Store +0 -0
  27. tests/data/Raw/em_map.map +0 -0
  28. tests/data/Structures/.DS_Store +0 -0
  29. tests/data/Structures/1pdj.cif +3339 -0
  30. tests/data/Structures/1pdj.pdb +1429 -0
  31. tests/data/Structures/5khe.cif +3685 -0
  32. tests/data/Structures/5khe.ent +2210 -0
  33. tests/data/Structures/5khe.pdb +2210 -0
  34. tests/data/Structures/5uz4.cif +70548 -0
  35. tests/preprocessing/__init__.py +0 -0
  36. tests/preprocessing/test_compose.py +76 -0
  37. tests/preprocessing/test_frequency_filters.py +178 -0
  38. tests/preprocessing/test_preprocessor.py +136 -0
  39. tests/preprocessing/test_utils.py +79 -0
  40. tests/test_analyzer.py +310 -0
  41. tests/test_backends.py +375 -0
  42. tests/test_density.py +508 -0
  43. tests/test_extensions.py +130 -0
  44. tests/test_matching_cli.py +283 -0
  45. tests/test_matching_data.py +162 -0
  46. tests/test_matching_exhaustive.py +162 -0
  47. tests/test_matching_memory.py +30 -0
  48. tests/test_matching_optimization.py +276 -0
  49. tests/test_matching_utils.py +326 -0
  50. tests/test_orientations.py +173 -0
  51. tests/test_packaging.py +95 -0
  52. tests/test_parser.py +33 -0
  53. tests/test_structure.py +243 -0
  54. tme/__init__.py +0 -1
  55. tme/__version__.py +1 -1
  56. tme/backends/jax_backend.py +8 -7
  57. tme/data/scattering_factors.pickle +0 -0
  58. tme/density.py +11 -4
  59. tme/external/bindings.cpp +332 -0
  60. tme/matching_data.py +11 -9
  61. tme/matching_exhaustive.py +10 -8
  62. tme/matching_utils.py +1 -0
  63. tme/preprocessing/_utils.py +14 -14
  64. tme/preprocessing/composable_filter.py +0 -2
  65. tme/preprocessing/compose.py +4 -4
  66. tme/preprocessing/frequency_filters.py +32 -35
  67. tme/preprocessing/tilt_series.py +202 -118
  68. tme/preprocessor.py +24 -246
  69. tme/structure.py +14 -14
  70. pytme-0.2.3.dist-info/RECORD +0 -75
  71. tme/matching_memory.py +0 -383
  72. {pytme-0.2.3.data → pytme-0.2.4.data}/scripts/estimate_ram_usage.py +0 -0
  73. {pytme-0.2.3.data → pytme-0.2.4.data}/scripts/postprocess.py +0 -0
  74. {pytme-0.2.3.dist-info → pytme-0.2.4.dist-info}/LICENSE +0 -0
  75. {pytme-0.2.3.dist-info → pytme-0.2.4.dist-info}/entry_points.txt +0 -0
@@ -186,8 +186,10 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
186
186
  ReconstructFromTilt,
187
187
  )
188
188
 
189
+ needs_reconstruction = False
189
190
  template_filter, target_filter = [], []
190
191
  if args.tilt_angles is not None:
192
+ needs_reconstruction = args.tilt_weighting is not None
191
193
  try:
192
194
  wedge = Wedge.from_file(args.tilt_angles)
193
195
  wedge.weight_type = args.tilt_weighting
@@ -232,11 +234,12 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
232
234
  angles=tilt_angles,
233
235
  weight_wedge=args.tilt_weighting == "angle",
234
236
  create_continuous_wedge=create_continuous_wedge,
237
+ reconstruction_filter=args.reconstruction_filter,
235
238
  )
236
239
  wedge_target = WedgeReconstructed(
237
- angles=tilt_angles,
240
+ angles=(np.abs(np.min(tilt_angles)), np.abs(np.max(tilt_angles))),
238
241
  weight_wedge=False,
239
- create_continuous_wedge=create_continuous_wedge,
242
+ create_continuous_wedge=True,
240
243
  )
241
244
  target_filter.append(wedge_target)
242
245
 
@@ -323,18 +326,13 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
323
326
  sampling_rate=template.sampling_rate,
324
327
  )
325
328
  template_filter.append(bandpass)
326
-
327
- if not args.no_filter_target:
328
- target_filter.append(bandpass)
329
+ target_filter.append(bandpass)
329
330
 
330
331
  if args.whiten_spectrum:
331
332
  whitening_filter = LinearWhiteningFilter()
332
333
  template_filter.append(whitening_filter)
333
334
  target_filter.append(whitening_filter)
334
335
 
335
- needs_reconstruction = any(
336
- [isinstance(t, ReconstructFromTilt) for t in template_filter]
337
- )
338
336
  if needs_reconstruction and args.reconstruction_filter is None:
339
337
  warnings.warn(
340
338
  "Consider using a --reconstruction_filter such as 'ramp' to avoid artifacts."
@@ -342,6 +340,8 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
342
340
 
343
341
  template_filter = Compose(template_filter) if len(template_filter) else None
344
342
  target_filter = Compose(target_filter) if len(target_filter) else None
343
+ if args.no_filter_target:
344
+ target_filter = None
345
345
 
346
346
  return template_filter, target_filter
347
347
 
@@ -79,6 +79,14 @@ def parse_args():
79
79
  action="store_true",
80
80
  help="Assumes the template is already centered and omits centering.",
81
81
  )
82
+ modulation_group.add_argument(
83
+ "--backend",
84
+ dest="backend",
85
+ type=str,
86
+ default=None,
87
+ choices=be.available_backends(),
88
+ help="Determines more suitable box size for the given compute backend.",
89
+ )
82
90
  args = parser.parse_args()
83
91
  return args
84
92
 
@@ -95,11 +103,18 @@ def main():
95
103
  if not args.no_centering:
96
104
  data, _ = data.centered(0)
97
105
 
98
- recommended_box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
99
- if recommended_box != args.box_size:
100
- warnings.warn(
101
- f"Consider using --box_size {recommended_box} instead of {args.box_size}."
102
- )
106
+ for name in be.available_backends():
107
+ be.change_backend(name, device="cpu")
108
+ box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
109
+ if box != args.box_size and args.backend is None:
110
+ print(f"Consider --box_size {box} instead of {args.box_size} for {name}.")
111
+
112
+ if args.backend is not None:
113
+ be.change_backend(name, device="cpu")
114
+ box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
115
+ if box != args.box_size:
116
+ print(f"Changed --box_size from {args.box_size} to {box}.")
117
+ args.box_size = box
103
118
 
104
119
  data.pad(
105
120
  np.multiply(args.box_size, np.divide(args.sampling_rate, data.sampling_rate)),
@@ -128,5 +143,6 @@ def main():
128
143
 
129
144
  data.to_file(args.output)
130
145
 
146
+
131
147
  if __name__ == "__main__":
132
- main()
148
+ main()
@@ -147,9 +147,7 @@ def wedge(
147
147
  tilt_step: float = 0,
148
148
  opening_axis: int = 0,
149
149
  tilt_axis: int = 1,
150
- gaussian_sigma: float = 0,
151
150
  omit_negative_frequencies: bool = True,
152
- extrude_plane: bool = True,
153
151
  infinite_plane: bool = True,
154
152
  ) -> NDArray:
155
153
  template_ft = np.fft.rfftn(template)
@@ -161,9 +159,7 @@ def wedge(
161
159
  tilt_axis=tilt_axis,
162
160
  opening_axis=opening_axis,
163
161
  shape=template.shape,
164
- sigma=gaussian_sigma,
165
162
  omit_negative_frequencies=omit_negative_frequencies,
166
- extrude_plane=extrude_plane,
167
163
  infinite_plane=infinite_plane,
168
164
  )
169
165
  np.multiply(template_ft, wedge_mask, out=template_ft)
@@ -177,7 +173,6 @@ def wedge(
177
173
  tilt_step=tilt_step,
178
174
  opening_axis=opening_axis,
179
175
  shape=template.shape,
180
- sigma=gaussian_sigma,
181
176
  omit_negative_frequencies=omit_negative_frequencies,
182
177
  )
183
178
  np.multiply(template_ft, wedge_mask, out=template_ft)
@@ -483,10 +478,9 @@ def wedge_mask(
483
478
  tilt_step: float = 0,
484
479
  opening_axis: int = 0,
485
480
  tilt_axis: int = 2,
486
- gaussian_sigma: float = 0,
487
481
  omit_negative_frequencies: bool = False,
488
- extrude_plane: bool = True,
489
- infinite_plane: bool = True,
482
+ infinite_plane: bool = False,
483
+ weight_angle: bool = False,
490
484
  **kwargs,
491
485
  ) -> NDArray:
492
486
  if tilt_step <= 0:
@@ -496,22 +490,23 @@ def wedge_mask(
496
490
  tilt_axis=tilt_axis,
497
491
  opening_axis=opening_axis,
498
492
  shape=template.shape,
499
- sigma=gaussian_sigma,
500
493
  omit_negative_frequencies=omit_negative_frequencies,
501
- extrude_plane=extrude_plane,
502
494
  infinite_plane=infinite_plane,
503
495
  )
504
496
  wedge_mask = np.fft.fftshift(wedge_mask)
505
497
  return wedge_mask
506
498
 
499
+ weights = None
500
+ tilt_angles = np.arange(-tilt_start, tilt_stop + tilt_step, tilt_step)
501
+ if weight_angle:
502
+ weights = np.cos(np.radians(tilt_angles))
503
+
507
504
  wedge_mask = preprocessor.step_wedge_mask(
508
- start_tilt=tilt_start,
509
- stop_tilt=tilt_stop,
505
+ tilt_angles=tilt_angles,
510
506
  tilt_axis=tilt_axis,
511
- tilt_step=tilt_step,
512
507
  opening_axis=opening_axis,
513
508
  shape=template.shape,
514
- sigma=gaussian_sigma,
509
+ weights=weights,
515
510
  omit_negative_frequencies=omit_negative_frequencies,
516
511
  )
517
512
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytme
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Python Template Matching Engine
5
5
  Author: Valentin Maurer
6
6
  Author-email: Valentin Maurer <valentin.maurer@embl-hamburg.de>
@@ -0,0 +1,119 @@
1
+ pytme-0.2.4.data/scripts/estimate_ram_usage.py,sha256=R1NDpFajcF-MonJ4a43SfDlA-nxBYwK7D2quzCdsVFM,2767
2
+ pytme-0.2.4.data/scripts/match_template.py,sha256=fDxH0yYudh4bWimmum1hCtjasG1EVJp6mKZ8a6zDt0Q,39852
3
+ pytme-0.2.4.data/scripts/postprocess.py,sha256=50PwDfOWe2Fdws4J5K-k2SgM55fARlAWCnIsv-l0i-4,24414
4
+ pytme-0.2.4.data/scripts/preprocess.py,sha256=A2nQlNr2fvrZ6C89jGsscgWk85KuDQIPKloQGBhExeE,4380
5
+ pytme-0.2.4.data/scripts/preprocessor_gui.py,sha256=AHgL8j7nVCH3srsyGYWU7i3mCxeu00H-mR2qObR90GA,39071
6
+ scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ scripts/estimate_ram_usage.py,sha256=rN7haobnHg3YcgGJIp81FNiCzy8-saJGeEurQlmQmNQ,2768
8
+ scripts/eval.py,sha256=ebJVLxbRlB6TI5YHNr0VavZ4lmaRdf8QVafyiDhh_oU,2528
9
+ scripts/extract_candidates.py,sha256=DAfNyuauogWvSdRWIbtH44tsk9buLn13JrL1zJjJGLE,8373
10
+ scripts/match_template.py,sha256=XYvrubQ8GOetpxnwT1z3Or3xW8h6YrykofA2-w5vLvI,39853
11
+ scripts/match_template_filters.py,sha256=Gj4a1b_S5NWp_dfFEPFn0D7jGf-qYgBbnTvZZ4bwqOQ,42036
12
+ scripts/postprocess.py,sha256=FdA4AZgsbz8enYT6q46akWX4O5Hdxrun4PUdomYhrPA,24415
13
+ scripts/preprocess.py,sha256=mUeGcVKtVhaqdfKNb_wrahsrD2p4LMlAko2mgljiDKU,4381
14
+ scripts/preprocessor_gui.py,sha256=jV3s2rUWl_8qCt669UsBeNqk_ulnAKWjnANesT7vEFQ,39072
15
+ scripts/refine_matches.py,sha256=Y17Ku_t0W9vglPNF2oU5EFrqoedJIm3lCGl-hXRHvjc,21920
16
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ tests/test_analyzer.py,sha256=wXFuCqV-yOIQUWeffSElTWUoSqpPAjI5AfKBbDfoTo8,11075
18
+ tests/test_backends.py,sha256=Ap4y2xtVk6-ZC0l6lX6F2pfdh0-HxMqe1Nt4fIVNGJg,14941
19
+ tests/test_density.py,sha256=mdzQgdlcIHBgkY_RyQn5FIuYALlmVPbw_zUYV7Cn0Zk,19138
20
+ tests/test_extensions.py,sha256=1Zv9dG_dmmC2mlbX91YIPyGLSToPC0202-ffLAfVcr4,5203
21
+ tests/test_matching_cli.py,sha256=9qLrUM3nuIkY_LaKuzxtTjOqtgC9jUCMZXTWhUxYBGw,9349
22
+ tests/test_matching_data.py,sha256=TyvnSJPzdLPiXYWdz9coQ-m4H1tUS_cbD0WaBdvrevg,6062
23
+ tests/test_matching_exhaustive.py,sha256=-Xm8jro1YJ3uPcPUCNazWX9Y7CxsTwPeKoy2Vr8TVH8,5531
24
+ tests/test_matching_memory.py,sha256=jypztjDwTxvixHKteZzcvTzEVyOyJzVNK5JxlzInLcE,1145
25
+ tests/test_matching_optimization.py,sha256=nG2R03eWGsZmdLPI0O0yBVKeD2k0C65OMJ7YKV5HLsc,9823
26
+ tests/test_matching_utils.py,sha256=jdQc8L5RhFFo5T_EeiIrDs6z8G43yAI-iBe5FKr5KZc,11401
27
+ tests/test_orientations.py,sha256=4ngFOUskcsumaaVCYIxapjdjX0A7KUM6VGkjLV-y9_Y,6776
28
+ tests/test_packaging.py,sha256=fZhTXqa_1ONSZSVW581QRZaFPw13l0Wpc-p8AgQ4b3E,2783
29
+ tests/test_parser.py,sha256=57oaksWrKNB4Z_22IxfW0nXMyQWLJFVsuvnJQPhMn10,993
30
+ tests/test_structure.py,sha256=3vGD18GaUX4Zse1I_OAmUf6QzVILhkDmVtj0wxUcf_o,8721
31
+ tests/data/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
32
+ tests/data/README.md,sha256=RMyG_mojKLo6AEIHUj40nTPI7ZGcs_6dRzWSRGxTgGY,83
33
+ tests/data/Blurring/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
34
+ tests/data/Blurring/blob_width18.npy,sha256=_BVu5T2q_8N5lA2KCMUTLwknec8fHXh9Nsyoa4ov0wo,21408
35
+ tests/data/Blurring/edgegaussian_sigma3.npy,sha256=OvxXAyJs5V_m7b91BFhBqS9BnisKWbckVcMlHuChQiY,21408
36
+ tests/data/Blurring/gaussian_sigma2.npy,sha256=OS9sNpu0Y7l--X8dyB-mp-EE5eaNHISqiNkOOutllfc,21408
37
+ tests/data/Blurring/hamming_width6.npy,sha256=yKdrOYGfHn-ER7GpTzASqfLZHkAR7AFeBcNRXrs4aIg,21408
38
+ tests/data/Blurring/kaiserb_width18.npy,sha256=08grtR1E2dWRfksiPrEdN0nQwugd6o-TV5lKwnuLXQg,21408
39
+ tests/data/Blurring/localgaussian_sigma0510.npy,sha256=KXASnlhxAnvvcgIDCniIHkak-NhsF_QmSV7j-p9kSk4,21408
40
+ tests/data/Blurring/mean_size5.npy,sha256=2APwsCR_1fpwGIc_mG0dPegpcbgXhUbcEEeQo9Wa1iA,42688
41
+ tests/data/Blurring/ntree_sigma0510.npy,sha256=HxYh_ItxdKulp8UiPMzQ0ze2iiQ3Oi7seWFvEzO1kWQ,21408
42
+ tests/data/Blurring/rank_rank3.npy,sha256=MxCsomoNPmiV0Cd-5nl2S8TYCfLyEj-WV19gLH_xe0c,21408
43
+ tests/data/Maps/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
44
+ tests/data/Maps/emd_8621.mrc.gz,sha256=ZAlSOQRT9B_e8xpeodio9j0WBzygl2R1ctg9m8QhCRA,4572566
45
+ tests/data/Raw/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
46
+ tests/data/Raw/em_map.map,sha256=YeY_R0p-90-oZgxfbKGIsyE5bui_uWq9iGhWl0bLYZI,22304
47
+ tests/data/Structures/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
48
+ tests/data/Structures/1pdj.cif,sha256=QdO4e2ulO621PVoK3q9n0qDPDKnzJpV6sPeG6zQec1A,169343
49
+ tests/data/Structures/1pdj.pdb,sha256=nTFGjecultoXNVUBDdsyho0CEzX5i1fSo_aBYDh5-pU,115749
50
+ tests/data/Structures/5khe.cif,sha256=SnC0so37wyuoYwAX5UDTTLvQiknZXxeJrvkGai-11rw,214644
51
+ tests/data/Structures/5khe.ent,sha256=AjXInxR_DgglZATzSNgB1rs7-LgAn2G1NdgnHb6fAmM,179010
52
+ tests/data/Structures/5khe.pdb,sha256=AjXInxR_DgglZATzSNgB1rs7-LgAn2G1NdgnHb6fAmM,179010
53
+ tests/data/Structures/5uz4.cif,sha256=KIcBaOf-RvOV4VRl1AU_EK4BsMxGXS8s8_UdlIhyeWk,6079401
54
+ tests/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ tests/preprocessing/test_compose.py,sha256=mk4c4TephOnxSMpiE6iug_uu8fn-xDDe58swdrgq8Os,2496
56
+ tests/preprocessing/test_frequency_filters.py,sha256=zXBRBvuFjiKWiT8yTXWYfYF3kKGTkokpro7nzXWghFA,6640
57
+ tests/preprocessing/test_preprocessor.py,sha256=XyR4xc4YM76PUKuTIiive76Q85DdcyDAvbXNGcoKL8w,4820
58
+ tests/preprocessing/test_utils.py,sha256=M6rmFl7a3JaBdONvPHhkbkzoDjjOAwrztPTHXqsbN6o,3037
59
+ tme/__init__.py,sha256=R0cxXFmTvL3p7y6D0zX_rfjChbXNU_-tYI4FTWZ16Ns,177
60
+ tme/__version__.py,sha256=SBl2EPFW-ltPvQ7vbVWItyAsz3aKYIpjO7vcfr84GkU,22
61
+ tme/analyzer.py,sha256=kYxtzBCp02OJrlMME8Njh-9wIZAvsuhTHNAveNplssY,50466
62
+ tme/density.py,sha256=APQgpZ8ILUsGCZTQDfAgcR_d-tm0T5m_AsPWIPr5pcg,84357
63
+ tme/extensions.cpython-311-darwin.so,sha256=KM0UcTYdq0Gib8rC6yVt7KnXrVvPNcWS-cvuYW2aPso,392496
64
+ tme/matching_data.py,sha256=UJnDk5CTDyoytD1CamUSmQR82WvtUUoFqUEadTHTIQ8,25394
65
+ tme/matching_exhaustive.py,sha256=g6znkqHcrgPMvKw2wYaHT_N9B_pR6bj1xbtTByJ-QW0,19593
66
+ tme/matching_optimization.py,sha256=Y8HfecXiOvAHXM1viBaQ_aXljqqTnGwlOlFe0MJpDRQ,45082
67
+ tme/matching_scores.py,sha256=CECxl2Lh0TMLfZYnoCJXy3euGf8i9J0eHsAD7sqvWGU,30962
68
+ tme/matching_utils.py,sha256=C4x4lxJq0_e1R-c0-JkGYM2MoqECAgJY5D1w4qaac5k,40046
69
+ tme/memory.py,sha256=6xeIMAncQkgYDi6w-PIYgFEWRTUPu0_OTCeRO0p9r9Q,11029
70
+ tme/orientations.py,sha256=KsYXJuLRLYXRHsDjP9_Tn1jXxIVPSaYkw1wRrWH3nUQ,26027
71
+ tme/parser.py,sha256=fNiCAdsWI4ql92F1Ob4suiVzpjUOBlh2lad1iNY_FP8,13772
72
+ tme/preprocessor.py,sha256=8UgPuNb0GwZ7JQoBZQisgp0r-wFKwvo0Jxb0u9kb2fg,40412
73
+ tme/structure.py,sha256=9cG9I4muinstujpj79ZJgVQEABly8OEt9Uha26FXJLM,65800
74
+ tme/types.py,sha256=NAY7C4qxE6yz-DXVtClMvFfoOV-spWGLNfpLATZ1LcU,442
75
+ tme/backends/__init__.py,sha256=4S68W2WJNZ9t33QSrRs6aL3OIyEVFo_zVsqXjS1iWYA,5185
76
+ tme/backends/_jax_utils.py,sha256=YuNJHCYnSqOESMV-9LPr-ZxBg6Zvax2euBjsZM-j-64,5906
77
+ tme/backends/cupy_backend.py,sha256=1nnCJ4nT7tJsXu1mrJGCy7x0Yg1wWVRg4SdzsQ2qiiw,9284
78
+ tme/backends/jax_backend.py,sha256=femPIcppQVPKMyVIowgoOFFWOArvAX16aLvGho8qBNQ,10414
79
+ tme/backends/matching_backend.py,sha256=KfCOKD_rA9el3Y7BeH17KJ1apCUIIhhvn-vmbkb3CB0,33750
80
+ tme/backends/mlx_backend.py,sha256=FJhqmCzgjXAjWGX1HhHFrCy_We4YwQQBkKFNG05ctzM,7788
81
+ tme/backends/npfftw_backend.py,sha256=JDTc_1QcVi9jU3yLQF7jkgwQz_Po60OhkKuV2V3g5v8,16997
82
+ tme/backends/pytorch_backend.py,sha256=61cAu8HBtGPDL8vSJx49f6yBxkLoWiX0X49Dy2tHAuk,15038
83
+ tme/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
+ tme/data/c48n309.npy,sha256=NwH64mOEbm3tStq5c98o81fY1vMOoq4nvXDAh7Z7iZg,296768
85
+ tme/data/c48n527.npy,sha256=saSUMTa1R0MisPvgFL02a7IHQSwEZ-mJu0v3qJjg5AU,506048
86
+ tme/data/c48n9.npy,sha256=bDVLV6mWjZHSQfeDc-MOCKKarfc1jaNeVvpoe2xMUy4,8768
87
+ tme/data/c48u1.npy,sha256=JeXMFzFITs2ezdc3x5lp3jo1cHHHHVADSA1Tpf77kXs,1088
88
+ tme/data/c48u1153.npy,sha256=ECiEximtYDWtIux3Fwe_EJlyn08gUqP85DN9gjkT9_k,1107008
89
+ tme/data/c48u1201.npy,sha256=aceC_Jeienz_81X4520nPpZcg5tnRhbW795EqbpWkrg,1153088
90
+ tme/data/c48u1641.npy,sha256=p4LwW3LzdTjrUUpA7H53RfNWxYfPX0XjeSwZ39Ac78Q,1575488
91
+ tme/data/c48u181.npy,sha256=mLYXrv1YHLH6DsBp5MkxHkxlxgMnj1mw_KKI0udH-FY,173888
92
+ tme/data/c48u2219.npy,sha256=p8TQeX8YHu4pdxnwJjEAlQWAPa66W7kpK96iZKZr9JE,2130368
93
+ tme/data/c48u27.npy,sha256=k03ZNEsoPwBKCy8IeIa5G0WRZqjGZMtX6Ibu7EpJHvU,26048
94
+ tme/data/c48u2947.npy,sha256=icI97ED6ct66y7FIaJAugmjzrIWk7CINCxtO3wDTnrU,2829248
95
+ tme/data/c48u3733.npy,sha256=tla-__Pf-hpN6h04vtFIfkkFdCLple11VO06kr1dXkM,3583808
96
+ tme/data/c48u4749.npy,sha256=tItOA4oV7SiqCCREwz3fyEpZoxM0lCq_jfEo5_-fp2s,4559168
97
+ tme/data/c48u5879.npy,sha256=bFk89MllIFCX_sLXTYWFquSyN1NuahH4wwnEsPJLxzA,5643968
98
+ tme/data/c48u7111.npy,sha256=CMy9kI2edH-q9eTIVdgUtXurplYNI7Uqp4dXfkkVdf8,6826688
99
+ tme/data/c48u815.npy,sha256=bCuJxLtm0Sjg3GGxtyjGzRYZ1G0Gz79XHI-71GvqQnI,782528
100
+ tme/data/c48u83.npy,sha256=7ODJYnsiuDjGbgd9GFopsyIW2IjrYI0J2X2f-cK868U,79808
101
+ tme/data/c48u8649.npy,sha256=-IPlpR4zrPQZWhhSPu4zEulFdrCEVgTMFffCB5d-huE,8303168
102
+ tme/data/c600v.npy,sha256=JqSu3ALoL1A9iguehc0YGUMFPsh2fprHHp76VXeFXIw,2528
103
+ tme/data/c600vc.npy,sha256=Yht-GFXDSjjGvsjFBvyxxEZAI-ODADPd5gEgFNZQVTA,14528
104
+ tme/data/metadata.yaml,sha256=fAgX-mEzB0QMHTEtYDG4cSMbJhYxBbDJH3sdvJvL7a8,750
105
+ tme/data/quat_to_numpy.py,sha256=-gkDZb10fKBxwfYrSLCUWvMB76TzZWELCeKsYProwws,1333
106
+ tme/data/scattering_factors.pickle,sha256=ZHktBc_AlS4H6uoER8AMmn5zOgjBwzgC92hUyww3Nik,38669
107
+ tme/external/bindings.cpp,sha256=CIukugVf55LicY2uSCasHWQlrlO9GS2iUuCR3WLvncM,12912
108
+ tme/preprocessing/__init__.py,sha256=7O3vDzJcIfxovJkf7avWSPtzaIVlTbmsW7egQFukC_s,98
109
+ tme/preprocessing/_utils.py,sha256=1K8xPquM0v1MASwsMpIc3ZWxxpUFt69LezVZY5QcJnY,6179
110
+ tme/preprocessing/composable_filter.py,sha256=zmXN_NcuvvtstFdU6yYQ09z-XJFE4Y-kkMCL4vHy-jc,778
111
+ tme/preprocessing/compose.py,sha256=NFB6oUQOwn8foy82i3Lm5DeZUd_5dmcKdhuwX8E6wpo,1454
112
+ tme/preprocessing/frequency_filters.py,sha256=XPG6zRF_VSPH4CWFj1BLICm3_jNrzmiHaln0JZR7CrU,12755
113
+ tme/preprocessing/tilt_series.py,sha256=6OptAfqISxzZOtHIx5MdSaJf7VGFeDntz2jWekpZMus,37307
114
+ pytme-0.2.4.dist-info/LICENSE,sha256=K1IUNSVAz8BXbpH5EA8y5FpaHdvFXnAF2zeK95Lr2bY,18467
115
+ pytme-0.2.4.dist-info/METADATA,sha256=fq2oJEwpG-N_8XYERPQwaBD-IbXySwuJ75BG8NP0WtQ,5278
116
+ pytme-0.2.4.dist-info/WHEEL,sha256=uY16WuvBs6SVLr1w0jr9fTUdSkt0n_9cWxlDSGwcm3o,109
117
+ pytme-0.2.4.dist-info/entry_points.txt,sha256=ff3LQL3FCWfCYOwFiP9zatm7laUbnwCkuPELkQVyUO4,241
118
+ pytme-0.2.4.dist-info/top_level.txt,sha256=ovCUR7UXXouH3zYt_fJLoqr_vtjp1wudFgjVAnztQLE,18
119
+ pytme-0.2.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (73.0.1)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-macosx_14_0_arm64
5
5
 
@@ -1,2 +1,3 @@
1
1
  scripts
2
+ tests
2
3
  tme
scripts/match_template.py CHANGED
@@ -186,8 +186,10 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
186
186
  ReconstructFromTilt,
187
187
  )
188
188
 
189
+ needs_reconstruction = False
189
190
  template_filter, target_filter = [], []
190
191
  if args.tilt_angles is not None:
192
+ needs_reconstruction = args.tilt_weighting is not None
191
193
  try:
192
194
  wedge = Wedge.from_file(args.tilt_angles)
193
195
  wedge.weight_type = args.tilt_weighting
@@ -232,11 +234,12 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
232
234
  angles=tilt_angles,
233
235
  weight_wedge=args.tilt_weighting == "angle",
234
236
  create_continuous_wedge=create_continuous_wedge,
237
+ reconstruction_filter=args.reconstruction_filter,
235
238
  )
236
239
  wedge_target = WedgeReconstructed(
237
- angles=tilt_angles,
240
+ angles=(np.abs(np.min(tilt_angles)), np.abs(np.max(tilt_angles))),
238
241
  weight_wedge=False,
239
- create_continuous_wedge=create_continuous_wedge,
242
+ create_continuous_wedge=True,
240
243
  )
241
244
  target_filter.append(wedge_target)
242
245
 
@@ -323,18 +326,13 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
323
326
  sampling_rate=template.sampling_rate,
324
327
  )
325
328
  template_filter.append(bandpass)
326
-
327
- if not args.no_filter_target:
328
- target_filter.append(bandpass)
329
+ target_filter.append(bandpass)
329
330
 
330
331
  if args.whiten_spectrum:
331
332
  whitening_filter = LinearWhiteningFilter()
332
333
  template_filter.append(whitening_filter)
333
334
  target_filter.append(whitening_filter)
334
335
 
335
- needs_reconstruction = any(
336
- [isinstance(t, ReconstructFromTilt) for t in template_filter]
337
- )
338
336
  if needs_reconstruction and args.reconstruction_filter is None:
339
337
  warnings.warn(
340
338
  "Consider using a --reconstruction_filter such as 'ramp' to avoid artifacts."
@@ -342,6 +340,8 @@ def setup_filter(args, template: Density, target: Density) -> Tuple[Compose, Com
342
340
 
343
341
  template_filter = Compose(template_filter) if len(template_filter) else None
344
342
  target_filter = Compose(target_filter) if len(target_filter) else None
343
+ if args.no_filter_target:
344
+ target_filter = None
345
345
 
346
346
  return template_filter, target_filter
347
347
 
scripts/preprocess.py CHANGED
@@ -79,6 +79,14 @@ def parse_args():
79
79
  action="store_true",
80
80
  help="Assumes the template is already centered and omits centering.",
81
81
  )
82
+ modulation_group.add_argument(
83
+ "--backend",
84
+ dest="backend",
85
+ type=str,
86
+ default=None,
87
+ choices=be.available_backends(),
88
+ help="Determines more suitable box size for the given compute backend.",
89
+ )
82
90
  args = parser.parse_args()
83
91
  return args
84
92
 
@@ -95,11 +103,18 @@ def main():
95
103
  if not args.no_centering:
96
104
  data, _ = data.centered(0)
97
105
 
98
- recommended_box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
99
- if recommended_box != args.box_size:
100
- warnings.warn(
101
- f"Consider using --box_size {recommended_box} instead of {args.box_size}."
102
- )
106
+ for name in be.available_backends():
107
+ be.change_backend(name, device="cpu")
108
+ box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
109
+ if box != args.box_size and args.backend is None:
110
+ print(f"Consider --box_size {box} instead of {args.box_size} for {name}.")
111
+
112
+ if args.backend is not None:
113
+ be.change_backend(name, device="cpu")
114
+ box = be.compute_convolution_shapes([args.box_size], [1])[1][0]
115
+ if box != args.box_size:
116
+ print(f"Changed --box_size from {args.box_size} to {box}.")
117
+ args.box_size = box
103
118
 
104
119
  data.pad(
105
120
  np.multiply(args.box_size, np.divide(args.sampling_rate, data.sampling_rate)),
@@ -128,5 +143,6 @@ def main():
128
143
 
129
144
  data.to_file(args.output)
130
145
 
146
+
131
147
  if __name__ == "__main__":
132
- main()
148
+ main()
@@ -147,9 +147,7 @@ def wedge(
147
147
  tilt_step: float = 0,
148
148
  opening_axis: int = 0,
149
149
  tilt_axis: int = 1,
150
- gaussian_sigma: float = 0,
151
150
  omit_negative_frequencies: bool = True,
152
- extrude_plane: bool = True,
153
151
  infinite_plane: bool = True,
154
152
  ) -> NDArray:
155
153
  template_ft = np.fft.rfftn(template)
@@ -161,9 +159,7 @@ def wedge(
161
159
  tilt_axis=tilt_axis,
162
160
  opening_axis=opening_axis,
163
161
  shape=template.shape,
164
- sigma=gaussian_sigma,
165
162
  omit_negative_frequencies=omit_negative_frequencies,
166
- extrude_plane=extrude_plane,
167
163
  infinite_plane=infinite_plane,
168
164
  )
169
165
  np.multiply(template_ft, wedge_mask, out=template_ft)
@@ -177,7 +173,6 @@ def wedge(
177
173
  tilt_step=tilt_step,
178
174
  opening_axis=opening_axis,
179
175
  shape=template.shape,
180
- sigma=gaussian_sigma,
181
176
  omit_negative_frequencies=omit_negative_frequencies,
182
177
  )
183
178
  np.multiply(template_ft, wedge_mask, out=template_ft)
@@ -483,10 +478,9 @@ def wedge_mask(
483
478
  tilt_step: float = 0,
484
479
  opening_axis: int = 0,
485
480
  tilt_axis: int = 2,
486
- gaussian_sigma: float = 0,
487
481
  omit_negative_frequencies: bool = False,
488
- extrude_plane: bool = True,
489
- infinite_plane: bool = True,
482
+ infinite_plane: bool = False,
483
+ weight_angle: bool = False,
490
484
  **kwargs,
491
485
  ) -> NDArray:
492
486
  if tilt_step <= 0:
@@ -496,22 +490,23 @@ def wedge_mask(
496
490
  tilt_axis=tilt_axis,
497
491
  opening_axis=opening_axis,
498
492
  shape=template.shape,
499
- sigma=gaussian_sigma,
500
493
  omit_negative_frequencies=omit_negative_frequencies,
501
- extrude_plane=extrude_plane,
502
494
  infinite_plane=infinite_plane,
503
495
  )
504
496
  wedge_mask = np.fft.fftshift(wedge_mask)
505
497
  return wedge_mask
506
498
 
499
+ weights = None
500
+ tilt_angles = np.arange(-tilt_start, tilt_stop + tilt_step, tilt_step)
501
+ if weight_angle:
502
+ weights = np.cos(np.radians(tilt_angles))
503
+
507
504
  wedge_mask = preprocessor.step_wedge_mask(
508
- start_tilt=tilt_start,
509
- stop_tilt=tilt_stop,
505
+ tilt_angles=tilt_angles,
510
506
  tilt_axis=tilt_axis,
511
- tilt_step=tilt_step,
512
507
  opening_axis=opening_axis,
513
508
  shape=template.shape,
514
- sigma=gaussian_sigma,
509
+ weights=weights,
515
510
  omit_negative_frequencies=omit_negative_frequencies,
516
511
  )
517
512
 
tests/__init__.py ADDED
File without changes
tests/data/.DS_Store ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
tests/data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ Test data was derived from EMD-8249
2
+ https://www.ebi.ac.uk/pdbe/entry/emdb/EMD-8249
Binary file
Binary file
Binary file