Fluences flipped and truncated; and a possible workaround

Hi James,

Firstly, awesome work with Pylinac! Thanks so much for making it freely available.

I’m having an interesting problem with the log_analyzer module. I’m grabbing all the dynalog files from our Trilogy / iX linacs and have noticed something odd: sometimes log_analyzer reconstructs step-and-shoot fluences and flips them (left / right), or so it seems.

I attach two screen shots to illustrate. “bad_fluence” is one where I think it is flipped (and truncated presumably by the X jaw position); “good_fluence” is what it is supposed to be. I enclose the zip files for the “bad_fluence” (tst1.zip) and “good_fluence” (tst2.zip).

—*** UPDATE ***—

I wrote the above text as a draft but had a dig around myself. I think the “bad_fluence” result is caused when the Axxxxx.dlg file is loaded first, because if I force the log_analyzer module to load the Bxxxx.dlg first, the issue is resolved.

Circa line 146 in log_analyzer.py, I’ve done a “quick and dirty” and reverse sorted the list of ‘cleaned_files’ so all the Bxxxx.dlg files are processed first. That seems to get around the issue.

I will send you the zips anyway.

Best wishes,



tst1.zip (23.9 KB)

tst2.zip (23.8 KB)

Thanks for the kind words and for looking into this. I am aware of the fluence left-right inversion and it’s fixed in the master branch and I’m working on a new release. However, I did not think about the log load order and how that might affect the fluence construction. Excellent work in determining this! I’ll have a look at your data and if I reproduce your results I’ll work on a fix. For reference I created an issue here.


I’ve fixed the fluence left-right flipping and the dynalog load order and pushed it to v1.0.3, which is now on pypi. You can do:
pip install --upgrade pylinac
or whatever method you like, just make sure it’s v1.0.3.

Let me know if any problems persist.