pytme 0.2.9__cp311-cp311-macosx_15_0_arm64.whl → 0.3b0__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.2.9.data/scripts/estimate_ram_usage.py → pytme-0.3b0.data/scripts/estimate_memory_usage.py +16 -33
- {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/match_template.py +224 -223
- {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/postprocess.py +283 -163
- {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/preprocess.py +11 -8
- {pytme-0.2.9.data → pytme-0.3b0.data}/scripts/preprocessor_gui.py +10 -9
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/METADATA +11 -9
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/RECORD +61 -58
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/entry_points.txt +1 -1
- scripts/{estimate_ram_usage.py → estimate_memory_usage.py} +16 -33
- scripts/extract_candidates.py +224 -0
- scripts/match_template.py +224 -223
- scripts/postprocess.py +283 -163
- scripts/preprocess.py +11 -8
- scripts/preprocessor_gui.py +10 -9
- scripts/refine_matches.py +626 -0
- tests/preprocessing/test_frequency_filters.py +9 -4
- tests/test_analyzer.py +143 -138
- tests/test_matching_cli.py +85 -29
- tests/test_matching_exhaustive.py +1 -2
- tests/test_matching_optimization.py +4 -9
- tests/test_orientations.py +0 -1
- tme/__version__.py +1 -1
- tme/analyzer/__init__.py +2 -0
- tme/analyzer/_utils.py +25 -17
- tme/analyzer/aggregation.py +385 -220
- tme/analyzer/base.py +138 -0
- tme/analyzer/peaks.py +150 -88
- tme/analyzer/proxy.py +122 -0
- tme/backends/__init__.py +4 -3
- tme/backends/_cupy_utils.py +25 -24
- tme/backends/_jax_utils.py +4 -3
- tme/backends/cupy_backend.py +4 -13
- tme/backends/jax_backend.py +6 -8
- tme/backends/matching_backend.py +4 -3
- tme/backends/mlx_backend.py +4 -3
- tme/backends/npfftw_backend.py +7 -5
- tme/backends/pytorch_backend.py +14 -4
- tme/cli.py +126 -0
- tme/density.py +4 -3
- tme/filters/__init__.py +1 -1
- tme/filters/_utils.py +4 -3
- tme/filters/bandpass.py +6 -4
- tme/filters/compose.py +5 -4
- tme/filters/ctf.py +426 -214
- tme/filters/reconstruction.py +58 -28
- tme/filters/wedge.py +139 -61
- tme/filters/whitening.py +36 -36
- tme/matching_data.py +4 -3
- tme/matching_exhaustive.py +17 -16
- tme/matching_optimization.py +5 -4
- tme/matching_scores.py +4 -3
- tme/matching_utils.py +6 -4
- tme/memory.py +4 -3
- tme/orientations.py +9 -6
- tme/parser.py +5 -4
- tme/preprocessor.py +4 -3
- tme/rotations.py +10 -7
- tme/structure.py +4 -3
- tests/data/Maps/.DS_Store +0 -0
- tests/data/Structures/.DS_Store +0 -0
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/WHEEL +0 -0
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/licenses/LICENSE +0 -0
- {pytme-0.2.9.dist-info → pytme-0.3b0.dist-info}/top_level.txt +0 -0
tme/matching_optimization.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements methods for non-exhaustive template matching.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import warnings
|
@@ -1308,4 +1309,4 @@ def optimize_match(
|
|
1308
1309
|
result.x = np.zeros_like(result.x)
|
1309
1310
|
translation, rotation = result.x[:ndim], result.x[ndim:]
|
1310
1311
|
rotation_matrix = euler_to_rotationmatrix(rotation)
|
1311
|
-
return translation, rotation_matrix, result.fun
|
1312
|
+
return translation, rotation_matrix, float(result.fun)
|
tme/matching_scores.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements a range of cross-correlation coefficients.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023-2024 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import warnings
|
tme/matching_utils.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Utility functions for template matching.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import os
|
@@ -15,7 +16,6 @@ from concurrent.futures import ThreadPoolExecutor
|
|
15
16
|
from typing import Tuple, Dict, Callable, Optional
|
16
17
|
|
17
18
|
import numpy as np
|
18
|
-
from tqdm import tqdm
|
19
19
|
from scipy.spatial import ConvexHull
|
20
20
|
from scipy.ndimage import gaussian_filter
|
21
21
|
|
@@ -1166,6 +1166,8 @@ class TqdmParallel(Parallel):
|
|
1166
1166
|
"""
|
1167
1167
|
|
1168
1168
|
def __init__(self, tqdm_args: Dict = {}, *args, **kwargs):
|
1169
|
+
from tqdm import tqdm
|
1170
|
+
|
1169
1171
|
super().__init__(*args, **kwargs)
|
1170
1172
|
self.pbar = tqdm(**tqdm_args)
|
1171
1173
|
|
tme/memory.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Compute memory consumption of template matching components.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
from abc import ABC, abstractmethod
|
tme/orientations.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"""
|
2
|
+
Handle template matching orientations and conversion between formats.
|
3
3
|
|
4
|
-
|
4
|
+
Copyright (c) 2024 European Molecular Biology Laboratory
|
5
5
|
|
6
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
7
7
|
"""
|
8
|
+
|
8
9
|
from typing import List, Tuple
|
9
10
|
from dataclasses import dataclass
|
10
11
|
from string import ascii_lowercase, ascii_uppercase
|
@@ -14,7 +15,7 @@ import numpy as np
|
|
14
15
|
from .parser import StarParser
|
15
16
|
from .matching_utils import compute_extraction_box
|
16
17
|
|
17
|
-
# Exceeds available numpy dimensions for default installations
|
18
|
+
# Exceeds available numpy dimensions for default installations
|
18
19
|
NAMES = ["x", "y", "z", *ascii_lowercase[:-3], *ascii_uppercase]
|
19
20
|
|
20
21
|
|
@@ -81,7 +82,7 @@ class Orientations:
|
|
81
82
|
self.translations = np.array(self.translations).astype(np.float32)
|
82
83
|
self.rotations = np.array(self.rotations).astype(np.float32)
|
83
84
|
self.scores = np.array(self.scores).astype(np.float32)
|
84
|
-
self.details = np.array(self.details)
|
85
|
+
self.details = np.array(self.details)
|
85
86
|
n_orientations = set(
|
86
87
|
[
|
87
88
|
self.translations.shape[0],
|
@@ -324,6 +325,7 @@ class Orientations:
|
|
324
325
|
"_rlnAngleRot",
|
325
326
|
"_rlnAngleTilt",
|
326
327
|
"_rlnAnglePsi",
|
328
|
+
"_rlnClassNumber",
|
327
329
|
]
|
328
330
|
if source_path is not None:
|
329
331
|
header.append("_rlnMicrographName")
|
@@ -339,6 +341,7 @@ class Orientations:
|
|
339
341
|
for index, (translation, rotation, score, detail) in enumerate(self):
|
340
342
|
line = [str(x) for x in translation]
|
341
343
|
line.extend([str(x) for x in rotation])
|
344
|
+
line.extend([str(detail)])
|
342
345
|
|
343
346
|
if source_path is not None:
|
344
347
|
line.append(source_path)
|
tme/parser.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements parsers for atomic structure file formats.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import re
|
@@ -560,7 +561,7 @@ class StarParser(MMCIFParser):
|
|
560
561
|
.. [1] https://www.iucr.org/__data/assets/file/0013/11416/star.5.html
|
561
562
|
"""
|
562
563
|
|
563
|
-
def parse_input(self, lines: List[str], delimiter: str =
|
564
|
+
def parse_input(self, lines: List[str], delimiter: str = None) -> Dict:
|
564
565
|
pattern = re.compile(r"\s*#.*")
|
565
566
|
|
566
567
|
ret, category, block = {}, None, []
|
tme/preprocessor.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements Preprocessor class for filtering operations.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import os
|
tme/rotations.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements various means of generating rotation matrices.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023-2025 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import yaml
|
@@ -183,12 +184,14 @@ def euler_to_rotationmatrix(angles: Tuple[float], seq: str = "zyz") -> NDArray:
|
|
183
184
|
NDArray
|
184
185
|
The generated rotation matrix.
|
185
186
|
"""
|
187
|
+
angles = np.asarray(angles)
|
188
|
+
|
186
189
|
n_angles = len(angles)
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
+
if angles.ndim == 2:
|
191
|
+
n_angles = angles.shape[1]
|
192
|
+
|
190
193
|
rotation_matrix = Rotation.from_euler(
|
191
|
-
seq=
|
194
|
+
seq=seq[:n_angles], angles=angles, degrees=True
|
192
195
|
)
|
193
196
|
return rotation_matrix.as_matrix().astype(np.float32)
|
194
197
|
|
tme/structure.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
"""
|
1
|
+
"""
|
2
|
+
Implements class Structure to represent atomic structures.
|
2
3
|
|
3
|
-
|
4
|
+
Copyright (c) 2023 European Molecular Biology Laboratory
|
4
5
|
|
5
|
-
|
6
|
+
Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
6
7
|
"""
|
7
8
|
|
8
9
|
import warnings
|
tests/data/Maps/.DS_Store
DELETED
Binary file
|
tests/data/Structures/.DS_Store
DELETED
Binary file
|
File without changes
|
File without changes
|
File without changes
|