def METHOD_NAME(data, X, Y):
    """calculates the mean angle in the image, used for z position estimation"""
    A = (data.max()- data.min()) #amplitude
    #threshold at half maximum and subtract threshold
    dr = numpy.maximum(data - data.min() - 0.2*A, 0).squeeze()
    drs = dr.sum()