def gabor(x, y, xsigma, ysigma, frequency, phase):
if xsigma==<NUM_LIT:0.0> or ysigma==<NUM_LIT:0.0>:<EOL><INDENT>return x*<NUM_LIT:0.0><EOL><DEDENT>with float_error_ignore():<EOL><INDENT>x_w = np.divide(x,xsigma)<EOL>y_h = np.divide(y,ysigma)<EOL>p = np.exp(-<NUM_LIT:0.5>*x_w*x_w + -<NUM_LIT:0.5>*y_h*y_h)<EOL><DEDENT>return p * <NUM_LIT:0.5>*np.cos(<NUM_LIT:2>*pi*frequency*y + phase)<EOL>
Gabor pattern (sine grating multiplied by a circular Gaussian).