Accessing MLC Leaf Pair Coordinates in Pylinac Picket Fence Module

Hi! I would like to begin by expressing our appreciation for the exceptional quality of the Pylinac package. Our medical physicists have found it to be a truly valuable resource.

We are currently working on calculating the peak-to-peak distances (i.e., the distances between successive pickets) for all MLC pairs. To achieve this, we need the coordinates of each MLC pair so that we can create a profile along the leaf travel and apply the find_peaks() function.

Does the PicketFence module in Pylinac store the coordinates of the MLC leaf pairs in a way that allows us to access them? If so, please guide us on how to retrieve this information.

Thank you so much for your time and assistance in addressing our question. We look forward to hearing back from you.

Best regards,
Stathis Kamperis

Hi Stathis,
Thank you for the kind words. I never thought this package would be used by anyone except me back in 2015.

If I’m understanding you correctly, you want to analyze the peak distances between each picket for each leaf pair.

Here’s a gist to show how to do that using the demo image: PF picket distances by leaf pair (
Note that the example is only for up/down PFs and also that this is only one-pixel-wide sampling. We can of course have noise in a single pixel row. Iterate over the y-values to get all the distances for all leaf pairs.