Skip to main content
Solved

Script a sequence of NSC ray trace and analysis

  • July 20, 2023
  • 5 replies
  • 240 views

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.

5 replies

  • Visible
  • 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
  • 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
  • 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.

The raytracing keyword for NSC is NSTR


Forum|alt.badge.img
  • Fully Spectral
  • 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
  • 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.

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