GDS stores rotation in degrees

This commit is contained in:
jan 2018-04-14 15:19:48 -07:00
parent 04ff11d3cb
commit 0170f45f75

View File

@ -101,7 +101,7 @@ def write(patterns: Pattern or List[Pattern],
sref = gdsii.elements.SRef(struct_name=encoded_name, sref = gdsii.elements.SRef(struct_name=encoded_name,
xy=numpy.round([subpat.offset]).astype(int)) xy=numpy.round([subpat.offset]).astype(int))
sref.strans = 0 sref.strans = 0
sref.angle = subpat.rotation sref.angle = subpat.rotation * 180 / numpy.pi
sref.mag = subpat.scale sref.mag = subpat.scale
structure.append(sref) structure.append(sref)
@ -210,7 +210,7 @@ def write_dose2dtype(patterns: Pattern or List[Pattern],
sref = gdsii.elements.SRef(struct_name=encoded_name, sref = gdsii.elements.SRef(struct_name=encoded_name,
xy=numpy.round([subpat.offset]).astype(int)) xy=numpy.round([subpat.offset]).astype(int))
sref.strans = 0 sref.strans = 0
sref.angle = subpat.rotation sref.angle = subpat.rotation * 180 / numpy.pi
sref.mag = subpat.scale sref.mag = subpat.scale
structure.append(sref) structure.append(sref)
@ -270,7 +270,7 @@ def read(filename: str,
if get_bit(element.strans, 13): if get_bit(element.strans, 13):
subpat.offset *= subpat.scale subpat.offset *= subpat.scale
if element.angle is not None: if element.angle is not None:
subpat.rotation = element.angle subpat.rotation = element.angle * numpy.pi / 180
# Bit 14 means absolute rotation # Bit 14 means absolute rotation
if get_bit(element.strans, 14): if get_bit(element.strans, 14):
subpat.offset = numpy.dot(rotation_matrix_2d(subpat.rotation), subpat.offset) subpat.offset = numpy.dot(rotation_matrix_2d(subpat.rotation), subpat.offset)