Solved

Difference between ZOS-API and Zemax Flux Measurements


Userlevel 1
Badge

Hello Folks,

I’ve recently started working with the ZOS-API in python, and I’m concerned there’s something fundamental I’m not understanding. Namely, whenever I use a GetDetectorData(DetObj, 0,0,0), the number generated does not match the value of “Total Power” obtained through zemax. So I prepared an example with Example02; I’ve attached the modified file.

When I call the detector data to get flux (ret1, p_val = TheSystem.NCE.GetDetectorData(4, 0, 0, 0)), I get p_val=14710.99 ; however, when I check the Total Power on the associated zemax file*, I get 7.3533 lumens. I’ve made attempts with the other data types, and with other functions (GetCoherentData), with similar issues.

Question remains, how to measure total power on a detector through the ZOS-API?

 

*"C:\Users\william.deschenes\Documents\Zemax\Samples\Non-sequential\Miscellaneous\Digital_projector_flys_eye_homogenizer.ZDA"

icon

Best answer by William Oak 16 May 2024, 21:09

View original

3 replies

Userlevel 4
Badge

Hi William,

 

Are you sure the total power is 7.3533 lumens in Zemax? I have 1000 times more when I run that model (“E+03”). In this case, you have a factor 2, which perhaps points to the detector not being cleared. That model file has the option “Retrace Source Rays Upon File Open”, so it may be that you trace without clearing the detectors and that double the power on the detector (it is added to the original ray tracing result).

Ways to test would be too uncheck the option, or run on another model. Or perhaps insert a clearing command. I think example 10 would be the one to look at. I am no python expert, but it looks that when I compare to your code, you should have a

NSCRayTrace.ClearDetectors(0)

in line 162 just after your call

NSCRayTrace = TheSystem.Tools.OpenNSCRayTrace()

Userlevel 1
Badge

Thanks for the response!

Yes, its definitly 1000x, I copy-pasted too hastily.

I will check for the detector clearing, but with my other test (which I cant share) I’d had 0.90W (api) vs 0.99 W (zemax), so its not an un-ambiguous doubling.

Userlevel 1
Badge

My mistake in this case, I was using polarization/ray splitting in one case and not the other.

Reply