pytme 0.3b0__cp311-cp311-macosx_15_0_arm64.whl → 0.3b0.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.
Files changed (55) hide show
  1. {pytme-0.3b0.data → pytme-0.3b0.post1.data}/scripts/estimate_memory_usage.py +1 -5
  2. {pytme-0.3b0.data → pytme-0.3b0.post1.data}/scripts/match_template.py +163 -201
  3. {pytme-0.3b0.data → pytme-0.3b0.post1.data}/scripts/postprocess.py +48 -39
  4. {pytme-0.3b0.data → pytme-0.3b0.post1.data}/scripts/preprocess.py +10 -23
  5. {pytme-0.3b0.data → pytme-0.3b0.post1.data}/scripts/preprocessor_gui.py +3 -4
  6. pytme-0.3b0.post1.data/scripts/pytme_runner.py +769 -0
  7. {pytme-0.3b0.dist-info → pytme-0.3b0.post1.dist-info}/METADATA +14 -14
  8. {pytme-0.3b0.dist-info → pytme-0.3b0.post1.dist-info}/RECORD +54 -50
  9. {pytme-0.3b0.dist-info → pytme-0.3b0.post1.dist-info}/entry_points.txt +1 -0
  10. pytme-0.3b0.post1.dist-info/licenses/LICENSE +339 -0
  11. scripts/estimate_memory_usage.py +1 -5
  12. scripts/eval.py +93 -0
  13. scripts/match_template.py +163 -201
  14. scripts/match_template_filters.py +1200 -0
  15. scripts/postprocess.py +48 -39
  16. scripts/preprocess.py +10 -23
  17. scripts/preprocessor_gui.py +3 -4
  18. scripts/pytme_runner.py +769 -0
  19. scripts/refine_matches.py +0 -1
  20. tests/preprocessing/test_frequency_filters.py +19 -10
  21. tests/test_analyzer.py +122 -122
  22. tests/test_backends.py +1 -0
  23. tests/test_matching_cli.py +30 -30
  24. tests/test_matching_data.py +5 -5
  25. tests/test_matching_utils.py +1 -1
  26. tme/__version__.py +1 -1
  27. tme/analyzer/__init__.py +1 -1
  28. tme/analyzer/_utils.py +1 -4
  29. tme/analyzer/aggregation.py +15 -6
  30. tme/analyzer/base.py +25 -36
  31. tme/analyzer/peaks.py +39 -113
  32. tme/analyzer/proxy.py +1 -0
  33. tme/backends/_jax_utils.py +16 -15
  34. tme/backends/cupy_backend.py +9 -13
  35. tme/backends/jax_backend.py +19 -16
  36. tme/backends/npfftw_backend.py +27 -25
  37. tme/backends/pytorch_backend.py +4 -0
  38. tme/density.py +5 -4
  39. tme/filters/__init__.py +2 -2
  40. tme/filters/_utils.py +32 -7
  41. tme/filters/bandpass.py +225 -186
  42. tme/filters/ctf.py +117 -67
  43. tme/filters/reconstruction.py +38 -9
  44. tme/filters/wedge.py +88 -105
  45. tme/filters/whitening.py +1 -6
  46. tme/matching_data.py +24 -36
  47. tme/matching_exhaustive.py +14 -11
  48. tme/matching_scores.py +21 -12
  49. tme/matching_utils.py +13 -6
  50. tme/orientations.py +13 -3
  51. tme/parser.py +109 -29
  52. tme/preprocessor.py +2 -2
  53. pytme-0.3b0.dist-info/licenses/LICENSE +0 -153
  54. {pytme-0.3b0.dist-info → pytme-0.3b0.post1.dist-info}/WHEEL +0 -0
  55. {pytme-0.3b0.dist-info → pytme-0.3b0.post1.dist-info}/top_level.txt +0 -0
scripts/eval.py ADDED
@@ -0,0 +1,93 @@
1
+ #!python3
2
+ """ Apply tme.preprocessor.Preprocessor methods to an input file based
3
+ on a provided yaml configuration obtaiend from preprocessor_gui.py.
4
+
5
+ Copyright (c) 2023 European Molecular Biology Laboratory
6
+
7
+ Author: Valentin Maurer <valentin.maurer@embl-hamburg.de>
8
+ """
9
+ import yaml
10
+ import argparse
11
+ import textwrap
12
+ from tme import Preprocessor, Density
13
+
14
+
15
+ def parse_args():
16
+ parser = argparse.ArgumentParser(
17
+ description=textwrap.dedent(
18
+ """
19
+ Apply preprocessing to an input file based on a provided YAML configuration.
20
+
21
+ Expected YAML file format:
22
+ ```yaml
23
+ <method_name>:
24
+ <parameter1>: <value1>
25
+ <parameter2>: <value2>
26
+ ...
27
+ ```
28
+ """
29
+ ),
30
+ formatter_class=argparse.RawDescriptionHelpFormatter,
31
+ )
32
+ parser.add_argument(
33
+ "-i",
34
+ "--input_file",
35
+ type=str,
36
+ required=True,
37
+ help="Path to the input data file in CCP4/MRC format.",
38
+ )
39
+ parser.add_argument(
40
+ "-y",
41
+ "--yaml_file",
42
+ type=str,
43
+ required=True,
44
+ help="Path to the YAML configuration file.",
45
+ )
46
+ parser.add_argument(
47
+ "-o",
48
+ "--output_file",
49
+ type=str,
50
+ required=True,
51
+ help="Path to output file in CPP4/MRC format..",
52
+ )
53
+ parser.add_argument(
54
+ "--compress", action="store_true", help="Compress the output file using gzip."
55
+ )
56
+
57
+ args = parser.parse_args()
58
+
59
+ return args
60
+
61
+
62
+ def main():
63
+ args = parse_args()
64
+ with open(args.yaml_file, "r") as f:
65
+ preprocess_settings = yaml.safe_load(f)
66
+
67
+ if len(preprocess_settings) > 1:
68
+ raise NotImplementedError(
69
+ "Multiple preprocessing methods specified. "
70
+ "The script currently supports one method at a time."
71
+ )
72
+
73
+ method_name = list(preprocess_settings.keys())[0]
74
+ if not hasattr(Preprocessor, method_name):
75
+ raise ValueError(f"Method {method_name} does not exist in Preprocessor.")
76
+
77
+ density = Density.from_file(args.input_file)
78
+ output = density.empty
79
+
80
+ method_params = preprocess_settings[method_name]
81
+ preprocessor = Preprocessor()
82
+ method = getattr(preprocessor, method_name, None)
83
+ if not method:
84
+ raise ValueError(
85
+ f"{method} does not exist in dge.preprocessor.Preprocessor class."
86
+ )
87
+
88
+ output.data = method(template=density.data, **method_params)
89
+ output.to_file(args.output_file, gzip=args.compress)
90
+
91
+
92
+ if __name__ == "__main__":
93
+ main()