Skip to main content

Minor Correction of Example 02 Python Code

  • May 9, 2024
  • 1 reply
  • 50 views

Liang

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.

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

1 reply

David.Nguyen
Luminary
Forum|alt.badge.img+2

@Liang 

 

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)

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

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

Take care,

 

David


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