ptypy.utils.scripts.xradia_star#

ptypy.utils.scripts.xradia_star(sh, spokes=48, std=0.5, minfeature=5, ringfact=2, rings=4, contrast=1.0, Fast=False)#

Creates an Xradia-like star pattern on an array of shape sh.

Works superb as test pattern in ptychography.

requires scipy

Parameters:
  • sh (int, tuple) – Shape of requested array.

  • std (float) –

    “Resolution” of xradia star, i.e. standard deviation of the

    error function used for smoothing the edges (in pixel).

  • spokes (int, optional) – Number of spokes.

  • minfeature (float, optional) – Spoke width at the smallest (inner) tip (in pixel).

  • ringfact (float) – Increase in feature size from ring to ring (factor). Determines position of the rings.

  • rings (int) – Number of rings with spokes.

  • contrast (float) – Minimum contrast, set to zero for a gradual increase of the profile from zero to 1, set to 1 for no gradient in profile.

  • Fast (bool) – If set to False, the error function is evaluated at the edges. Preferred choice when using fft, as edges are less prone to antialiasing in this case. If set to True, simple boolean comparison will be used instead to draw the edges and the result is later smoothed with a gaussian filter. Preferred choice for impatient users, as this choice is roughly a factor 2 faster for larger arrays

Examples

>>> from ptypy.utils.scripts import xradia_star
>>> # Base configuration
>>> X1 = xradia_star(1024)
>>> # Few spokes single ring
>>> X2 = xradia_star(1024, 12, std=4, rings=1, minfeature=10, ringfact=10)
>>> # Very fine plus gradient
>>> X3 = xradia_star(1024, 64, std = 0.2, rings = 10, minfeature=1,
>>>                  contrast=0)
>>> from matplotlib import pyplot as plt
>>> ax = plt.subplot(131)
>>> ax.imshow(X1, cmap='gray')
>>> ax = plt.subplot(132)
>>> ax.imshow(X2, cmap='gray')
>>> ax = plt.subplot(133)
>>> ax.imshow(X3, cmap='gray')
>>> plt.show()