Solved

Script a sequence of NSC ray trace and analysis

  • 20 July 2023
  • 5 replies
  • 107 views

Userlevel 3
Badge

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

icon

Best answer by John.Hygelund 20 July 2023, 14:37

View original

5 replies

Userlevel 2

 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

Userlevel 3
Badge

@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.

Userlevel 2

@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

Userlevel 4
Badge

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.

Userlevel 3
Badge

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