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

fix type mismatch when attempting to plot #47

Closed stylewarning closed 7 years ago

stylewarning commented 8 years ago

The default example on the homepage doesn't work on Windows (but probably other platforms as well) with Anaconda installed.

The issue is that a Python list of characters is trying to be appended to a numpy array of S32s. We can just convert the array (which is small) into a list and continue going.

The error is below:

Documents>python simple_example.py
Writing the following cells
EXAMPLE: Cell ("EXAMPLE", 2 elements, 2 references)
CONT_ALGN: Cell ("CONT_ALGN", 9 elements, 0 references)
TOP: Cell ("TOP", 0 elements, 1 references)
Traceback (most recent call last):
  File "simple_example.py", line 25, in <module>
    layout.show()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 82, in _show
    artists=self.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 1132, in artist
    artists += c.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 1389, in artist
    art+=e.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 1844, in artist
    art=self.ref_cell.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 1389, in artist
    art+=e.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 954, in artist
    art+=p.artist()
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\gdsCAD\core.py", line 350, in artist
    return [matplotlib.patches.Polygon(self.points, closed=True, lw=0, **self._layer_properties(self.layer))]
  File "C:\Anaconda2\lib\site-packages\gdscad-0.4.5-py2.7.egg\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')
stylewarning commented 8 years ago

Looks like this fix duplicates #37 and #38

hohlraum commented 7 years ago

Fixed in PR #38.