How to get dose rate information from Trajectory log file

The program is working great for me. I wonder, in Trajectory log file, if dose rate of each control point is recorded during delivery and how to extract the information? Appreciate it.

Hello ZZ,
I’m glad pylinac is working for you. To determine dose rate, by which I assume you mean MU/min, it’s probably easiest to look at the differential of the MU axis and convert it from snapshots to minutes.

See this gist for a simple way to get the dose rate for the entire log (below). It’s close to a full solution; you just have to index the MU actual to the control point you want to get control-point-specific data. Let me know if this doesn’t work!


Hi James,

What do you think about creat an RTPlan from log file to re-import in TPS for new calculation to check DVH !
let me know

This should be doable. I don’t know that it falls within the scope of pylinac however. It wouldn’t be that hard in principle:

  1. load the log
  2. load the RTPlan file
    for each control point:
    for each leaf:
  3. replace the plan leaf position with the log’s leaf position
  4. save the new RTPlan file.

Darcy Mason (creator of pydicom) may have some better ideas; you can also post there if you wish.

Interesting discussion. This would be a nice ability to have.

I haven’t used linac logs yet, but I have always assumed that linacs are continually adjusting leaf speeds etc. during the delivery of a segment to try to keep it on track. VMAT segments can be ~10 MU (at least for Elekta plans which I am familiar with), which is ~1 sec at full dose rate, which could be several cm of leaf travel, or ~ 6 degrees of gantry travel. I’m thinking to get an accurate dose calculation, you would need to figure out which snapshot points differed by a significant amount from where they should be at that point in the control point pair. You could just convert all snapshots to control points, but I imagine that might overwhelm the planning system. If so, then it seems to me that the hard part in this would be figuring out which snapshots to use, or how to produce new segments which represent big enough deviations to significantly change the dose.

As I said, I haven’t worked with log files yet, so I could be misunderstanding how they work and/or how linacs adjust during delivery.


Good point Darcy. Static delivery wouldn’t be hard; the control points are pretty clear. For VMAT delivery the best option is probably, as mentioned, to turn every snapshot into a control point, but that just doesn’t seem practical. Varian, which I’m more familiar with, uses discrete control points and interpolates the gantry, MU, and MLC positions from them. I believe the interpolation is linear. One strategy would be to average the MLC and gantry positions for all snapshots within a control point. The average values could be used as the value for that control point. This way you can reconstruct the discrete control points again. The errors within the control point would be averaged, but then again, the errors are averaged out in real life as well.