pytme 0.2.0b0__cp311-cp311-macosx_14_0_arm64.whl → 0.2.1__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 (42) hide show
  1. {pytme-0.2.0b0.data → pytme-0.2.1.data}/scripts/match_template.py +473 -140
  2. {pytme-0.2.0b0.data → pytme-0.2.1.data}/scripts/postprocess.py +107 -49
  3. {pytme-0.2.0b0.data → pytme-0.2.1.data}/scripts/preprocessor_gui.py +4 -1
  4. {pytme-0.2.0b0.dist-info → pytme-0.2.1.dist-info}/METADATA +2 -2
  5. pytme-0.2.1.dist-info/RECORD +73 -0
  6. scripts/extract_candidates.py +117 -85
  7. scripts/match_template.py +473 -140
  8. scripts/match_template_filters.py +458 -169
  9. scripts/postprocess.py +107 -49
  10. scripts/preprocessor_gui.py +4 -1
  11. scripts/refine_matches.py +364 -160
  12. tme/__version__.py +1 -1
  13. tme/analyzer.py +278 -148
  14. tme/backends/__init__.py +1 -0
  15. tme/backends/cupy_backend.py +20 -13
  16. tme/backends/jax_backend.py +218 -0
  17. tme/backends/matching_backend.py +25 -10
  18. tme/backends/mlx_backend.py +13 -9
  19. tme/backends/npfftw_backend.py +22 -12
  20. tme/backends/pytorch_backend.py +20 -9
  21. tme/density.py +85 -64
  22. tme/extensions.cpython-311-darwin.so +0 -0
  23. tme/matching_data.py +86 -60
  24. tme/matching_exhaustive.py +245 -166
  25. tme/matching_optimization.py +137 -69
  26. tme/matching_utils.py +1 -1
  27. tme/orientations.py +175 -55
  28. tme/preprocessing/__init__.py +2 -0
  29. tme/preprocessing/_utils.py +188 -0
  30. tme/preprocessing/composable_filter.py +31 -0
  31. tme/preprocessing/compose.py +51 -0
  32. tme/preprocessing/frequency_filters.py +378 -0
  33. tme/preprocessing/tilt_series.py +1017 -0
  34. tme/preprocessor.py +17 -7
  35. tme/structure.py +4 -1
  36. pytme-0.2.0b0.dist-info/RECORD +0 -66
  37. {pytme-0.2.0b0.data → pytme-0.2.1.data}/scripts/estimate_ram_usage.py +0 -0
  38. {pytme-0.2.0b0.data → pytme-0.2.1.data}/scripts/preprocess.py +0 -0
  39. {pytme-0.2.0b0.dist-info → pytme-0.2.1.dist-info}/LICENSE +0 -0
  40. {pytme-0.2.0b0.dist-info → pytme-0.2.1.dist-info}/WHEEL +0 -0
  41. {pytme-0.2.0b0.dist-info → pytme-0.2.1.dist-info}/entry_points.txt +0 -0
  42. {pytme-0.2.0b0.dist-info → pytme-0.2.1.dist-info}/top_level.txt +0 -0
tme/preprocessor.py CHANGED
@@ -47,7 +47,7 @@ class Preprocessor:
47
47
 
48
48
  def apply_method(self, method: str, parameters: Dict):
49
49
  """
50
- Apply a method on the atomic structure.
50
+ Invoke ``Preprocessor.method`` using ``parameters``.
51
51
 
52
52
  Parameters
53
53
  ----------
@@ -1135,6 +1135,7 @@ class Preprocessor:
1135
1135
  opening_axis: int = 0,
1136
1136
  tilt_axis: int = 2,
1137
1137
  sigma: float = 0,
1138
+ weights: float = 1,
1138
1139
  omit_negative_frequencies: bool = True,
1139
1140
  ) -> NDArray:
1140
1141
  """
@@ -1165,6 +1166,8 @@ class Preprocessor:
1165
1166
  - 2 for X-axis
1166
1167
  sigma : float, optional
1167
1168
  Standard deviation for Gaussian kernel used for smoothing the wedge.
1169
+ weights : float, tuple of float
1170
+ Weight of each element in the wedge. Defaults to one.
1168
1171
  omit_negative_frequencies : bool, optional
1169
1172
  Whether the wedge mask should omit negative frequencies, i.e. be
1170
1173
  applicable to symmetric Fourier transforms (see :obj:`numpy.fft.fftn`)
@@ -1188,16 +1191,20 @@ class Preprocessor:
1188
1191
  if tilt_angles is None:
1189
1192
  tilt_angles = np.arange(-start_tilt, stop_tilt + tilt_step, tilt_step)
1190
1193
 
1194
+ shape = tuple(int(x) for x in shape)
1195
+ opening_axis, tilt_axis = int(opening_axis), int(tilt_axis)
1196
+
1197
+ weights = np.asarray(weights)
1198
+ weights = np.repeat(weights, tilt_angles.size // weights.size)
1191
1199
  plane = np.zeros((shape[opening_axis], shape[tilt_axis]), dtype=np.float32)
1192
1200
  subset = tuple(
1193
1201
  slice(None) if i != 0 else slice(x // 2, x // 2 + 1)
1194
1202
  for i, x in enumerate(plane.shape)
1195
1203
  )
1196
- plane[subset] = 1
1197
1204
  plane_rotated, wedge_volume = np.zeros_like(plane), np.zeros_like(plane)
1198
1205
  for index in range(tilt_angles.shape[0]):
1199
1206
  plane_rotated.fill(0)
1200
-
1207
+ plane[subset] = weights[index]
1201
1208
  rotation_matrix = euler_to_rotationmatrix((tilt_angles[index], 0))
1202
1209
  rotation_matrix = rotation_matrix[np.ix_((0, 1), (0, 1))]
1203
1210
 
@@ -1210,10 +1217,13 @@ class Preprocessor:
1210
1217
  )
1211
1218
  wedge_volume += plane_rotated
1212
1219
 
1213
- wedge_volume = self.gaussian_filter(
1214
- template=wedge_volume, sigma=sigma, fourier=False
1215
- )
1216
- wedge_volume = np.where(wedge_volume > np.exp(-2), 1, 0)
1220
+ # Ramp filtering would be more accurate
1221
+ np.fmin(wedge_volume, np.max(weights), wedge_volume)
1222
+
1223
+ if sigma > 0:
1224
+ wedge_volume = self.gaussian_filter(
1225
+ template=wedge_volume, sigma=sigma, fourier=False
1226
+ )
1217
1227
 
1218
1228
  if opening_axis > tilt_axis:
1219
1229
  wedge_volume = np.moveaxis(wedge_volume, 1, 0)
tme/structure.py CHANGED
@@ -480,7 +480,6 @@ class Structure:
480
480
  filename : str
481
481
  The filename of the file to write.
482
482
  """
483
- data_out = []
484
483
  if np.any(np.vectorize(len)(self.chain_identifier) > 2):
485
484
  warnings.warn("Chain identifiers longer than one will be shortened.")
486
485
 
@@ -612,6 +611,9 @@ class Structure:
612
611
 
613
612
  ret = ""
614
613
  for category, subdict in output_data.items():
614
+ if not len(subdict):
615
+ continue
616
+
615
617
  ret += "#\n"
616
618
  is_loop = isinstance(subdict[list(subdict.keys())[0]], list)
617
619
  if not is_loop:
@@ -776,6 +778,7 @@ class Structure:
776
778
 
777
779
  origin : Tuple[float,]
778
780
  The origin of the coordinate system.
781
+
779
782
  Returns
780
783
  -------
781
784
  Tuple[NDArray, List[str], Tuple[int, ], float, Tuple[float,]]
@@ -1,66 +0,0 @@
1
- pytme-0.2.0b0.data/scripts/estimate_ram_usage.py,sha256=R1NDpFajcF-MonJ4a43SfDlA-nxBYwK7D2quzCdsVFM,2767
2
- pytme-0.2.0b0.data/scripts/match_template.py,sha256=gViezEvCrx1vagvFEUu3mb34XD5_GQs9DwaNb8mbJH4,26663
3
- pytme-0.2.0b0.data/scripts/postprocess.py,sha256=mgSkDoW9NNQiYYq8jkJxHRlHUkOkpkwCzxeqwQTZPps,21011
4
- pytme-0.2.0b0.data/scripts/preprocess.py,sha256=zog-l2Je-GeouJ6SnamOMuHgTn7fFPiGnO5X03y5qSY,2527
5
- pytme-0.2.0b0.data/scripts/preprocessor_gui.py,sha256=dX8y9FjCqwYIgZZ4G3xaFqIGB6FqY0ohiY9VodMBXBI,35189
6
- scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- scripts/estimate_ram_usage.py,sha256=rN7haobnHg3YcgGJIp81FNiCzy8-saJGeEurQlmQmNQ,2768
8
- scripts/extract_candidates.py,sha256=L2IXg99hgW8jUBp06e6PEDO-Y5iUhoFuhe0i5B9gcOE,6871
9
- scripts/match_template.py,sha256=2p1-gF33N7JnLeE4QVFmQFVHG9HjliaDLyoFTYULjVM,26664
10
- scripts/match_template_filters.py,sha256=3wUhXq67yW2waiAm-K7ILRQaPUd15K8q9-0aP_OOOjA,28989
11
- scripts/postprocess.py,sha256=rqsBmbJWX_yG6fUDcwXMjlHorqgetgYcmgzm4yEsj9U,21012
12
- scripts/preprocess.py,sha256=ebJVLxbRlB6TI5YHNr0VavZ4lmaRdf8QVafyiDhh_oU,2528
13
- scripts/preprocessor_gui.py,sha256=3K2PXCboUC2v9u6JyyNzPkAWn_TyMeWhFfshESUNvTk,35190
14
- scripts/refine_matches.py,sha256=zV7piR5tGhrbomYN1tjnFDOfPInU07APU8syciSUZz8,7077
15
- tme/__init__.py,sha256=MGVeRX1f5k6RwExBcffZtCM7igNNtpoIr2G2yJZ4OHI,251
16
- tme/__version__.py,sha256=jaXChwfIgwjM8CGVXQS3V5mfoUdkBU_6vPxsrLg-QJc,23
17
- tme/analyzer.py,sha256=qBasMmn4cnxWl3dEw-bkFQeyqtnLMuwgcmKuc0o2N5E,55632
18
- tme/density.py,sha256=Tu37m-47ZWWs3wsR7G3dQmP69BNKZd3xdgmhBllR1EI,87856
19
- tme/extensions.cpython-311-darwin.so,sha256=jUKGwYCpx9B6DAz3EDL5vPbfoxwQVM2KwQBizMDWkaA,412480
20
- tme/helpers.py,sha256=TMtBuJoZk6q4M_rfkr8yPpGzJD74ycqyN3yXMuU9mr4,23625
21
- tme/matching_constrained.py,sha256=NAJnZpusjQs5rKabHiNyrclXSPm27K0V8HVFjTQ2zB0,6725
22
- tme/matching_data.py,sha256=OUyTVaELYCIqLExuf6Kps95Co4ymCHB0MypsaJOpmMA,24135
23
- tme/matching_exhaustive.py,sha256=r45l45kMrjD3kTfKoZcVU3sl4C_1FOXfXGGWgUJu3_w,59531
24
- tme/matching_memory.py,sha256=bmCAUYyXWEet-1XXhldtc0irio2ytMSsAzWYyFI5LNM,11273
25
- tme/matching_optimization.py,sha256=oqZYk9hhquF9SmPiDZwSfxehirddxJUOIg3SbokgylI,41138
26
- tme/matching_utils.py,sha256=b9aLcj4m0BmmJo4P8nivpd3rgic_WkounqLS3AJkB8g,42504
27
- tme/orientations.py,sha256=sEGhwBIE19jeRsMr5OZ1VM5ccRBpN5uThx6xG9obbo0,19118
28
- tme/parser.py,sha256=tA9ABeV95cZn8lJCukVUaocQ9RguR6ZZzQsMXf_-ud0,13887
29
- tme/preprocessor.py,sha256=TFBmLA7ESfKF2cSbKB4PuDfjIxSyA6Hxccp1qpkDdQY,50760
30
- tme/structure.py,sha256=1Dlh6gFn1VhoIr7H9ZDgOfaPJbVVfKv_c8AA00X_lbQ,52465
31
- tme/types.py,sha256=2Tyh_xnMLxIWYb3aJDAUb6GWpaL6gcYMUm2YNbJlAPI,295
32
- tme/backends/__init__.py,sha256=xB2GBUFRskppvEs6S74VH0Pi-nXnIvu9_QFhESlcl3Y,4366
33
- tme/backends/cupy_backend.py,sha256=4x8vy3eIpHKmfjg5BtqB9J0-gP0fWcT85FY-rFRXgVU,13145
34
- tme/backends/matching_backend.py,sha256=E3cMXnMEazYJUr9RP5Q5rMEAf3vbkiOwzWrx5amt_nI,29311
35
- tme/backends/mlx_backend.py,sha256=MrwICZpUiAcpZXON70r4SH-KsWxfhq1PdHUe80WbT-k,8467
36
- tme/backends/npfftw_backend.py,sha256=ZYUkcmUE_NXwvddfKrCorVPETjxbg0-5UJfjAMf3yc4,27451
37
- tme/backends/pytorch_backend.py,sha256=0QrWX_MSE8ymhaniAzRBgMVL4h5QBJrbLbMbnnaWveE,18293
38
- tme/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- tme/data/c48n309.npy,sha256=NwH64mOEbm3tStq5c98o81fY1vMOoq4nvXDAh7Z7iZg,296768
40
- tme/data/c48n527.npy,sha256=saSUMTa1R0MisPvgFL02a7IHQSwEZ-mJu0v3qJjg5AU,506048
41
- tme/data/c48n9.npy,sha256=bDVLV6mWjZHSQfeDc-MOCKKarfc1jaNeVvpoe2xMUy4,8768
42
- tme/data/c48u1.npy,sha256=JeXMFzFITs2ezdc3x5lp3jo1cHHHHVADSA1Tpf77kXs,1088
43
- tme/data/c48u1153.npy,sha256=ECiEximtYDWtIux3Fwe_EJlyn08gUqP85DN9gjkT9_k,1107008
44
- tme/data/c48u1201.npy,sha256=aceC_Jeienz_81X4520nPpZcg5tnRhbW795EqbpWkrg,1153088
45
- tme/data/c48u1641.npy,sha256=p4LwW3LzdTjrUUpA7H53RfNWxYfPX0XjeSwZ39Ac78Q,1575488
46
- tme/data/c48u181.npy,sha256=mLYXrv1YHLH6DsBp5MkxHkxlxgMnj1mw_KKI0udH-FY,173888
47
- tme/data/c48u2219.npy,sha256=p8TQeX8YHu4pdxnwJjEAlQWAPa66W7kpK96iZKZr9JE,2130368
48
- tme/data/c48u27.npy,sha256=k03ZNEsoPwBKCy8IeIa5G0WRZqjGZMtX6Ibu7EpJHvU,26048
49
- tme/data/c48u2947.npy,sha256=icI97ED6ct66y7FIaJAugmjzrIWk7CINCxtO3wDTnrU,2829248
50
- tme/data/c48u3733.npy,sha256=tla-__Pf-hpN6h04vtFIfkkFdCLple11VO06kr1dXkM,3583808
51
- tme/data/c48u4749.npy,sha256=tItOA4oV7SiqCCREwz3fyEpZoxM0lCq_jfEo5_-fp2s,4559168
52
- tme/data/c48u5879.npy,sha256=bFk89MllIFCX_sLXTYWFquSyN1NuahH4wwnEsPJLxzA,5643968
53
- tme/data/c48u7111.npy,sha256=CMy9kI2edH-q9eTIVdgUtXurplYNI7Uqp4dXfkkVdf8,6826688
54
- tme/data/c48u815.npy,sha256=bCuJxLtm0Sjg3GGxtyjGzRYZ1G0Gz79XHI-71GvqQnI,782528
55
- tme/data/c48u83.npy,sha256=7ODJYnsiuDjGbgd9GFopsyIW2IjrYI0J2X2f-cK868U,79808
56
- tme/data/c48u8649.npy,sha256=-IPlpR4zrPQZWhhSPu4zEulFdrCEVgTMFffCB5d-huE,8303168
57
- tme/data/c600v.npy,sha256=JqSu3ALoL1A9iguehc0YGUMFPsh2fprHHp76VXeFXIw,2528
58
- tme/data/c600vc.npy,sha256=Yht-GFXDSjjGvsjFBvyxxEZAI-ODADPd5gEgFNZQVTA,14528
59
- tme/data/metadata.yaml,sha256=fAgX-mEzB0QMHTEtYDG4cSMbJhYxBbDJH3sdvJvL7a8,750
60
- tme/data/quat_to_numpy.py,sha256=-gkDZb10fKBxwfYrSLCUWvMB76TzZWELCeKsYProwws,1333
61
- pytme-0.2.0b0.dist-info/LICENSE,sha256=K1IUNSVAz8BXbpH5EA8y5FpaHdvFXnAF2zeK95Lr2bY,18467
62
- pytme-0.2.0b0.dist-info/METADATA,sha256=yopToQgTnAF3CbAIDIhWrm6EeVVtFiQoD0KopVoTEnQ,2172
63
- pytme-0.2.0b0.dist-info/WHEEL,sha256=BDgKu9_KNfDn85ptly0T56JpX4avXH07X_ZCqAJnQwY,110
64
- pytme-0.2.0b0.dist-info/entry_points.txt,sha256=ff3LQL3FCWfCYOwFiP9zatm7laUbnwCkuPELkQVyUO4,241
65
- pytme-0.2.0b0.dist-info/top_level.txt,sha256=J8FUkazOb2fZ0n_KexnqCGyNOtie2bwisFSUBiM5-0w,12
66
- pytme-0.2.0b0.dist-info/RECORD,,
File without changes