fastlisaresponse 1.1.14__cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.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.
- fastlisaresponse/__init__.py +93 -0
- fastlisaresponse/_version.py +34 -0
- fastlisaresponse/cutils/__init__.py +141 -0
- fastlisaresponse/git_version.py +7 -0
- fastlisaresponse/git_version.py.in +7 -0
- fastlisaresponse/response.py +813 -0
- fastlisaresponse/utils/__init__.py +1 -0
- fastlisaresponse/utils/citations.py +356 -0
- fastlisaresponse/utils/config.py +793 -0
- fastlisaresponse/utils/exceptions.py +95 -0
- fastlisaresponse/utils/parallelbase.py +11 -0
- fastlisaresponse/utils/utility.py +82 -0
- fastlisaresponse-1.1.14.dist-info/METADATA +166 -0
- fastlisaresponse-1.1.14.dist-info/RECORD +17 -0
- fastlisaresponse-1.1.14.dist-info/WHEEL +6 -0
- fastlisaresponse_backend_cpu/git_version.py +7 -0
- fastlisaresponse_backend_cpu/responselisa.cpython-311-x86_64-linux-gnu.so +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""FastLISAResponse."""
|
|
2
|
+
|
|
3
|
+
# ruff: noqa: E402
|
|
4
|
+
try:
|
|
5
|
+
from fastlisaresponse._version import ( # pylint: disable=E0401,E0611
|
|
6
|
+
__version__,
|
|
7
|
+
__version_tuple__,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
except ModuleNotFoundError:
|
|
11
|
+
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version(__name__)
|
|
15
|
+
__version_tuple__ = tuple(__version__.split("."))
|
|
16
|
+
except PackageNotFoundError: # pragma: no cover
|
|
17
|
+
__version__ = "unknown"
|
|
18
|
+
__version_tuple__ = (0, 0, 0, "unknown")
|
|
19
|
+
finally:
|
|
20
|
+
del version, PackageNotFoundError
|
|
21
|
+
|
|
22
|
+
_is_editable: bool
|
|
23
|
+
try:
|
|
24
|
+
from . import _editable
|
|
25
|
+
|
|
26
|
+
_is_editable = True
|
|
27
|
+
del _editable
|
|
28
|
+
except (ModuleNotFoundError, ImportError):
|
|
29
|
+
_is_editable = False
|
|
30
|
+
|
|
31
|
+
from . import cutils, utils
|
|
32
|
+
from .cutils import KNOWN_BACKENDS
|
|
33
|
+
|
|
34
|
+
from gpubackendtools import Globals
|
|
35
|
+
from .cutils import FastLISAResponseCpuBackend, FastLISAResponseCuda11xBackend, FastLISAResponseCuda12xBackend
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
add_backends = {
|
|
39
|
+
"fastlisaresponse_cpu": FastLISAResponseCpuBackend,
|
|
40
|
+
"fastlisaresponse_cuda11x": FastLISAResponseCuda11xBackend,
|
|
41
|
+
"fastlisaresponse_cuda12x": FastLISAResponseCuda12xBackend,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Globals().backends_manager.add_backends(add_backends)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
from gpubackendtools import get_backend as _get_backend
|
|
49
|
+
from gpubackendtools import has_backend as _has_backend
|
|
50
|
+
from gpubackendtools import get_first_backend as _get_first_backend
|
|
51
|
+
from gpubackendtools.gpubackendtools import Backend
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_backend(backend: str) -> Backend:
|
|
55
|
+
__doc__ = _get_backend.__doc__
|
|
56
|
+
if "fastlisaresponse_" not in backend:
|
|
57
|
+
return _get_backend("fastlisaresponse_" + backend)
|
|
58
|
+
else:
|
|
59
|
+
return _get_backend(backend)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def has_backend(backend: str) -> Backend:
|
|
63
|
+
__doc__ = _has_backend.__doc__
|
|
64
|
+
if "fastlisaresponse_" not in backend:
|
|
65
|
+
return _has_backend("fastlisaresponse_" + backend)
|
|
66
|
+
else:
|
|
67
|
+
return _has_backend(backend)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def get_first_backend(backend: str) -> Backend:
|
|
71
|
+
__doc__ = _get_first_backend.__doc__
|
|
72
|
+
if "fastlisaresponse_" not in backend:
|
|
73
|
+
return _get_first_backend("fastlisaresponse_" + backend)
|
|
74
|
+
else:
|
|
75
|
+
return _get_first_backend(backend)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
from .response import pyResponseTDI, ResponseWrapper
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
__all__ = [
|
|
82
|
+
"__version__",
|
|
83
|
+
"__version_tuple__",
|
|
84
|
+
"_is_editable",
|
|
85
|
+
"pyResponseTDI",
|
|
86
|
+
"ResponseWrapper",
|
|
87
|
+
"get_logger",
|
|
88
|
+
"get_config",
|
|
89
|
+
"get_config_setter",
|
|
90
|
+
"get_backend",
|
|
91
|
+
"get_file_manager",
|
|
92
|
+
"has_backend",
|
|
93
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '1.1.14'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 1, 14)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import dataclasses
|
|
3
|
+
import enum
|
|
4
|
+
import types
|
|
5
|
+
import typing
|
|
6
|
+
import abc
|
|
7
|
+
from typing import Optional, Sequence, TypeVar, Union
|
|
8
|
+
from ..utils.exceptions import *
|
|
9
|
+
|
|
10
|
+
from gpubackendtools.gpubackendtools import BackendMethods, CpuBackend, Cuda11xBackend, Cuda12xBackend
|
|
11
|
+
from gpubackendtools.exceptions import *
|
|
12
|
+
|
|
13
|
+
@dataclasses.dataclass
|
|
14
|
+
class FastLISAResponseBackendMethods(BackendMethods):
|
|
15
|
+
get_response_wrap: typing.Callable[(...), None]
|
|
16
|
+
get_tdi_delays_wrap: typing.Callable[(...), None]
|
|
17
|
+
pycppDetector_fastlisa: object
|
|
18
|
+
|
|
19
|
+
class FastLISAResponseBackend:
|
|
20
|
+
get_response_wrap: typing.Callable[(...), None]
|
|
21
|
+
get_tdi_delays_wrap: typing.Callable[(...), None]
|
|
22
|
+
pycppDetector_fastlisa: object
|
|
23
|
+
|
|
24
|
+
def __init__(self, fastlisaresponse_backend_methods):
|
|
25
|
+
|
|
26
|
+
# set direct fastlisaresponse methods
|
|
27
|
+
# pass rest to general backend
|
|
28
|
+
assert isinstance(fastlisaresponse_backend_methods, FastLISAResponseBackendMethods)
|
|
29
|
+
|
|
30
|
+
self.get_response_wrap = fastlisaresponse_backend_methods.get_response_wrap
|
|
31
|
+
self.get_tdi_delays_wrap = fastlisaresponse_backend_methods.get_tdi_delays_wrap
|
|
32
|
+
self.pycppDetector_fastlisa = fastlisaresponse_backend_methods.pycppDetector_fastlisa
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FastLISAResponseCpuBackend(CpuBackend, FastLISAResponseBackend):
|
|
36
|
+
"""Implementation of the CPU backend"""
|
|
37
|
+
|
|
38
|
+
_backend_name = "fastlisaresponse_backend_cpu"
|
|
39
|
+
_name = "fastlisaresponse_cpu"
|
|
40
|
+
def __init__(self, *args, **kwargs):
|
|
41
|
+
CpuBackend.__init__(self, *args, **kwargs)
|
|
42
|
+
FastLISAResponseBackend.__init__(self, self.cpu_methods_loader())
|
|
43
|
+
|
|
44
|
+
@staticmethod
|
|
45
|
+
def cpu_methods_loader() -> FastLISAResponseBackendMethods:
|
|
46
|
+
try:
|
|
47
|
+
import fastlisaresponse_backend_cpu.responselisa
|
|
48
|
+
|
|
49
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
50
|
+
raise BackendUnavailableException(
|
|
51
|
+
"'cpu' backend could not be imported."
|
|
52
|
+
) from e
|
|
53
|
+
|
|
54
|
+
numpy = FastLISAResponseCpuBackend.check_numpy()
|
|
55
|
+
|
|
56
|
+
return FastLISAResponseBackendMethods(
|
|
57
|
+
get_response_wrap=fastlisaresponse_backend_cpu.responselisa.get_response_wrap,
|
|
58
|
+
get_tdi_delays_wrap=fastlisaresponse_backend_cpu.responselisa.get_tdi_delays_wrap,
|
|
59
|
+
pycppDetector_fastlisa=fastlisaresponse_backend_cpu.responselisa.pycppDetector,
|
|
60
|
+
xp=numpy,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class FastLISAResponseCuda11xBackend(Cuda11xBackend, FastLISAResponseBackend):
|
|
65
|
+
|
|
66
|
+
"""Implementation of CUDA 11.x backend"""
|
|
67
|
+
_backend_name : str = "fastlisaresponse_backend_cuda11x"
|
|
68
|
+
_name = "fastlisaresponse_cuda11x"
|
|
69
|
+
|
|
70
|
+
def __init__(self, *args, **kwargs):
|
|
71
|
+
Cuda11xBackend.__init__(self, *args, **kwargs)
|
|
72
|
+
FastLISAResponseBackend.__init__(self, self.cuda11x_module_loader())
|
|
73
|
+
|
|
74
|
+
@staticmethod
|
|
75
|
+
def cuda11x_module_loader():
|
|
76
|
+
try:
|
|
77
|
+
import fastlisaresponse_backend_cuda11x.responselisa
|
|
78
|
+
|
|
79
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
80
|
+
raise BackendUnavailableException(
|
|
81
|
+
"'cuda11x' backend could not be imported."
|
|
82
|
+
) from e
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
import cupy
|
|
86
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
87
|
+
raise MissingDependencies(
|
|
88
|
+
"'cuda11x' backend requires cupy", pip_deps=["cupy-cuda11x"]
|
|
89
|
+
) from e
|
|
90
|
+
|
|
91
|
+
return FastLISAResponseBackendMethods(
|
|
92
|
+
get_response_wrap=fastlisaresponse_backend_cuda11x.responselisa.get_response_wrap,
|
|
93
|
+
get_tdi_delays_wrap=fastlisaresponse_backend_cuda11x.responselisa.get_tdi_delays_wrap,
|
|
94
|
+
pycppDetector_fastlisa=fastlisaresponse_backend_cuda11x.responselisa.pycppDetector_fastlisa,
|
|
95
|
+
xp=cupy,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
class FastLISAResponseCuda12xBackend(Cuda12xBackend, FastLISAResponseBackend):
|
|
99
|
+
"""Implementation of CUDA 12.x backend"""
|
|
100
|
+
_backend_name : str = "fastlisaresponse_backend_cuda12x"
|
|
101
|
+
_name = "fastlisaresponse_cuda12x"
|
|
102
|
+
|
|
103
|
+
def __init__(self, *args, **kwargs):
|
|
104
|
+
Cuda12xBackend.__init__(self, *args, **kwargs)
|
|
105
|
+
FastLISAResponseBackend.__init__(self, self.cuda12x_module_loader())
|
|
106
|
+
|
|
107
|
+
@staticmethod
|
|
108
|
+
def cuda12x_module_loader():
|
|
109
|
+
try:
|
|
110
|
+
import fastlisaresponse_backend_cuda12x.responselisa
|
|
111
|
+
|
|
112
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
113
|
+
raise BackendUnavailableException(
|
|
114
|
+
"'cuda12x' backend could not be imported."
|
|
115
|
+
) from e
|
|
116
|
+
|
|
117
|
+
try:
|
|
118
|
+
import cupy
|
|
119
|
+
except (ModuleNotFoundError, ImportError) as e:
|
|
120
|
+
raise MissingDependencies(
|
|
121
|
+
"'cuda12x' backend requires cupy", pip_deps=["cupy-cuda12x"]
|
|
122
|
+
) from e
|
|
123
|
+
|
|
124
|
+
return FastLISAResponseBackendMethods(
|
|
125
|
+
get_response_wrap=fastlisaresponse_backend_cuda12x.responselisa.get_response_wrap,
|
|
126
|
+
get_tdi_delays_wrap=fastlisaresponse_backend_cuda12x.responselisa.get_tdi_delays_wrap,
|
|
127
|
+
pycppDetector_fastlisa=fastlisaresponse_backend_cuda12x.responselisa.pycppDetector_fastlisa,
|
|
128
|
+
xp=cupy,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
KNOWN_BACKENDS = {
|
|
133
|
+
"cuda12x": FastLISAResponseCuda12xBackend,
|
|
134
|
+
"cuda11x": FastLISAResponseCuda11xBackend,
|
|
135
|
+
"cpu": FastLISAResponseCpuBackend,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
"""List of existing backends, per default order of preference."""
|
|
139
|
+
# TODO: __all__ ?
|
|
140
|
+
|
|
141
|
+
|