def InterpolateDosePlanes(uplane, lplane, fz):
    """Interpolates a dose plane between two bounding planes at the given relative location."""

    # uplane and lplane are the upper and lower dose plane, between which the new dose plane
    #   will be interpolated.
    # fz is the fractional distance from the bottom to the top, where the new plane is located.
    #   E.g. if fz = 1, the plane is at the upper plane, fz = 0, it is at the lower plane.

    # A simple linear interpolation
    doseplane = fz * uplane + (1.0 - fz) * lplane

    return doseplane