|
20 | 20 |
|
21 | 21 | _deltas_rel_default = .2 ## the default relative error on the signal strength |
22 | 22 |
|
| 23 | +def printEnvironmentInfo( args ): |
| 24 | + """ very simple method that prints out info relevant to debugging |
| 25 | + machine-dependent problems """ |
| 26 | + print ( args ) |
| 27 | + import importlib, platform |
| 28 | + |
| 29 | + modules = [ "scipy", "sympy", "numpy", |
| 30 | + "pyslha", "unum", "pyhf" ] |
| 31 | + |
| 32 | + print("Environment Information:") |
| 33 | + print(f"Operating System: {platform.system()} {platform.release()}") |
| 34 | + print(f"Python Version: {platform.python_version()}") |
| 35 | + print(f"Machine Architecture: {platform.machine()}") |
| 36 | + print(f"Processor: {platform.processor()}") |
| 37 | + print("\nModule Versions:") |
| 38 | + |
| 39 | + for module_name in modules: |
| 40 | + try: |
| 41 | + module = importlib.import_module(module_name) |
| 42 | + version = getattr(module, '__version__', 'Unknown version attribute') |
| 43 | + print(f"{module_name:<12}: {version}") |
| 44 | + except ImportError: |
| 45 | + print(f"{module_name:<12}: Not installed") |
| 46 | + |
23 | 47 | def filetype ( filename ): |
24 | 48 | """ obtain information about the filetype of an input file, |
25 | 49 | currently only used to discriminate between slha and lhe |
@@ -53,12 +77,11 @@ def filetype ( filename ): |
53 | 77 | return None |
54 | 78 | return None |
55 | 79 |
|
56 | | - |
57 | 80 | def experimentalFeature( feature : str ) -> Union[None,bool]: |
58 | 81 | """ method to check if a certain experimental feature is enabled. |
59 | 82 | can be turned on and off via options:experimental in parameters.ini. |
60 | 83 | :param feature: ask for feature |
61 | | - |
| 84 | + |
62 | 85 | :returns: None if feature does not exist, else boolean |
63 | 86 | """ |
64 | 87 | if not feature in _experimental: |
@@ -99,4 +122,5 @@ def nCPUs(): |
99 | 122 | return None |
100 | 123 |
|
101 | 124 | if __name__ == "__main__": |
102 | | - print ( f"This machine has {nCPUs()} CPUs" ) |
| 125 | + printEnvironmentInfo() |
| 126 | + # print ( f"This machine has {nCPUs()} CPUs" ) |
0 commit comments