Skip to main content
Solved

Script a sequence of NSC ray trace and analysis


John.Hygelund
Fully Spectral
Forum|alt.badge.img+1

I would like to analyze stray light in non-sequential mode over a range of focus travel. Scripting this seems necessary given the duration for ray tracing and the large number of focus positions needed. I’m sure this is a common task and I’m reaching out for any possible example scripts. The basic functions would be

  1. Run ray trace
  2. Save detector output (inverse gray scale, incoherent irradiance, log -10 as image file)
  3. Update Z position of object
  4. Repeat steps 1-3

Everything except step 2 seems straight forward, so I’m mainly looking for help with saving detector data.

My preference would be to work directly in ZPL, but can work via the API (Matlab preferred) .

Thanks in advance for any help,

John

Best answer by John.Hygelund

@Oran , Thanks for your help. I’ve got the position updating and detector image saving in a loop, but I’m not finding how to initiate a new ray trace on each loop. The RAYTRACE keyword seems specific to sequential mode.

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

5 replies

  • Visible
  • 22 replies
  • July 20, 2023

 Hello John,

 

For step 2 look at this thread: 

And step 3 would look something like

POSITION_CODE = 3  # 3 is for Z
SETNSCPOSITION 1, OBJECT_NUMBER, POSITION_CODE, NEW_POSITION

Run it through your FOR loop and that’s it.

 

 

Oran


John.Hygelund
Fully Spectral
Forum|alt.badge.img+1
  • Author
  • Fully Spectral
  • 71 replies
  • Answer
  • July 20, 2023

@Oran , Thanks for your help. I’ve got the position updating and detector image saving in a loop, but I’m not finding how to initiate a new ray trace on each loop. The RAYTRACE keyword seems specific to sequential mode.


  • Visible
  • 22 replies
  • July 20, 2023
John.Hygelund wrote:

@Oran , Thanks for your help. I’ve got the position updating and detector image saving in a loop, but I’m not finding how to initiate a new ray trace on each loop. The RAYTRACE keyword seems specific to sequential mode.

The raytracing keyword for NSC is NSTR


Forum|alt.badge.img
  • Fully Spectral
  • 100 replies
  • July 20, 2023

In ZPL, you can use NSTR to trace. Note that if your want to clear the detector (before the trace), you have to use a NSDD(1,0,0,0) first.


John.Hygelund
Fully Spectral
Forum|alt.badge.img+1
  • Author
  • Fully Spectral
  • 71 replies
  • July 20, 2023
Ray wrote:

In ZPL, you can use NSTR to trace. Note that if your want to clear the detector (before the trace), you have to use a NSDD(1,0,0,0) first.

@Ray , Thank you. I’m up and running now.


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