code: def bg_phase_mask_from_sim(sim, radial_clearance=1.1):
      
      # Mask values around the object
      cx, cy = sim["sim center"]
      radius = sim["sim radius"]
      px_um = sim["pixel size"]
      x = np.arange(sim.shape[0]).reshape(-1, 1)
      y = np.arange(sim.shape[1]).reshape(1, -1)
      rsq = (x - cx)**2 + (y - cy)**2
      mask = rsq > (radius/px_um * radial_clearance)**2
      return mask
docs: Return the background phase mask of a qpsphere simulation
  
      Parameters
      ----------
      sim: qpimage.QPImage
          Quantitative phase data simulated with qpsphere;
          The simulation keyword arguments "sim center", "sim radius",
          and "pixel size" must be present in `sim.meta`.
      radial_clearance: float
          Multiplicator to the fitted radius of the sphere; modifies
          the size of the mask; set to "1" to use the radius determined
          by :func:`qpsphere.analyze`.
          The circular area containing the phase object is set to
          `False` in the output `mask` image.
  
      Returns
      -------
      mask: boolean 2d np.ndarray
          The mask is `True` for background regions and `False` for
          object regions.