pytme 0.3b0.post1__cp311-cp311-macosx_15_0_arm64.whl → 0.3.1.post1__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.
- {pytme-0.3b0.post1.data → pytme-0.3.1.post1.data}/scripts/match_template.py +28 -39
- {pytme-0.3b0.post1.data → pytme-0.3.1.post1.data}/scripts/postprocess.py +35 -21
- {pytme-0.3b0.post1.data → pytme-0.3.1.post1.data}/scripts/preprocessor_gui.py +95 -24
- pytme-0.3.1.post1.data/scripts/pytme_runner.py +1223 -0
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/METADATA +5 -7
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/RECORD +55 -48
- scripts/extract_candidates.py +118 -99
- scripts/match_template.py +28 -39
- scripts/postprocess.py +35 -21
- scripts/preprocessor_gui.py +95 -24
- scripts/pytme_runner.py +644 -190
- scripts/refine_matches.py +156 -386
- tests/data/.DS_Store +0 -0
- tests/data/Blurring/.DS_Store +0 -0
- tests/data/Maps/.DS_Store +0 -0
- tests/data/Raw/.DS_Store +0 -0
- tests/data/Structures/.DS_Store +0 -0
- tests/preprocessing/test_utils.py +18 -0
- tests/test_analyzer.py +2 -3
- tests/test_backends.py +3 -9
- tests/test_density.py +0 -1
- tests/test_extensions.py +0 -1
- tests/test_matching_utils.py +10 -60
- tests/test_rotations.py +1 -1
- tme/__version__.py +1 -1
- tme/analyzer/_utils.py +4 -4
- tme/analyzer/aggregation.py +35 -15
- tme/analyzer/peaks.py +11 -10
- tme/backends/_jax_utils.py +26 -13
- tme/backends/_numpyfftw_utils.py +270 -0
- tme/backends/cupy_backend.py +16 -55
- tme/backends/jax_backend.py +76 -37
- tme/backends/matching_backend.py +17 -51
- tme/backends/mlx_backend.py +1 -27
- tme/backends/npfftw_backend.py +71 -65
- tme/backends/pytorch_backend.py +1 -26
- tme/density.py +2 -6
- tme/extensions.cpython-311-darwin.so +0 -0
- tme/filters/ctf.py +22 -21
- tme/filters/wedge.py +10 -7
- tme/mask.py +341 -0
- tme/matching_data.py +31 -19
- tme/matching_exhaustive.py +37 -47
- tme/matching_optimization.py +2 -1
- tme/matching_scores.py +229 -411
- tme/matching_utils.py +73 -422
- tme/memory.py +1 -1
- tme/orientations.py +13 -8
- tme/rotations.py +1 -1
- pytme-0.3b0.post1.data/scripts/pytme_runner.py +0 -769
- {pytme-0.3b0.post1.data → pytme-0.3.1.post1.data}/scripts/estimate_memory_usage.py +0 -0
- {pytme-0.3b0.post1.data → pytme-0.3.1.post1.data}/scripts/preprocess.py +0 -0
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/WHEEL +0 -0
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/entry_points.txt +0 -0
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/licenses/LICENSE +0 -0
- {pytme-0.3b0.post1.dist-info → pytme-0.3.1.post1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pytme
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.1.post1
|
4
4
|
Summary: Python Template Matching Engine
|
5
5
|
Author: Valentin Maurer
|
6
6
|
Author-email: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
@@ -25,10 +25,8 @@ Requires-Dist: h5py
|
|
25
25
|
Requires-Dist: importlib_resources
|
26
26
|
Requires-Dist: joblib
|
27
27
|
Provides-Extra: cupy
|
28
|
-
Requires-Dist: cupy-cuda12x
|
29
|
-
|
30
|
-
Requires-Dist: cupy-cuda12x>=13.0.0; extra == "cupy-voltools"
|
31
|
-
Requires-Dist: voltools; extra == "cupy-voltools"
|
28
|
+
Requires-Dist: cupy-cuda12x>13.0.0; extra == "cupy"
|
29
|
+
Requires-Dist: voltools; extra == "cupy"
|
32
30
|
Provides-Extra: pytorch
|
33
31
|
Requires-Dist: torch; extra == "pytorch"
|
34
32
|
Requires-Dist: torchvision; extra == "pytorch"
|
@@ -77,8 +75,8 @@ You can find alternative installation methods in the [documentation](https://kos
|
|
77
75
|
|
78
76
|
Learn how to get started with
|
79
77
|
|
80
|
-
- [Installation
|
81
|
-
- [Template matching
|
78
|
+
- [Installation](https://kosinskilab.github.io/pyTME/quickstart/installation.html)
|
79
|
+
- [Template matching](https://kosinskilab.github.io/pyTME/quickstart/matching/particle_picking.html) Find your template of interest.
|
82
80
|
- [Postprocessing](https://kosinskilab.github.io/pyTME/quickstart/postprocessing/motivation.html) Analyze template matching results and downstream integrations.
|
83
81
|
|
84
82
|
## How to Cite
|
@@ -1,37 +1,39 @@
|
|
1
|
-
pytme-0.
|
2
|
-
pytme-0.
|
3
|
-
pytme-0.
|
4
|
-
pytme-0.
|
5
|
-
pytme-0.
|
6
|
-
pytme-0.
|
7
|
-
pytme-0.
|
1
|
+
pytme-0.3.1.post1.data/scripts/estimate_memory_usage.py,sha256=Ry46LXUv3SZ0g41g3RDUg9UH6hiSnnG3mHTyaGletXE,2114
|
2
|
+
pytme-0.3.1.post1.data/scripts/match_template.py,sha256=X0Sa4dBuE3fvKer--JgY7kPSyZ7H6fa5PKi2lxRoyzM,37563
|
3
|
+
pytme-0.3.1.post1.data/scripts/postprocess.py,sha256=GVlavaLWPdbTmMeEczsrG0cGhHXW4wZOZ5zLIV0sx4o,27708
|
4
|
+
pytme-0.3.1.post1.data/scripts/preprocess.py,sha256=eq-67cuj3WFx5jAdS56yQSVv_sCt7SRW-dqzQRbLnVE,6328
|
5
|
+
pytme-0.3.1.post1.data/scripts/preprocessor_gui.py,sha256=R73N-UTSiAplTqyRw-SLGcGusnJVv2dlAFLuqmUrl-8,44153
|
6
|
+
pytme-0.3.1.post1.data/scripts/pytme_runner.py,sha256=dqCd60puAOOOSvuCxrJC1MbfdsRS-ctMso5YIwM-JkI,40356
|
7
|
+
pytme-0.3.1.post1.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
8
8
|
scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
scripts/estimate_memory_usage.py,sha256=UiaX30o_H59vzTQZaXISxgzWj5jwgFbMoH1E5ydVHcw,2115
|
10
10
|
scripts/eval.py,sha256=ebJVLxbRlB6TI5YHNr0VavZ4lmaRdf8QVafyiDhh_oU,2528
|
11
|
-
scripts/extract_candidates.py,sha256=
|
12
|
-
scripts/match_template.py,sha256=
|
11
|
+
scripts/extract_candidates.py,sha256=B2O4Xm0eVJzBZOblfkH5za8fTxLIdBRDl89Qwkq4Kjk,8097
|
12
|
+
scripts/match_template.py,sha256=LsoS7gPh6tx3c5uyF3v5XbATjb8jJ_jh91zmO2IruZ0,37564
|
13
13
|
scripts/match_template_filters.py,sha256=Gj4a1b_S5NWp_dfFEPFn0D7jGf-qYgBbnTvZZ4bwqOQ,42036
|
14
|
-
scripts/postprocess.py,sha256=
|
14
|
+
scripts/postprocess.py,sha256=ysI1hBFqRly8noeOgL2ZONm27hSkPoVsbeG1kwI53G4,27709
|
15
15
|
scripts/preprocess.py,sha256=PrtO0aWGbTvSMqCdNYuzW02FoGvSsvQzJab52DTssQ4,6329
|
16
|
-
scripts/preprocessor_gui.py,sha256=
|
17
|
-
scripts/pytme_runner.py,sha256=
|
18
|
-
scripts/refine_matches.py,sha256=
|
16
|
+
scripts/preprocessor_gui.py,sha256=eozUE6D_vJOO11Prardwm7zWrjvTXLHFaAMmY7yfNIc,44154
|
17
|
+
scripts/pytme_runner.py,sha256=BD5u45vtzJo_d6ZAM2N_CKnGpfjtNg4v7C-31vbTGnU,40357
|
18
|
+
scripts/refine_matches.py,sha256=1AG-E2PuTauflR_qVC1CaZKg7ev9xxGu3CIYeyJ2-WQ,12777
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
tests/test_analyzer.py,sha256=
|
21
|
-
tests/test_backends.py,sha256=
|
22
|
-
tests/test_density.py,sha256=
|
23
|
-
tests/test_extensions.py,sha256=
|
20
|
+
tests/test_analyzer.py,sha256=9TVJacQF44AnMYOWfLhqQgz1V2TeKjijVT1rJb50NMw,8360
|
21
|
+
tests/test_backends.py,sha256=65jCvPfB2YjUHkhmjkC49Rpd1SyPRQ7_lnLXHI5QC-U,17361
|
22
|
+
tests/test_density.py,sha256=JVQunV445qij5WdcpKn-5GKqT3endzjXvBPkIaXPADo,18914
|
23
|
+
tests/test_extensions.py,sha256=K71MvMhLdZz66ifJYqRl0IEr7-PCXSMxKokg-4NCc8Q,5170
|
24
24
|
tests/test_matching_cli.py,sha256=JF7LQixpFQMpbijoPwtNSe9FoYXZmBR6J3T5BvsLbR8,11202
|
25
25
|
tests/test_matching_data.py,sha256=U6ISe4lBLDj-OzgA6QAaoO_aegCJjPtXqHbPiPZ2tkA,6091
|
26
26
|
tests/test_matching_exhaustive.py,sha256=bRPCN0pyZk3DmXMrWRcEGAksYoch8P7fRiwE3g0yIf4,4039
|
27
27
|
tests/test_matching_memory.py,sha256=XrBGRi4cIp3-4nN6s7tj0pBbFJrvJaG3vQdtK-6uzY0,1151
|
28
28
|
tests/test_matching_optimization.py,sha256=bYt3d_nHewTRxKCXgGaMLhObkqBufGwrYL4gfinr_jE,7732
|
29
|
-
tests/test_matching_utils.py,sha256=
|
29
|
+
tests/test_matching_utils.py,sha256=m6mkjo-rgA0q67MYQwjeyy_y6GBErh68A-lqxvQ8NT4,4948
|
30
30
|
tests/test_orientations.py,sha256=ydqYZc3mOWSweFEGWMrMaygxX7-7in7forUtiNWfQKc,6767
|
31
31
|
tests/test_parser.py,sha256=57oaksWrKNB4Z_22IxfW0nXMyQWLJFVsuvnJQPhMn10,993
|
32
|
-
tests/test_rotations.py,sha256=
|
32
|
+
tests/test_rotations.py,sha256=Kll51PZm_5MWP6TcW_II6oJLgORM4piZtWbzhn2fiA8,5374
|
33
33
|
tests/test_structure.py,sha256=Qgrex3wYl9TpFLcqMeUOkq-7w93bzEsMNStKdJdsbnw,8881
|
34
|
+
tests/data/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
34
35
|
tests/data/README.md,sha256=RMyG_mojKLo6AEIHUj40nTPI7ZGcs_6dRzWSRGxTgGY,83
|
36
|
+
tests/data/Blurring/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
35
37
|
tests/data/Blurring/blob_width18.npy,sha256=_BVu5T2q_8N5lA2KCMUTLwknec8fHXh9Nsyoa4ov0wo,21408
|
36
38
|
tests/data/Blurring/edgegaussian_sigma3.npy,sha256=OvxXAyJs5V_m7b91BFhBqS9BnisKWbckVcMlHuChQiY,21408
|
37
39
|
tests/data/Blurring/gaussian_sigma2.npy,sha256=OS9sNpu0Y7l--X8dyB-mp-EE5eaNHISqiNkOOutllfc,21408
|
@@ -41,8 +43,11 @@ tests/data/Blurring/localgaussian_sigma0510.npy,sha256=KXASnlhxAnvvcgIDCniIHkak-
|
|
41
43
|
tests/data/Blurring/mean_size5.npy,sha256=2APwsCR_1fpwGIc_mG0dPegpcbgXhUbcEEeQo9Wa1iA,42688
|
42
44
|
tests/data/Blurring/ntree_sigma0510.npy,sha256=HxYh_ItxdKulp8UiPMzQ0ze2iiQ3Oi7seWFvEzO1kWQ,21408
|
43
45
|
tests/data/Blurring/rank_rank3.npy,sha256=MxCsomoNPmiV0Cd-5nl2S8TYCfLyEj-WV19gLH_xe0c,21408
|
46
|
+
tests/data/Maps/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
44
47
|
tests/data/Maps/emd_8621.mrc.gz,sha256=ZAlSOQRT9B_e8xpeodio9j0WBzygl2R1ctg9m8QhCRA,4572566
|
48
|
+
tests/data/Raw/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
45
49
|
tests/data/Raw/em_map.map,sha256=YeY_R0p-90-oZgxfbKGIsyE5bui_uWq9iGhWl0bLYZI,22304
|
50
|
+
tests/data/Structures/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
46
51
|
tests/data/Structures/1pdj.cif,sha256=QdO4e2ulO621PVoK3q9n0qDPDKnzJpV6sPeG6zQec1A,169343
|
47
52
|
tests/data/Structures/1pdj.pdb,sha256=nTFGjecultoXNVUBDdsyho0CEzX5i1fSo_aBYDh5-pU,115749
|
48
53
|
tests/data/Structures/5khe.cif,sha256=SnC0so37wyuoYwAX5UDTTLvQiknZXxeJrvkGai-11rw,214644
|
@@ -53,39 +58,41 @@ tests/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
53
58
|
tests/preprocessing/test_compose.py,sha256=z44fgQhxJU0-zHSV0CLBMEJqwhK5gEFDhUCLuVsQpQc,2490
|
54
59
|
tests/preprocessing/test_frequency_filters.py,sha256=UmOK5a67tZeeppE0_O8f3ZczxI6RLIyBuVeHdaPT3tk,7057
|
55
60
|
tests/preprocessing/test_preprocessor.py,sha256=XyR4xc4YM76PUKuTIiive76Q85DdcyDAvbXNGcoKL8w,4820
|
56
|
-
tests/preprocessing/test_utils.py,sha256=
|
61
|
+
tests/preprocessing/test_utils.py,sha256=RnqlA3vHcVguWp0gmBOwBgUZK85ylNLqr_oFkf8wVFo,3706
|
57
62
|
tme/__init__.py,sha256=GXfIuzU4fh2KZfgUOIXnNeKlJ8kSp3EqoBr6bSik848,217
|
58
|
-
tme/__version__.py,sha256=
|
63
|
+
tme/__version__.py,sha256=r4xAFihOf72W9TD-lpMi6ntWSTKTP2SlzKP1ytkjRbI,22
|
59
64
|
tme/cli.py,sha256=48Q7QGIuCwNSms5wOnGmWjMSlZrXjAQUz_9zsIFT9tY,3652
|
60
|
-
tme/density.py,sha256=
|
61
|
-
tme/extensions.cpython-311-darwin.so,sha256=
|
62
|
-
tme/
|
63
|
-
tme/
|
64
|
-
tme/
|
65
|
-
tme/
|
66
|
-
tme/
|
67
|
-
tme/
|
68
|
-
tme/
|
65
|
+
tme/density.py,sha256=iupy3gL7gwE2Q9FHcZfHY_AcbOSUAo3i9tSbC-KF-DA,82405
|
66
|
+
tme/extensions.cpython-311-darwin.so,sha256=xUCjh1eMK3iKWMC04oFG3LzxBRAqHpl7idIIV4ezx3Q,415840
|
67
|
+
tme/mask.py,sha256=4xHqWtOabgdYDDCXHpXflaZmLlmE2_9-bxjs4AaCIYM,10472
|
68
|
+
tme/matching_data.py,sha256=y6UBUykYpZHsl5NEDyKthKztuwcKFIaOIlB0eEh-Sww,31255
|
69
|
+
tme/matching_exhaustive.py,sha256=DnWl7zBfnK83MFZzLDQ9WsBvI2mZkTikxpiXIWrdmxQ,18385
|
70
|
+
tme/matching_optimization.py,sha256=r2zMyOKyvoP8OX9xValJE0DLWbLpNdyY1MLWcOi-H1U,45715
|
71
|
+
tme/matching_scores.py,sha256=sX4hMki9WjwgenNWJ1wNu04J808wOgGuVqbRYSA2TB8,35860
|
72
|
+
tme/matching_utils.py,sha256=Qn65B2F8v1yHLetqpiirvUbj-A9-J1giq3lE9cSb-1E,27426
|
73
|
+
tme/memory.py,sha256=lOD_XJtAWo3IFG5fJIdYgLSpn8o0ORO6Vua_tlm5YEk,9683
|
74
|
+
tme/orientations.py,sha256=xMVC5FWDNYSoiIpRXqTi3K1QiSsH2ilUoDEUqEJLYzk,21642
|
69
75
|
tme/parser.py,sha256=d59A7meIUJ8OzfB6eaVqd7CwLj9oYnOfubqlvygbu1U,24210
|
70
76
|
tme/preprocessor.py,sha256=7DAGRfCPc9ge-hEuYsNA_KCeajVnpWl-w4NzGQS53GM,40377
|
71
|
-
tme/rotations.py,sha256=
|
77
|
+
tme/rotations.py,sha256=wVnvZrRCHb1wd5E6yDsLxiP2G0Oin66A4W14vsz4i50,10641
|
72
78
|
tme/structure.py,sha256=ojk-IQnIe1JrzxUVHlNlyLxtwzNkNykvxTaXvyBMmbs,72135
|
73
79
|
tme/types.py,sha256=NAY7C4qxE6yz-DXVtClMvFfoOV-spWGLNfpLATZ1LcU,442
|
74
80
|
tme/analyzer/__init__.py,sha256=aJyVGlQwO6Ij-_NZ5rBlgBQQSIj0dqpUwlmvIvnQqBM,89
|
75
|
-
tme/analyzer/_utils.py,sha256=
|
76
|
-
tme/analyzer/aggregation.py,sha256=
|
81
|
+
tme/analyzer/_utils.py,sha256=48Xq2Hi_P3VYl1SozYz3WwEj3BwL1QdtFYx7dTxv0bc,6344
|
82
|
+
tme/analyzer/aggregation.py,sha256=3ieZlNcDp0dhnQ85DdVLsCFrRfqU4jim3JRcMwORF_U,28518
|
77
83
|
tme/analyzer/base.py,sha256=2uEYKa0xLwggJUenAA6-l8DIO5sYtklHMg9dR3DzAOI,3887
|
78
|
-
tme/analyzer/peaks.py,sha256=
|
84
|
+
tme/analyzer/peaks.py,sha256=y40YVa2zJFLWD3aoP0xtuhK8yOrQV0AVH6ElWyVjXkM,32587
|
79
85
|
tme/analyzer/proxy.py,sha256=NH0J93ESl5NAVd_22rLZGDWjCx1ov8I995Fr3mYqUSM,4162
|
80
86
|
tme/backends/__init__.py,sha256=VUvEnpfjmZQVn_9QHkLPBoa6y8M3gDyNNL9kq4OQNGE,5249
|
81
87
|
tme/backends/_cupy_utils.py,sha256=scxCSK9BcsDaIbHR2mFxAJRIxdc0r5JTC1gCJmVJa64,24558
|
82
|
-
tme/backends/_jax_utils.py,sha256=
|
83
|
-
tme/backends/
|
84
|
-
tme/backends/
|
85
|
-
tme/backends/
|
86
|
-
tme/backends/
|
87
|
-
tme/backends/
|
88
|
-
tme/backends/
|
88
|
+
tme/backends/_jax_utils.py,sha256=UrC0RwwxwnNdz6QusPOgC8eISTX_C1KbZmt7Karl_Nk,6096
|
89
|
+
tme/backends/_numpyfftw_utils.py,sha256=RnYgbSs_sL-NlwYGRqU9kziq0U5qzl9GecVx9uUeSJs,7904
|
90
|
+
tme/backends/cupy_backend.py,sha256=Ms2sObxr0xc_tdHctcL659G8YWOTqPG59F3665yZH4c,8163
|
91
|
+
tme/backends/jax_backend.py,sha256=d14u__H9leb5aXCz383T1xjTrGOzxgfWxXjgRrRWZMI,12676
|
92
|
+
tme/backends/matching_backend.py,sha256=B9LXxKpfNYdJBIksyGm7g7V7SC9G3mrluscz3aqISsU,33199
|
93
|
+
tme/backends/mlx_backend.py,sha256=3aAKv7VkK_jfxwDMPQZsLp_lRU8MBJ6zNAzrs6VZd3s,6718
|
94
|
+
tme/backends/npfftw_backend.py,sha256=8-Hs3slqnWvsHpqICxKxb-fbmg3IbSok3sThXew-P7M,18800
|
95
|
+
tme/backends/pytorch_backend.py,sha256=yn1hhowUMmzMLHdh2jqw2B0CvBIVcSAWOvRMMDkSHmw,14229
|
89
96
|
tme/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
90
97
|
tme/data/c48n309.npy,sha256=NwH64mOEbm3tStq5c98o81fY1vMOoq4nvXDAh7Z7iZg,296768
|
91
98
|
tme/data/c48n527.npy,sha256=saSUMTa1R0MisPvgFL02a7IHQSwEZ-mJu0v3qJjg5AU,506048
|
@@ -115,12 +122,12 @@ tme/filters/__init__.py,sha256=aDgaWTCcl01BVamzrc8iEyfTfeRB4OdNRU1ywRZ8450,292
|
|
115
122
|
tme/filters/_utils.py,sha256=VZj7qixVhmFmXIvssxJ0PoUNv2SyyYXFLvY3zZoYyr8,10874
|
116
123
|
tme/filters/bandpass.py,sha256=-xmoBhMIDQA_ah2kiERfom0T9oVZ5n0avt0HLZ90OtQ,8751
|
117
124
|
tme/filters/compose.py,sha256=yeC84D0HznqhRJ7guV6Cpxzq2UWpvV6nouhFECjIDEw,1980
|
118
|
-
tme/filters/ctf.py,sha256=
|
125
|
+
tme/filters/ctf.py,sha256=HNB03Pw3gn2Y8pIM2391iRHQzp2NcHZWFDC61v3K0oM,24520
|
119
126
|
tme/filters/reconstruction.py,sha256=4gCGpuWuM-yCDQvuzyex_Q8bmsFqUI_8IoZnv3B_3UA,7564
|
120
|
-
tme/filters/wedge.py,sha256=
|
127
|
+
tme/filters/wedge.py,sha256=JWiN9IwRXnc7A7syq11kSuin6QjhlVmi38nwGHu4yxE,19541
|
121
128
|
tme/filters/whitening.py,sha256=Zwk-0jMVqy_F8TdQ0ht5unMz2JBOePOC3okUhQpU0bo,6348
|
122
|
-
pytme-0.
|
123
|
-
pytme-0.
|
124
|
-
pytme-0.
|
125
|
-
pytme-0.
|
126
|
-
pytme-0.
|
129
|
+
pytme-0.3.1.post1.dist-info/METADATA,sha256=2EXMjS9Dx7TEo0gDEgGjvWD7rKnhJ0eTTb4AalGW9kE,4985
|
130
|
+
pytme-0.3.1.post1.dist-info/WHEEL,sha256=SPbiHAOPLnBtml4sk5MIwvWF6YnGfOfy9C__W6Bpeg4,109
|
131
|
+
pytme-0.3.1.post1.dist-info/entry_points.txt,sha256=pbUSmB0J4Ghlg0w7jHfaFSvPMuvRWzeSuvdjdRPisAU,288
|
132
|
+
pytme-0.3.1.post1.dist-info/top_level.txt,sha256=ovCUR7UXXouH3zYt_fJLoqr_vtjp1wudFgjVAnztQLE,18
|
133
|
+
pytme-0.3.1.post1.dist-info/RECORD,,
|
scripts/extract_candidates.py
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
#!python3
|
2
|
-
"""
|
2
|
+
"""Prepare orientations stack for refinement.
|
3
3
|
|
4
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
5
5
|
|
6
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
7
7
|
"""
|
8
8
|
import argparse
|
9
|
-
from os
|
9
|
+
from os import unlink
|
10
|
+
from os.path import splitext, basename
|
10
11
|
|
11
12
|
import numpy as np
|
13
|
+
from collections import defaultdict
|
12
14
|
|
15
|
+
from tme.parser import StarParser
|
13
16
|
from tme import Density, Orientations
|
14
|
-
from tme.matching_utils import
|
15
|
-
|
16
|
-
|
17
|
+
from tme.matching_utils import generate_tempfile_name
|
18
|
+
from tme.rotations import (
|
19
|
+
align_vectors,
|
17
20
|
euler_from_rotationmatrix,
|
18
21
|
euler_to_rotationmatrix,
|
19
22
|
)
|
@@ -25,7 +28,7 @@ class ProgressBar:
|
|
25
28
|
"""
|
26
29
|
|
27
30
|
def __init__(self, message: str, nchars: int, total: int):
|
28
|
-
self._size = nchars - len(message) - (len(str(total))+2) * 2
|
31
|
+
self._size = nchars - len(message) - (len(str(total)) + 2) * 2
|
29
32
|
self._message = message
|
30
33
|
self._total = total
|
31
34
|
|
@@ -45,20 +48,14 @@ def parse_args():
|
|
45
48
|
)
|
46
49
|
|
47
50
|
io_group = parser.add_argument_group("Input / Output")
|
48
|
-
io_group.add_argument(
|
49
|
-
"--target",
|
50
|
-
required=True,
|
51
|
-
type=str,
|
52
|
-
help="Extract candidates from this target.",
|
53
|
-
)
|
54
51
|
io_group.add_argument(
|
55
52
|
"--orientations",
|
56
53
|
required=True,
|
57
54
|
type=str,
|
58
|
-
help="
|
55
|
+
help="Star file with picks and micrograph names.",
|
59
56
|
)
|
60
57
|
io_group.add_argument(
|
61
|
-
"--
|
58
|
+
"--orientations-scaling",
|
62
59
|
required=False,
|
63
60
|
type=float,
|
64
61
|
default=1.0,
|
@@ -67,54 +64,59 @@ def parse_args():
|
|
67
64
|
)
|
68
65
|
io_group.add_argument(
|
69
66
|
"-o",
|
70
|
-
"--
|
67
|
+
"--output-prefix",
|
71
68
|
required=True,
|
72
69
|
type=str,
|
73
|
-
help="
|
70
|
+
help="Output prefix to use.",
|
74
71
|
)
|
75
72
|
|
76
73
|
alignment_group = parser.add_argument_group("Alignment")
|
77
74
|
alignment_group.add_argument(
|
78
|
-
"--
|
75
|
+
"--align-orientations",
|
79
76
|
action="store_true",
|
80
77
|
required=False,
|
81
78
|
help="Whether to align extracted orientations based on their angles. Allows "
|
82
79
|
"for efficient subsequent sampling of cone angles.",
|
83
80
|
)
|
84
81
|
alignment_group.add_argument(
|
85
|
-
"--
|
82
|
+
"--angles-are-vector",
|
86
83
|
action="store_true",
|
87
84
|
required=False,
|
88
85
|
help="Considers euler_z euler_y, euler_x as vector that will be rotated to align "
|
89
86
|
"with the z-axis (1,0,0). Only considered when --align_orientations is set.",
|
90
87
|
)
|
91
88
|
alignment_group.add_argument(
|
92
|
-
"--
|
93
|
-
dest="interpolation_order",
|
89
|
+
"--interpolation-order",
|
94
90
|
required=False,
|
95
91
|
type=int,
|
96
92
|
default=1,
|
97
93
|
help="Interpolation order for alignment, less than zero is no interpolation.",
|
98
94
|
)
|
95
|
+
alignment_group.add_argument(
|
96
|
+
"--split-by-micrograph",
|
97
|
+
action="store_true",
|
98
|
+
required=False,
|
99
|
+
help="Create separate output files for each micrograph."
|
100
|
+
)
|
99
101
|
|
100
102
|
extraction_group = parser.add_argument_group("Extraction")
|
101
103
|
extraction_group.add_argument(
|
102
|
-
"--
|
103
|
-
required=
|
104
|
+
"--box-size",
|
105
|
+
required=True,
|
104
106
|
type=int,
|
105
|
-
help="Box size for extraction
|
107
|
+
help="Box size for extraction.",
|
106
108
|
)
|
107
109
|
extraction_group.add_argument(
|
108
|
-
"--
|
110
|
+
"--translation-uncertainty",
|
109
111
|
required=False,
|
110
112
|
type=int,
|
111
113
|
help="Sets box size for extraction to template box plus this value.",
|
112
114
|
)
|
113
115
|
extraction_group.add_argument(
|
114
|
-
"--
|
116
|
+
"--drop-out-of-box",
|
115
117
|
action="store_true",
|
116
118
|
required=False,
|
117
|
-
help="Whether to
|
119
|
+
help="Whether to drop orientations that fall outside the box. If the "
|
118
120
|
"orientations are sensible, it is safe to pass this flag.",
|
119
121
|
)
|
120
122
|
|
@@ -125,100 +127,117 @@ def parse_args():
|
|
125
127
|
|
126
128
|
def main():
|
127
129
|
args = parse_args()
|
130
|
+
|
131
|
+
data = StarParser(args.orientations, delimiter="\t")
|
132
|
+
key = list(data.keys())[0]
|
133
|
+
|
134
|
+
index_map = defaultdict(list)
|
135
|
+
for index, value in enumerate(data[key]["_rlnMicrographName"]):
|
136
|
+
index_map[value].append(index)
|
137
|
+
|
128
138
|
orientations = Orientations.from_file(args.orientations)
|
129
139
|
orientations.translations = np.divide(
|
130
|
-
orientations.translations, args.
|
140
|
+
orientations.translations, args.orientations_scaling
|
131
141
|
)
|
132
142
|
|
133
|
-
target = Density.from_file(args.target, use_memmap=True)
|
134
|
-
|
135
143
|
box_size = np.array(args.box_size)
|
136
|
-
box_size = np.repeat(box_size,
|
137
|
-
|
144
|
+
box_size = np.repeat(box_size, 3 // box_size.size).astype(int)
|
138
145
|
extraction_shape = np.copy(box_size)
|
139
|
-
if args.align_orientations:
|
140
|
-
extraction_shape[:] = int(np.linalg.norm(box_size) + 1)
|
141
|
-
|
142
|
-
orientations, cand_slices, obs_slices = orientations.get_extraction_slices(
|
143
|
-
target_shape=target.shape,
|
144
|
-
extraction_shape=extraction_shape,
|
145
|
-
drop_out_of_box=not args.keep_out_of_box,
|
146
|
-
return_orientations=True,
|
147
|
-
)
|
148
146
|
|
149
147
|
if args.align_orientations:
|
148
|
+
extraction_shape[:] = int(np.linalg.norm(box_size) + 1)
|
150
149
|
for index in range(orientations.rotations.shape[0]):
|
151
150
|
rotation_matrix = euler_to_rotationmatrix(orientations.rotations[index])
|
152
151
|
rotation_matrix = np.linalg.inv(rotation_matrix)
|
153
152
|
if args.angles_are_vector:
|
154
|
-
rotation_matrix =
|
153
|
+
rotation_matrix = align_vectors(
|
155
154
|
orientations.rotations[index], target_vector=(1, 0, 0)
|
156
155
|
)
|
157
156
|
orientations.rotations[index] = euler_from_rotationmatrix(rotation_matrix)
|
158
157
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
),
|
173
|
-
sampling_rate=(1, *target.sampling_rate),
|
174
|
-
origin=(0, *target.origin),
|
175
|
-
)
|
176
|
-
dens.data[:] = target.metadata["mean"]
|
177
|
-
|
178
|
-
data_subset = np.zeros(extraction_shape, dtype=target.data.dtype)
|
179
|
-
pbar = ProgressBar(message="Aligning ", nchars=80, total=len(obs_slices))
|
180
|
-
for index, (obs_slice, cand_slice) in enumerate(zip(obs_slices, cand_slices)):
|
181
|
-
pbar.update(index + 1)
|
182
|
-
|
183
|
-
data_subset.fill(0)
|
184
|
-
data_subset[cand_slice] = target.data[obs_slice]
|
185
|
-
target_subset = Density(
|
186
|
-
data_subset,
|
187
|
-
sampling_rate=target.sampling_rate,
|
188
|
-
origin=target.origin,
|
158
|
+
ret_orientations, ret_dens, ix = [], [], 0
|
159
|
+
n_particles = orientations.translations.shape[0]
|
160
|
+
pbar = ProgressBar(message="Processing ", nchars=80, total=n_particles)
|
161
|
+
for target_path, indices in index_map.items():
|
162
|
+
|
163
|
+
target = Density.from_file(target_path, use_memmap=True)
|
164
|
+
|
165
|
+
subset = orientations[indices]
|
166
|
+
subset, cand_slices, obs_slices = subset.get_extraction_slices(
|
167
|
+
target_shape=target.shape,
|
168
|
+
extraction_shape=extraction_shape,
|
169
|
+
drop_out_of_box=args.drop_out_of_box,
|
170
|
+
return_orientations=True,
|
189
171
|
)
|
190
172
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
173
|
+
dens = Density(
|
174
|
+
np.memmap(
|
175
|
+
generate_tempfile_name(),
|
176
|
+
mode="w+",
|
177
|
+
shape=(subset.translations.shape[0], *box_size),
|
178
|
+
dtype=np.float32,
|
179
|
+
),
|
180
|
+
sampling_rate = (1, *target.sampling_rate),
|
181
|
+
metadata = {"batch_dimension" : (0,), "path" : target_path}
|
182
|
+
)
|
183
|
+
|
184
|
+
data_subset = np.zeros(extraction_shape, dtype=target.data.dtype)
|
185
|
+
for index, (obs_slice, cand_slice) in enumerate(zip(obs_slices, cand_slices)):
|
186
|
+
pbar.update(ix + 1)
|
187
|
+
|
188
|
+
data_subset.fill(0)
|
189
|
+
data_subset[cand_slice] = target.data[obs_slice]
|
190
|
+
target_subset = Density(
|
191
|
+
data_subset,
|
192
|
+
sampling_rate=target.sampling_rate,
|
193
|
+
origin=target.origin,
|
197
194
|
)
|
198
|
-
target_subset.pad(box_size, center=True)
|
199
195
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
196
|
+
if args.align_orientations:
|
197
|
+
rotation_matrix = euler_to_rotationmatrix(subset.rotations[index])
|
198
|
+
target_subset = target_subset.rigid_transform(
|
199
|
+
rotation_matrix=rotation_matrix,
|
200
|
+
use_geometric_center=True,
|
201
|
+
order=args.interpolation_order,
|
202
|
+
)
|
203
|
+
target_subset.pad(box_size, center=True)
|
204
|
+
dens.data[index] = target_subset.data.astype(np.float32)
|
205
|
+
ix += 1
|
207
206
|
|
208
|
-
dens
|
209
|
-
|
207
|
+
ret_dens.append(dens)
|
208
|
+
ret_orientations.append(subset)
|
210
209
|
|
211
|
-
|
212
|
-
|
213
|
-
}
|
214
|
-
dens.metadata.update(target_meta)
|
215
|
-
dens.metadata["batch_dimension"] = (0,)
|
216
|
-
dens.metadata["normals"] = orientations.rotations
|
210
|
+
if not len(ret_dens):
|
211
|
+
exit("Found no valid particles.")
|
217
212
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
213
|
+
print("")
|
214
|
+
if not args.split_by_micrograph:
|
215
|
+
ret_orientations = [Orientations(
|
216
|
+
translations=np.concatenate([x.translations for x in ret_orientations]),
|
217
|
+
rotations=np.concatenate([x.rotations for x in ret_orientations]),
|
218
|
+
scores=np.concatenate([x.scores for x in ret_orientations]),
|
219
|
+
details=np.concatenate([x.details for x in ret_orientations]),
|
220
|
+
)]
|
221
|
+
dens_data = Density(
|
222
|
+
np.concatenate([x.data for x in ret_dens]),
|
223
|
+
sampling_rate=ret_dens[0].sampling_rate
|
224
|
+
)
|
225
|
+
_ = [unlink(x.data.filename) for x in ret_dens]
|
226
|
+
dens_data.metadata.update({"batch_dimension" : (0, )})
|
227
|
+
ret_dens = [dens_data]
|
228
|
+
|
229
|
+
for orientation, dens in zip(ret_orientations, ret_dens):
|
230
|
+
fname = args.output_prefix
|
231
|
+
if args.split_by_micrograph:
|
232
|
+
target = splitext(basename(dens.metadata["path"]))[0]
|
233
|
+
fname = f"{args.output_prefix}_{target}"
|
234
|
+
|
235
|
+
dens.to_file(f"{fname}.h5")
|
236
|
+
orientation.to_file(f"{fname}_aligned.star")
|
237
|
+
try:
|
238
|
+
unlink(dens.data.filename)
|
239
|
+
except Exception:
|
240
|
+
continue
|
222
241
|
|
223
242
|
if __name__ == "__main__":
|
224
243
|
main()
|