Skip to content

Commit f39fe2c

Browse files
committed
plot_wafer(): shows alignment marks
1 parent 96bd513 commit f39fe2c

1 file changed

Lines changed: 87 additions & 39 deletions

File tree

ASML_JobCreator/Plot.py

Lines changed: 87 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ def __init__(self, parent=None):
3333

3434

3535

36-
def plot_wafer(self):
36+
def plot_wafer(self, showwafer=True, showmarks=True):
3737
"""
3838
Plot the Wafer layout and distributed Images.
3939
Note that some plotting options, such as font size and axis positioning, are set in __globals.py
4040
41+
Parameters
42+
----------
43+
showwafer, showmarks : True | False, optional
44+
Show the wafer outline marks + edge clearance (showware) and alignment marks (showmarks). Defaults to True.
45+
4146
Returns
4247
-------
4348
fig, ax : Matplotlib Figure and Axis objects containing the schematic. Use these handles to manipulate the plot after generation. Matplotlib Patches are used to draw the shapes.
@@ -47,7 +52,7 @@ def plot_wafer(self):
4752
import numpy as np
4853

4954
fig, ax = plt.subplots(nrows=1, ncols=1)
50-
55+
LegendEntries = []
5156

5257
## Plot the wafer outline:
5358
# Arc angles:
@@ -57,9 +62,11 @@ def plot_wafer(self):
5762
A = np.rad2deg( np.arcsin( (F/2) / (D/2) ) ) # arc angle corresponding to 1/2 of wafer flat
5863
else:
5964
A = 2
60-
# matplotlib.patches.Arc(xy, width, height, angle=0.0, theta1=0.0, theta2=360.0) :
61-
wf = mplp.Arc( (0,0) , D, D, angle=-90, theta1=A, theta2=-A , color=Defaults.Plotting_WaferEdgeColor, hatch=Defaults.Plotting_BGHatch)
62-
ax.add_patch( wf )
65+
66+
if showwafer:
67+
# matplotlib.patches.Arc(xy, width, height, angle=0.0, theta1=0.0, theta2=360.0) :
68+
wf = mplp.Arc( (0,0) , D, D, angle=-90, theta1=A, theta2=-A , color=Defaults.Plotting_WaferEdgeColor, hatch=Defaults.Plotting_BGHatch)
69+
ax.add_patch( wf )
6370

6471

6572
## Plot the edge clearance
@@ -70,8 +77,10 @@ def plot_wafer(self):
7077
Ac = np.rad2deg( np.arcsin( (Fc/2) / (Dc/2) ) ) # arc angle corresponding to 1/2 of wafer flat
7178
else:
7279
Ac = 2
73-
clearance = mplp.Arc( (0,0) , Dc, Dc, angle=-90, theta1=Ac, theta2=(-Ac) , color=Defaults.Plotting_WaferColor, hatch=Defaults.Plotting_BGHatch)
74-
ax.add_patch( clearance )
80+
81+
if showwafer:
82+
clearance = mplp.Arc( (0,0) , Dc, Dc, angle=-90, theta1=Ac, theta2=(-Ac) , color=Defaults.Plotting_WaferColor, hatch=Defaults.Plotting_BGHatch)
83+
ax.add_patch( clearance )
7584

7685

7786
## Plot the Cell grid:
@@ -127,13 +136,50 @@ def gen_grid(inc, maxval, shift=0):
127136
tick.label1.set_horizontalalignment('center')
128137
#end for(ytick)
129138

130-
ax.grid(True, which='minor', color=Defaults.Plotting_GridColor, linestyle=Defaults.Plotting_GridStyle)
131-
ax.grid(False, which='major')
139+
if showwafer:
140+
ax.grid(True, which='minor', color=Defaults.Plotting_GridColor, linestyle=Defaults.Plotting_GridStyle)
141+
ax.grid(False, which='major')
142+
#end if(showwafer)
143+
144+
145+
# Plot alignment marks
146+
if self.parent.Alignment:
147+
cmap = plt.get_cmap(Defaults.Plotting_MarkColorMap) # cycling colors
148+
c=-1 # colormap index
149+
AlImgs = []
150+
for i, Mrk in enumerate(self.parent.Alignment.MarkList):
151+
if DEBUG(): print("plot_wafer:marks(): MrkImg #%i:\n"%i, Mrk.Image.ImageID, "c=%i"%c )
152+
Iwidth = Mrk.Image.sizeXY[0]
153+
Iheight = Mrk.Image.sizeXY[1]
154+
X = Mrk.waferXY[0] - Iwidth/2
155+
Y = Mrk.waferXY[1] - Iheight/2
156+
157+
Imgi = np.where( np.isin(AlImgs, Mrk.Image) )[0]
158+
if len(Imgi)==0:
159+
# Unlisted Mark Image
160+
c = c+1 # cycle colormap
161+
#end if(Mark added to legend)
162+
163+
R = mplp.Rectangle( (X,Y), Iwidth, Iheight,
164+
facecolor=Defaults.Plotting_MarkFace,
165+
edgecolor=cmap(c),
166+
label=Mrk.Image.ImageID,
167+
alpha=Defaults.Plotting_MarkAlpha,
168+
linewidth=Defaults.Plotting_MarkLineWidth )
169+
ax.add_patch( R )
170+
171+
if len(Imgi)==0:
172+
# Unlisted Mark Image
173+
AlImgs.append( Mrk.Image )
174+
LegendEntries.append( R ) # add once only
175+
if DEBUG(): print("plot_wafer:marks(): ", "\nAdding Legend entry %i\n"%len(LegendEntries), "MrkImg: ", Mrk.Image.ImageID, "c=%i"%c )
176+
#end if(Mark added to legend)
177+
#end for(Imagelist)
178+
#end if(Alignment)
132179

133180

134181
# Plot the distributed images:
135-
cmap = plt.get_cmap("tab20") # cycling colors
136-
LegendEntries = []
182+
cmap = plt.get_cmap(Defaults.Plotting_ImageColorMap) # cycling colors
137183
for i, Img in enumerate(self.parent.ImageList):
138184
Iwidth = Img.sizeXY[0]
139185
Iheight = Img.sizeXY[1]
@@ -151,6 +197,7 @@ def gen_grid(inc, maxval, shift=0):
151197
#end for(ImgDistr)
152198
#end for(Imagelist)
153199

200+
154201
# Shrink current axis by 20% for legend to fit
155202
box = ax.get_position()
156203
if DEBUG(): print("ax:box=", box.x0, box.y0)
@@ -166,7 +213,7 @@ def gen_grid(inc, maxval, shift=0):
166213

167214

168215

169-
def plot_reticles(self, scale=False):
216+
def plot_reticles(self, scale=False, showwindow=True, showlens=True):
170217
"""
171218
Plot the Reticle layout(s). If multiple Reticle ID's are detected, multiple reticles will be plotted.
172219
Note that some plotting options, such as font size and axis positioning, are set in __globals.py
@@ -175,6 +222,9 @@ def plot_reticles(self, scale=False):
175222
----------
176223
scale : True | False, optional
177224
If True, plot at Reticle scale (eg. 4x or 5x, as set in `Defaults.py :: LENS_REDUCTION`). Defaults to False, which plots at 1x wafer-scale.
225+
226+
showwindow, showlens : True | False, optional
227+
If True, show the rectangular reticle table window (showwindow) and circular lens (showlens) outlines. These dimensions are defined in Defaults.py. Both defualt to True.
178228
179229
Returns
180230
-------
@@ -188,14 +238,9 @@ def plot_reticles(self, scale=False):
188238
else:
189239
Mag = 1.0
190240

191-
# RETICLE_TABLE_SIZE, LENS_DIAMETER
192241
import matplotlib.pyplot as plt
193242
import matplotlib.patches as mplp # for plotting shapes
194-
import numpy as np
195-
196-
# TODO:
197-
# - figure out number of ReticleID's, one axis per
198-
# - loop thru images on each reticle
243+
import numpy as np
199244

200245
Rets,Imgs = self._get_ReticlesPerImage()
201246
figs, axs = [],[]
@@ -205,25 +250,28 @@ def plot_reticles(self, scale=False):
205250
figs.append(fig)
206251
axs.append(ax)
207252

208-
## Plot the Lens outline:
209-
Lens = mplp.Circle( (0,0), Defaults.LENS_DIAMETER/2.0 * Mag, label="Lens Diameter",
210-
facecolor=Defaults.Plotting_LensColor,
211-
linewidth=Defaults.Plotting_BGOutlineWidth,
212-
edgecolor=Defaults.Plotting_BGOutlineColor,
213-
linestyle=Defaults.Plotting_BGOutlineStyle,
214-
alpha = Defaults.Plotting_Alpha )
215-
ax.add_patch( Lens )
216-
217-
218-
## Plot the Reticle Table outline:
219-
RT = mplp.Rectangle( (-Defaults.RETICLE_TABLE_WINDOW[0]/2.0 * Mag, -Defaults.RETICLE_TABLE_WINDOW[1]/2.0 * Mag), Defaults.RETICLE_TABLE_WINDOW[0] * Mag, Defaults.RETICLE_TABLE_WINDOW[1] * Mag,
220-
label="Reticle Table Window",
221-
facecolor=Defaults.Plotting_ReticleTableColor,
222-
linewidth=Defaults.Plotting_BGOutlineWidth,
223-
edgecolor=Defaults.Plotting_BGOutlineColor,
224-
linestyle=Defaults.Plotting_BGOutlineStyle,
225-
alpha = Defaults.Plotting_Alpha )
226-
ax.add_patch( RT )
253+
if showlens:
254+
## Plot the Lens outline:
255+
Lens = mplp.Circle( (0,0), Defaults.LENS_DIAMETER/2.0 * Mag, label="Lens Diameter",
256+
facecolor=Defaults.Plotting_LensColor,
257+
linewidth=Defaults.Plotting_BGOutlineWidth,
258+
edgecolor=Defaults.Plotting_BGOutlineColor,
259+
linestyle=Defaults.Plotting_BGOutlineStyle,
260+
alpha = Defaults.Plotting_Alpha )
261+
ax.add_patch( Lens )
262+
#end if(showlens)
263+
264+
if showwindow:
265+
## Plot the Reticle Table outline:
266+
RT = mplp.Rectangle( (-Defaults.RETICLE_TABLE_WINDOW[0]/2.0 * Mag, -Defaults.RETICLE_TABLE_WINDOW[1]/2.0 * Mag), Defaults.RETICLE_TABLE_WINDOW[0] * Mag, Defaults.RETICLE_TABLE_WINDOW[1] * Mag,
267+
label="Reticle Table Window",
268+
facecolor=Defaults.Plotting_ReticleTableColor,
269+
linewidth=Defaults.Plotting_BGOutlineWidth,
270+
edgecolor=Defaults.Plotting_BGOutlineColor,
271+
linestyle=Defaults.Plotting_BGOutlineStyle,
272+
alpha = Defaults.Plotting_Alpha )
273+
ax.add_patch( RT )
274+
#end if(showwindow)
227275

228276
ax.set_xlabel("%ix Scale, mm" % (Mag), fontsize=PlotLabelFontSize)
229277
ax.set_ylabel("mm", fontsize=PlotLabelFontSize)
@@ -232,7 +280,7 @@ def plot_reticles(self, scale=False):
232280

233281

234282
# Plot the defined images:
235-
cmap = plt.get_cmap("tab20") # cycling colors
283+
cmap = plt.get_cmap(Defaults.Plotting_ImageColorMap) # cycling colors
236284
LegendEntries = []
237285
for i, Img in enumerate(Imgs[r]):
238286
#if DEBUG(): print("_get_ReticlesPerImage(): Imgs:\n", Imgs, "\nImg #%i\n"%i, Img)
@@ -241,7 +289,7 @@ def plot_reticles(self, scale=False):
241289
X = Img.shiftXY[0] * Mag - Iwidth/2
242290
Y = Img.shiftXY[1] * Mag - Iheight/2
243291

244-
R = mplp.Rectangle( (X,Y), Iwidth, Iheight, color=cmap(i), label=Img.ImageID, alpha=1.0, linewidth=Defaults.Plotting_LineWidth )
292+
R = mplp.Rectangle( (X,Y), Iwidth, Iheight, color=cmap(i), label=Img.ImageID, alpha=Defaults.Plotting_Alpha, linewidth=Defaults.Plotting_LineWidth )
245293
ax.add_patch( R )
246294
LegendEntries.append( R ) # add once only
247295
#end for(Imagelist)

0 commit comments

Comments
 (0)