def gabor(x, y, xsigma, ysigma, frequency, phase):
    """
    Gabor pattern (sine grating multiplied by a circular Gaussian).
    """
    if xsigma==0.0 or ysigma==0.0:
        return x*0.0

    with float_error_ignore():
        x_w = np.divide(x,xsigma)
        y_h = np.divide(y,ysigma)
        p = np.exp(-0.5*x_w*x_w + -0.5*y_h*y_h)
    return p * 0.5*np.cos(2*pi*frequency*y + phase)