hohlraum / gdsCAD

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

example error 'TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')' #57

Open unnir opened 6 years ago

unnir commented 6 years ago

I'm trying to start the example script:

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()

And getting this error:

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

Rory-Lambert commented 6 years ago

The maintainer of this repo is not very active. Anyway, I'm pretty sure you're having the same problem as everyone else: there's a line in the source code that needs changing. Pasted from my issue submission;

This has actually been identified previously on stackoverflow. The top voted answer sorted the issue for me. https://stackoverflow.com/questions/34264282/typeerror-ufunc-add-did-not-contain-a-loop

Follow the link, follow the advice and it should work like a charm. Hope this helps!

dorianherle commented 5 years ago

Thanks a lot for this helpful comment !

nmz787 commented 5 years ago

to save people time scrolling and searching through the few answers on that stackoverflow post, the fix is: open gdsCAD/core.py change this line: colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)) to this line: colors += list(matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)))