pytme 0.3.1.post1__cp311-cp311-macosx_15_0_arm64.whl → 0.3.2.dev0__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.dev0.data/scripts/estimate_ram_usage.py +97 -0
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/match_template.py +213 -196
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/postprocess.py +40 -78
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/preprocess.py +4 -5
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/preprocessor_gui.py +50 -103
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/pytme_runner.py +46 -69
- {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/METADATA +2 -1
- pytme-0.3.2.dev0.dist-info/RECORD +136 -0
- 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 +50 -103
- scripts/pytme_runner.py +46 -69
- scripts/refine_matches.py +5 -7
- 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_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 +124 -71
- tme/backends/cupy_backend.py +6 -19
- tme/backends/jax_backend.py +110 -105
- 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 +102 -58
- 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 +28 -8
- tme/preprocessor.py +0 -239
- tme/rotations.py +102 -70
- tme/structure.py +601 -631
- tme/types.py +1 -0
- pytme-0.3.1.post1.dist-info/RECORD +0 -133
- {pytme-0.3.1.post1.data → pytme-0.3.2.dev0.data}/scripts/estimate_memory_usage.py +0 -0
- {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/WHEEL +0 -0
- {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/entry_points.txt +0 -0
- {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/licenses/LICENSE +0 -0
- {pytme-0.3.1.post1.dist-info → pytme-0.3.2.dev0.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,7 @@ import subprocess
|
|
8
8
|
from abc import ABC, abstractmethod
|
9
9
|
|
10
10
|
from pathlib import Path
|
11
|
-
from dataclasses import dataclass
|
11
|
+
from dataclasses import dataclass, field, fields
|
12
12
|
from typing import Dict, List, Optional, Any
|
13
13
|
|
14
14
|
from tme.backends import backend as be
|
@@ -149,7 +149,7 @@ class AnalysisDatasetDiscovery(DatasetDiscovery):
|
|
149
149
|
|
150
150
|
#: Glob pattern for TM pickle files, e.g., "/data/results/*.pickle"
|
151
151
|
input_patterns: List[str]
|
152
|
-
#: List of glob patterns for background files, e.g., ["
|
152
|
+
#: List of glob patterns for background files, e.g., ["bg1/*.pickle", "bg2/*."]
|
153
153
|
background_patterns: List[str] = None
|
154
154
|
#: Target masks, e.g., "/data/masks/*.mrc"
|
155
155
|
mask_patterns: Optional[str] = None
|
@@ -230,46 +230,47 @@ class TMParameters:
|
|
230
230
|
axis_sampling: Optional[float] = None
|
231
231
|
axis_symmetry: int = 1
|
232
232
|
cone_axis: int = 2
|
233
|
-
invert_cone: bool = False
|
234
|
-
no_use_optimized_set: bool = False
|
233
|
+
invert_cone: bool = field(default=False, metadata={"flag": True})
|
234
|
+
no_use_optimized_set: bool = field(default=False, metadata={"flag": True})
|
235
235
|
|
236
236
|
# Microscope parameters
|
237
237
|
acceleration_voltage: float = 300.0 # kV
|
238
238
|
spherical_aberration: float = 2.7e7 # Å
|
239
239
|
amplitude_contrast: float = 0.07
|
240
240
|
defocus: Optional[float] = None # Å
|
241
|
-
phase_shift: float = 0.0 #
|
241
|
+
phase_shift: float = 0.0 # degrees
|
242
242
|
|
243
243
|
# Processing options
|
244
244
|
lowpass: Optional[float] = None # Å
|
245
245
|
highpass: Optional[float] = None # Å
|
246
246
|
pass_format: str = "sampling_rate" # "sampling_rate", "voxel", "frequency"
|
247
|
-
no_pass_smooth: bool = True
|
247
|
+
no_pass_smooth: bool = field(default=True, metadata={"flag": False})
|
248
248
|
interpolation_order: int = 3
|
249
249
|
score_threshold: float = 0.0
|
250
250
|
score: str = "FLCSphericalMask"
|
251
|
+
background_correction: Optional[str] = None
|
251
252
|
|
252
253
|
# Weighting and correction
|
253
254
|
tilt_weighting: Optional[str] = None # "angle", "relion", "grigorieff"
|
254
255
|
wedge_axes: str = "2,0"
|
255
|
-
whiten_spectrum: bool = False
|
256
|
-
scramble_phases: bool = False
|
257
|
-
invert_target_contrast: bool = False
|
256
|
+
whiten_spectrum: bool = field(default=False, metadata={"flag": True})
|
257
|
+
scramble_phases: bool = field(default=False, metadata={"flag": True})
|
258
|
+
invert_target_contrast: bool = field(default=False, metadata={"flag": True})
|
258
259
|
|
259
260
|
# CTF parameters
|
260
261
|
ctf_file: Optional[Path] = None
|
261
|
-
no_flip_phase: bool = True
|
262
|
-
correct_defocus_gradient: bool = False
|
262
|
+
no_flip_phase: bool = field(default=True, metadata={"flag": False})
|
263
|
+
correct_defocus_gradient: bool = field(default=False, metadata={"flag": True})
|
263
264
|
|
264
265
|
# Performance options
|
265
|
-
centering: bool = False
|
266
|
-
pad_edges: bool = False
|
267
|
-
pad_filter: bool = False
|
268
|
-
use_mixed_precision: bool = False
|
269
|
-
use_memmap: bool = False
|
266
|
+
centering: bool = field(default=False, metadata={"flag": True})
|
267
|
+
pad_edges: bool = field(default=False, metadata={"flag": True})
|
268
|
+
pad_filter: bool = field(default=False, metadata={"flag": True})
|
269
|
+
use_mixed_precision: bool = field(default=False, metadata={"flag": True})
|
270
|
+
use_memmap: bool = field(default=False, metadata={"flag": True})
|
270
271
|
|
271
272
|
# Analysis options
|
272
|
-
peak_calling: bool = False
|
273
|
+
peak_calling: bool = field(default=False, metadata={"flag": True})
|
273
274
|
num_peaks: int = 1000
|
274
275
|
|
275
276
|
# Backend selection
|
@@ -279,7 +280,7 @@ class TMParameters:
|
|
279
280
|
# Reconstruction
|
280
281
|
reconstruction_filter: str = "ramp"
|
281
282
|
reconstruction_interpolation_order: int = 1
|
282
|
-
no_filter_target: bool = False
|
283
|
+
no_filter_target: bool = field(default=False, metadata={"flag": True})
|
283
284
|
|
284
285
|
def __post_init__(self):
|
285
286
|
"""Validate parameters and convert units."""
|
@@ -337,6 +338,9 @@ class TMParameters:
|
|
337
338
|
args["ctf-file"] = str(files.metadata)
|
338
339
|
args["tilt-angles"] = str(files.metadata)
|
339
340
|
|
341
|
+
if self.background_correction:
|
342
|
+
args["background-correction"] = self.background_correction
|
343
|
+
|
340
344
|
# Optional parameters
|
341
345
|
if self.lowpass:
|
342
346
|
args["lowpass"] = self.lowpass
|
@@ -378,43 +382,26 @@ class TMParameters:
|
|
378
382
|
return {k: v for k, v in args.items() if v is not None}
|
379
383
|
|
380
384
|
def get_flags(self) -> List[str]:
|
381
|
-
"""Get boolean flags for pyTME command."""
|
382
385
|
flags = []
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
if self.use_mixed_precision:
|
398
|
-
flags.append("use-mixed-precision")
|
399
|
-
if self.use_memmap:
|
400
|
-
flags.append("use-memmap")
|
401
|
-
if self.peak_calling:
|
402
|
-
flags.append("peak-calling")
|
403
|
-
if not self.no_flip_phase:
|
404
|
-
flags.append("no-flip-phase")
|
405
|
-
if self.correct_defocus_gradient:
|
406
|
-
flags.append("correct-defocus-gradient")
|
407
|
-
if self.invert_cone:
|
408
|
-
flags.append("invert-cone")
|
409
|
-
if self.no_use_optimized_set:
|
410
|
-
flags.append("no-use-optimized-set")
|
411
|
-
if self.no_filter_target:
|
412
|
-
flags.append("no-filter-target")
|
386
|
+
|
387
|
+
for field_info in fields(self):
|
388
|
+
flag_meta = field_info.metadata.get("flag")
|
389
|
+
if flag_meta is None:
|
390
|
+
continue
|
391
|
+
|
392
|
+
value = getattr(self, field_info.name)
|
393
|
+
if not isinstance(value, bool):
|
394
|
+
continue
|
395
|
+
|
396
|
+
flag_name = field_info.name.replace("_", "-")
|
397
|
+
if (flag_meta is True and value) or (flag_meta is False and not value):
|
398
|
+
flags.append(flag_name)
|
399
|
+
|
413
400
|
return flags
|
414
401
|
|
415
402
|
|
416
403
|
@dataclass
|
417
|
-
class AnalysisParameters:
|
404
|
+
class AnalysisParameters(TMParameters):
|
418
405
|
"""Parameters for template matching analysis and peak calling."""
|
419
406
|
|
420
407
|
# Peak calling
|
@@ -424,13 +411,12 @@ class AnalysisParameters:
|
|
424
411
|
max_score: Optional[float] = None
|
425
412
|
min_distance: int = 5
|
426
413
|
min_boundary_distance: int = 0
|
427
|
-
mask_edges: bool = False
|
414
|
+
mask_edges: bool = field(default=False, metadata={"flag": True})
|
428
415
|
n_false_positives: Optional[int] = None
|
429
416
|
|
430
417
|
# Output format
|
431
418
|
output_format: str = "relion4"
|
432
419
|
output_directory: Optional[str] = None
|
433
|
-
angles_clockwise: bool = False
|
434
420
|
|
435
421
|
# Advanced options
|
436
422
|
extraction_box_size: Optional[int] = None
|
@@ -468,15 +454,6 @@ class AnalysisParameters:
|
|
468
454
|
|
469
455
|
return {k: v for k, v in args.items() if v is not None}
|
470
456
|
|
471
|
-
def get_flags(self) -> List[str]:
|
472
|
-
"""Get boolean flags for analyze_template_matching command."""
|
473
|
-
flags = []
|
474
|
-
if self.mask_edges:
|
475
|
-
flags.append("mask-edges")
|
476
|
-
if self.angles_clockwise:
|
477
|
-
flags.append("angles-clockwise")
|
478
|
-
return flags
|
479
|
-
|
480
457
|
|
481
458
|
@dataclass
|
482
459
|
class ComputeResources:
|
@@ -592,12 +569,10 @@ class ExecutionBackend(ABC):
|
|
592
569
|
@abstractmethod
|
593
570
|
def submit_job(self, task) -> str:
|
594
571
|
"""Submit a single job and return job ID or status."""
|
595
|
-
pass
|
596
572
|
|
597
573
|
@abstractmethod
|
598
574
|
def submit_jobs(self, tasks: List) -> List[str]:
|
599
575
|
"""Submit multiple jobs and return list of job IDs."""
|
600
|
-
pass
|
601
576
|
|
602
577
|
|
603
578
|
class SlurmBackend(ExecutionBackend):
|
@@ -841,6 +816,13 @@ def parse_args():
|
|
841
816
|
default="FLCSphericalMask",
|
842
817
|
help="Template matching scoring function. Use FLC if mask is not spherical.",
|
843
818
|
)
|
819
|
+
tm_group.add_argument(
|
820
|
+
"--background-correction",
|
821
|
+
choices=["phase-scrambling"],
|
822
|
+
required=False,
|
823
|
+
help="Transform cross-correlation into SNR-like values using a given method: "
|
824
|
+
"'phase-scrambling' uses a phase-scrambled template as background",
|
825
|
+
)
|
844
826
|
tm_group.add_argument(
|
845
827
|
"--score-threshold", type=float, default=0.0, help="Minimum score threshold"
|
846
828
|
)
|
@@ -1006,11 +988,6 @@ def parse_args():
|
|
1006
988
|
default="relion4",
|
1007
989
|
help="Output format for analysis results",
|
1008
990
|
)
|
1009
|
-
output_group.add_argument(
|
1010
|
-
"--angles-clockwise",
|
1011
|
-
action="store_true",
|
1012
|
-
help="Report Euler angles in clockwise format expected by RELION",
|
1013
|
-
)
|
1014
991
|
|
1015
992
|
advanced_group = analysis_parser.add_argument_group("Advanced Options")
|
1016
993
|
advanced_group.add_argument(
|
@@ -1077,6 +1054,7 @@ def run_matching(args, resources):
|
|
1077
1054
|
backend=args.backend,
|
1078
1055
|
whiten_spectrum=args.whiten_spectrum,
|
1079
1056
|
scramble_phases=args.scramble_phases,
|
1057
|
+
background_correction=args.background_correction,
|
1080
1058
|
)
|
1081
1059
|
print_params = params.to_command_args(files[0], "")
|
1082
1060
|
_ = print_params.pop("target")
|
@@ -1132,7 +1110,6 @@ def run_analysis(args, resources):
|
|
1132
1110
|
mask_edges=args.mask_edges,
|
1133
1111
|
n_false_positives=args.n_false_positives,
|
1134
1112
|
output_format=args.output_format,
|
1135
|
-
angles_clockwise=args.angles_clockwise,
|
1136
1113
|
extraction_box_size=args.extraction_box_size,
|
1137
1114
|
)
|
1138
1115
|
print_params = params.to_command_args(files[0], Path(""))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pytme
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.2.dev0
|
4
4
|
Summary: Python Template Matching Engine
|
5
5
|
Author: Valentin Maurer
|
6
6
|
Author-email: Valentin Maurer <valentin.maurer@embl-hamburg.de>
|
@@ -24,6 +24,7 @@ Requires-Dist: psutil
|
|
24
24
|
Requires-Dist: h5py
|
25
25
|
Requires-Dist: importlib_resources
|
26
26
|
Requires-Dist: joblib
|
27
|
+
Requires-Dist: pydantic
|
27
28
|
Provides-Extra: cupy
|
28
29
|
Requires-Dist: cupy-cuda12x>13.0.0; extra == "cupy"
|
29
30
|
Requires-Dist: voltools; extra == "cupy"
|
@@ -0,0 +1,136 @@
|
|
1
|
+
pytme-0.3.2.dev0.data/scripts/estimate_memory_usage.py,sha256=Ry46LXUv3SZ0g41g3RDUg9UH6hiSnnG3mHTyaGletXE,2114
|
2
|
+
pytme-0.3.2.dev0.data/scripts/estimate_ram_usage.py,sha256=R1NDpFajcF-MonJ4a43SfDlA-nxBYwK7D2quzCdsVFM,2767
|
3
|
+
pytme-0.3.2.dev0.data/scripts/match_template.py,sha256=h-t-BfG501vk6AprUYOFljkXHuJS2giUY8A5Mk8N93c,39532
|
4
|
+
pytme-0.3.2.dev0.data/scripts/postprocess.py,sha256=4pdJNKZcASnN09SMAiscEoxTK5iNQSjg-DIl1eRlHaA,26287
|
5
|
+
pytme-0.3.2.dev0.data/scripts/preprocess.py,sha256=0GVzGWG0r1cAfOAsKaNAbJ7yq7CrQQ7GCiX-pQCyf3Y,6287
|
6
|
+
pytme-0.3.2.dev0.data/scripts/preprocessor_gui.py,sha256=637ELl4ncSTmdUnVsmjpP0tgCJSSAZpnKeEa_ncLbcs,42433
|
7
|
+
pytme-0.3.2.dev0.data/scripts/pytme_runner.py,sha256=KkuTHy6LOaInt6xqbti25w-qpEhZAjInv0Ms8qw3qYc,40207
|
8
|
+
pytme-0.3.2.dev0.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
9
|
+
scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
+
scripts/estimate_memory_usage.py,sha256=UiaX30o_H59vzTQZaXISxgzWj5jwgFbMoH1E5ydVHcw,2115
|
11
|
+
scripts/estimate_ram_usage.py,sha256=rN7haobnHg3YcgGJIp81FNiCzy8-saJGeEurQlmQmNQ,2768
|
12
|
+
scripts/eval.py,sha256=ebJVLxbRlB6TI5YHNr0VavZ4lmaRdf8QVafyiDhh_oU,2528
|
13
|
+
scripts/extract_candidates.py,sha256=B2O4Xm0eVJzBZOblfkH5za8fTxLIdBRDl89Qwkq4Kjk,8097
|
14
|
+
scripts/match_template.py,sha256=z32gpSEumIvn9x0Y-ffc0I_viTB1y56cL-l_xn5SCJs,39533
|
15
|
+
scripts/match_template_devel.py,sha256=ZJiom1pzOnwbPYTe0Q-NwJOgAB7aKRKhBzB6cyz4ix0,46596
|
16
|
+
scripts/match_template_filters.py,sha256=Gj4a1b_S5NWp_dfFEPFn0D7jGf-qYgBbnTvZZ4bwqOQ,42036
|
17
|
+
scripts/postprocess.py,sha256=XMO7XyyuMF14_bgqk4UOwYFFc6-VLQ5AGnGGynZYhs4,26288
|
18
|
+
scripts/preprocess.py,sha256=NfMRP8wgSkNxWjjhQxKW15ysFdRv0Dx4ve1Z2kgFHDs,6288
|
19
|
+
scripts/preprocessor_gui.py,sha256=gtFwEXt6IVbpfj2laXfwLsEQd8JyikOof2yuN6ONsbw,42434
|
20
|
+
scripts/pytme_runner.py,sha256=bxe7txORNA4mG-4EaWtQajg4fR9lfIIuAz-J3afUc7A,40208
|
21
|
+
scripts/refine_matches.py,sha256=dLu3aW0-iAn0Qn-GoQBaZfgEGUcTWMQ2J2tA8aNm5Yo,12725
|
22
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
+
tests/test_analyzer.py,sha256=sPjWod8zVUkrXCiY33DoZHjkXelXj_DU4vct-5g7tL8,8084
|
24
|
+
tests/test_backends.py,sha256=ve7ySJ8Ty1iVjQv2JxzscobDGaPlpJJIyS7uEZgL1ac,18267
|
25
|
+
tests/test_density.py,sha256=Zu3jfVba5tnyGQnkcSq9vEF3VejIjPQzC_34hDiB3Uw,20432
|
26
|
+
tests/test_extensions.py,sha256=1Zv9dG_dmmC2mlbX91YIPyGLSToPC0202-ffLAfVcr4,5203
|
27
|
+
tests/test_matching_cli.py,sha256=Zjl-4AvRom2uSDDjq5PGUCdrf-LRlNp3JDSTPrwUYPg,11707
|
28
|
+
tests/test_matching_data.py,sha256=U6ISe4lBLDj-OzgA6QAaoO_aegCJjPtXqHbPiPZ2tkA,6091
|
29
|
+
tests/test_matching_exhaustive.py,sha256=WyyFkhiCrRqeLEhWsI-qbd3ZeX9yHViad9P59ZyuFOk,4058
|
30
|
+
tests/test_matching_memory.py,sha256=XrBGRi4cIp3-4nN6s7tj0pBbFJrvJaG3vQdtK-6uzY0,1151
|
31
|
+
tests/test_matching_optimization.py,sha256=bYt3d_nHewTRxKCXgGaMLhObkqBufGwrYL4gfinr_jE,7732
|
32
|
+
tests/test_matching_utils.py,sha256=I1PRtt7NeFq42yoPIUfOXJA_d-9FZw6pLEB99LhJygY,4900
|
33
|
+
tests/test_orientations.py,sha256=ydqYZc3mOWSweFEGWMrMaygxX7-7in7forUtiNWfQKc,6767
|
34
|
+
tests/test_parser.py,sha256=57oaksWrKNB4Z_22IxfW0nXMyQWLJFVsuvnJQPhMn10,993
|
35
|
+
tests/test_rotations.py,sha256=r2bFARrJzElyoPeD_1VfeS_4_Bdg2dYzKnI6seKhmmQ,4894
|
36
|
+
tests/test_structure.py,sha256=EddKMy5AhJyToRUUNQwCgA7WmBAjhiMoakGjJ0TLZb8,8570
|
37
|
+
tests/data/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
38
|
+
tests/data/README.md,sha256=RMyG_mojKLo6AEIHUj40nTPI7ZGcs_6dRzWSRGxTgGY,83
|
39
|
+
tests/data/Blurring/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
40
|
+
tests/data/Blurring/blob_width18.npy,sha256=_BVu5T2q_8N5lA2KCMUTLwknec8fHXh9Nsyoa4ov0wo,21408
|
41
|
+
tests/data/Blurring/edgegaussian_sigma3.npy,sha256=OvxXAyJs5V_m7b91BFhBqS9BnisKWbckVcMlHuChQiY,21408
|
42
|
+
tests/data/Blurring/gaussian_sigma2.npy,sha256=OS9sNpu0Y7l--X8dyB-mp-EE5eaNHISqiNkOOutllfc,21408
|
43
|
+
tests/data/Blurring/hamming_width6.npy,sha256=yKdrOYGfHn-ER7GpTzASqfLZHkAR7AFeBcNRXrs4aIg,21408
|
44
|
+
tests/data/Blurring/kaiserb_width18.npy,sha256=08grtR1E2dWRfksiPrEdN0nQwugd6o-TV5lKwnuLXQg,21408
|
45
|
+
tests/data/Blurring/localgaussian_sigma0510.npy,sha256=KXASnlhxAnvvcgIDCniIHkak-NhsF_QmSV7j-p9kSk4,21408
|
46
|
+
tests/data/Blurring/mean_size5.npy,sha256=2APwsCR_1fpwGIc_mG0dPegpcbgXhUbcEEeQo9Wa1iA,42688
|
47
|
+
tests/data/Blurring/ntree_sigma0510.npy,sha256=HxYh_ItxdKulp8UiPMzQ0ze2iiQ3Oi7seWFvEzO1kWQ,21408
|
48
|
+
tests/data/Blurring/rank_rank3.npy,sha256=MxCsomoNPmiV0Cd-5nl2S8TYCfLyEj-WV19gLH_xe0c,21408
|
49
|
+
tests/data/Maps/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
50
|
+
tests/data/Maps/emd_8621.mrc.gz,sha256=ZAlSOQRT9B_e8xpeodio9j0WBzygl2R1ctg9m8QhCRA,4572566
|
51
|
+
tests/data/Raw/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
52
|
+
tests/data/Raw/em_map.map,sha256=YeY_R0p-90-oZgxfbKGIsyE5bui_uWq9iGhWl0bLYZI,22304
|
53
|
+
tests/data/Structures/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
|
54
|
+
tests/data/Structures/1pdj.cif,sha256=QdO4e2ulO621PVoK3q9n0qDPDKnzJpV6sPeG6zQec1A,169343
|
55
|
+
tests/data/Structures/1pdj.pdb,sha256=nTFGjecultoXNVUBDdsyho0CEzX5i1fSo_aBYDh5-pU,115749
|
56
|
+
tests/data/Structures/5khe.cif,sha256=SnC0so37wyuoYwAX5UDTTLvQiknZXxeJrvkGai-11rw,214644
|
57
|
+
tests/data/Structures/5khe.ent,sha256=AjXInxR_DgglZATzSNgB1rs7-LgAn2G1NdgnHb6fAmM,179010
|
58
|
+
tests/data/Structures/5khe.pdb,sha256=AjXInxR_DgglZATzSNgB1rs7-LgAn2G1NdgnHb6fAmM,179010
|
59
|
+
tests/data/Structures/5uz4.cif,sha256=KIcBaOf-RvOV4VRl1AU_EK4BsMxGXS8s8_UdlIhyeWk,6079401
|
60
|
+
tests/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
|
+
tests/preprocessing/test_compose.py,sha256=zwvyX6AK3y6ZYOiZ5bUzSLKffRocoyte9-c5eoQryIk,2543
|
62
|
+
tests/preprocessing/test_frequency_filters.py,sha256=y5kTyUC-RtTWzFeWJWt3R7pkHJRtEuRNSAHx0IhMuXA,6348
|
63
|
+
tests/preprocessing/test_preprocessor.py,sha256=5RZM2lWeZlV64kS3ZcntCRhtZab6mXIsnXALbpLrQ6I,4137
|
64
|
+
tests/preprocessing/test_utils.py,sha256=5cU8v-CnYOnLi-h3MyPhIuFfu9jPy1oMKtWl5M5fbI0,4053
|
65
|
+
tme/__init__.py,sha256=GXfIuzU4fh2KZfgUOIXnNeKlJ8kSp3EqoBr6bSik848,217
|
66
|
+
tme/__version__.py,sha256=vNiWJ14r_cw5t_7UDqDQIVZvladKFGyHH2avsLpN7Vg,22
|
67
|
+
tme/cli.py,sha256=oIpsVoImiDescf-iO39Clyq5vddc5_NNZAU_oD_mZ5c,3660
|
68
|
+
tme/density.py,sha256=Kpz1QbimwabVa4Y-HsADUymnZtfXplIasaC3ue5Tpas,83769
|
69
|
+
tme/extensions.cpython-311-darwin.so,sha256=Nx_f6KFkVpE-1sDsZVo3tckYag1-k7AHQR3u3ZBwXxE,416944
|
70
|
+
tme/mask.py,sha256=IZbiVhUHJjMP3W95iM3LArcXMpvk3H0yQ3LGlinH_So,10474
|
71
|
+
tme/matching_data.py,sha256=lpRPeBlEPtsvIu6S46Ud56WgpzFGTCN77d9Aq3LMkp0,34100
|
72
|
+
tme/matching_exhaustive.py,sha256=bx-kjGkSi1eRurg1GZ3nvtm32n8P3Tgm51eKSIzZfgw,16340
|
73
|
+
tme/matching_optimization.py,sha256=Ld7q_SqsPILrtbHU0kUOWb-Fzlmrk3okxO792p1iy7o,43996
|
74
|
+
tme/matching_scores.py,sha256=DpxaKeiFfNIohHzDjoXXzUmA2n59ttV_WiB-QXZjJGo,42593
|
75
|
+
tme/matching_utils.py,sha256=bvyfStu9pW-_YZuHlcGU3D_3eQwOiBLZOp3yp70fCEs,29839
|
76
|
+
tme/memory.py,sha256=J0IDrCDcINbf3lClG_4u-NCMOPhKoWy_x9KAvPJYnos,9711
|
77
|
+
tme/orientations.py,sha256=iMS0lTutm8FqJ0bCM4-QfWlYVZiiCJ1Kd-9mzNa_lkk,22406
|
78
|
+
tme/parser.py,sha256=d59A7meIUJ8OzfB6eaVqd7CwLj9oYnOfubqlvygbu1U,24210
|
79
|
+
tme/preprocessor.py,sha256=9yuW_-oDnsbMNDWXLuNTfcoLfA-7nsA8xzEOk_iNEDI,32027
|
80
|
+
tme/rotations.py,sha256=DHhdq6S3IHOQOn_nLY6SG7RGkb0CvqUoC8of6yNLBIo,11386
|
81
|
+
tme/structure.py,sha256=ymmn3vV3Df9V55OaxDrv1D-KklwVardg3WKx-RfbtH4,69485
|
82
|
+
tme/types.py,sha256=s5Firx8IpYJF-D2UUkkhWMYWllUoAI3zEVFx1Xvs9zw,486
|
83
|
+
tme/analyzer/__init__.py,sha256=aJyVGlQwO6Ij-_NZ5rBlgBQQSIj0dqpUwlmvIvnQqBM,89
|
84
|
+
tme/analyzer/_utils.py,sha256=48Xq2Hi_P3VYl1SozYz3WwEj3BwL1QdtFYx7dTxv0bc,6344
|
85
|
+
tme/analyzer/aggregation.py,sha256=GNp2t033JrL9CYnVLYvu_ECTmQPlnY480oEWecRJ3iU,29710
|
86
|
+
tme/analyzer/base.py,sha256=uyDuzYy7wRYGESMCRaXiKsOfE-ooduvNAruwMBZVwZs,5114
|
87
|
+
tme/analyzer/peaks.py,sha256=A59Qrd6bwDsvvlY25eA7U4ZnziEanHOfTfiWkzSoJ0k,33137
|
88
|
+
tme/analyzer/proxy.py,sha256=Nm_blf2uxHB5qZoRkGH5w980NxmPOl8_fhz39ATTQMo,4855
|
89
|
+
tme/backends/__init__.py,sha256=VUvEnpfjmZQVn_9QHkLPBoa6y8M3gDyNNL9kq4OQNGE,5249
|
90
|
+
tme/backends/_cupy_utils.py,sha256=scxCSK9BcsDaIbHR2mFxAJRIxdc0r5JTC1gCJmVJa64,24558
|
91
|
+
tme/backends/_jax_utils.py,sha256=ugxDfojx7jx9Lrd9eZtmoBJUN9XUsK1t3NpcbauBJNw,7925
|
92
|
+
tme/backends/_numpyfftw_utils.py,sha256=RnYgbSs_sL-NlwYGRqU9kziq0U5qzl9GecVx9uUeSJs,7904
|
93
|
+
tme/backends/cupy_backend.py,sha256=t9DmcKZbGmeJll5-brb7ajUdM8BJjClHe0L7W57gWd8,7698
|
94
|
+
tme/backends/jax_backend.py,sha256=UOzEg64nRNn8WL2VteJTbDL_3DRM47BFjVGh5E1xDvQ,12720
|
95
|
+
tme/backends/matching_backend.py,sha256=zTGwLu57kmIY-2IBQ0GakLztf6EM3cGAU788UeAMI0k,32730
|
96
|
+
tme/backends/mlx_backend.py,sha256=FVdAPozUCDtSRQXyxEEKlmhnAZlKhbl8KaZkwxmcSnI,5676
|
97
|
+
tme/backends/npfftw_backend.py,sha256=C-3yUZNWd9eSUm5LiaWlCosoAQawyaP27l1KNVs0rMQ,18555
|
98
|
+
tme/backends/pytorch_backend.py,sha256=MT-5w3zp_uWhdaHqhNyVM4xTWa1OrJJbCVy99cuzMro,13567
|
99
|
+
tme/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
100
|
+
tme/data/c48n309.npy,sha256=NwH64mOEbm3tStq5c98o81fY1vMOoq4nvXDAh7Z7iZg,296768
|
101
|
+
tme/data/c48n527.npy,sha256=saSUMTa1R0MisPvgFL02a7IHQSwEZ-mJu0v3qJjg5AU,506048
|
102
|
+
tme/data/c48n9.npy,sha256=bDVLV6mWjZHSQfeDc-MOCKKarfc1jaNeVvpoe2xMUy4,8768
|
103
|
+
tme/data/c48u1.npy,sha256=JeXMFzFITs2ezdc3x5lp3jo1cHHHHVADSA1Tpf77kXs,1088
|
104
|
+
tme/data/c48u1153.npy,sha256=ECiEximtYDWtIux3Fwe_EJlyn08gUqP85DN9gjkT9_k,1107008
|
105
|
+
tme/data/c48u1201.npy,sha256=aceC_Jeienz_81X4520nPpZcg5tnRhbW795EqbpWkrg,1153088
|
106
|
+
tme/data/c48u1641.npy,sha256=p4LwW3LzdTjrUUpA7H53RfNWxYfPX0XjeSwZ39Ac78Q,1575488
|
107
|
+
tme/data/c48u181.npy,sha256=mLYXrv1YHLH6DsBp5MkxHkxlxgMnj1mw_KKI0udH-FY,173888
|
108
|
+
tme/data/c48u2219.npy,sha256=p8TQeX8YHu4pdxnwJjEAlQWAPa66W7kpK96iZKZr9JE,2130368
|
109
|
+
tme/data/c48u27.npy,sha256=k03ZNEsoPwBKCy8IeIa5G0WRZqjGZMtX6Ibu7EpJHvU,26048
|
110
|
+
tme/data/c48u2947.npy,sha256=icI97ED6ct66y7FIaJAugmjzrIWk7CINCxtO3wDTnrU,2829248
|
111
|
+
tme/data/c48u3733.npy,sha256=tla-__Pf-hpN6h04vtFIfkkFdCLple11VO06kr1dXkM,3583808
|
112
|
+
tme/data/c48u4749.npy,sha256=tItOA4oV7SiqCCREwz3fyEpZoxM0lCq_jfEo5_-fp2s,4559168
|
113
|
+
tme/data/c48u5879.npy,sha256=bFk89MllIFCX_sLXTYWFquSyN1NuahH4wwnEsPJLxzA,5643968
|
114
|
+
tme/data/c48u7111.npy,sha256=CMy9kI2edH-q9eTIVdgUtXurplYNI7Uqp4dXfkkVdf8,6826688
|
115
|
+
tme/data/c48u815.npy,sha256=bCuJxLtm0Sjg3GGxtyjGzRYZ1G0Gz79XHI-71GvqQnI,782528
|
116
|
+
tme/data/c48u83.npy,sha256=7ODJYnsiuDjGbgd9GFopsyIW2IjrYI0J2X2f-cK868U,79808
|
117
|
+
tme/data/c48u8649.npy,sha256=-IPlpR4zrPQZWhhSPu4zEulFdrCEVgTMFffCB5d-huE,8303168
|
118
|
+
tme/data/c600v.npy,sha256=JqSu3ALoL1A9iguehc0YGUMFPsh2fprHHp76VXeFXIw,2528
|
119
|
+
tme/data/c600vc.npy,sha256=Yht-GFXDSjjGvsjFBvyxxEZAI-ODADPd5gEgFNZQVTA,14528
|
120
|
+
tme/data/metadata.yaml,sha256=fAgX-mEzB0QMHTEtYDG4cSMbJhYxBbDJH3sdvJvL7a8,750
|
121
|
+
tme/data/quat_to_numpy.py,sha256=-gkDZb10fKBxwfYrSLCUWvMB76TzZWELCeKsYProwws,1333
|
122
|
+
tme/data/scattering_factors.pickle,sha256=ZHktBc_AlS4H6uoER8AMmn5zOgjBwzgC92hUyww3Nik,38669
|
123
|
+
tme/external/bindings.cpp,sha256=CIukugVf55LicY2uSCasHWQlrlO9GS2iUuCR3WLvncM,12912
|
124
|
+
tme/filters/__init__.py,sha256=aDgaWTCcl01BVamzrc8iEyfTfeRB4OdNRU1ywRZ8450,292
|
125
|
+
tme/filters/_utils.py,sha256=PlvJ1rabhI8vAzlUmz-i3eIsdeOnWAw_dMvujm1Jx-U,12178
|
126
|
+
tme/filters/bandpass.py,sha256=b9XXTAKK5xNAM0TW9gk9eonQETMVqwM0TRqxMntRsac,8512
|
127
|
+
tme/filters/compose.py,sha256=YsrDRxl7_AkY-y9QrRotxfKMEKWqgmXb3jjBuOSXzyo,6523
|
128
|
+
tme/filters/ctf.py,sha256=kiPQlDsFdHfxhhZGNBi6pOq5Ve_XBUNrqorBqJY4MaM,22641
|
129
|
+
tme/filters/reconstruction.py,sha256=8cUL73LlnZkvDREaq595MWRRVaNcHuG6bpphTSHkjjI,5951
|
130
|
+
tme/filters/wedge.py,sha256=ycxaryDg0m4kQqT_i7dvVAEKmuMpKPxJfhxqjH-bFp8,17951
|
131
|
+
tme/filters/whitening.py,sha256=kW_iD37zKqrlSh4FXePjXbXYqaIoMtZIStcZVOdo9H8,4851
|
132
|
+
pytme-0.3.2.dev0.dist-info/METADATA,sha256=2ACPslKDjuhcb7QSstB4EZvXlrDfbfU3bU4NCzUEi3o,5008
|
133
|
+
pytme-0.3.2.dev0.dist-info/WHEEL,sha256=SPbiHAOPLnBtml4sk5MIwvWF6YnGfOfy9C__W6Bpeg4,109
|
134
|
+
pytme-0.3.2.dev0.dist-info/entry_points.txt,sha256=pbUSmB0J4Ghlg0w7jHfaFSvPMuvRWzeSuvdjdRPisAU,288
|
135
|
+
pytme-0.3.2.dev0.dist-info/top_level.txt,sha256=ovCUR7UXXouH3zYt_fJLoqr_vtjp1wudFgjVAnztQLE,18
|
136
|
+
pytme-0.3.2.dev0.dist-info/RECORD,,
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!python3
|
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()
|