Source code for ewoksxrdct.tasks.utils.validate
import numpy as np
[docs]
def validate_motor_counts(
expected: int, translations: np.ndarray, rotations: np.ndarray
) -> None:
"""Check the recorded motor positions cover the expected number of scan
points."""
if translations.size != expected:
raise ValueError(
f"Expected {expected} translation positions, "
f"but the scan has {translations.size}."
)
if rotations.size != expected:
raise ValueError(
f"Expected {expected} rotation angles, but the scan has {rotations.size}."
)
[docs]
def validate_frame_count(expected: int, intensity: np.ndarray) -> None:
"""Check the integrated frames cover the expected number of scan points."""
if intensity.shape[0] != expected:
raise ValueError(
f"Expected {expected} integrated frames, "
f"but the integration output has {intensity.shape[0]}."
)