Get the value of AutoExposure (exp)

Discuss macros to control the hardware functions of your ZEISS microscope
Post Reply
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Get the value of AutoExposure (exp)

Post by user-6850 »

Hello. Thank you always for your cooperation.

I use "ZEN 2.6 system" and create a macro.

I want to get the value adjusted by AutoExposure (exp), but it doesn't work.

What should I do?

I thank you in advance for your reply.

Code:
experiment1 = Zen.Acquisition.Experiments.GetByName(ExpFileName)
Zen.Acquisition.AutoExposure(experiment1)
experiment1.SaveAs(NewFileName) # NG
gain = Zen.Devices.HardwareSettings.ActiveHardwareSetting.GetParameter("MTBLSMDetectorLine1", "DetectorGain") # NG
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Yosuke,

you can also try

exposureTime = Zen.Acquisition.ActiveCamera.ExposureTime

I hope this is what you are searching for.
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6850 »

Thank you for your reply.

When I tried it, I got "Exposure Time" for "Locate".
I want to get the “Master Gain”(Ch1) of “Acquisition”.

Is there any other way?
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Yosuke,

sorry, but I have not the Zen-LSM setup on my computer that allows me to test your case but my first try would be to have a look at the collection that comes back from

Zen.Devices.HardwareSettings.ActiveHardwareSetting.GetAllParameterNames()

If this is not successful, then please have a look at the Experiment-File (after saving it), which is an XML-file.
Open it with an editor and search for HardwareSettings and then HardwareSetting. You will find a HardwareSetting for each track.
Now search for the master gain value you want to read.

To read the value via macro first save the experiment,

E.g.:
Experiment = Zen.Acquisition.Experiments.ActiveExperiment
Experiment.Save()


read it with an XML-Reader (.Net-Library or Python-Library) and finally get the value via the path etc. of the XMP-structure.
Please have a look at the documentation on the internet how to work with XML-Files in Python

I hope this helps ...
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6850 »

Thank you very much.
I could get the value with the following code.

Experiment = Zen.Acquisition.Experiments.ActiveExperiment
Experiment.SaveAs (TmpExpFile)

When reading an XML file, using "xml.etree.ElementTree" results in the following error:

System.Xml.XmlException: The root level data is invalid.Line 1, position 1.

Is it a development environment problem?
By the way, “ConfigParser” works.
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello,

did you try the class XmlDocument or XDocument from the .Net Framework?

Please have a look at the internet for further advice and examples.
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6850 »

Hello,

The "XmlDocument" class worked.

Thank you for the advice.
Post Reply