Version 1.1

Hello all,
pylinac version 1.1 is now out. Changes are listed below:

Hello James,

Happy new year !

James, I would like to do live analysis each 5-10 seconde I get the last .bin file

def do_something(sc):
print(“Analysis Log…”)


#filelist = os.listdir(os.getcwd())
#filelist = filter(lambda x: not os.path.isdir(x), filelist)
#newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
path = “Z:\TrajectoryLog\Treatment”
dst = “X:\QA\Linacs\LinacLA1\Logs”

f = max(glob.iglob(‘*.bin’), key=os.path.getctime)

if “KV” in f:
print(f + “is kv file”)
elif “MV” in f:
print(f + “is MV file”)
log = MachineLog(f)
#newest_txt = max(glob.iglob(‘*.txt’), key=os.path.getctime)
#shutil.move(path, dst)

if gamma_pct < 0.99: # How I can get gamma_pct from Log Analysis Module ??
server = smtplib.SMTP(‘’)
msg = “\r\n”.join([
“Subject: Just a message”,
“Why, oh why”
sc.enter(5, 1, do_something, (sc,))

s.enter(5, 1, do_something, (s,))

But I would like to do an condition on gamma_pct value to get an email or to have a alerte.

Could you please help me to get gamma_pct value


  1. To get the gamma percent of the log, use the ``pass_prcnt’’ property of the gamma. Docs here. E.g.


load logs and do stuff

log.fluence.gamma.pass_prcnt # <----------

  1. To watch a directory, consider using the script I’ve already written. This will watch a directory for you and analyze anything pylinac can. It doesn’t do everything you want (like move files elsewhere or send an email), but it’s a start. I’d use/hack that first if you can (link to the script). If you still want to roll your own, I’d strongly urge you to use a file-watching library. For example I use watchdog and it allows an easy, OO-based way to watch and process files that move in and out of directories. Don’t reinvent the wheel if you don’t have to.

Let me know if you get it working! I’d incorporate any good parts into the watcher script.


Ok Thank you James, I will test the file watching library

Directory Watching it’s perfect !


the is very good idea.
But at the moment after module name correction pylinac.xxxx replace by pylinac, the script don’t reconized the field.bin file.
" was added but was not deemed a file to be analyzed* ok for kv_MV_CBCT file, but I am sur we have the same message for field file.

I’m sorry but I don’t understand what’s going on. Can you give me a screenshot or error traceback or a link to a file where I could reproduce the problem? Thanks