get_as_mask#
- DiffractionSimulation.get_as_mask(shape, radius=6.0, negative=True, radius_function=None, direct_beam_position=None, in_plane_angle=0, mirrored=False, *args, **kwargs)[source]#
Return the diffraction pattern as a binary mask of type bool
- Parameters:
- shape: 2-tuple of ints
Shape of the output mask (width, height)
- radius: float or array, optional
Radii of the spots in pixels. An array may be supplied of the same length as the number of spots.
- negative: bool, optional
Whether the spots are masked (True) or everything else is masked (False)
- radius_function: Callable, optional
Calculate the radius as a function of the spot intensity, for example np.sqrt. args and kwargs supplied to this method are passed to this function. Will override radius.
- direct_beam_position: 2-tuple of ints, optional
The (x,y) coordinate in pixels of the direct beam. Defaults to the center of the image.
- in_plane_angle: float, optional
In plane rotation of the pattern in degrees
- mirrored: bool, optional
Whether the pattern should be flipped over the x-axis, corresponding to the inverted orientation
- Returns:
- mask:
numpy.ndarray Boolean mask of the diffraction pattern
- mask: