Minor Correction of Example 02 Python Code

  • 9 May 2024
  • 1 reply

Hi everyone,

In sample file 「PythonStandalone_02_NSC_ray_trace.py」, I found several slight mistakes and going to share here.

First in Line 192,

    pix = 0

setting parameter pix as 0 may cause unexpected detector data of the firt pixel(Line 199). Changing pix to 1 may fix the problem.


And in Line 216,

    detectorData = zos.transpose(detectorData)

「transpose」should be function of 「numpy(np)」,this may be typing mistake.


Please confirm and I hope it helps.

1 reply

Userlevel 7
Badge +2



There are several issues with the example files, I think there is a plan to update those in the near future? Another thing to consider is whether you are using Pythonnet > 2.5.2:

Regarding the transpose though, ANYS have defined their own transpose in the boilerplate template:

def transpose(data):
"""Transposes a 2D list (Python3.x or greater).

Useful for converting mutli-dimensional line series (i.e. FFT PSF)

data : Python native list (if using System.Data[,] object reshape first)

res : transposed 2D list
if type(data) is not list:
data = list(data)
return list(map(list, zip(*data)))

Take care,