Skip to main content

Hello All!

Is there an easy way to get the merit function to return the leftmost or rightmost pixel on a detector that has flux data? I don’t want RMS I want to return the most extreme values. 

For example, if I was looking at the detector below, I would want the merit function to return:

X Max = 0.1

X min = -0.1

 

Thanks!

Hi Kaleb

I checked the help files for NSDD and it seems we don’t have an operand to return the most extreme points of the spot on a detector. I think that a good option can be to write a user defined operand in C#.

 

With the API, you can retrieve the results of the detector as a grid using for example the GetAllDetectorDataSafe function. Let us know if that is a solution or if you need any help, and feel free to share your solution on the https://community.zemax.com/code-exchange-10


Hi Kaleb,

 

I was about to suggest the same as @Sandrine Auriol.

With the User Operand you could store the detector pixels in an array, threshold the array such that the pixels of the spot become 1, and the background 0. Then, sum the pixels along the rows and find the first and last non-zero values and then do the same for the columns.

I don’t know how slow your Merit Function will become though.

Take care,

 

David


Hi Sandrine and David,

Thank you for the responses. I ended up writing something in Matlab to get the data. It is not returned in the Merit Function, but it works fine for my application. I can still put it in the code exchange later if you are interested!

Thanks,

Kaleb

 


Hey Kaleb

Yes please that would be great.


Reply