Zen.Devices.
so that IntelliSense of the Python Editor gives you an idea what is accessible directly.
You will discover that only very view devices are listed. This is because there is a huge list of devices that are available ‘in principle’ but on the other side only a very special amount of devices is combined with your microscope.
To bridge this gab we decided to introduce the HardwareSetting which can be read by
Code: Select all
hardwareSetting= Zen.Devices.ReadHardwareSetting()
Code: Select all
hardwareSetting.SaveAs(filename)
Code: Select all
hardwareSetting = ZenHardwareSetting()
hardwareSetting.Load(filename)
Code: Select all
componentIds = hardwareSetting.GetAllComponentIds()
for componentId in componentIds:
print componentId
parameterNames = hardwareSetting.GetAllParameterNames(componentId)
for parameterName in parameterNames:
print parameterName
parameterValue = hardwareSetting.GetParameter(componentId, parameterName)
print parameterValue
Code: Select all
hardwareSetting.SetParameter(componentId, parameterName, parameterValue)
Code: Select all
Zen.Devices.ApplyHardwareSetting(hardwareSetting)
Please keep in mind, that when you work with
hardwareSetting= Zen.Devices.ReadHardwareSetting()
you will obtain the full set of all devices plus its status.
This might be very correct in certain situations but can also be sort of an overkill when you just intend to modify the status of some selected devices.
There are two main ways to limit your apply to the view devices you want to change.
First of all use
Code: Select all
hardwareSetting = ZenHardwareSetting()
hw.SetParameter('MTBDiracLaser1','IsEnabled', False / Tue)
Please be aware, that this procedure only works with version 2.6 and later.
Therefore
Code: Select all
Zen.Devices.ApplyHardwareSetting(hardwareSetting)
An alternative is to save a ‘full-blown’ HardwareSetting with
Code: Select all
hardwareSetting= Zen.Devices.ReadHardwareSetting()
hardwareSetting.SaveAs(filename)
Using the file like
Code: Select all
hardwareSetting = ZenHardwareSetting()
hardwareSetting.Load(filename)
Zen.Devices.ApplyHardwareSetting(hardwareSetting)