From 2b79634854e45f040ceece5974f404a3ce50aafe Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:36:22 -0700 Subject: [PATCH 1/6] add test for empty axes --- pycromanager/test/test_acquisition.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pycromanager/test/test_acquisition.py b/pycromanager/test/test_acquisition.py index ced6827c..313300d7 100644 --- a/pycromanager/test/test_acquisition.py +++ b/pycromanager/test/test_acquisition.py @@ -652,3 +652,18 @@ def test_multi_channel_parsing(launch_mm_headless, setup_data_folder): assert all([channel in dataset.get_channel_names() for channel in ["DAPI", "FITC"]]) finally: dataset.close() + + +def test_empty_axes(launch_mm_headless, setup_data_folder): + """ + Test that images with empty axes are correctly saved + """ + + with Acquisition(setup_data_folder, 'acq', show_display=False) as acq: + acq.acquire({'axes': {}}) + + dataset = acq.get_dataset() + try: + assert dataset.read_image() is not None and dataset.read_image().max() > 0 + finally: + dataset.close() \ No newline at end of file From 7d2f3c77a638c79823580cff2867a968f0e37305 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:55:12 -0700 Subject: [PATCH 2/6] clarify camera notifications --- pycromanager/acquisition/acq_eng_py/internal/engine.py | 7 ++++++- .../acquisition/acq_eng_py/main/acq_notification.py | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pycromanager/acquisition/acq_eng_py/internal/engine.py b/pycromanager/acquisition/acq_eng_py/internal/engine.py index 0b1c7b39..8fd24205 100644 --- a/pycromanager/acquisition/acq_eng_py/internal/engine.py +++ b/pycromanager/acquisition/acq_eng_py/internal/engine.py @@ -246,7 +246,7 @@ def acquire_images(self, event: AcquisitionEvent, hardware_sequences_in_progress height = self.core.get_image_height() self.core.snap_image() event.acquisition_.post_notification(AcqNotification( - AcqNotification.Camera, event.axisPositions_, AcqNotification.Camera.POST_EXPOSURE)) + AcqNotification.Camera, event.axisPositions_, AcqNotification.Camera.POST_SNAP)) for h in event.acquisition_.get_after_exposure_hooks(): h.run(event) @@ -383,6 +383,11 @@ def acquire_images(self, event: AcquisitionEvent, hardware_sequences_in_progress corresponding_event.acquisition_.add_to_image_metadata(ti.tags) corresponding_event.acquisition_.add_to_output(ti) + self.stop_hardware_sequences(hardware_sequences_in_progress) + + event.acquisition_.post_notification(AcqNotification( + AcqNotification.Camera, event.axisPositions_, AcqNotification.Camera.POST_SEQUENCE_STOPPED)) + if timeout: raise TimeoutError("Timeout waiting for images to arrive in circular buffer") diff --git a/pycromanager/acquisition/acq_eng_py/main/acq_notification.py b/pycromanager/acquisition/acq_eng_py/main/acq_notification.py index 79ea77a8..75adc42a 100644 --- a/pycromanager/acquisition/acq_eng_py/main/acq_notification.py +++ b/pycromanager/acquisition/acq_eng_py/main/acq_notification.py @@ -20,8 +20,9 @@ def to_string(): class Camera: PRE_SEQUENCE_STARTED = "pre_sequence_started" + POST_SEQUENCE_STOPPED = "post_sequence_stopped" PRE_SNAP = "pre_snap" - POST_EXPOSURE = "post_exposure" + POST_SNAP = "post_snap" @staticmethod def to_string(): From 537d64cc6eb8394ffb67c52d55ae69ee555e8c14 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:00:53 -0700 Subject: [PATCH 3/6] bump version --- pycromanager/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycromanager/_version.py b/pycromanager/_version.py index ca045f46..b5a480a9 100644 --- a/pycromanager/_version.py +++ b/pycromanager/_version.py @@ -1,2 +1,2 @@ -version_info = (0, 31, 1) +version_info = (0, 31, 2) __version__ = ".".join(map(str, version_info)) From b9218cca9b36b360bef073980ff121f51979d503 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:58:17 -0700 Subject: [PATCH 4/6] bump java versions --- java/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index a58f9f57..74dc7907 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.micro-manager.pycro-manager PycroManagerJava - 0.46.1 + 0.46.2 jar Pycro-Manager Java The Java components of Pycro-Manager @@ -55,7 +55,7 @@ org.micro-manager.acqengj AcqEngJ - 0.35.1 + 0.36.0 org.micro-manager.ndviewer @@ -112,11 +112,11 @@ - - --pinentry-mode - loopback - - + + --pinentry-mode + loopback + + From 5f3c5c2b5eced08a12b8bef256884690a914e4d5 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:01:51 -0700 Subject: [PATCH 5/6] fix test --- pycromanager/acq_future.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pycromanager/acq_future.py b/pycromanager/acq_future.py index cf570f17..a26fbb35 100644 --- a/pycromanager/acq_future.py +++ b/pycromanager/acq_future.py @@ -31,7 +31,8 @@ def _add_notifications(self, axes_or_axes_list): AcqNotification.Camera.PRE_SNAP: False, AcqNotification.Camera.PRE_SEQUENCE_STARTED: False, - AcqNotification.Camera.POST_EXPOSURE: False, + AcqNotification.Camera.POST_SNAP: False, + AcqNotification.Camera.POST_SEQUENCE_STOPPED: False, AcqNotification.Image.IMAGE_SAVED: False, } From 94c3c4c0dafde679f727480f0f4e8bc4e82df1d7 Mon Sep 17 00:00:00 2001 From: Henry Pinkard <7969470+henrypinkard@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:25:26 -0700 Subject: [PATCH 6/6] notificaiton fixes --- pycromanager/acquisition/acq_eng_py/internal/engine.py | 5 +++-- pycromanager/acquisition/acq_eng_py/main/acq_notification.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pycromanager/acquisition/acq_eng_py/internal/engine.py b/pycromanager/acquisition/acq_eng_py/internal/engine.py index 8fd24205..da02f57c 100644 --- a/pycromanager/acquisition/acq_eng_py/internal/engine.py +++ b/pycromanager/acquisition/acq_eng_py/internal/engine.py @@ -385,8 +385,9 @@ def acquire_images(self, event: AcquisitionEvent, hardware_sequences_in_progress self.stop_hardware_sequences(hardware_sequences_in_progress) - event.acquisition_.post_notification(AcqNotification( - AcqNotification.Camera, event.axisPositions_, AcqNotification.Camera.POST_SEQUENCE_STOPPED)) + if event.get_sequence() is not None: + event.acquisition_.post_notification(AcqNotification( + AcqNotification.Camera, event.axisPositions_, AcqNotification.Camera.POST_SEQUENCE_STOPPED)) if timeout: raise TimeoutError("Timeout waiting for images to arrive in circular buffer") diff --git a/pycromanager/acquisition/acq_eng_py/main/acq_notification.py b/pycromanager/acquisition/acq_eng_py/main/acq_notification.py index 75adc42a..e8b77457 100644 --- a/pycromanager/acquisition/acq_eng_py/main/acq_notification.py +++ b/pycromanager/acquisition/acq_eng_py/main/acq_notification.py @@ -46,8 +46,8 @@ def __init__(self, type, payload, milestone=None): self.type = AcqNotification.Image self.payload = payload self.milestone = milestone - elif milestone in [AcqNotification.Camera.PRE_SNAP, AcqNotification.Camera.POST_EXPOSURE, - AcqNotification.Camera.PRE_SEQUENCE_STARTED]: + elif milestone in [AcqNotification.Camera.PRE_SNAP, AcqNotification.Camera.POST_SNAP, + AcqNotification.Camera.PRE_SEQUENCE_STARTED, AcqNotification.Camera.POST_SEQUENCE_STOPPED]: self.type = AcqNotification.Camera self.payload = json.loads(payload) if isinstance(payload, str) else payload # convert from '{'time': 5}' to {'time': 5} elif milestone in [AcqNotification.Hardware.PRE_HARDWARE, AcqNotification.Hardware.POST_HARDWARE]: