def ring(x, y, height, thickness, gaussian_width):
radius = height/<NUM_LIT><EOL>half_thickness = thickness/<NUM_LIT><EOL>distance_from_origin = np.sqrt(x**<NUM_LIT:2>+y**<NUM_LIT:2>)<EOL>distance_outside_outer_disk = distance_from_origin - radius - half_thickness<EOL>distance_inside_inner_disk = radius - half_thickness - distance_from_origin<EOL>ring = <NUM_LIT:1.0>-np.bitwise_xor(np.greater_equal(distance_inside_inner_disk,<NUM_LIT:0.0>),<EOL>np.greater_equal(distance_outside_outer_disk,<NUM_LIT:0.0>))<EOL>sigmasq = gaussian_width*gaussian_width<EOL>if sigmasq==<NUM_LIT:0.0>:<EOL><INDENT>inner_falloff = x*<NUM_LIT:0.0><EOL>outer_falloff = x*<NUM_LIT:0.0><EOL><DEDENT>else:<EOL><INDENT>with float_error_ignore():<EOL><INDENT>inner_falloff = np.exp(np.divide(-distance_inside_inner_disk*distance_inside_inner_disk, <NUM_LIT>*sigmasq))<EOL>outer_falloff = np.exp(np.divide(-distance_outside_outer_disk*distance_outside_outer_disk, <NUM_LIT>*sigmasq))<EOL><DEDENT><DEDENT>return np.maximum(inner_falloff,np.maximum(outer_falloff,ring))<EOL>
Circular ring (annulus) with Gaussian fall-off after the solid ring-shaped region.