Skip to article frontmatterSkip to article content

gdsfactory.read.from_np

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

Returns Component from a np.ndarray.

Extracts contours skimage.measure.find_contours using threshold.

Parameters
  • ndarray2D ndarray representing the device layout.

  • nm_per_pixelscale_factor.

  • layerlayer tuple to output gds.

  • thresholdvalue along which to find contours in the array.

  • invertinvert the mask.