1 from pathlib
import Path
2 from typing
import Union
7 from .ActsPythonBindings
import *
8 from .ActsPythonBindings
import __version__
9 from .
import ActsPythonBindings
10 from ._adapter
import _patch_config
13 "ACTS_LOG_FAILURE_THRESHOLD" in os.environ
14 and os.environ[
"ACTS_LOG_FAILURE_THRESHOLD"] != logging.getFailureThreshold().name
17 "Runtime log failure threshold is given in environment variable "
18 f
"`ACTS_LOG_FAILURE_THRESHOLD={os.environ['ACTS_LOG_FAILURE_THRESHOLD']}`"
19 "However, a compile-time value is set via CMake, i.e. "
20 f
"`ACTS_LOG_FAILURE_THRESHOLD={logging.getFailureThreshold().name}`. "
21 "or `ACTS_ENABLE_LOG_FAILURE_THRESHOLD=OFF`, which disables runtime thresholds."
23 if "PYTEST_CURRENT_TEST" in os.environ:
25 raise RuntimeError(error)
27 warnings.warn(error +
"\nThe compile-time threshold will be used in this case!")
31 for prefix
in (
"Eigen",
"Atlas",
"StraightLine"):
32 _stepper = getattr(ActsPythonBindings, f
"{prefix}Stepper")
33 if isinstance(stepper, _stepper):
34 _detectorNavigator = getattr(ActsPythonBindings,
"DetectorNavigator")
35 if isinstance(navigator, _detectorNavigator):
37 ActsPythonBindings._propagator, f
"{prefix}DetectorPropagator"
39 return getattr(ActsPythonBindings._propagator, f
"{prefix}Propagator")(
42 raise TypeError(f
"Unknown stepper {type(stepper).__name__}")
50 if isinstance(file, str):
53 kwargs.setdefault(
"level", ActsPythonBindings.logging.INFO)
55 if file.suffix
in (
".json",
".cbor"):
56 c = ActsPythonBindings.MaterialMapJsonConverter.Config()
57 for k
in kwargs.keys():
59 setattr(c, k, kwargs.pop(k))
61 return ActsPythonBindings.JsonMaterialDecorator(
62 jFileName=
str(file), rConfig=c, **kwargs
64 elif file.suffix ==
".root":
65 return ActsPythonBindings._examples.RootMaterialDecorator(
66 fileName=
str(file), **kwargs
69 raise ValueError(f
"Unknown file type {file.suffix}")
72 ActsPythonBindings.IMaterialDecorator.fromFile = _decoratorFromFile