Python Noob discussion for pylinac

Hi all, it might be useful to have a topic thread for people without much python experience. I learned the very basics a few years ago to use pydicom to extract fluence maps from exported treatment fields. I am still VERY new to the language, but have been fiddling with pylinac for a few days and am finding it to be really useful.

So far I’m only using Dynalog-based QA and starshots, but plan to use the other modules soon.

Here is an example of a very quick script to run in your python console (after pylinac is installed of course) that make use of the windows file explorer to navigate to your dynalog folder.

import pylinac

from pylinac.log_analyzer import MachineLog

log = MachineLog()

log.load_UI()

log.fluence.gamma.calc_map(resolution=0.1)

log.plot_all()

This could be expanded to batch process multiple files.

Also, your Linac may not be recording dynalogs currently so message me if you want to learn how to enable the logging function in VxWorks.

Thanks James this is great!

Jay

Jay,
Batch processing log files, e.g. from a directory, should be easy to implement and has been my next minor goal (last few weeks have been busy).

Considering that matlab is the de facto language in med phys, I’ve tried to make pylinac easy to approach, as a new language (python) can be intimidating for physicists who don’t have time to learn intricacies, plus build an algorithm to do work. I myself came from matlab, so kudos to those willing to try new things.

I’m very open to new ideas, so keep them coming!

Cheers,
James