loop-interpolation 0.0.1__py3-none-any.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.
Files changed (39) hide show
  1. loop_interpolation/__init__.py +152 -0
  2. loop_interpolation/_builders.py +149 -0
  3. loop_interpolation/_constant_norm.py +232 -0
  4. loop_interpolation/_diagnostics.py +102 -0
  5. loop_interpolation/_discrete_fold_interpolator.py +242 -0
  6. loop_interpolation/_discrete_interpolator.py +1405 -0
  7. loop_interpolation/_fd_fold_interpolator.py +237 -0
  8. loop_interpolation/_finite_difference_interpolator.py +1348 -0
  9. loop_interpolation/_fold_event.py +185 -0
  10. loop_interpolation/_fold_norm_alignment.py +118 -0
  11. loop_interpolation/_fold_setup.py +39 -0
  12. loop_interpolation/_geological_interpolator.py +920 -0
  13. loop_interpolation/_interpolator_builder.py +251 -0
  14. loop_interpolation/_interpolator_factory.py +167 -0
  15. loop_interpolation/_interpolatortype.py +20 -0
  16. loop_interpolation/_operator.py +44 -0
  17. loop_interpolation/_p1interpolator.py +299 -0
  18. loop_interpolation/_p2interpolator.py +317 -0
  19. loop_interpolation/_regularisation.py +110 -0
  20. loop_interpolation/_solver_pipeline.py +138 -0
  21. loop_interpolation/_solver_strategy.py +218 -0
  22. loop_interpolation/_surfe_wrapper.py +211 -0
  23. loop_interpolation/_svariogram.py +133 -0
  24. loop_interpolation/_validation.py +604 -0
  25. loop_interpolation/constraints.py +473 -0
  26. loop_interpolation/fold_function/__init__.py +39 -0
  27. loop_interpolation/fold_function/_base_fold_rotation_angle.py +219 -0
  28. loop_interpolation/fold_function/_fourier_series_fold_rotation_angle.py +131 -0
  29. loop_interpolation/fold_function/_lambda_fold_rotation_angle.py +53 -0
  30. loop_interpolation/loopsolver/__init__.py +2 -0
  31. loop_interpolation/loopsolver/admm_constant_norm.py +118 -0
  32. loop_interpolation/loopsolver/admm_method.py +25 -0
  33. loop_interpolation/loopsolver/admm_solver.py +463 -0
  34. loop_interpolation/loopsolver/version.py +1 -0
  35. loop_interpolation-0.0.1.dist-info/METADATA +34 -0
  36. loop_interpolation-0.0.1.dist-info/RECORD +39 -0
  37. loop_interpolation-0.0.1.dist-info/WHEEL +5 -0
  38. loop_interpolation-0.0.1.dist-info/licenses/LICENSE +21 -0
  39. loop_interpolation-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,473 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ from typing import ClassVar
5
+
6
+ import numpy as np
7
+ from loop_common.base import NumpyArray
8
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
9
+ from pydantic import ValidationError as PydanticValidationError
10
+
11
+ from ._validation import (
12
+ DtypeError,
13
+ ShapeError,
14
+ ValidationError,
15
+ VectorError,
16
+ _check_finite,
17
+ _drop_nan_data_rows,
18
+ _ensure_float_array,
19
+ )
20
+
21
+ _logger = logging.getLogger(__name__)
22
+
23
+
24
+ def _construct(cls, **kwargs):
25
+ """Construct a constraint model, re-raising the library's own exception
26
+ types instead of the generic ``pydantic.ValidationError`` that wraps
27
+ them when raised from inside a ``@model_validator``.
28
+ """
29
+ try:
30
+ return cls(**kwargs)
31
+ except PydanticValidationError as exc:
32
+ msg = "; ".join(err.get("msg", "") for err in exc.errors())
33
+ if "zero or near-zero magnitude" in msg:
34
+ raise VectorError(msg) from exc
35
+ if "must have shape" in msg or "must contain the same number of rows" in msg:
36
+ raise ShapeError(msg) from exc
37
+ if "could not be converted to float64" in msg:
38
+ raise DtypeError(msg) from exc
39
+ raise ValidationError(msg) from exc
40
+
41
+
42
+ def _to_float_array(points: np.ndarray, name: str) -> np.ndarray:
43
+ try:
44
+ return np.asarray(points, dtype=float)
45
+ except (TypeError, ValueError) as e:
46
+ raise DtypeError(f"{name} could not be converted to float64. Error: {e}") from e
47
+
48
+
49
+ class BaseConstraint(BaseModel):
50
+ """Base pydantic model for interpolation constraints."""
51
+
52
+ model_config = ConfigDict(
53
+ arbitrary_types_allowed=True, validate_assignment=True, extra="forbid"
54
+ )
55
+
56
+ weight_name: ClassVar[str] = "constraint"
57
+
58
+ def _set_field(self, name: str, value) -> None:
59
+ object.__setattr__(self, name, value)
60
+
61
+ def _validate_weights(self) -> None:
62
+ if np.isscalar(self.weights):
63
+ return
64
+
65
+ weights = _ensure_float_array(self.weights, f"{self.weight_name} weights")
66
+ if weights.ndim != 1 or weights.shape[0] != self.points.shape[0]:
67
+ raise ShapeError(
68
+ f"{self.weight_name} weights must be scalar or shape ({self.points.shape[0]},), got {weights.shape}"
69
+ )
70
+ if weights.shape[0] == 0:
71
+ self._set_field("weights", weights)
72
+ return
73
+
74
+ nan_mask = ~np.isfinite(weights)
75
+ if np.any(nan_mask):
76
+ n_replaced = int(np.sum(nan_mask))
77
+ _logger.warning(
78
+ "%d NaN weight value(s) replaced with 1.0 (default weight). Provide explicit finite weights to suppress this warning.",
79
+ n_replaced,
80
+ )
81
+ weights = weights.copy()
82
+ weights[nan_mask] = 1.0
83
+
84
+ _check_finite(weights, f"{self.weight_name} weights")
85
+ self._set_field("weights", weights)
86
+
87
+ @staticmethod
88
+ def _drop_invalid_rows(
89
+ points: np.ndarray,
90
+ data_arrays: list[np.ndarray],
91
+ name: str,
92
+ ) -> tuple[np.ndarray, list[np.ndarray], np.ndarray]:
93
+ normalized_arrays = [arr.reshape(-1, 1) if arr.ndim == 1 else arr for arr in data_arrays]
94
+ combined = np.hstack([points, *normalized_arrays])
95
+ filtered = _drop_nan_data_rows(combined, slice(0, combined.shape[1]), name)
96
+ if filtered.shape[0] == combined.shape[0]:
97
+ mask = np.ones(combined.shape[0], dtype=bool)
98
+ else:
99
+ mask = np.isfinite(combined).all(axis=1)
100
+
101
+ if not data_arrays:
102
+ return filtered[:, : points.shape[1]], [], mask
103
+
104
+ new_arrays = []
105
+ start = points.shape[1]
106
+ for arr in data_arrays:
107
+ width = 1 if arr.ndim == 1 else arr.shape[1]
108
+ chunk = filtered[:, start : start + width]
109
+ if arr.ndim == 1:
110
+ chunk = chunk.reshape(-1)
111
+ new_arrays.append(chunk)
112
+ start += width
113
+ return filtered[:, : points.shape[1]], new_arrays, mask
114
+
115
+
116
+ def _weights_to_column(weights: float | np.ndarray, n_rows: int) -> np.ndarray:
117
+ if n_rows == 0:
118
+ return np.empty((0, 1), dtype=float)
119
+ if np.isscalar(weights):
120
+ return np.full((n_rows, 1), float(weights), dtype=float)
121
+
122
+ arr = np.asarray(weights, dtype=float)
123
+ if arr.ndim != 1 or arr.shape[0] != n_rows:
124
+ raise ValueError(f"Weights must be scalar or shape ({n_rows},), got {arr.shape}")
125
+ return arr.reshape(-1, 1)
126
+
127
+
128
+ class ValueConstraint(BaseConstraint):
129
+ weight_name: ClassVar[str] = "Value constraint"
130
+ points: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
131
+ values: NumpyArray = Field(default_factory=lambda: np.empty((0,), dtype=float))
132
+ weights: float | NumpyArray = 1.0
133
+
134
+ @model_validator(mode="after")
135
+ def check_shapes(self):
136
+ self._set_field("points", _ensure_float_array(self.points, "Value constraint points"))
137
+ self._set_field("values", _ensure_float_array(self.values, "Value constraint values"))
138
+
139
+ if self.points.ndim != 2:
140
+ raise ShapeError("Value constraint points must have shape (N, D)")
141
+ if self.values.ndim != 1:
142
+ raise ShapeError("Value constraint values must have shape (N,)")
143
+ if self.points.shape[0] != self.values.shape[0]:
144
+ raise ShapeError(
145
+ "Value constraint points and values must contain the same number of rows"
146
+ )
147
+
148
+ self._validate_weights()
149
+ points, values_list, keep_mask = self._drop_invalid_rows(
150
+ self.points,
151
+ [self.values],
152
+ "value constraint",
153
+ )
154
+ self._set_field("points", points)
155
+ self._set_field("values", values_list[0])
156
+ if not np.isscalar(self.weights):
157
+ self._set_field("weights", self.weights[keep_mask])
158
+ self._validate_weights()
159
+
160
+ if self.points.shape[0] == 0:
161
+ return self
162
+
163
+ _check_finite(self.points, "Position (X, Y, Z)")
164
+ _check_finite(self.values, "Value column")
165
+ return self
166
+
167
+ def to_array(self) -> np.ndarray:
168
+ n_rows = self.points.shape[0]
169
+ weights = _weights_to_column(self.weights, n_rows)
170
+ return np.hstack([self.points, self.values.reshape(-1, 1), weights])
171
+
172
+ @classmethod
173
+ def from_array(cls, points: np.ndarray, dimensions: int = 3) -> ValueConstraint:
174
+ pts = _to_float_array(points, "Value constraint array")
175
+ if pts.ndim != 2:
176
+ raise ShapeError("Value constraint array must be 2D")
177
+ if pts.shape[1] == dimensions + 1:
178
+ return _construct(cls, points=pts[:, :dimensions], values=pts[:, dimensions], weights=1.0)
179
+ if pts.shape[1] == dimensions + 2:
180
+ return _construct(
181
+ cls,
182
+ points=pts[:, :dimensions],
183
+ values=pts[:, dimensions],
184
+ weights=pts[:, dimensions + 1],
185
+ )
186
+ raise ShapeError(
187
+ f"Value constraint array must have {dimensions + 1} or {dimensions + 2} columns"
188
+ )
189
+
190
+
191
+ class GradientConstraint(BaseConstraint):
192
+ weight_name: ClassVar[str] = "Gradient constraint"
193
+ points: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
194
+ vectors: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
195
+ weights: float | NumpyArray = 1.0
196
+ is_normal: bool = False
197
+ drop_invalid_rows: bool = True
198
+ @model_validator(mode="after")
199
+ def check_shapes(self):
200
+ label = "Normal" if self.is_normal else "Gradient"
201
+ vector_label = (
202
+ "Normal vector (nx, ny, nz)" if self.is_normal else "Gradient vector (gx, gy, gz)"
203
+ )
204
+
205
+ self._set_field("points", _ensure_float_array(self.points, f"{label} constraint points"))
206
+ self._set_field("vectors", _ensure_float_array(self.vectors, f"{label} constraint vectors"))
207
+
208
+ if self.points.ndim != 2:
209
+ raise ShapeError(f"{label} constraint points must have shape (N, D)")
210
+ if self.vectors.ndim != 2:
211
+ raise ShapeError(f"{label} constraint vectors must have shape (N, D)")
212
+ if self.points.shape != self.vectors.shape:
213
+ raise ShapeError(f"{label} constraint points and vectors must have matching shape")
214
+
215
+ self._validate_weights()
216
+ points, vectors_list, keep_mask = self._drop_invalid_rows(
217
+ self.points,
218
+ [self.vectors],
219
+ f"{label.lower()} constraint",
220
+ )
221
+ self._set_field("points", points)
222
+ self._set_field("vectors", vectors_list[0])
223
+ if not np.isscalar(self.weights):
224
+ self._set_field("weights", self.weights[keep_mask])
225
+ self._validate_weights()
226
+
227
+ if self.points.shape[0] == 0:
228
+ return self
229
+
230
+ _check_finite(self.points, "Position (X, Y, Z)")
231
+ _check_finite(self.vectors, vector_label)
232
+
233
+ magnitudes = np.linalg.norm(self.vectors, axis=1)
234
+ zero_mag = magnitudes < 1e-14
235
+ if np.any(zero_mag):
236
+ if self.drop_invalid_rows:
237
+ _logger.warning(
238
+ "Dropping %d %s constraints with zero or near-zero magnitude vectors.",
239
+ int(np.sum(zero_mag)),
240
+ label.lower(),
241
+ )
242
+ self._set_field("vectors", self.vectors[~zero_mag])
243
+ self._set_field("points", self.points[~zero_mag])
244
+ if not np.isscalar(self.weights):
245
+ self._set_field("weights", self.weights[~zero_mag])
246
+ self._validate_weights()
247
+ else:
248
+
249
+ zero_indices = np.where(zero_mag)[0]
250
+ raise VectorError(
251
+ f"Found {int(np.sum(zero_mag))} {label.lower()} constraints with zero or near-zero magnitude. "
252
+ f"{label} vectors must have non-zero length. "
253
+ f"Zero-magnitude vectors at indices: {zero_indices}"
254
+ )
255
+ return self
256
+
257
+ def to_array(self) -> np.ndarray:
258
+ n_rows = self.points.shape[0]
259
+ weights = _weights_to_column(self.weights, n_rows)
260
+ return np.hstack([self.points, self.vectors, weights])
261
+
262
+ @classmethod
263
+ def from_array(
264
+ cls, points: np.ndarray, dimensions: int = 3, is_normal: bool = False
265
+ ) -> GradientConstraint:
266
+ pts = _to_float_array(points, "Gradient constraint array")
267
+ if pts.ndim != 2:
268
+ raise ShapeError("Gradient constraint array must be 2D")
269
+ if pts.shape[1] == dimensions * 2:
270
+ return _construct(
271
+ cls,
272
+ points=pts[:, :dimensions],
273
+ vectors=pts[:, dimensions : 2 * dimensions],
274
+ weights=1.0,
275
+ is_normal=is_normal,
276
+ )
277
+ if pts.shape[1] == dimensions * 2 + 1:
278
+ return _construct(
279
+ cls,
280
+ points=pts[:, :dimensions],
281
+ vectors=pts[:, dimensions : 2 * dimensions],
282
+ weights=pts[:, 2 * dimensions],
283
+ is_normal=is_normal,
284
+ )
285
+ raise ShapeError(
286
+ f"Gradient constraint array must have {dimensions * 2} or {dimensions * 2 + 1} columns"
287
+ )
288
+
289
+
290
+ class InequalityConstraint(BaseConstraint):
291
+ weight_name: ClassVar[str] = "Inequality constraint"
292
+ points: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
293
+ bounds: NumpyArray = Field(default_factory=lambda: np.empty((0, 2), dtype=float))
294
+ weights: float | NumpyArray = 1.0
295
+
296
+ @model_validator(mode="after")
297
+ def check_shapes(self):
298
+ self._set_field("points", _ensure_float_array(self.points, "Inequality constraint points"))
299
+ self._set_field("bounds", _ensure_float_array(self.bounds, "Inequality constraint bounds"))
300
+
301
+ if self.points.ndim != 2:
302
+ raise ShapeError("Inequality constraint points must have shape (N, D)")
303
+ if self.bounds.ndim != 2 or self.bounds.shape[1] != 2:
304
+ raise ShapeError("Inequality constraint bounds must have shape (N, 2)")
305
+ if self.points.shape[0] != self.bounds.shape[0]:
306
+ raise ShapeError(
307
+ "Inequality constraint points and bounds must contain the same number of rows"
308
+ )
309
+
310
+ self._validate_weights()
311
+ _check_finite(self.points, "Position (X, Y, Z)")
312
+ _check_finite(self.bounds, "Bound values")
313
+
314
+ lower_bounds = self.bounds[:, 0]
315
+ upper_bounds = self.bounds[:, 1]
316
+ invalid_bounds = lower_bounds >= upper_bounds
317
+ if np.any(invalid_bounds):
318
+ invalid_indices = np.where(invalid_bounds)[0]
319
+ raise ValidationError(
320
+ f"Found {int(np.sum(invalid_bounds))} inequality constraints with lower_bound >= upper_bound. "
321
+ "For each constraint, lower_bound must be strictly less than upper_bound. "
322
+ f"Invalid constraints at indices: {invalid_indices}"
323
+ )
324
+ return self
325
+
326
+ def to_array(self) -> np.ndarray:
327
+ n_rows = self.points.shape[0]
328
+ weights = _weights_to_column(self.weights, n_rows)
329
+ return np.hstack([self.points, self.bounds, weights])
330
+
331
+ @classmethod
332
+ def from_array(cls, points: np.ndarray, dimensions: int = 3) -> InequalityConstraint:
333
+ pts = _to_float_array(points, "Inequality constraint array")
334
+ if pts.ndim != 2:
335
+ raise ShapeError("Inequality constraint array must be 2D")
336
+ if pts.shape[1] == dimensions + 2:
337
+ return _construct(
338
+ cls, points=pts[:, :dimensions], bounds=pts[:, dimensions : dimensions + 2]
339
+ )
340
+ if pts.shape[1] == dimensions + 3:
341
+ return _construct(
342
+ cls,
343
+ points=pts[:, :dimensions],
344
+ bounds=pts[:, dimensions : dimensions + 2],
345
+ weights=pts[:, dimensions + 2],
346
+ )
347
+ raise ShapeError(
348
+ f"Inequality constraint array must have {dimensions + 2} or {dimensions + 3} columns"
349
+ )
350
+
351
+
352
+ class InequalityPair(BaseConstraint):
353
+ """Represents pairwise ordering rows [x, y, z, pair_id, weight?]."""
354
+
355
+ weight_name: ClassVar[str] = "Inequality pairs constraint"
356
+ points: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
357
+ pair_ids: NumpyArray = Field(default_factory=lambda: np.empty((0,), dtype=float))
358
+ weights: float | NumpyArray = 1.0
359
+
360
+ @model_validator(mode="after")
361
+ def check_shapes(self):
362
+ self._set_field(
363
+ "points", _ensure_float_array(self.points, "Inequality pairs constraint points")
364
+ )
365
+ self._set_field(
366
+ "pair_ids", _ensure_float_array(self.pair_ids, "Inequality pairs constraint ids")
367
+ )
368
+
369
+ if self.points.ndim != 2:
370
+ raise ShapeError("Inequality pairs constraint points must have shape (N, D)")
371
+ if self.pair_ids.ndim != 1:
372
+ raise ShapeError("Inequality pairs constraint pair_ids must have shape (N,)")
373
+ if self.points.shape[0] != self.pair_ids.shape[0]:
374
+ raise ShapeError(
375
+ "Inequality pairs constraint points and pair_ids must contain the same number of rows"
376
+ )
377
+
378
+ self._validate_weights()
379
+ _check_finite(self.points, "Position (X, Y, Z)")
380
+ _check_finite(self.pair_ids, "Pair id column")
381
+ return self
382
+
383
+ def to_array(self) -> np.ndarray:
384
+ n_rows = self.points.shape[0]
385
+ weights = _weights_to_column(self.weights, n_rows)
386
+ return np.hstack([self.points, self.pair_ids.reshape(-1, 1), weights])
387
+
388
+ @classmethod
389
+ def from_array(cls, points: np.ndarray, dimensions: int = 3) -> InequalityPair:
390
+ pts = _to_float_array(points, "Inequality pair constraint array")
391
+ if pts.ndim != 2:
392
+ raise ShapeError("Inequality pair constraint array must be 2D")
393
+ if pts.shape[1] == dimensions + 1:
394
+ return _construct(
395
+ cls, points=pts[:, :dimensions], pair_ids=pts[:, dimensions], weights=1.0
396
+ )
397
+ if pts.shape[1] == dimensions + 2:
398
+ return _construct(
399
+ cls,
400
+ points=pts[:, :dimensions],
401
+ pair_ids=pts[:, dimensions],
402
+ weights=pts[:, dimensions + 1],
403
+ )
404
+ raise ShapeError(
405
+ f"Inequality pair array must have {dimensions + 1} or {dimensions + 2} columns"
406
+ )
407
+
408
+
409
+ class InterfaceConstraint(BaseConstraint):
410
+ weight_name: ClassVar[str] = "Interface constraint"
411
+ points: NumpyArray = Field(default_factory=lambda: np.empty((0, 3), dtype=float))
412
+ interface_ids: NumpyArray = Field(default_factory=lambda: np.empty((0,), dtype=float))
413
+ weights: float | NumpyArray = 1.0
414
+
415
+ @model_validator(mode="after")
416
+ def check_shapes(self):
417
+ self._set_field("points", _ensure_float_array(self.points, "Interface constraint points"))
418
+ self._set_field(
419
+ "interface_ids", _ensure_float_array(self.interface_ids, "Interface constraint ids")
420
+ )
421
+
422
+ if self.points.ndim != 2:
423
+ raise ShapeError("Interface constraint points must have shape (N, D)")
424
+ if self.interface_ids.ndim != 1:
425
+ raise ShapeError("Interface constraint interface_ids must have shape (N,)")
426
+ if self.points.shape[0] != self.interface_ids.shape[0]:
427
+ raise ShapeError(
428
+ "Interface constraint points and interface_ids must contain the same number of rows"
429
+ )
430
+
431
+ self._validate_weights()
432
+ points, interface_ids_list, keep_mask = self._drop_invalid_rows(
433
+ self.points,
434
+ [self.interface_ids],
435
+ "interface constraint",
436
+ )
437
+ self._set_field("points", points)
438
+ self._set_field("interface_ids", interface_ids_list[0])
439
+ if not np.isscalar(self.weights):
440
+ self._set_field("weights", self.weights[keep_mask])
441
+ self._validate_weights()
442
+
443
+ if self.points.shape[0] == 0:
444
+ return self
445
+
446
+ _check_finite(self.points, "Position (X, Y, Z)")
447
+ _check_finite(self.interface_ids, "Interface id column")
448
+ return self
449
+
450
+ def to_array(self) -> np.ndarray:
451
+ n_rows = self.points.shape[0]
452
+ weights = _weights_to_column(self.weights, n_rows)
453
+ return np.hstack([self.points, self.interface_ids.reshape(-1, 1), weights])
454
+
455
+ @classmethod
456
+ def from_array(cls, points: np.ndarray, dimensions: int = 3) -> InterfaceConstraint:
457
+ pts = _to_float_array(points, "Interface constraint array")
458
+ if pts.ndim != 2:
459
+ raise ShapeError("Interface constraint array must be 2D")
460
+ if pts.shape[1] == dimensions + 1:
461
+ return _construct(
462
+ cls, points=pts[:, :dimensions], interface_ids=pts[:, dimensions], weights=1.0
463
+ )
464
+ if pts.shape[1] == dimensions + 2:
465
+ return _construct(
466
+ cls,
467
+ points=pts[:, :dimensions],
468
+ interface_ids=pts[:, dimensions],
469
+ weights=pts[:, dimensions + 1],
470
+ )
471
+ raise ShapeError(
472
+ f"Interface constraint array must have {dimensions + 1} or {dimensions + 2} columns"
473
+ )
@@ -0,0 +1,39 @@
1
+ """Fold rotation-angle profile implementations."""
2
+ from __future__ import annotations
3
+
4
+ from enum import Enum
5
+ from typing import Optional
6
+
7
+ import numpy as np
8
+ import numpy.typing as npt
9
+
10
+ from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile
11
+ from ._fourier_series_fold_rotation_angle import FourierSeriesFoldRotationAngleProfile
12
+ from ._lambda_fold_rotation_angle import LambdaFoldRotationAngleProfile
13
+
14
+ __all__ = [
15
+ "BaseFoldRotationAngleProfile",
16
+ "FoldRotationType",
17
+ "FourierSeriesFoldRotationAngleProfile",
18
+ "LambdaFoldRotationAngleProfile",
19
+ "get_fold_rotation_profile",
20
+ ]
21
+
22
+
23
+ class FoldRotationType(Enum):
24
+ FOURIER_SERIES = FourierSeriesFoldRotationAngleProfile
25
+
26
+ def __str__(self) -> str:
27
+ return self.name
28
+
29
+ def __repr__(self) -> str:
30
+ return self.name
31
+
32
+
33
+ def get_fold_rotation_profile(
34
+ fold_rotation_type: FoldRotationType,
35
+ rotation_angle: npt.NDArray[np.float64] | None = None,
36
+ fold_frame_coordinate: npt.NDArray[np.float64] | None = None,
37
+ **kwargs,
38
+ ) -> BaseFoldRotationAngleProfile:
39
+ return fold_rotation_type.value(rotation_angle, fold_frame_coordinate, **kwargs)