gdsfactory.read.from_np

Contents

gdsfactory.read.from_np#

gdsfactory.read.from_np(ndarray: ndarray[Any, dtype[floating[Any]]], nm_per_pixel: int = 20, layer: tuple[int, int] = (1, 0), threshold: float = 0.99, invert: bool = True) Component[source]#

Returns Component from a np.ndarray.

Extracts contours skimage.measure.find_contours using threshold.

Parameters:
  • ndarray – 2D ndarray representing the device layout.

  • nm_per_pixel – scale_factor.

  • layer – layer tuple to output gds.

  • threshold – value along which to find contours in the array.

  • invert – invert the mask.