Skip to main content
Solved

Accessing lost energy in the Python API


c​hris

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



Best answer by David.Nguyen

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


 

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

4 replies

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1088 replies
  • Answer
  • April 22, 2021

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


 


c​hris
  • Author
  • Infrared
  • 12 replies
  • April 22, 2021

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


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

Hi Chris,


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


Cheers,


David


 


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 337 replies
  • April 27, 2021

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


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