Skip to main content
Solved

return leftmost or rightmost pixel on detector viewer that has flux in merit function


Forum|alt.badge.img+1
  • Ultraviolet
  • 42 replies

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!

Best answer by Sandrine Auriol

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

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+2

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


David.Nguyen
Luminary
Forum|alt.badge.img+2

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


Forum|alt.badge.img+1
  • Author
  • Ultraviolet
  • 42 replies
  • May 26, 2022

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

 


Forum|alt.badge.img+2

Hey Kaleb

Yes please that would be great.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings