I´ve a simple simulation with a diode source followed by a gaussian diffuser and then a polar or rectangle detectors. I would like to see how the gaussian diffuser parameters (e.g. sigma parameter) affect the angular parameters of the output field.
I´m having difficulties extracting the data both from the polar and rectangle detectors when using the ZOS-API.
For the rectangle detector i´ve used the following sample code adapted from the Zemax repository:
DetObj = 12obj = TheSystem.NCE.GetObjectAt(DetObj);numXPixels = obj.ObjectData.NumberXPixels;numYPixels = obj.ObjectData.NumberYPixels;pltWidth = 2 * obj.ObjectData.XHalfWidth;pltHeight = 2 * obj.ObjectData.YHalfWidth;pix = 0# Get detector datadetectorData = ta0 for x in range(numYPixels)] for x in range(numXPixels)]for x in range(0,numYPixels,1): for y in range(0,numXPixels,1): ret, pixel_val = TheNCE.GetDetectorData(DetObj, pix, 1, 0) pix += 1 if ret == 1: detectorDatary]tx] = pixel_val else: detectorDatarx]ty] = -1
However Python returns “AttributeError: 'IObject' object has no attribute 'NumberXPixels"”. I have checked that
obj.ObjectData is a IO Object, ZemaxUI.ZOSAPI.Editors.ZOSAPI_DetectorRectangleObject, so I am picking the correct object, but I cannot find any of the following parameters (NumberXPixels, NumberYPixels, ,XHalfWidth, YHalfWidth). I´m faced with a similar problem when retrieving data from the PolarDetector.