id3c.tests.test_pair_frames_from_ad_file#

Tests for pair_frames_to_positions_from_ad_file.

Synthetic AD HDF1 files built via h5py; no IOC, no live detector. The motor monitor stream is faked via the same SimpleNamespace + duck-typed stream pattern used by the rest of the analysis tests.

Functions#

test_basic_constant_velocity_recovery(tmp_path)

At constant motor velocity, AD-sourced pairing returns the

test_epics_to_unix_epoch_conversion(tmp_path)

The EPICS->Unix conversion is applied exactly once.

test_image_number_is_one_based(tmp_path)

NDArrayUniqueId is 0-based; output image_number must be 1-based.

test_missing_timestamp_dataset_raises(tmp_path)

A file without the timestamp dataset raises KeyError.

test_missing_unique_id_dataset_raises(tmp_path)

A file without the UID dataset raises KeyError.

test_mismatched_lengths_raise(tmp_path)

timestamp + UID arrays of different length raise ValueError.

test_custom_dataset_paths(tmp_path)

The timestamp / UID HDF5 paths are overridable.

test_recovers_frames_that_ca_path_would_drop(tmp_path)

The AD path returns every frame the IOC wrote, regardless of

Module Contents#

id3c.tests.test_pair_frames_from_ad_file.test_basic_constant_velocity_recovery(tmp_path)[source]#

At constant motor velocity, AD-sourced pairing returns the expected (position, 1-based image_number) for every in-scan frame.

id3c.tests.test_pair_frames_from_ad_file.test_epics_to_unix_epoch_conversion(tmp_path)[source]#

The EPICS->Unix conversion is applied exactly once.

Construct an AD timestamp that, without conversion, would land well outside the motor stream’s time range (and be dropped as extrapolation). After conversion it falls cleanly inside.

id3c.tests.test_pair_frames_from_ad_file.test_image_number_is_one_based(tmp_path)[source]#

NDArrayUniqueId is 0-based; output image_number must be 1-based.

id3c.tests.test_pair_frames_from_ad_file.test_missing_timestamp_dataset_raises(tmp_path)[source]#

A file without the timestamp dataset raises KeyError.

id3c.tests.test_pair_frames_from_ad_file.test_missing_unique_id_dataset_raises(tmp_path)[source]#

A file without the UID dataset raises KeyError.

id3c.tests.test_pair_frames_from_ad_file.test_mismatched_lengths_raise(tmp_path)[source]#

timestamp + UID arrays of different length raise ValueError.

id3c.tests.test_pair_frames_from_ad_file.test_custom_dataset_paths(tmp_path)[source]#

The timestamp / UID HDF5 paths are overridable.

id3c.tests.test_pair_frames_from_ad_file.test_recovers_frames_that_ca_path_would_drop(tmp_path)[source]#

The AD path returns every frame the IOC wrote, regardless of whether the CA monitor stream would have lost some.

This is the core motivation: the AD file is authoritative. The test asserts that for N frames written by the IOC, the helper returns N (modulo in-range filtering), independent of whether a parallel CA monitor stream would have dropped any.