pytme 0.3.1.post2__cp311-cp311-macosx_15_0_arm64.whl → 0.3.2__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.3.2.data/scripts/estimate_ram_usage.py +97 -0
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/match_template.py +213 -196
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/postprocess.py +40 -78
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/preprocess.py +4 -5
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/preprocessor_gui.py +49 -103
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/pytme_runner.py +46 -69
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/METADATA +3 -2
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/RECORD +68 -65
- scripts/estimate_ram_usage.py +97 -0
- scripts/match_template.py +213 -196
- scripts/match_template_devel.py +1339 -0
- scripts/postprocess.py +40 -78
- scripts/preprocess.py +4 -5
- scripts/preprocessor_gui.py +49 -103
- scripts/pytme_runner.py +46 -69
- tests/preprocessing/test_compose.py +31 -30
- tests/preprocessing/test_frequency_filters.py +17 -32
- tests/preprocessing/test_preprocessor.py +0 -19
- tests/preprocessing/test_utils.py +13 -1
- tests/test_analyzer.py +2 -10
- tests/test_backends.py +47 -18
- tests/test_density.py +72 -13
- tests/test_extensions.py +1 -0
- tests/test_matching_cli.py +23 -9
- tests/test_matching_exhaustive.py +5 -5
- tests/test_matching_utils.py +3 -3
- tests/test_orientations.py +12 -0
- tests/test_rotations.py +13 -23
- tests/test_structure.py +1 -7
- tme/__version__.py +1 -1
- tme/analyzer/aggregation.py +47 -16
- tme/analyzer/base.py +34 -0
- tme/analyzer/peaks.py +26 -13
- tme/analyzer/proxy.py +14 -0
- tme/backends/_jax_utils.py +91 -68
- tme/backends/cupy_backend.py +6 -19
- tme/backends/jax_backend.py +103 -98
- tme/backends/matching_backend.py +0 -17
- tme/backends/mlx_backend.py +0 -29
- tme/backends/npfftw_backend.py +100 -97
- tme/backends/pytorch_backend.py +65 -78
- tme/cli.py +2 -2
- tme/density.py +44 -57
- tme/extensions.cpython-311-darwin.so +0 -0
- tme/filters/_utils.py +52 -24
- tme/filters/bandpass.py +99 -105
- tme/filters/compose.py +133 -39
- tme/filters/ctf.py +51 -102
- tme/filters/reconstruction.py +67 -122
- tme/filters/wedge.py +296 -325
- tme/filters/whitening.py +39 -75
- tme/mask.py +2 -2
- tme/matching_data.py +87 -15
- tme/matching_exhaustive.py +70 -120
- tme/matching_optimization.py +9 -63
- tme/matching_scores.py +261 -100
- tme/matching_utils.py +150 -91
- tme/memory.py +1 -0
- tme/orientations.py +17 -3
- tme/preprocessor.py +0 -239
- tme/rotations.py +102 -70
- tme/structure.py +601 -631
- tme/types.py +1 -0
- {pytme-0.3.1.post2.data → pytme-0.3.2.data}/scripts/estimate_memory_usage.py +0 -0
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/WHEEL +0 -0
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/entry_points.txt +0 -0
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/licenses/LICENSE +0 -0
- {pytme-0.3.1.post2.dist-info → pytme-0.3.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
#!python
|
2
|
+
""" Estimate RAM requirements for template matching jobs.
|
3
|
+
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
5
|
+
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
7
|
+
"""
|
8
|
+
import numpy as np
|
9
|
+
import argparse
|
10
|
+
from tme import Density
|
11
|
+
from tme.matching_utils import estimate_ram_usage
|
12
|
+
from tme.matching_exhaustive import MATCHING_EXHAUSTIVE_REGISTER
|
13
|
+
|
14
|
+
|
15
|
+
def parse_args():
|
16
|
+
parser = argparse.ArgumentParser(
|
17
|
+
description="Estimate RAM usage for template matching."
|
18
|
+
)
|
19
|
+
parser.add_argument(
|
20
|
+
"-m",
|
21
|
+
"--target",
|
22
|
+
dest="target",
|
23
|
+
type=str,
|
24
|
+
required=True,
|
25
|
+
help="Path to a target in CCP4/MRC format.",
|
26
|
+
)
|
27
|
+
parser.add_argument(
|
28
|
+
"-i",
|
29
|
+
"--template",
|
30
|
+
dest="template",
|
31
|
+
type=str,
|
32
|
+
required=True,
|
33
|
+
help="Path to a template in PDB/MMCIF or CCP4/MRC format.",
|
34
|
+
)
|
35
|
+
parser.add_argument(
|
36
|
+
"--matching_method",
|
37
|
+
required=False,
|
38
|
+
default=None,
|
39
|
+
help="Analyzer method to use.",
|
40
|
+
)
|
41
|
+
parser.add_argument(
|
42
|
+
"-s",
|
43
|
+
dest="score",
|
44
|
+
type=str,
|
45
|
+
default="FLCSphericalMask",
|
46
|
+
help="Template matching scoring function.",
|
47
|
+
choices=MATCHING_EXHAUSTIVE_REGISTER.keys(),
|
48
|
+
)
|
49
|
+
parser.add_argument(
|
50
|
+
"--ncores", type=int, help="Number of cores for parallelization.", required=True
|
51
|
+
)
|
52
|
+
parser.add_argument(
|
53
|
+
"--no_edge_padding",
|
54
|
+
dest="no_edge_padding",
|
55
|
+
action="store_true",
|
56
|
+
default=False,
|
57
|
+
help="Whether to pad the edges of the target. This is useful, if the target"
|
58
|
+
" has a well defined bounding box, e.g. a density map.",
|
59
|
+
)
|
60
|
+
parser.add_argument(
|
61
|
+
"--no_fourier_padding",
|
62
|
+
dest="no_fourier_padding",
|
63
|
+
action="store_true",
|
64
|
+
default=False,
|
65
|
+
help="Whether input arrays should be zero-padded to the full convolution shape"
|
66
|
+
" for numerical stability. When working with very large targets such as"
|
67
|
+
" tomograms it is safe to use this flag and benefit from the performance gain.",
|
68
|
+
)
|
69
|
+
args = parser.parse_args()
|
70
|
+
return args
|
71
|
+
|
72
|
+
|
73
|
+
def main():
|
74
|
+
args = parse_args()
|
75
|
+
target = Density.from_file(args.target)
|
76
|
+
template = Density.from_file(args.template)
|
77
|
+
|
78
|
+
target_box = target.shape
|
79
|
+
if not args.no_edge_padding:
|
80
|
+
target_box = np.add(target_box, template.shape)
|
81
|
+
|
82
|
+
template_box = template.shape
|
83
|
+
if args.no_fourier_padding:
|
84
|
+
template_box = np.ones(len(template_box), dtype=int)
|
85
|
+
|
86
|
+
result = estimate_ram_usage(
|
87
|
+
shape1=target_box,
|
88
|
+
shape2=template_box,
|
89
|
+
matching_method=args.score,
|
90
|
+
ncores=args.ncores,
|
91
|
+
analyzer_method="MaxScoreOverRotations",
|
92
|
+
)
|
93
|
+
print(result)
|
94
|
+
|
95
|
+
|
96
|
+
if __name__ == "__main__":
|
97
|
+
main()
|