backscattermeter_analyzer 2.1.1__tar.gz → 2.2.1__tar.gz
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.
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/PKG-INFO +2 -2
- backscattermeter_analyzer-2.2.1/mise.toml +6 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/pyproject.toml +2 -2
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/characterize/angle/result.py +73 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/distance/__init__.py +0 -4
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/distance/ratio.py +3 -2
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/distance/result.py +56 -7
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/distance/vector.py +8 -4
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/__init__.py +9 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/base.py +5 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/__init__.py +7 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/base.py +7 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/__init__.py +15 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/already_defined.py +34 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/ambiguous_format.py +22 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/base.py +7 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/identification.py +23 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/not_defined.py +29 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/motor/jump.py +3 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/motor/path.py +8 -5
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/__init__.py +11 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/distance/__init__.py +7 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/distance/main.py +195 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/distance/motor.py +214 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/measurement/__init__.py +7 -0
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/io/hdf5/measurement.py → backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/measurement/main.py +108 -67
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/measurement/motor.py +230 -0
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/io/hdf5/result.py +199 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/hdf5/utils.py +74 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/interface/unified_read_write.py +6 -4
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/interface/unified_read_write_method.py +4 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/unified_input_registry.py +4 -2
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/unified_io_registry.py +4 -2
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/unified_io_registry_base.py +31 -28
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/unified_output_registry.py +4 -2
- backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/utils/distance/connect.py +91 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/distance.py +12 -4
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/motor/state.py +10 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/motor/yes.py +4 -3
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/state.py +3 -3
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/angle/state.py +1 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/angle/yes.py +6 -5
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/camera/state.py +1 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/camera/yes.py +4 -3
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/connect.py +43 -2
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/measurement.py +15 -9
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/motor/state.py +10 -1
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/motor/yes.py +4 -3
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/state.py +10 -10
- backscattermeter_analyzer-2.1.1/mise.toml +0 -6
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/characterize/angle/result.py +0 -8
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/characterize/distance/distance.py +0 -22
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/characterize/distance/measurement.py +0 -23
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/characterize/distance/utils.py +0 -178
- backscattermeter_analyzer-2.1.1/src/backscattermeter_analyzer/io/hdf5/__init__.py +0 -7
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/LICENSE +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/README.md +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/display.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/justfile +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/axis.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/characterize/angle/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/direction.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/backscattermeter.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/camera/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/motor/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/motor/step_numbers.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/hardware/optic/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/default.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/io/registry/interface/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/scale.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/motor/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/distance/motor/no.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/angle/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/angle/no.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/camera/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/camera/no.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/motor/__init__.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/measurement/motor/no.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/src/backscattermeter_analyzer/utils/utils.py +0 -0
- {backscattermeter_analyzer-2.1.1 → backscattermeter_analyzer-2.2.1}/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: backscattermeter_analyzer
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Tool to work on the backscattermeter at LAPP
|
|
5
5
|
Project-URL: Documentation, https://git.linarphy.net/linarphy/backscattermeter_analyzer/wiki
|
|
6
6
|
Project-URL: Homepage, https://git.linarphy.net/linarphy/backscattermeter_analyzer
|
|
@@ -15,7 +15,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (G
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
17
|
Classifier: Topic :: Scientific/Engineering
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.14.7
|
|
19
19
|
Requires-Dist: gwpy>=3.0.12
|
|
20
20
|
Requires-Dist: lalsuite>=7.26.15
|
|
21
21
|
Requires-Dist: pyqt6>=6.9.1
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "backscattermeter_analyzer"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.2.1"
|
|
4
4
|
description = "Tool to work on the backscattermeter at LAPP"
|
|
5
5
|
authors = [{ name = "linarphy", email = "linarphy@linarphy.net" }]
|
|
6
6
|
readme = "README.md"
|
|
7
|
-
requires-python = ">=3.
|
|
7
|
+
requires-python = ">=3.14.7"
|
|
8
8
|
classifiers = [
|
|
9
9
|
"Programming Language :: Python :: 3",
|
|
10
10
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Result class."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from backscattermeter_analyzer import Direction, Distance
|
|
8
|
+
from backscattermeter_analyzer.characterize.distance import (
|
|
9
|
+
Result as DistanceResult,
|
|
10
|
+
)
|
|
11
|
+
from backscattermeter_analyzer.utils.measurement.angle import (
|
|
12
|
+
WithManualAngle,
|
|
13
|
+
)
|
|
14
|
+
from backscattermeter_analyzer.utils.measurement.motor import (
|
|
15
|
+
WithMotorPath,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from backscattermeter_analyzer import Axis, Measurement
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class Result:
|
|
24
|
+
"""Result of an analysis of an angle measurement."""
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def analyze(*measurements: Measurement) -> Result:
|
|
28
|
+
"""
|
|
29
|
+
Link manual angle measurements and motorized angle measurements.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
*measurements: Measurement
|
|
34
|
+
Manuals and Motorized measurements.
|
|
35
|
+
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
dict_manual: dict[tuple[Axis, Direction], list[Distance]] = {}
|
|
39
|
+
motor_measurements: list[DistanceResult] = []
|
|
40
|
+
|
|
41
|
+
for measurement in measurements:
|
|
42
|
+
angle_state = measurement.state.angle
|
|
43
|
+
motor_state = measurement.state.motor
|
|
44
|
+
if isinstance(angle_state, WithManualAngle):
|
|
45
|
+
if isinstance(motor_state, WithMotorPath):
|
|
46
|
+
message = (
|
|
47
|
+
"Cannot have a measurement with a manual "
|
|
48
|
+
"angle and a motor path at the same time"
|
|
49
|
+
)
|
|
50
|
+
raise TypeError(message)
|
|
51
|
+
direction = Direction(angle_state.angle.pdf_mean < 0)
|
|
52
|
+
result = DistanceResult.analyze(measurement)
|
|
53
|
+
if (angle_state.axis, direction) not in dict_manual:
|
|
54
|
+
distances = 0
|
|
55
|
+
dict_manual[(angle_state.axis, direction)] = (
|
|
56
|
+
result.distances
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
dict_manual[(angle_state.axis, direction)].append(
|
|
60
|
+
measurement
|
|
61
|
+
)
|
|
62
|
+
else:
|
|
63
|
+
if not isinstance(motor_state, WithMotorPath):
|
|
64
|
+
message = (
|
|
65
|
+
"Cannot have a measurement with no manual "
|
|
66
|
+
"angle nor motor path."
|
|
67
|
+
)
|
|
68
|
+
raise TypeError(message)
|
|
69
|
+
motor_measurements.append(
|
|
70
|
+
DistanceResult.analyze(measurement)
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return Result()
|
|
@@ -103,15 +103,11 @@ We have l, and j via (6), which can be used to check consistency
|
|
|
103
103
|
To get the distance associated to each step, we have to
|
|
104
104
|
"""
|
|
105
105
|
|
|
106
|
-
from .distance import Distance
|
|
107
|
-
from .measurement import Measurement
|
|
108
106
|
from .ratio import Ratio
|
|
109
107
|
from .result import Result
|
|
110
108
|
from .vector import Vector
|
|
111
109
|
|
|
112
110
|
__all__ = [
|
|
113
|
-
"Distance",
|
|
114
|
-
"Measurement",
|
|
115
111
|
"Ratio",
|
|
116
112
|
"Result",
|
|
117
113
|
"Vector",
|
|
@@ -11,12 +11,13 @@ from numpy.linalg import norm
|
|
|
11
11
|
from backscattermeter_analyzer import Axis, Direction
|
|
12
12
|
from backscattermeter_analyzer.utils.distance.motor import WithMotorJump
|
|
13
13
|
|
|
14
|
-
from .result import Result
|
|
15
14
|
from .vector import Vector
|
|
16
15
|
|
|
17
16
|
if TYPE_CHECKING:
|
|
18
17
|
from backscattermeter_analyzer.utils.distance import Distance
|
|
19
18
|
|
|
19
|
+
from .result import Result
|
|
20
|
+
|
|
20
21
|
|
|
21
22
|
@dataclass
|
|
22
23
|
class Ratio:
|
|
@@ -36,7 +37,7 @@ class Ratio:
|
|
|
36
37
|
@staticmethod
|
|
37
38
|
def compute(
|
|
38
39
|
results: list[Result], reference: tuple[Axis, Direction]
|
|
39
|
-
) ->
|
|
40
|
+
) -> Ratio:
|
|
40
41
|
"""Compute the distance ratio from multiple results."""
|
|
41
42
|
distances: dict[tuple[Axis, Direction], list[Distance]] = {
|
|
42
43
|
(Axis.X, Direction.POSITIVE): [],
|
|
@@ -1,19 +1,64 @@
|
|
|
1
1
|
"""Result class."""
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
4
5
|
from uuid import uuid4
|
|
5
6
|
|
|
6
7
|
from astropy.time import TimeDelta
|
|
7
8
|
from astropy.uncertainty import normal
|
|
8
9
|
from numpy import mean, std
|
|
9
10
|
|
|
11
|
+
from backscattermeter_analyzer.io.registry import (
|
|
12
|
+
UnifiedReadWrite,
|
|
13
|
+
UnifiedReadWriteMethod,
|
|
14
|
+
)
|
|
10
15
|
from backscattermeter_analyzer.utils.distance import Distance
|
|
11
|
-
from backscattermeter_analyzer.utils.measurement import Measurement
|
|
12
16
|
from backscattermeter_analyzer.utils.measurement.motor import (
|
|
13
17
|
WithMotorPath,
|
|
14
18
|
)
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from backscattermeter_analyzer.utils.measurement import Measurement
|
|
22
|
+
|
|
23
|
+
_Base = UnifiedReadWrite["Result"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Read(_Base):
|
|
27
|
+
"""
|
|
28
|
+
Read and parse a Result.
|
|
29
|
+
|
|
30
|
+
This function provides the Result interface to the
|
|
31
|
+
backscattermeter_analyzer unified I/O layer.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def __init__(
|
|
35
|
+
self, instance: Result | None, class_: type[Result]
|
|
36
|
+
) -> None:
|
|
37
|
+
"""Initialize this class."""
|
|
38
|
+
super().__init__(instance, class_, "read")
|
|
39
|
+
|
|
40
|
+
def __call__(self, *args: Any, **kwargs: Any) -> Result:
|
|
41
|
+
"""Run the main function."""
|
|
42
|
+
return self._registry.read(self._class_, *args, **kwargs)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Write(_Base):
|
|
46
|
+
"""
|
|
47
|
+
Write a Result object out in the specified format.
|
|
48
|
+
|
|
49
|
+
This function provides the Result interface to the
|
|
50
|
+
backscattermeter_analyzer unified I/O layer.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self, instance: Result | None, class_: type[Result]
|
|
55
|
+
) -> None:
|
|
56
|
+
"""Initialize this class."""
|
|
57
|
+
super().__init__(instance, class_, "write")
|
|
58
|
+
|
|
59
|
+
def __call__(self, *args: Any, **kwargs: Any) -> object | None:
|
|
60
|
+
"""Run the main function."""
|
|
61
|
+
return self._registry.write(self._instance, *args, **kwargs)
|
|
17
62
|
|
|
18
63
|
|
|
19
64
|
@dataclass
|
|
@@ -22,10 +67,14 @@ class Result:
|
|
|
22
67
|
|
|
23
68
|
measurement: Measurement
|
|
24
69
|
distances: list[Distance]
|
|
70
|
+
|
|
25
71
|
identifier: str = field(default_factory=lambda: str(uuid4()))
|
|
26
72
|
|
|
73
|
+
read = UnifiedReadWriteMethod(Read)
|
|
74
|
+
write = UnifiedReadWriteMethod(Write)
|
|
75
|
+
|
|
27
76
|
@staticmethod
|
|
28
|
-
def analyze(measurement: Measurement) ->
|
|
77
|
+
def analyze(measurement: Measurement) -> Result:
|
|
29
78
|
"""Generate a result from a measurement by analysing it."""
|
|
30
79
|
motor_state = measurement.state.motor
|
|
31
80
|
if not isinstance(motor_state, WithMotorPath):
|
|
@@ -40,10 +89,10 @@ class Result:
|
|
|
40
89
|
|
|
41
90
|
transition_duration = mean(durations) / 4
|
|
42
91
|
|
|
43
|
-
segments =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
92
|
+
segments = measurement.split(
|
|
93
|
+
number=len(jumps),
|
|
94
|
+
duration=transition_duration,
|
|
95
|
+
transformation=lambda _, x: abs(x.diff()),
|
|
47
96
|
)
|
|
48
97
|
|
|
49
98
|
positions = [
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"""Vector class."""
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
4
5
|
from uuid import uuid4
|
|
5
6
|
|
|
6
7
|
from astropy.uncertainty import Distribution, normal
|
|
7
|
-
from gwpy.detector.channel import Channel
|
|
8
8
|
from numpy import mean, sqrt
|
|
9
9
|
|
|
10
|
-
from backscattermeter_analyzer import Axis, Direction
|
|
11
|
-
from backscattermeter_analyzer.utils.distance import Distance
|
|
12
10
|
from backscattermeter_analyzer.utils.distance.motor import WithMotorJump
|
|
13
11
|
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from gwpy.detector.channel import Channel
|
|
14
|
+
|
|
15
|
+
from backscattermeter_analyzer import Axis, Direction
|
|
16
|
+
from backscattermeter_analyzer.utils.distance import Distance
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
@dataclass
|
|
16
20
|
class Vector:
|
|
@@ -28,7 +32,7 @@ class Vector:
|
|
|
28
32
|
step: dict[str | Channel, Distribution] = field(
|
|
29
33
|
init=False,
|
|
30
34
|
doc="displacement for one step",
|
|
31
|
-
)
|
|
35
|
+
)
|
|
32
36
|
identifier: str = field(default_factory=lambda: str(uuid4()))
|
|
33
37
|
|
|
34
38
|
def __post_init__(self) -> None:
|
backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Exception about registry registration."""
|
|
2
|
+
|
|
3
|
+
from .already_defined import AlreadyDefinedError
|
|
4
|
+
from .ambiguous_format import AmbiguousFormatError
|
|
5
|
+
from .base import RegistryError
|
|
6
|
+
from .identification import IdentificationError
|
|
7
|
+
from .not_defined import NotDefinedError
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"AlreadyDefinedError",
|
|
11
|
+
"AmbiguousFormatError",
|
|
12
|
+
"IdentificationError",
|
|
13
|
+
"NotDefinedError",
|
|
14
|
+
"RegistryError",
|
|
15
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""AlreadyDefinedError class."""
|
|
2
|
+
|
|
3
|
+
from .base import RegistryError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AlreadyDefinedError(RegistryError):
|
|
7
|
+
"""A function that link a format to a class is already defined."""
|
|
8
|
+
|
|
9
|
+
def __init__(
|
|
10
|
+
self, data_format: str, data_class: type, function_type: str
|
|
11
|
+
) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Error initialization.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
data_format: str
|
|
18
|
+
Data format linked to the registry entry.
|
|
19
|
+
data_class: type
|
|
20
|
+
Type linked to the registry entry.
|
|
21
|
+
function_type: str
|
|
22
|
+
Type of the entry (identifier, writer, reader, etc.).
|
|
23
|
+
|
|
24
|
+
Notes
|
|
25
|
+
-----
|
|
26
|
+
data_class - write -> data_format
|
|
27
|
+
data_format - read -> data_class
|
|
28
|
+
|
|
29
|
+
"""
|
|
30
|
+
super().__init__(
|
|
31
|
+
f"{function_type.capitalize()} for format `{data_format}`"
|
|
32
|
+
f" and class `{data_class}` is already defined. Use "
|
|
33
|
+
"`force=True` to overwrite and ignore the existing entry."
|
|
34
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""AmbiguousFormatError class."""
|
|
2
|
+
|
|
3
|
+
from .base import RegistryError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AmbiguousFormatError(RegistryError):
|
|
7
|
+
"""Ambiguous format."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, valid_formats: str) -> None:
|
|
10
|
+
"""
|
|
11
|
+
Error initialization.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
valid_formats: str
|
|
16
|
+
Valid formats.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
super().__init__(
|
|
21
|
+
f"Format is ambiguous. Options are: {valid_formats}."
|
|
22
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""IdentificationError class."""
|
|
2
|
+
|
|
3
|
+
from .base import RegistryError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class IdentificationError(RegistryError):
|
|
7
|
+
"""Impossible to identify format without explicit format arg."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, format_table: str) -> None:
|
|
10
|
+
"""
|
|
11
|
+
Error initialization.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
format_table: str
|
|
16
|
+
Available format table.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
super().__init__(
|
|
20
|
+
"Format could not be identified based on the file name or "
|
|
21
|
+
"contents, please provide a `format` argument.\n"
|
|
22
|
+
f"The available formats are:\n{format_table}"
|
|
23
|
+
)
|
backscattermeter_analyzer-2.2.1/src/backscattermeter_analyzer/exception/io/registry/not_defined.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""NotDefinedError class."""
|
|
2
|
+
|
|
3
|
+
from .base import RegistryError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NotDefinedError(RegistryError):
|
|
7
|
+
"""A function that link a format to a class does not exist."""
|
|
8
|
+
|
|
9
|
+
def __init__(
|
|
10
|
+
self, data_format: str, data_class: type, function_type: str
|
|
11
|
+
) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Error initialization.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
data_format: str
|
|
18
|
+
Data format linked to the non-existing registry entry.
|
|
19
|
+
data_class: type
|
|
20
|
+
Type linked to the non-existing registry entry.
|
|
21
|
+
function_type: str
|
|
22
|
+
Type of the non-existing entry (identifier, writer, reader,
|
|
23
|
+
etc.)
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
super().__init__(
|
|
27
|
+
f"No {function_type} defined for format {data_format} and "
|
|
28
|
+
f"class {data_class}."
|
|
29
|
+
)
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
"""Path class."""
|
|
2
2
|
|
|
3
3
|
from collections.abc import Iterable
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
4
5
|
|
|
5
6
|
from astropy.time import TimeDelta
|
|
6
7
|
|
|
7
8
|
from backscattermeter_analyzer import Axis, Direction
|
|
8
|
-
from backscattermeter_analyzer.hardware.motor.step_numbers import (
|
|
9
|
-
StepNumbers,
|
|
10
|
-
)
|
|
11
9
|
|
|
12
10
|
from .jump import Jump
|
|
13
11
|
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from backscattermeter_analyzer.hardware.motor.step_numbers import (
|
|
14
|
+
StepNumbers,
|
|
15
|
+
)
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
class Path(Iterable):
|
|
16
19
|
"""A sequence of MotorJump."""
|
|
@@ -30,7 +33,7 @@ class Path(Iterable):
|
|
|
30
33
|
self._inner = data
|
|
31
34
|
self._idx = 0
|
|
32
35
|
|
|
33
|
-
def __iter__(self) ->
|
|
36
|
+
def __iter__(self) -> Path:
|
|
34
37
|
"""Default __iter__ function."""
|
|
35
38
|
|
|
36
39
|
return self
|
|
@@ -63,7 +66,7 @@ class Path(Iterable):
|
|
|
63
66
|
duration: TimeDelta,
|
|
64
67
|
speed: int,
|
|
65
68
|
step_numbers: StepNumbers,
|
|
66
|
-
) ->
|
|
69
|
+
) -> Path:
|
|
67
70
|
"""Generate a motor path with a snail structure."""
|
|
68
71
|
|
|
69
72
|
x_p = Jump(
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Sub-package for writing and parsing hdf5 files."""
|
|
2
|
+
|
|
3
|
+
from .distance import register_distance as register_distance_hdf5
|
|
4
|
+
from .measurement import (
|
|
5
|
+
register_measurement as register_measurement_hdf5,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"register_distance_hdf5",
|
|
10
|
+
"register_measurement_hdf5",
|
|
11
|
+
]
|