Error in PicketFence module after updates

Hello,

I recently updated Python and Pylinac to 3.8.1 and 3.0.1, respectively. After the update I get the following error for every run of this module, including the demo run:

PicketFence.run_demo()
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 226, in run_demo
pf.analyze(tolerance, action_tolerance=action_tolerance)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 298, in analyze
self.pickets = PicketManager(self.image, self.settings, num_pickets)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 608, in init
self.find_pickets()
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 640, in find_pickets
self.pickets.append(Picket(self.image, self.settings, peak_idx, peak_spacing/2))
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 683, in init
self._get_mlc_positions()
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 690, in _get_mlc_positions
mlc_position = self.find_mlc_peak(mlc_center)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 704, in find_mlc_peak
pix_vals = np.median(self.picket_array[:, mlc_rows], axis=1)
File “C:\Users\felipe.barreto\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylinac\picketfence.py”, line 740, in picket_array
top_edge = int(self.approximate_idx - self.spacing)
TypeError: only size-1 arrays can be converted to Python scalars

Does anyone have an insight regarding this error?

Thanks in advance,

Felipe.

Hi,

is there a special reason you did not upgrade to Python 3.8.12 and Pylinac 3.1.0?
When upgrading did you also upgrade all dependencies? https://pylinac.readthedocs.io/en/latest/installation.html#dependencies

regards
Thomas

Hi Thomas,

Thanks for your input. During my first contact with Pylinac a year ago, the warning below from installation page motivated me to start with Python 2. I see now my interpretation was wrong…

“Python(x,y) is not yet available for Python 3, so don’t choose this to try running pylinac.”

I dedicated extra time to the code and realized I had mixed uncompatible parts of picketfence.py from my old (and modified) version of Pylinac with the current release code. Now I’m running Python 3.9 with the latest pylinac version smoothly. So, no compatibility issues betweeen python version and pylinac version, it was jut my bad.

Best regards,

Felipe.