make_sigmoid_mask#
- ptyrad.utils.math_ops.make_sigmoid_mask(Npix, relative_radius=0.6666666666666666, relative_width=0.2, center=None)[source]#
Create a 2D circular mask with a sigmoid transition.
- Parameters:
Npix (int) – Size of the square mask (Npix x Npix).
relative_radius (float) – Relative radius of the circular mask where the sigmoid equals 0.5, as a fraction of the image size.
relative_width (float) – Relative width of the sigmoid transition, as a fraction of the image size.
center (Optional[Tuple[float, float]]) – (y, x) coordinates of the center of the circle. Defaults to the center of the image.
- Returns:
A 2D circular mask with a sigmoid transition.
- Return type:
torch.Tensor
Notes
The default relative_radius=2/3 is inspired by its use in abTEM to reduce edge artifacts in diffraction patterns. It sets an antialias cutoff frequency at 2/3 of the simulated kMax. https://abtem.readthedocs.io/en/latest/user_guide/appendix/antialiasing.html
The relative_width controls the steepness of the sigmoid transition. Smaller values result in sharper transitions, while larger values produce smoother transitions.