Solved

Enter Zernike Fringe Phase Surface from Python API

  • 14 September 2022
  • 1 reply
  • 187 views

I am trying to take a known set of Fringe Zernike Coefficients, and insert them into a zemax optical system model as a Zernike Fringe Phase surface. I’ve gotten as far as being able to insert the surface and set it as a Zernike Fringe Phase type, but I haven’t had any success with entering coefficient values into the LDE. 

I’ve tried 

LDE.GetSurfaceAt(28).GetCellAt(14).DoubleValue = value

where value is a float, but it throws an exception saying that a Double was expected and it got a string. I’ve also tried to just return a value that I’ve typed in manually, but had no success that way either. Can anyone point me in the right direction here? It seems like it should be simple with entering numbers into the LDE, but nothing has seemed to work so far. 

 

Thanks

icon

Best answer by MichaelH 15 September 2022, 03:18

View original

1 reply

Userlevel 6
Badge +2

Hey Niko,

Without actually creating a test script, the GetCellAt() method is for all editors, not just the LDE, and starts at the left most column.  I’m thinking that with GetCellAt(14), you’re trying to change Par14, but you’re really trying to change one of the unused columns for the Zernike Fringe Phase (around Par3).  To have a more 1:1 comparison with column headers in the LDE, I would suggest using the ILDERow method of GetSurfaceCell(SurfaceColumn.Par14).  This way, you know you’re always looking at Par14 rather than a random column. 

You can also determine the offset (fixed number of columns to the left of Par0) and use this like GetCellAt(14 + offset)...the problem is I always forget what the offset is for each type of editor.

Reply