def METHOD_NAME(data, X, Y):
    """calculates the \sigma_x - \sigma_y term used for z position estimation"""
    data = np.atleast_3d(data)
    A = np.atleast_1d((data - data.min(1).min(0)[None,None,:]).sum(1).sum(0)) #amplitude
    A_ = np.atleast_1d(data.max(1).max(0) - data.min(1).min(0))
    #print data.shape, A, X
    #threshold at half maximum and subtract threshold
    dr = numpy.maximum(data - data.min(1).min(0) - 0.2*A_[None,None, :], 0)#.squeeze()
    dr = numpy.maximum(data - data.mean(1).mean(0), 0)#.squeeze()
    #dr = (data - data.mean()).squeeze()
    #print A
    if len(A) == 2:
        sr = dr.sum(1).sum(0)
        sr = (sr[0]/sr.sum(), )
    else:
        sr = ()
    dr = dr/dr.sum(1).sum(0)[None,None,:]
    if False:#DEBUG_PLOTS:
        #print feat.shape
        import matplotlib.pyplot as plt
        plt.figure(figsize=(5, 3))
        plt.subplot(1,2,1)
        plt.imshow(dr[:,:,0])
        plt.subplot(1, 2, 2)
        plt.imshow(dr[:, :, 1])
    #print dr.sum(1).sum(0)[None,None,:] 
    x0 = (X[:,None, None]*dr).sum(1).sum(0)
    y0 = (Y[None, :, None]*dr).sum(1).sum(0)
    x0_ = (x0*A).sum()/A.sum()
    y0_ = (y0 * A).sum() / A.sum()
    #print x0
    xn = X[:,None, None] - x0_
    yn = Y[None, :, None] - y0_
    #r = numpy.sqrt(xn*xn + yn*yn)
    #sig = numpy.sqrt((xn*xn*dr + yn*yn*dr).sum(1).sum(0)) #+ (xn*xn*dr).sum(1).sum(0)
    rn2 = xn*xn + yn*yn
    #print data.shape,
    sig_x = (numpy.abs(xn) * dr).sum(1).sum(0)/80.
    sig_y = (numpy.abs(yn) * dr).sum(1).sum(0)/80.
    d_sig = (sig_x - sig_y)
    #d2_sig = (sig_x[1] - sig_x[0], sig_y[1] - sig_y[0])
    d1 = (rn2 < (2*70.)**2).astype('f')*data
    #print d1.shape
    sig = d1.sum(1).sum(0)/data.sum(1).sum(0)
    #print A.mean(), x0[0], y0[0], sig[1] - sig[0]
    return (x0_, y0_) + tuple(A/1e3) + tuple(d_sig) + tuple(0.5*(sig_x + sig_y) - 1)  #+ sr