ewoksxas.resources.data.regenerate_reference#

Regenerate the reference snapshots used by the test suite.

The tests compare computed arrays against stored .npz snapshots (in the snapshots directory next to this module) with a tolerance, which is portable across operating systems where byte-level hashing is not. Run this only after a dependency change (e.g. a larch upgrade) has been reviewed and accepted, to refresh those snapshots:

python -m ewoksxas.resources.data.regenerate_reference              # all
python -m ewoksxas.resources.data.regenerate_reference autobk_chi   # one

Adding a snapshot for a new test takes two steps:

  1. Write a builder function returning a dict of arrays and register it in SNAPSHOTS under the snapshot name.

  2. In the test, load it with np.load(resource_filename("ewoksxas:data/snapshots/<name>.npz")) and compare with numpy.testing.assert_allclose.

The data-loading helpers mirror the fixtures in tasks/tests/conftest.py.

Functions

main([argv])

Regenerate the snapshots named on the command line, or all of them.

normalized_fe_foil_one()

Return a single normalized Fe-foil spectrum, as the fe_foil_one fixture.

raw_fe_foil()

Return the raw Fe-foil scans, as the fe_foil_data fixture does.

regenerate(name)

Rebuild one snapshot and write it into the snapshots directory.