hohlraum / gdsCAD

A simple but powerful Python package for creating photolithography masks in the GDSII format.
GNU General Public License v3.0
89 stars 52 forks source link

layout.show() error #36

Closed mjcorriere closed 7 years ago

mjcorriere commented 8 years ago

When running the sample code below I get the following error:

The Code:

import os.path
from gdsCAD import *

# Create some things to draw:
amarks = templates.AlignmentMarks(('A', 'C'), (1,2))
text = shapes.Label('Hello\nworld!', 200, (0, 0))
box = shapes.Box((-500, -400), (1500, 400), 10, layer=2)

# Create a Cell to hold the objects
cell = core.Cell('EXAMPLE')
cell.add([text, box])
cell.add(amarks, origin=(-200, 0))
cell.add(amarks, origin=(1200, 0))

# Create two copies of the Cell
top = core.Cell('TOP')
cell_array = core.CellArray(cell, 1, 2, (0, 850))
top.add(cell_array)

# Add the copied cell to a Layout and save
layout = core.Layout('LIBRARY')
layout.add(top)
layout.save('output.gds')

layout.show()

The Error:

Writing the following cells TOP: Cell ("TOP", 0 elements, 1 references) EXAMPLE: Cell ("EXAMPLE", 2 elements, 2 references) CONT_ALGN: Cell ("CONT_ALGN", 9 elements, 0 references) Traceback (most recent call last):

.... [removed]

File "C:\Python27\lib\site-packages\gdsCAD\core.py", line 105, in _layer_properties colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)) TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

The Fix?

It appears line 105 in core.py is trying to combine a numpy array with a regular Python list. If I change line 105 to:

colors += list(matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)))

Things run normally.

hohlraum commented 7 years ago

Thanks. Fixed now by PR #38.

yangxucb commented 5 years ago

When I pip install today, I still get this error and I manually fixed by colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)).tolist()