Solved

Accessing lost energy in the Python API

  • 21 April 2021
  • 4 replies
  • 86 views

Userlevel 2

How do I access 'Lost energy (thresholds)' and 'Lost energy (errors)' in the Python API? I didn't see anything in the syntax help.



icon

Best answer by David.Nguyen 22 April 2021, 10:46

View original

4 replies

Userlevel 7
Badge +2

Hi Chris,


Those are properties of your INSCRayTrace:



double DeadRayErrors [get]


double DeadRayThreshold [get]

You find this in the Syntax Help file under: ZOSAPI > Tools > RayTrace > INSCRayTrace. But there isn't much documentation about it.


Here is a code snippet showing you how to call those properties:



# Setup and run the ray trace
NSCRayTrace = TheSystem.Tools.OpenNSCRayTrace()
NSCRayTrace.ClearDetectors(0)
NSCRayTrace.SplitNSCRays = True
NSCRayTrace.ScatterNSCRays = True
NSCRayTrace.UsePolarization = True
NSCRayTrace.IgnoreErrors = True
NSCRayTrace.SaveRays = False
NSCRayTrace.RunAndWaitForCompletion()
print('Lost energy (errors): ', NSCRayTrace.DeadRayErrors)
print('Lost energy (thresholds): ', NSCRayTrace.DeadRayThreshold)
NSCRayTrace.Close()
print('Finished ray trace')

Let me know if this helps.


Take care,


David


 

Userlevel 2

That helps, thanks. I was looking for 'lost' in the documentation - choosing one name or the other would be helpful.

Userlevel 7
Badge +2

Hi Chris,


I completely agree with you. Perhaps someone from Zemax can raise this issue to the developers?


Cheers,


David


 

Userlevel 6
Badge +2

Hi Chris and David,


Thanks for noting this! I agree that it would be useful to align the terminology here. I will submit a feature request to our developers 🙂


Best,


Allie

Reply