-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from azazellochg/devel
0.9.5
- Loading branch information
Showing
18 changed files
with
344 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!python | ||
# -*- coding: utf-8 -*- | ||
# ************************************************************************** | ||
# * | ||
# * Authors: Grigory Sharov ([email protected]) [1] | ||
|
@@ -30,38 +32,39 @@ | |
|
||
from .config import microscopes | ||
|
||
__version__ = '0.9.4' | ||
__version__ = '0.9.5' | ||
|
||
tests = ( | ||
("AFIS", "AFIS validation"), | ||
("Anisotropy", "Magnification anisotropy"), | ||
("C2Fringes", "C2 Fresnel fringes"), | ||
("Eucentricity", "Eucentricity check"), | ||
("GainRef", "Gain reference check"), | ||
("GoldDiffr", "Gold diffraction"), | ||
("InfoLimit", "Information limit (Young fringes)"), | ||
("PointRes", "Point resolution"), | ||
("StageDrift", "Stage drift"), | ||
("ThonRings", "Thon rings"), | ||
("TiltAxis", "Tilt axis offset"), | ||
) | ||
tests = { | ||
"AFIS": "AFIS validation", | ||
"AtlasRealignment": "Atlas realignment", | ||
"Anisotropy": "Magnification anisotropy", | ||
"C2Fringes": "C2 Fresnel fringes", | ||
"Eucentricity": "Eucentricity check", | ||
"GainRef": "Gain reference check", | ||
"GoldDiffr": "Gold diffraction", | ||
"InfoLimit": "Information limit", | ||
"PointRes": "Point resolution", | ||
"StageDrift": "Stage drift", | ||
"ThonRings": "Thon rings", | ||
"TiltAxis": "Tilt axis offset" | ||
} | ||
|
||
|
||
def show_all_tests(print_docstr: bool = False) -> None: | ||
""" Print list of tests, with an optional docstring for each. """ | ||
for num, test in enumerate(tests, start=1): | ||
print(f"\t[{num}] {test[1]}") | ||
for i, item in enumerate(tests.items()): | ||
print(f"\t[{i+1}] {item[1]}") | ||
if print_docstr: | ||
module = importlib.import_module("perfectem.scripts") | ||
func = getattr(module, test[0]) | ||
func = getattr(module, item[0]) | ||
print(func.__doc__) | ||
print("="*80) | ||
|
||
|
||
def main(argv: Optional[List] = None) -> None: | ||
try: | ||
import serialem | ||
except ImportError: | ||
except ModuleNotFoundError: | ||
raise ImportError("This program must be run on the computer with SerialEM Python module") | ||
|
||
parser = argparse.ArgumentParser(description="This script launches selected TEM performance test") | ||
|
@@ -79,16 +82,23 @@ def main(argv: Optional[List] = None) -> None: | |
raise IndexError("Wrong test number!") | ||
|
||
print("\nAvailable microscopes:") | ||
for scope_num, scope in enumerate(microscopes, start=1): | ||
print(f"\t[{scope_num}] {scope[0]}") | ||
for scope_num, scope in enumerate(microscopes.keys(), start=1): | ||
print(f"\t[{scope_num}] {scope}") | ||
|
||
scope_num = int(input("\nInput the microscope number: ").strip()) - 1 | ||
if scope_num not in range(len(microscopes)): | ||
raise IndexError("Wrong microscope number!") | ||
scope_name = microscopes[scope_num][0] | ||
scope_name = list(microscopes.keys())[scope_num] | ||
|
||
func_name = tests[test_num][0] | ||
func_name = list(tests.keys())[test_num] | ||
module = importlib.import_module("perfectem.scripts") | ||
func_object = getattr(module, func_name) | ||
print(func_object.__doc__) | ||
func_object(scope_name=scope_name, **microscopes[scope_num][1][func_name]).run() | ||
func_args = list(microscopes.values())[scope_num][func_name] | ||
func_object(scope_name=scope_name, **func_args).run() | ||
|
||
|
||
def main_gui() -> None: | ||
from .gui import Application | ||
gui = Application(tests, microscopes) | ||
gui.create_widgets() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.