Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for image processed/image saved parity #689

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
Expand Down