Beam energy

Hello group,

I’ve been using the Machinelog class to compare treatment beams, but I can’t seem to find where the beam energy parameter is stored in the log file. I’ve read that the Trajectory log *.bin files include the energy but not the Dynalog files. Does anyone know where I can pull the beam energy value from using pylinac?

Olivier Blasi

Hi Olivier,
Good question. According to the Tlog specs, both 2.1 and 3.0 (TB versions 1.5 and 2.0 respectively) the beam energy isn’t actually recorded in the .bin file, which is actually quite strange considering how much info it does record. I’m unsure if there are cases where this isn’t done, but most of the time when the logs are created, both a *.txt and *.bin file are created. They have the same name, but different extensions. The *.txt file holds some rather obscure values like voltages, power, currents, etc that are of little value to physicists. It does however contain the patient ID, plan name, plan UID, energy, radiation time, and dose rate, which the *.bin file does not (at least not in a direct summary value). Sun et al make it sound like all the information is in just the .bin file (see Table 1), which isn’t quite accurate. Even they say it’s both: “During the delivery of a beam, the expected and actual status of TrueBeam delivery parameters are recorded in one of the Linac computers in a binary and a text file”. They also use both: “…the TrueBeam trajectory log files are [plural] recorded and transferred to the database…”.

So, it would seem that the Energy is only stored in the corresponding *.txt file, not the *.bin file. I’d love to be wrong here, so if I am then someone please point it out, because it’d be nice to have that. In the meantime, I can work on MachineLog such that it will search for the corresponding *.txt file when a *.bin is loaded and, if there, attach that information. Until you pointed this out I was unaware that the .txt file contained information not in the tlog.

Is that something that would be useful for you? Other thoughts?


With v0.5.1 you can now find the beam energy, assuming you have the .txt file along with the .bin file.

To do so, make sure you have both files in the same directory and load the .bin file as normal. The .txt file is now accessible via the txt attribute, with all values being mapped to a dictionary. For example:

from pylinac.log_analyzer import MachineLog

logpath = r"path/to/my/tlog.bin"
log = MachineLog(logpath)

log.txt[‘Energy’] = ‘6x’
log.txt[‘Logging Scale’] = ‘IEC’

note that the keys aren’t stripped. I.e. some keys may be 'Energy ', etc. Will fix next release.


Thanks for adding that in.