# Exclude chip located in the edge of circle margin

Hello All…i am looking for a code to start where in circular shape like plate there is 700 chips. Each chip have its x and y coordinate.I would like to create a list of all chip coordinates EXCLUDING those chips in the margin highlighted in red. See image for details…looking forward for your help…thanks

Without writing the code for you, just keep in mind that the y/x maximum coordinates must be less than or equal than the radius of the circle. Thus, the radius would be your upper bound on all four coordinates - the radius of the green circle in the image that you have provided.

Bounded by (both must be satisfied simultaneously):
x = x1 + dx <= r_green
y = y1 + dy <= r_green

r_green = sqrt(x^2 + y^2)

When you’re checking your test code, keep in mind this test check:

Here, I am assuming that you are taking the chip center as your chip reference. Thereafter, you can add the distance from the center to each edge. Test the result to make sure it is within the upper bounds defined above. What simplifies it is that the squares/chips are identical in dimensions such that the chips are equidistant from each other. This should greatly simplify the approach to solving this problem.

In the code, if you center the chips along both the x and y axis, this might simplify it further. Note that since you will be creating a virtual x/y coordinate system, pay attention to absolute distances since you will be dealing with negative y and x values.

( Notice the grid like drawing - the solution probably has an array along with a for loop (plural?) all over it)

Hope this helps you.

2 Likes

I believe you have given me a good inputs but i still find difficulties to catch up…Would be very helpful if can provide sample code, the actual image that i am going to use is attached and also the actual xy coordinate of the chip…coordinates really dont start with x=1, y=1…thanks

Do you really need to check if the rectangle for the “chip” is intersecting the ring? Or do you only care, for example, about the distance from the center of the “chip” to the center of the circle? The latter case will be much easier to calculate.

1 Like

Thanks for the reply…can you please help me or guide me how to start the code using the latter one…thanks

Start by writing the code to compute that distance, following the explanation above about the radius. Then you can use any standard techniques to loop over all the chips, and check each one to see if the distance is suitable.

Can you please start a code for me…then i try my best to understand, learn, and complete it by myself…thanks

Hello, how to get the dx dy values? Pls explain further…thank you.
And also i found a circle formula r = sqrt [(x-x1)^2 + (y-y1)^2] , why this they took difference…really need help…thanks

Hi,

I believe that you do. I think that this problem is simulating an IC wafer. You can’t use a partial IC chip.

1 Like

Well, like I stated above, your solution will resemble a grid. You should think of it as such for simplicity. If you have 700 identical wafers, and x_side = y_side, that is they are square (you did not state that they are rectangle, meaning different x_side and y_side), you can take the square root of 700. Doing so gives you a result of 26.46. If you add a bit of margin, say to 29, then you can create a 29 by 29 grid of chips. If we superimpose that onto an x-y coordinate system, centered, then you have one in the center plus fourteen on either side, top and bottom. I specifically chose an odd number so that when superimposing the chip grid it will be symmetrical and subsequent square center distances can be taken from each respect x/y axis, as multiples, meaning: 1, 2, 3, …, 14.

You did not state the dimensions of the chips nor the actual radius of the green circle. So, based on the limited information given, to simplify, we can normalize each side to one (1). Thus, answering your question above, we can state that dx = dy = 1/2, since we are taking the center of each chip as our reference for the location of each chip.

From your original post:

Well, from the requirements given, the chip coordinates including those potentially outside the radius include (we can check those that fail in a minute):

x = -14 and all y: (-14, 14); for example: (-14, -14), (-14, -13), …, (-14, 0), …, (-14, 13), (-14, 14)
x = -13 and all y: (-14, 14)

x = 13 and all y: (-14, 14)
x = 14 and all y: (-14, 14);

Do you see the pattern here?

Now, to check if the combinations are within the radius. Note that here I am using the `range` built-in because the width of each square has been normalized to one (1). If you provide an actual width and height, then we would need to multiply the range value with these values.

Update: Let’s check all combinations instead of a select few.

``````delta = 0.5 # Will be the same for both dx and dy since a square

for value_x in range(-14, 15):
for value_y in in range(-14, 15):
if value_x + delta >= radius or values_y + delta >= radius:
print('Coordinate pair: ({}, {}) fails'.format(value_x, value_y))

``````

This should be sufficient to help you in solving your issue.

1 Like

Hello @onePythonUser good day and thank you very much for the detailed explanations. By the way, each chip in the circle have its own coordinate as u can see from the previous image i posted. How i can apply your suggestion…thank you

I played around with this problem. Note that, as I stated before, since no actual measurements were provided, I have normalized each side to one (1). I am taking the center of each chip (which I am making the assumption is a perfect square). If they are not a complete square, and or if you obtain the actual measurements, enough is being provided in this code script to get you going.

Try this:

``````from numpy import sqrt

delta = 0.5         # Assuming L = H = One (1)
radius = 14.5       # This value was not stated so arbitrary for test purposes
inbound_chips = 0   # Chips within the radius
outbound_chips = 0  # Chips on or outside radius

# Create chip x-y center coordinates
chip_x_centers = []
chip_y_centers = []

for coordinate in range(-14, 15, 1):

chip_x_centers.append(coordinate)
chip_y_centers.append(coordinate)

# Check if chips are on or outside radial perimeter
for x_coordinate in chip_x_centers:

if x_coordinate < 0:
x_edge = x_coordinate - delta
else:
x_edge = x_coordinate + delta

for y_coordinate in chip_y_centers:

if y_coordinate < 0:
y_edge = y_coordinate - delta
else:
y_edge = y_coordinate + delta

chip_radius = sqrt(x_edge ** 2 + y_edge ** 2)

print('Fail: Chip Radius = {:4.1f}, Coordinate pair: ({}, {})'.format(chip_radius, x_coordinate, y_coordinate))
outbound_chips += 1
else:
print('Pass: Chip Radius = {:4.1f}, Coordinate pair: ({}, {})'.format(chip_radius, x_coordinate, y_coordinate))
inbound_chips += 1

print('\nTotal outbound chips: ', outbound_chips)
print('Total inbound chips: ', inbound_chips)

``````
1 Like

For each chip, calculate its bounding box (the x-coordinate of the left and right edges and the y-coordinate of the top and bottom edges). From these you can get the coordinates of the chip’s four corners.

Reject a chip if the distance of any corner from the centre of the circle is greater than the radius of the circle.

If L and H is not same, how we can get the delta? thanks

Hello @onePythonUser , thank you…i have tried to run your code and plot chart manually, it looks nice. I believe this is what i am looking. But please help me 2 things:
1.) From 4 sides, would to add layers from the edge to be included in red (see fig2).
2.) Would like to put pass and fail coordinates in a list.
Thank you

By the way, here i got more info about the chip

Reminder: This site is about the Python language. You are no longer asking about Python related software issues but about solving the problem for you. I have already provided more than adequate information including a tutorial that described how to approach this problem and a detailed Python script. All that is needed is sincere effort on your part.

Good luck.

3 Likes

Really? This is a rectangle. How would you calculate the midpoints? This is fundamental.

Hello @onePythonUser , i have tried to revise your code using the actual values but i got all chips fail.
Please guide me how to fix.

``````import math

delta = 0.5         # Assuming L = H = One (1)
radius = 6       # using this formula r = (w/2) * (h/2) / SQRT((w/2)^2 + (h/2)^2)
inbound_chips = 0   # Chips within the radius
outbound_chips = 0  # Chips on or outside radius

# Create chip x-y center coordinates
chip_x_centers = []
chip_y_centers = []

for coordinatex in range(11, 27, 1):
chip_x_centers.append(coordinatex)

for coordinatey in range(11, 46, 1):
chip_y_centers.append(coordinatey)

# Check if chips are on or outside radial perimeter
for x_coordinate in chip_x_centers:

if x_coordinate < 18:  #center of x
x_edge = x_coordinate - delta
else:
x_edge = x_coordinate + delta

for y_coordinate in chip_y_centers:

if y_coordinate < 28: #center of y
y_edge = y_coordinate - delta
else:
y_edge = y_coordinate + delta

chip_radius = math.sqrt(x_edge ** 2 + y_edge ** 2)

print('Fail: Chip Radius = {:4.1f}, Coordinate pair: ({}, {})'.format(chip_radius, x_coordinate, y_coordinate))
outbound_chips += 1
else:
print('Pass: Chip Radius = {:4.1f}, Coordinate pair: ({}, {})'.format(chip_radius, x_coordinate, y_coordinate))
inbound_chips += 1

print('\nTotal outbound chips: ', outbound_chips)
print('Total inbound chips: ', inbound_chips)
``````

result

``````Total outbound chips:  560
Total inbound chips:  0
``````