I'm trying to set up a microscope control script using Pycro-Manager, which is a Python wrapper for Micro-Manager:
from pycromanager import Acquisition, multi_d_acquisition_events
with Acquisition(directory=r'C:\Users\joanna\Desktop', name='z-stack') as acq:
# Generate the events for a single z-stack
events = multi_d_acquisition_events(z_start=0, z_end=10, z_step=0.5)
acq.acquire(events)
For some reason, the cell doesn't execute until I terminate the kernel. What is the problem here?
I first thought that adding VAR.__exit__()
at the end (as suggested here) would solve the issue, but it does not. This seems to be a problem specific to Jupyter/IPython as the same code runs fine directly from the Python interpreter, i.e. an acquisition window is opened and an image stack is acquired from the camera.