Acquisition with ZenBlue macro becomes slower over time

Discuss macros to control the hardware functions of your ZEISS microscope
Post Reply
Aliaksandr Halavatyi
Posts: 2
Joined: Wed Aug 05, 2020 2:12 pm

Acquisition with ZenBlue macro becomes slower over time

Post by Aliaksandr Halavatyi »

We run long multiposition timelapse acquisitions controlled by OAD Macro in ZenBlue. The experiment lasts more then 72 hours.

We realised that acquisition get slower over time - after 24 hours more time is needed to apply experiment settings and trigger image acquisition, e.g. perform the following:

job = Zen.Acquisition.Experiments.GetByName(jobName)
job.SetActive()
job.ClearTileRegionsAndPositions(0)
job.AddRectangleTileRegion(0,Zen.Devices.Stage.ActualPositionX+dx,Zen.Devices.Stage.ActualPositionY+dy,607,607,Zen.Devices.Focus.ActualPosition+dz)
image = Zen.Acquisition.Execute(job)
job.ClearTileRegionsAndPositions(0)
Zen.Application.Save(image,path)

We make sure that not too many files are opened by closing opened documents after acquiring each time point:
Zen.Application.Documents.RemoveAll(False)

RAM monitor looks fine, there is no memory leackage observed.

Would anyone have a sugggestion how to solve the problem or how to test the issue further?
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Acquisition with ZenBlue macro becomes slower over time

Post by CarlZeissMicroscopy3 »

Hello Aliaksandr Halavatyi,

Did you try:

Code: Select all

image.Save(...)

Zen.Application.Documents.RemoveAll(False)

image.Close()
In most cases image.Close() should be called if the image is no loger needed.

Pease note that this subject is a bit complicated, because:

In old Versions of Zen
Zen.Application.Documents.RemoveAll(False)
just removed the image in the GUI
and you had to call
image.Close()
to free memory

In new Versions of Zen
Zen.Application.Documents.RemoveAll(False)
removes the image in the GUI AND closes the image, to free memory!
But if an image is used in code after RemoveAll, the image is opened automatically again
and you have to call
image.Close()
to free memory.
Post Reply