diff --git a/pycromanager/test/test_hook_functions.py b/pycromanager/test/test_callback_functions.py similarity index 76% rename from pycromanager/test/test_hook_functions.py rename to pycromanager/test/test_callback_functions.py index 9675d945..36182582 100644 --- a/pycromanager/test/test_hook_functions.py +++ b/pycromanager/test/test_callback_functions.py @@ -1,3 +1,6 @@ +""" +tests for acquisition hooks, image processors, image_saved functions, etc +""" import numpy as np from pycromanager import Acquisition, multi_d_acquisition_events @@ -41,6 +44,25 @@ def hook_fn(image, metadata): assert dataset is None + +def test_img_process_fn_image_saved_fn_consistency(launch_mm_headless, setup_data_folder): + def processed(image, metadata): + processed.num_processed += 1 + return image, metadata + processed.num_processed = 0 + + def saved(_axis, _dataset): + saved.num_saved += 1 + saved.num_saved = 0 + + with Acquisition(directory=setup_data_folder, name="acq", + image_saved_fn=saved, image_process_fn=processed, + show_display=False) as acq: + acq.acquire(multi_d_acquisition_events(num_time_points=200)) + + assert(processed.num_processed == 200) + assert(saved.num_saved == 200) + def test_event_serialize_and_deserialize(launch_mm_headless): """ Test for cycle consistency of event serialization and deserialization.