porespy.generators.sierpinski_foam#

porespy.generators.sierpinski_foam(shape, n: int = 5, mode: str = 'upper')#

Generates an image of a Sierpinski carpet or foam with independent control of image size and number of iterations

Parameters:
  • shape (array_like) – The shape of the final image to create. To create a full image with no cropping, use a that is a multiple of 3**n.

  • n (int) – The number of times to iteratively divide the image. This functions starts by inserting single voxels, then inserts increasingly large squares/cubes.

  • mode (str) –

    Controls the portion of the image that is returned, options are:

    Mode

    Description

    ’upper’

    Returns the upper corner

    ’centered’

    Returns the center portion

    None

    Provide the full image, in which case the returned image will be larger than shape.

Returns:

im – A boolean image with False values inserted at the center of each square (or cubic) sub-section.

Return type:

ndarray

Examples

Click here to view online example.