code: def smooth_rectangle(x, y, rec_w, rec_h, gaussian_width_x, gaussian_width_y):
      
  
      gaussian_x_coord = abs(x)-rec_w/2.0
      gaussian_y_coord = abs(y)-rec_h/2.0
  
      box_x=np.less(gaussian_x_coord,0.0)
      box_y=np.less(gaussian_y_coord,0.0)
      sigmasq_x=gaussian_width_x*gaussian_width_x
      sigmasq_y=gaussian_width_y*gaussian_width_y
  
      with float_error_ignore():
          falloff_x=x*0.0 if sigmasq_x==0.0 else \
              np.exp(np.divide(-gaussian_x_coord*gaussian_x_coord,2*sigmasq_x))
          falloff_y=y*0.0 if sigmasq_y==0.0 else \
              np.exp(np.divide(-gaussian_y_coord*gaussian_y_coord,2*sigmasq_y))
  
      return np.minimum(np.maximum(box_x,falloff_x), np.maximum(box_y,falloff_y))
docs: Rectangle with a solid central region, then Gaussian fall-off at the edges.