Skip to content

Commit

Permalink
Release of 1.0.6 / 2015-04-01
Browse files Browse the repository at this point in the history
  - Refactored wm_core.draw_wafer_outline so that there are fewer branches
  - Added wm_core.calc_flat_coords to reduce code duplication. This function
    calculates the start and end coordinates of a horizontal chord below
    the circle origin whos length spans a given angle. See doctring on
    wm_core.calc_flat_coords for more info.
  - Fixed issue where a flat exclusion of 0 would not work
  - Fixed issue where an exclusion of 0 would prevent the flat exclusion from
    being drawn.
  • Loading branch information
dougthor42 committed Apr 1, 2015
1 parent c58d039 commit 45bd39a
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 49 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ Current capabilities:

Changelog
=========
* **1.0.6 / 2015-04-01**
- Refactored wm_core.draw_wafer_outline so that there are fewer branches
- Added wm_core.calc_flat_coords to reduce code duplication. This function
calculates the start and end coordinates of a horizontal chord below
the circle origin whos length spans a given angle. See doctring on
wm_core.calc_flat_coords for more info.
- Fixed issue where a flat exclusion of 0 would not work
- Fixed issue where an exclusion of 0 would prevent the flat exclusion from
being drawn.

* **1.0.5 / 2015-03-30**

+ Added optional "grid_center" input to gen_fake_data
Expand Down
Binary file added dist/wafer_map-1.0.6.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name="wafer_map",
packages=["wafer_map"],
version="1.0.5",
version="1.0.6",
description="Semiconductor Wafer Mapping",
author="Douglas Thor",
author_email="[email protected]",
Expand Down
150 changes: 102 additions & 48 deletions wafer_map/wm_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def mouse_right_up(self, event):
print("Right mouse up!")


def draw_wafer_outline(dia=150, excl=5, flat=5):
def draw_wafer_outline(dia=150, excl=5, flat=None):
"""
Draws a wafer outline for a given radius, including any edge exclusion
lines.
Expand All @@ -484,22 +484,24 @@ def draw_wafer_outline(dia=150, excl=5, flat=5):
"""

rad = float(dia)/2.0
if flat is None:
flat = excl

# Full wafer outline circle
circ = FloatCanvas.Circle((0, 0),
dia,
LineColor=wx.YELLOW,
LineWidth=1,
)

if flat == 0:
flat = excl
# Calculate the exclusion Radius
exclRad = 0.5 * (dia - 2.0 * excl)

# TODO: There's a lot of duplicate code here. I should try and change that.
if dia in wm_FLAT_LENGTHS:
# A flat is defined, so we draw it.
flat_size = wm_FLAT_LENGTHS[dia]
x = flat_size/2
y = -math.sqrt(rad**2 - x**2)
y = -math.sqrt(rad**2 - x**2) # Wfr Flat's Y Location

arc = FloatCanvas.Arc((x, y),
(-x, y),
Expand All @@ -510,13 +512,34 @@ def draw_wafer_outline(dia=150, excl=5, flat=5):

# actually a wafer flat, but called notch
notch = draw_wafer_flat(rad, wm_FLAT_LENGTHS[dia])
# Define the arc angle based on the flat exclusion, not the edge
# exclusion. Find the flat exclusion X and Y coords.
FSSflatY = y + flat
if exclRad < abs(FSSflatY):
# Then draw a circle with no flat
excl_arc = FloatCanvas.Circle((0, 0),
exclRad * 2,
LineColor=wx.RED,
LineWidth=3,
)
excl_group = FloatCanvas.Group([excl_arc])
else:
FSSflatX = math.sqrt(exclRad**2 - FSSflatY**2)

# Define the wafer arc
excl_arc = FloatCanvas.Arc((FSSflatX, FSSflatY),
(-FSSflatX, FSSflatY),
(0, 0),
LineColor=wx.RED,
LineWidth=3,
)

excl_notch = draw_wafer_flat(exclRad, FSSflatX * 2)
excl_group = FloatCanvas.Group([excl_arc, excl_notch])
else:
# Flat not defined, so use a notch to denote wafer orientation.
ang = 2.5
ang_rad = ang * math.pi / 180

start_xy = (rad * math.sin(ang_rad), -rad * math.cos(ang_rad))
end_xy = (-rad * math.sin(ang_rad), -rad * math.cos(ang_rad))
start_xy, end_xy = calc_flat_coords(rad, ang)

arc = FloatCanvas.Arc(start_xy,
end_xy,
Expand All @@ -526,50 +549,81 @@ def draw_wafer_outline(dia=150, excl=5, flat=5):
)

notch = draw_wafer_notch(rad)
# Flat not defined, so use a notch to denote wafer orientation.
start_xy, end_xy = calc_flat_coords(exclRad, ang)

# Group the outline arc and the orientation (flat / notch) together
group = FloatCanvas.Group([circ, arc, notch])

# if an exclusion is defined: create it and add to group
if excl != 0:
exclRad = 0.5 * (dia - 2.0 * excl)

if dia in wm_FLAT_LENGTHS:
# Define the arc angle based on the flat exclusion, not the edge
# exclusion. Find the flat exclusion X and Y coords.
FSSflatY = y + flat
FSSflatX = math.sqrt(exclRad**2 - FSSflatY**2)

# Define the wafer arc
excl_arc = FloatCanvas.Arc((FSSflatX, FSSflatY),
(-FSSflatX, FSSflatY),
(0, 0),
LineColor=wx.RED,
LineWidth=3,
)

excl_notch = draw_wafer_flat(exclRad, FSSflatX * 2)
excl_arc = FloatCanvas.Arc(start_xy,
end_xy,
(0, 0),
LineColor=wx.RED,
LineWidth=3,
)

else:
# Flat not defined, so use a notch to denote wafer orientation.
ang = 2.5
ang_rad = ang * math.pi / 180
excl_notch = draw_wafer_notch(exclRad)
excl_group = FloatCanvas.Group([excl_arc, excl_notch])

start_xy = (exclRad * math.sin(ang_rad),
-exclRad * math.cos(ang_rad))
end_xy = (-exclRad * math.sin(ang_rad),
-exclRad * math.cos(ang_rad))
# Group the outline arc and the orientation (flat / notch) together
group = FloatCanvas.Group([circ, arc, notch, excl_group])
return group

excl_arc = FloatCanvas.Arc(start_xy,
end_xy,
(0, 0),
LineColor=wx.RED,
LineWidth=3,
)

excl_notch = draw_wafer_notch(exclRad)
group = FloatCanvas.Group([circ, arc, notch, excl_arc, excl_notch])
return group
def calc_flat_coords(radius, angle):
"""
Calculates the starting and ending XY coordinates for a horizontal line
below the y axis that interects a circle of radius ``radius`` and
makes an angle ``angle`` at the center of the circle.
This line is below the y axis.
Parameters:
-----------
radius : float
The radius of the circle that the line intersects.
angle : float
The angle, in degrees, that the line spans.
Returns:
--------
(start_xy, end_xy) : tuple of coord pairs
The starting and ending XY coordinates of the line.
(start_x, start_y), (end_x, end_y))
Notes:
------
What follows is a poor-mans schematic. I hope.
::
1-------------------------------------------------------1
1 1
1 1
1 + 1
1 . . 1
1 . . 1
1 . . Radius 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1 . <--angle--> . 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1 . . 1
1-------------line--------------1
1 1
1 1
1 1
111111111111
"""
ang_rad = angle * math.pi / 180
start_xy = (radius * math.sin(ang_rad), -radius * math.cos(ang_rad))
end_xy = (-radius * math.sin(ang_rad), -radius * math.cos(ang_rad))
return (start_xy, end_xy)


def draw_crosshairs(dia=150, dot=False):
Expand Down

0 comments on commit 45bd39a

Please sign in to comment.