gdsfactory.read.from_np

Contents

gdsfactory.read.from_np#

gdsfactory.read.from_np(ndarray, nm_per_pixel=20, layer=(1, 0), threshold=0.99, invert=True)[source]#

Returns Component from a np.ndarray.

Extracts contours skimage.measure.find_contours using threshold.

Parameters:
  • ndarray (ndarray[tuple[int, ...], dtype[floating[Any]]]) – 2D ndarray representing the device layout.

  • nm_per_pixel (int) – scale_factor.

  • layer (tuple[int, int]) – layer tuple to output gds.

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

  • invert (bool) – invert the mask.

Return type:

Component