Winston-Lutz test unknown sudden error/bug

Hello,

I have got the following code, which was working perfectly fine and gave results for all tests:

import io
import math

import pylinac
from matplotlib import pyplot as plt

from pylinac import WinstonLutz
from pylinac.winston_lutz import GANTRY, COLLIMATOR, COUCH, COMBO, EPID

GANTRY = ‘Gantry’
COLLIMATOR = ‘Collimator’
COUCH = ‘Couch’
COMBO = ‘Combo’
EPID = ‘Epid’
REFERENCE = ‘Reference’
ALL = 'All

#wl = WinstonLutz.from_zip(……)
wl = WinstonLutz.from_zip(BIN_FILE.path)

wl.plot_images(show=False)
figure = plt.gcf()
UTILS.write_file(“wl.png”, figure)

wl_analysis = {
‘gantry iso size’: wl.gantry_iso_size,
‘collimator iso size’ : wl.collimator_iso_size,
‘couch iso size’ : wl.couch_iso_size,
‘shift vector x’ : wl.bb_shift_vector.x,
‘shift vector y’ : wl.bb_shift_vector.y,
‘shift vector z’ : wl.bb_shift_vector.z,
“cax to bb max”: wl.cax2bb_distance(‘max’),
“cax to bb median”: wl.cax2bb_distance(‘median’),
'nimages" : len(wl.images),
‘gantry max rms dev’ : max(wl.axis_rms_deviation(GANTRY)),
‘epid max rms dev’ : max(wl.axis_rms_deviation(EPID)),
‘coll max rms dev’ : max(wl.axis_rms_deviation(COLLIMATOR)),
‘couch max rms dev’ : max(wl.axis_rms_deviation(COUCH)),
‘shift’ : wl.bb_shift_instructions(couch_vrt=None, couch_lng=None, couch_lat=None),
}

wl.plot_summary(show=True)
summaryfigure = plt.gcf()
UTILS.write_file(“wlsummary.png”, summaryfigure)

Then, for single tests, I added commands to round up the return values, like this:
wl_coll_maxrmsdev=round(wl_analysis[‘coll max rms dev’],2)

However, at some point, QATrack failed so I started to delete the “round” commands accordingly to make it work again. I did not find any way to debug the code within QATrack and I have some issue with setting up an environment for Python and installing pip.

Since this moment I could never get the code to work again. I started to quote lines and eventually, deleted most of the code. I created a second test and test list, simply to find an issue, with the following content:

import pylinac

from pylinac import WinstonLutz

wl = WinstonLutz.from_zip(BIN_FILE.path)
wl_import = {
‘gantry iso size’: wl.gantry_iso_size,
}

Unfortunately, it does not import an image for some reason. Obviously, I did change file names to what was suggested and as I mentioned code was working fine earlier.

I will very appreciate your help as I have no idea what causes this. I restarted web browser, computer, but it also didn’t help.

With best wishes,
Klaudiusz

Hi Klaudiusz,

It looks to me like this might be more appropriate on the QATrack+ mailing list! If you post there, I can try to help you but will likely need more information (including what version of QATrack+ you are using). You can also usually get an indication of what the error is by hovering your mouse over the test status in QATrack+, or by looking in the browsers developer console.

Randy

Klaudiusz,
Randy is correct that this best answered on the QAT forum, but I have a few general comments:

  1. All-caps variables in Python are usually understood to be constants, so there is no reason to declare them again. I.e. you don’t need to do GANTRY = ‘Gantry’, etc.

  2. Until Randy builds a linter (coming soon, right Randy? =), it’s probably best to run your script standalone (i.e. outside QAT) to make sure you don’t have syntax or type errors first, then copy over to QAT.

Re 2) There was a basic check previously but as of 2 minutes ago now much better. As an initial check, I ran the calculation procedure here through and lo and behold:

image.png

Klaudiusz, please check to make sure you’re using the same quotes everywhere!

Oh snap! This is getting serious now! =D

image.png