@wafertools/wafermap 0.37.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -1
- package/README.md +20 -13
- package/dist/packages/canvas-adapter/chartPopulation.d.ts +8 -3
- package/dist/packages/canvas-adapter/chartPopulation.js +1 -1
- package/dist/packages/canvas-adapter/charts/chartShell.d.ts +27 -17
- package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
- package/dist/packages/canvas-adapter/charts/plotChart.d.ts +0 -7
- package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
- package/dist/packages/canvas-adapter/drilldown.d.ts +5 -0
- package/dist/packages/canvas-adapter/drilldown.js +1 -1
- package/dist/packages/canvas-adapter/index.d.ts +1 -0
- package/dist/packages/canvas-adapter/index.js +1 -1
- package/dist/packages/canvas-adapter/insightsTab.js +1 -1
- package/dist/packages/canvas-adapter/pinnedTests.d.ts +10 -0
- package/dist/packages/canvas-adapter/pinnedTests.js +1 -0
- package/dist/packages/canvas-adapter/plotCard.d.ts +1 -1
- package/dist/packages/canvas-adapter/plotCard.js +1 -1
- package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
- package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
- package/dist/packages/canvas-adapter/summaryPanel.d.ts +3 -3
- package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
- package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
- package/dist/packages/canvas-adapter/userGuideHtml.js +32 -19
- package/dist/packages/canvas-adapter/version.d.ts +2 -2
- package/dist/packages/canvas-adapter/version.js +1 -1
- package/dist/packages/canvas-adapter/viewSwitch.js +1 -1
- package/dist/packages/renderer/buildWaferMap.js +1 -1
- package/dist/packages/renderer/derivedTests/apply.d.ts +10 -0
- package/dist/packages/renderer/derivedTests/apply.js +1 -1
- package/dist/packages/renderer/derivedTests/check.d.ts +35 -0
- package/dist/packages/renderer/derivedTests/check.js +1 -0
- package/dist/packages/renderer/fmt.d.ts +5 -0
- package/dist/packages/renderer/fmt.js +1 -1
- package/dist/packages/renderer/index.d.ts +2 -0
- package/dist/packages/renderer/index.js +1 -1
- package/dist/packages/stats/analyzeWaferLot.js +1 -1
- package/dist/packages/stats/analyzeWaferMap.js +1 -1
- package/dist/packages/stats/chartCatalogue.js +1 -1
- package/dist/packages/stats/clusterDetection.js +1 -1
- package/dist/packages/stats/plotData.d.ts +7 -0
- package/dist/packages/stats/plotData.js +1 -1
- package/dist/packages/stats/reportHtml.js +33 -29
- package/dist/packages/stats/synthesis.d.ts +1 -1
- package/dist/packages/stats/synthesis.js +1 -1
- package/package.json +8 -4
|
@@ -72,7 +72,7 @@ export const USER_GUIDE_HTML=`<div class="wmap-guide">
|
|
|
72
72
|
.wmap-guide-toc{display:none!important}
|
|
73
73
|
}
|
|
74
74
|
</style>
|
|
75
|
-
<h1 id="wmap-wafer-map-user-guide">Wafer Map \u2014 User Guide<span class="wmap-guide-version" title="Built 2026-10-
|
|
75
|
+
<h1 id="wmap-wafer-map-user-guide">Wafer Map \u2014 User Guide<span class="wmap-guide-version" title="Built 2026-10-28T17:57:47.014Z">v0.38.0</span></h1>
|
|
76
76
|
<p class="wmap-guide-online-link">This is a quick reference. <a href="https://wafertools.github.io/wafermap/user-guide/" target="_blank" rel="noopener">View the full illustrated guide online \u2197</a></p>
|
|
77
77
|
<p>This guide describes the display and analysis features of the wafer map viewer.
|
|
78
78
|
It is written for users who may be semiconductor test engineers, device engineers, and yield engineers
|
|
@@ -130,26 +130,26 @@ there; <strong>Reset orientation</strong> leaves it as it is.</p>
|
|
|
130
130
|
<p>A no-data die is not a fail; it simply has no result recorded. Edge-excluded dies are shown dimmed and are
|
|
131
131
|
not counted in yield calculations. Dies the filter drops are drawn faded and are counted nowhere: not in the legend, the
|
|
132
132
|
yield, the Summary panel or the findings.</p>
|
|
133
|
-
<h3 id="wmap-legend-and-
|
|
133
|
+
<h3 id="wmap-legend-and-colour-bar">1.4 Legend and colour bar</h3>
|
|
134
134
|
<p><strong>Bin modes</strong> show a discrete colour legend: one swatch per bin, with bin number
|
|
135
135
|
and name if the application has supplied bin names. Passing bins are listed first,
|
|
136
136
|
then failing bins from the most dies to the fewest \u2014 the same order as the Summary
|
|
137
137
|
panel and reports.</p>
|
|
138
|
-
<p><strong>Value mode</strong> shows a continuous
|
|
139
|
-
to maximum value, with units when available. The
|
|
138
|
+
<p><strong>Value mode</strong> shows a continuous colour bar: the colour scale runs from the minimum
|
|
139
|
+
to maximum value, with units when available. The colour bar is informational only \u2014
|
|
140
140
|
clicking it has no effect. To switch to a pass/fail view, use the <strong>Limit pass/fail</strong>
|
|
141
141
|
or <strong>Test pass/fail</strong> option in the Overlays menu (available when test limits are
|
|
142
142
|
defined, or a recorded verdict exists, for the active test).</p>
|
|
143
|
-
<p><strong>Limit pass/fail mode</strong> replaces the
|
|
143
|
+
<p><strong>Limit pass/fail mode</strong> replaces the colour bar with a small legend: Pass,
|
|
144
144
|
Fail high, and Fail low swatches (only the categories that apply to the test's
|
|
145
145
|
limits) with a die count beside each. This judges dies against the test's lower
|
|
146
146
|
and upper test limits.</p>
|
|
147
|
-
<p><strong>Test pass/fail mode</strong> replaces the
|
|
147
|
+
<p><strong>Test pass/fail mode</strong> replaces the colour bar with a <strong>Pass / Fail legend</strong> and die
|
|
148
148
|
counts, coloured by the tester's own <strong>recorded</strong> verdict for that test \u2014 not a
|
|
149
149
|
limit judgement. A test with no measured value (a functional, go/no-go test)
|
|
150
150
|
always displays this way; selecting it switches the map into Test pass/fail
|
|
151
151
|
automatically, since there is nothing to plot on a gradient.</p>
|
|
152
|
-
<p>Every map also shows a short <strong>title</strong> by the
|
|
152
|
+
<p>Every map also shows a short <strong>title</strong> by the colour bar or legend naming what is
|
|
153
153
|
displayed \u2014 the test name (and number, in limit pass/fail mode), the bin type, or the stacked
|
|
154
154
|
wafer count.</p>
|
|
155
155
|
<p>Clicking a bin swatch in the legend filters the display to that bin: every other bin is
|
|
@@ -230,12 +230,12 @@ application has loaded.</p>
|
|
|
230
230
|
<p>Stacked modes are only available on lot-stack maps (multiple wafers combined into
|
|
231
231
|
one display). The panel identifies how many wafers were stacked and which
|
|
232
232
|
aggregation method is active.</p>
|
|
233
|
-
<h3 id="wmap-test-value-mode-
|
|
233
|
+
<h3 id="wmap-test-value-mode-colour-bar-range-and-test-limits">Test Value mode \u2014 colour bar range and test limits</h3>
|
|
234
234
|
<p>When test limits are defined for the active test, two additional display options
|
|
235
235
|
become available:</p>
|
|
236
236
|
<ul>
|
|
237
|
-
<li><strong>
|
|
238
|
-
actual data extent and the test limits. This affects only the
|
|
237
|
+
<li><strong>Colour bar range \u2014 Data / Limits</strong>: switches the colour bar scale between the
|
|
238
|
+
actual data extent and the test limits. This affects only the colour bar's
|
|
239
239
|
range, never how failing dies are shown. In <strong>both</strong> ranges every die is
|
|
240
240
|
coloured by the gradient so you can read the value distribution, and dies
|
|
241
241
|
outside the test limits are marked with a triangle \u2014 pointing <strong>down (\u25BD) for below the low limit</strong>, <strong>up (\u25B3)
|
|
@@ -249,7 +249,7 @@ in</strong>; zoom in and they appear.</li>
|
|
|
249
249
|
a pass colour and dies outside them are highlighted \u2014 <strong>blue for below the
|
|
250
250
|
low limit</strong>, <strong>red for above the high limit</strong>. Both flags apply
|
|
251
251
|
independently; a die can be flagged on either or both limits. A Pass/Fail legend
|
|
252
|
-
replaces the
|
|
252
|
+
replaces the colour bar, listing each applicable category with its die count.</li>
|
|
253
253
|
</ul>
|
|
254
254
|
<p>Some tests have no measured value at all \u2014 a continuity check or any other
|
|
255
255
|
go/no-go test, where the only result is a recorded pass or fail. Selecting one
|
|
@@ -320,8 +320,8 @@ shows die tooltips \u2014 a separate thing from the toolbar, which is always pre
|
|
|
320
320
|
</tr>
|
|
321
321
|
<tr>
|
|
322
322
|
<td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik01IDQgTDUgMjAiLz48cGF0aCBkPSJNNSA0IEw4IDQiLz48cGF0aCBkPSJNNSAyMCBMOCAyMCIvPjxwYXRoIGQ9Ik0xOSA0IEwxOSAyMCIvPjxwYXRoIGQ9Ik0xOSA0IEwxNiA0Ii8+PHBhdGggZD0iTTE5IDIwIEwxNiAyMCIvPjxwYXRoIGQ9Ik01IDEyIEwxOSAxMiIgc3Ryb2tlLWRhc2hhcnJheT0iMyAyIi8+PC9zdmc+Cg==" width="20" height="20"></td>
|
|
323
|
-
<td>
|
|
324
|
-
<td>Test Value mode with test limits only. Toggles the
|
|
323
|
+
<td>Colour bar range</td>
|
|
324
|
+
<td>Test Value mode with test limits only. Toggles the colour bar between the <strong>limit range</strong> (default \u2014 the colours mean the same thing on every wafer, so maps are comparable) and the <strong>data range</strong> (stretches the scale to the values actually present, which shows more contrast but is not comparable between wafers).</td>
|
|
325
325
|
</tr>
|
|
326
326
|
<tr>
|
|
327
327
|
<td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjciIHg9IjMiIHk9IjMiIHJ4PSIxIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iNyIgeD0iMyIgeT0iMTQiIHJ4PSIxIi8+PHBhdGggZD0iTTE0IDRoNyIvPjxwYXRoIGQ9Ik0xNCA5aDciLz48cGF0aCBkPSJNMTQgMTVoNyIvPjxwYXRoIGQ9Ik0xNCAyMGg3Ii8+PC9zdmc+Cg==" width="20" height="20"></td>
|
|
@@ -500,6 +500,10 @@ it as a file and send it to whoever supports this software.</p>
|
|
|
500
500
|
<td><strong>Space (hold) + drag</strong></td>
|
|
501
501
|
<td>Temporarily pan without leaving the current tool</td>
|
|
502
502
|
</tr>
|
|
503
|
+
<tr>
|
|
504
|
+
<td><strong>1</strong> to <strong>5</strong>, <strong>0</strong></td>
|
|
505
|
+
<td>Over a gallery (or with focus in it) or on the Insights tab: set that many columns of cards; over a plot of panels: that plot's columns. <strong>0</strong> is Auto (same as the Columns control)</td>
|
|
506
|
+
</tr>
|
|
503
507
|
</tbody></table>
|
|
504
508
|
<h3 id="wmap-gallery">Gallery</h3>
|
|
505
509
|
<p>The gallery control bar applies to all cards simultaneously.</p>
|
|
@@ -534,7 +538,7 @@ it as a file and send it to whoever supports this software.</p>
|
|
|
534
538
|
<tr>
|
|
535
539
|
<td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPgogIDxyZWN0IHg9IjMiIHk9IjMiIHdpZHRoPSI0IiBoZWlnaHQ9IjE4IiByeD0iMSIvPgogIDxyZWN0IHg9IjEwIiB5PSIzIiB3aWR0aD0iNCIgaGVpZ2h0PSIxOCIgcng9IjEiLz4KICA8cmVjdCB4PSIxNyIgeT0iMyIgd2lkdGg9IjQiIGhlaWdodD0iMTgiIHJ4PSIxIi8+Cjwvc3ZnPgo=" width="20" height="20"></td>
|
|
536
540
|
<td>Columns</td>
|
|
537
|
-
<td>Sets the number of columns. <strong>Auto</strong> fits as many cards as
|
|
541
|
+
<td>Sets the number of columns, or press <strong>1</strong> to <strong>5</strong>, or <strong>0</strong> for Auto, while the pointer is over the gallery or focus is in it. <strong>Auto</strong> fits as many cards as keep each die at least 6 px across, so a dense wafer gets a wider card and a window that cannot hold another column at that width keeps the columns it has; a number divides the full width between that many columns.</td>
|
|
538
542
|
</tr>
|
|
539
543
|
<tr>
|
|
540
544
|
<td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik01IDNhMiAyIDAgMCAwLTIgMiIvPjxwYXRoIGQ9Ik0xOSAzYTIgMiAwIDAgMSAyIDIiLz48cGF0aCBkPSJNMjEgMTlhMiAyIDAgMCAxLTIgMiIvPjxwYXRoIGQ9Ik01IDIxYTIgMiAwIDAgMS0yLTIiLz48cGF0aCBkPSJNOSAzaDEiLz48cGF0aCBkPSJNOSAyMWgxIi8+PHBhdGggZD0iTTE0IDNoMSIvPjxwYXRoIGQ9Ik0xNCAyMWgxIi8+PHBhdGggZD0iTTMgOXYxIi8+PHBhdGggZD0iTTIxIDl2MSIvPjxwYXRoIGQ9Ik0zIDE0djEiLz48cGF0aCBkPSJNMjEgMTR2MSIvPjwvc3ZnPgo=" width="20" height="20"></td>
|
|
@@ -563,7 +567,7 @@ it as a file and send it to whoever supports this software.</p>
|
|
|
563
567
|
</tr>
|
|
564
568
|
<tr>
|
|
565
569
|
<td><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiBmaWxsPSJub25lIiBzdHJva2U9IiMzNzQxNTEiIHN0cm9rZS13aWR0aD0iMS44IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik01IDQgTDUgMjAiLz48cGF0aCBkPSJNNSA0IEw4IDQiLz48cGF0aCBkPSJNNSAyMCBMOCAyMCIvPjxwYXRoIGQ9Ik0xOSA0IEwxOSAyMCIvPjxwYXRoIGQ9Ik0xOSA0IEwxNiA0Ii8+PHBhdGggZD0iTTE5IDIwIEwxNiAyMCIvPjxwYXRoIGQ9Ik01IDEyIEwxOSAxMiIgc3Ryb2tlLWRhc2hhcnJheT0iMyAyIi8+PC9zdmc+Cg==" width="20" height="20"></td>
|
|
566
|
-
<td>
|
|
570
|
+
<td>Colour bar range</td>
|
|
567
571
|
<td>Test Value mode with test limits only. Toggles all cards between the limit range and the data range. Leave it on the test limits when comparing wafers \u2014 the data range rescales per view.</td>
|
|
568
572
|
</tr>
|
|
569
573
|
<tr>
|
|
@@ -704,7 +708,11 @@ cluster, a scratch or an edge region on its own, or at one wafer out of a lot.</
|
|
|
704
708
|
<ul>
|
|
705
709
|
<li><strong>Selected dies</strong> \u2014 select some dies, then right-click on the map. Right-
|
|
706
710
|
clicking a die that is <strong>not</strong> selected selects that die alone first;
|
|
707
|
-
right-clicking a selected die, or empty space, keeps the selection
|
|
711
|
+
right-clicking a selected die, or empty space, keeps the selection. On a single map the menu's first row, <strong>Invert
|
|
712
|
+
selection</strong>, selects the dies that were not selected and deselects those that were. Below the charts of the selection,
|
|
713
|
+
<strong>Selection vs the rest of the wafer</strong> offers a <strong>Value histogram</strong> (one colour for each side, overlaid) and a <strong>Box plot</strong>
|
|
714
|
+
of the selected dies against the wafer's other dies, each side labelled with its die count. Partial and edge-excluded dies are
|
|
715
|
+
left out of both, and with fewer than 10 dies on a side the window says to read the spread rather than small differences.</li>
|
|
708
716
|
<li><strong>Dies selected on several wafers of a gallery</strong> \u2014 by clicking a finding, or by selecting on more than one card.
|
|
709
717
|
Right-click a selected die on any of those cards and the menu opens on every selected die, with a first row,
|
|
710
718
|
<strong>Only this wafer</strong>, that narrows it to the dies selected on the card you clicked (and <strong>All selected</strong> to go back).</li>
|
|
@@ -1045,6 +1053,9 @@ hides the other's toolbar button, since Findings has nothing to highlight
|
|
|
1045
1053
|
against once the map is replaced.</p>
|
|
1046
1054
|
<p>The <a href="https://wafertools.github.io/wafermap/charts/">Chart reference</a> describes every chart, plot and table: what it
|
|
1047
1055
|
shows, how to read it, when to reach for it and where to find it. This section covers how the tab works.</p>
|
|
1056
|
+
<p>The <strong>Columns</strong> control beside <strong>Group by</strong> and <strong>Show</strong>, or the keys <strong>1</strong> to <strong>5</strong> (and <strong>0</strong> for Auto), sets how many columns of
|
|
1057
|
+
cards every section of the tab uses. <strong>Auto</strong> fits as many as the width holds at 420 px or more; a number divides the width that many ways,
|
|
1058
|
+
and the choice stays while you move between the tabs.</p>
|
|
1048
1059
|
<p>Any chart mark that stands for one wafer \u2014 a bar in <em>Yield by wafer</em>, a box in
|
|
1049
1060
|
<em>Test value distribution</em>, a point in <em>Wafer-to-wafer trend</em> \u2014 can be
|
|
1050
1061
|
right-clicked to chart that wafer on its own (see
|
|
@@ -1080,7 +1091,8 @@ filter or <strong>Show</strong> narrows the population it says so instead of dra
|
|
|
1080
1091
|
in the physical sequence, so there is no sort control to destroy it, and it needs at least two wafers; drag across it to pick a
|
|
1081
1092
|
run of wafers. The box plot, histogram and trend are plots: each has the test picker and the axis settings (<em>Axis includes
|
|
1082
1093
|
limits</em>, <em>Clip outliers</em>, and which limits to draw), and a change in one reaches the others. Clicking a capability box drives
|
|
1083
|
-
them onto that same test
|
|
1094
|
+
them onto that same test. In a lot with hundreds of tests, click the \u2606 at the end of a row in any test picker (or press <strong>P</strong> on
|
|
1095
|
+
the focused row) to <strong>pin</strong> that test: pinned tests are listed first, under a "Pinned" heading, in every picker.</p>
|
|
1084
1096
|
<p>With <strong>Group by</strong> on (a split, a lot), the cards that compare the groups come first, under <strong>Comparing \u2026</strong>: the
|
|
1085
1097
|
<a href="https://wafertools.github.io/wafermap/charts/#comparison-by-group">Comparison by</a> table and the <a href="https://wafertools.github.io/wafermap/charts/#difference-map">difference map</a> (pick the two groups and a test or <em>Yield</em>; it follows
|
|
1086
1098
|
the test the other panels show until you pick one), then the cards for each test under <strong>Test by test</strong>. In the table,
|
|
@@ -1174,7 +1186,7 @@ onto that pair.</em></p>
|
|
|
1174
1186
|
</tr>
|
|
1175
1187
|
<tr>
|
|
1176
1188
|
<td>A bar of the <strong>value histogram</strong> (with Group by on, a column of it)</td>
|
|
1177
|
-
<td>the menu on the dies whose values fall in that bar, across the groups, or in the one group the legend has
|
|
1189
|
+
<td>the menu on the dies whose values fall in that bar, across the groups, or in the one group <strong>Show</strong> has narrowed to (or the one a legend click has left showing)</td>
|
|
1178
1190
|
</tr>
|
|
1179
1191
|
<tr>
|
|
1180
1192
|
<td>A level of a <strong>sweep</strong> curve</td>
|
|
@@ -1447,7 +1459,8 @@ die field (ring, site, bin) the dies with that value from every wafer; <strong>T
|
|
|
1447
1459
|
one test a panel. So "one scatter per split" or "a histogram per ring" is one plot. Rescaled values are measured over
|
|
1448
1460
|
the whole population, so a panel is not re-centred on itself and panels compare. Each panel has its own expand button, and
|
|
1449
1461
|
the plot's Save as PNG saves the whole grid. At most 24 panels; a field on the X axis or the colour cannot also make
|
|
1450
|
-
the panels
|
|
1462
|
+
the panels. The <strong>Columns</strong> control above the panels, or the keys <strong>1</strong> to <strong>5</strong> (and <strong>0</strong> for Auto) while the pointer is
|
|
1463
|
+
over the plot, sets how many panels sit side by side; Auto fits as many as the width holds at 260 px or more.</li>
|
|
1451
1464
|
<li><strong>Wafer-level comparison</strong> (box and bar of one measured test): when the categories or the colour are a wafer field
|
|
1452
1465
|
such as split or lot, the line under the plot adds the comparison of those groups with each wafer as one value, as
|
|
1453
1466
|
the Distributions table does: the wafers in each group, Welch p and rank p.</li>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const WMAP_VERSION = "0.
|
|
2
|
-
export declare const WMAP_BUILD_TIME = "2026-10-
|
|
1
|
+
export declare const WMAP_VERSION = "0.38.0";
|
|
2
|
+
export declare const WMAP_BUILD_TIME = "2026-10-28T18:00:48.604Z";
|
|
3
3
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WMAP_VERSION="0.
|
|
1
|
+
export const WMAP_VERSION="0.38.0",WMAP_BUILD_TIME="2026-10-28T18:00:48.604Z";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CLR as
|
|
1
|
+
import{CLR as o,FONT as w,RADIUS as l,SHADOW as f,SPACE as p,wireControlHover as A,wireTooltip as y}from"./toolbar.js";export function createViewSwitch(s,g,c,m){const n=s.createElement("div");n.setAttribute("role","tablist"),n.setAttribute("aria-label","View"),n.dataset.wmapViewSwitch="1",Object.assign(n.style,{order:"1",flexShrink:"0",display:"inline-flex",alignItems:"stretch",background:o.menuBg,border:`1px solid ${o.menuBorder}`,borderRadius:l.control,boxShadow:f.panel});const d=(t,e,h)=>{const r=s.createElement("button");return r.type="button",r.textContent=t,r.dataset.wmapView=e,r.setAttribute("role","tab"),Object.assign(r.style,{border:"none",cursor:"pointer",fontSize:w.body,padding:`${p.sm} ${p.lg}`,whiteSpace:"nowrap"}),A(r,"bare"),y(r,h),r.addEventListener("click",()=>{r.getAttribute("aria-selected")!=="true"&&m(e==="insights")}),r},i=d(g,"maps",c==="lot"?"The wafer maps":"The wafer map"),a=d("Insights","insights",`Charts and statistics for this ${c}`);i.style.borderRadius=`${l.control} 0 0 ${l.control}`,a.style.borderRadius=`0 ${l.control} ${l.control} 0`,n.append(i,a);const b=(t,e)=>{t.setAttribute("aria-selected",String(e)),t.dataset.on=String(e),t.tabIndex=e?0:-1,Object.assign(t.style,{background:e?o.bgActive:"transparent",color:e?o.iconActive:o.label,fontWeight:"600"})},u=t=>{b(i,!t),b(a,t)};return u(!1),n.addEventListener("keydown",t=>{if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=s.activeElement===i?a:i;s.activeElement!==i&&s.activeElement!==a||(t.preventDefault(),e.focus(),e.click())}),{el:n,setInsightsOpen:u}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createWafer as Q}from"../core/wafer.js";import{isYieldEligibleDie as ve,getDieKey as X,hasPosition as W,positionKey as Se}from"../core/dies.js";import{applyOrientation as se,transformDies as Ce,clipDiesToWafer as ke}from"../core/transforms.js";import{generateDies as Oe}from"../core/dies.js";import{dieHasAnyTestData as Ae,dieLink as U,finaliseDie as z,linkDie as $e,recordedVerdict as Ne,recordedVerdictsReader as Re,tableFromRows as Fe,testValue as Z,testsPresent as Ee,VERDICT_FAIL as Te,VERDICT_NONE as We,VERDICT_PASS as Ie}from"../core/dieTable.js";import{isDieColumns as _e,linkColumns as Pe,linkRows as re,relink as oe}from"./columnarInput.js";import{affineRotation as Ve,affineMirror as Be,affineCompose as Le,affinePoint as Ye}from"../core/transforms.js";import{inferWaferFromXY as Xe}from"../core/inference/wafer.js";import{resolveGridPitch as Ke}from"../core/inference/pitch.js";import{assignGridIndices as je}from"../core/inference/grid.js";import{generateReticleGrid as He}from"../core/reticle.js";import{applyDerivedTests as Ue}from"./derivedTests/apply.js";import{isStdfBin as ze,isStdfCoord as ae,isStdfTestNumber as de,isStdfSite as Ge,STDF_BIN_MAX as qe,STDF_COORD_MAX as fe,STDF_TEST_NUM_MAX as Je,STDF_SITE_MAX as Qe}from"../core/stdf.js";import{hasAnyKey as Ze,maxOf as ee,minOf as le,modeOf as et}from"../core/utils.js";import{aggregateValues as ue,aggregateBinCounts as tt,stackHoldsMeasurements as nt,stackBinsAreData as it}from"../core/aggregates.js";import{normalizePassBins as ce}from"../core/passBins.js";import{defaultRingCount as te}from"../core/ringCount.js";import{applyValueFilter as st,mergeValueFilterTests as rt,valueFilterWarning as ot}from"./valueFilter.js";export function isParametricTest(n){return n?.testType!=="F"}export function isBuiltMap(n){return"wafer"in n&&"dies"in n&&"dataAxisFlip"in n}function at(n){const e=(i,a)=>({ringCount:i,ringCountWarning:{code:"analysis-option-corrected",severity:"warning",message:`ringCount=${String(n)} ${a} (using ${i}).`}});if(n===void 0)return{ringCount:te(),ringCountWarning:void 0};if(typeof n!="number"||!Number.isFinite(n))return e(te(),"is not a finite number");const t=Math.max(1,Math.round(n));return t===n?{ringCount:n,ringCountWarning:void 0}:e(t,"is not a whole number of at least 1")}function dt(n,e){const t=Array.isArray(n)?{}:n,i={hbin:0,sbin:0,siteNum:0,testValues:0,testPass:0};let a;const d=(u,C)=>{i[u]++,a??=`${u} ${JSON.stringify(C)}`},o={bins:0,positions:0,values:0,sites:0,orientation:0},r=new Set;let p=0;if(e){i.testValues+=e.wrongValues,i.testPass+=e.wrongVerdicts,e.example!==void 0&&(a??=e.example),o.values+=e.nonFinite;for(const u of e.badTestNumbers)r.add(u)}const h=u=>u==null?!0:typeof u!="number"?!1:Number.isNaN(u)?(p++,!1):ze(u)?!0:(o.bins++,!1);function l(u){const C=new Set,D=new Set;for(let S=0;S<u.length;S+=S<50?1:100){const N=u[S];if(!(N===null||typeof N!="object")){if(N.testValues&&typeof N.testValues=="object")for(const M of Object.keys(N.testValues))C.add(M);if(N.testPass&&typeof N.testPass=="object")for(const M of Object.keys(N.testPass))D.add(M)}}const g=[...C],b=[...D],k=S=>de(Number(S));for(const S of new Set([...g,...b]))k(S)||r.add(S);const R=g.map(k),v=b.map(k),T=g.map(Number),L=b.map(Number);let K;for(let S=0;S<u.length;S++){const N=u[S];if(N===null||typeof N!="object")continue;const M=N;let F;const $=()=>F??={...M};M.hbin!=null&&typeof M.hbin!="number"&&d("hbin",M.hbin),M.sbin!=null&&typeof M.sbin!="number"&&d("sbin",M.sbin),h(M.hbin)||($().hbin=void 0),h(M.sbin)||($().sbin=void 0);const Y=typeof M.x=="number"&&!ae(M.x),j=typeof M.y=="number"&&!ae(M.y);if(Y||j){o.positions+=(Y?1:0)+(j?1:0);const s=$();s.x=void 0,s.y=void 0}M.siteNum!=null&&typeof M.siteNum!="number"?(d("siteNum",M.siteNum),$().siteNum=void 0):typeof M.siteNum=="number"&&!Ge(M.siteNum)&&(o.sites++,$().siteNum=void 0);const P=M.testValues;if(P&&typeof P=="object"){let s;for(let x=0;x<g.length;x++){const A=g[x],O=P[T[x]];if(O!=null){if(!R[x]){s??={...P},delete s[A];continue}typeof O!="number"?(d("testValues",O),s??={...P},delete s[A]):Number.isFinite(O)||(o.values++,s??={...P},delete s[A])}}s&&($().testValues=s)}const I=M.testPass;if(I&&typeof I=="object"){let s;for(let x=0;x<b.length;x++){const A=b[x],O=I[L[x]];if(O!=null){if(!v[x]){s??={...I},delete s[A];continue}typeof O!="boolean"&&(d("testPass",O),s??={...I},delete s[A])}}s&&($().testPass=s)}F&&((K??=u.slice())[S]=F)}return K}const f={warnings:[]};if(Array.isArray(n))f.results=l(n);else{Array.isArray(t.results)&&(f.results=l(t.results)),Array.isArray(t.dies)&&(f.dies=l(t.dies));const u=t.lotStack?.results;if(Array.isArray(u)){const C=u.map(D=>Array.isArray(D)?l(D):void 0);C.some(Boolean)&&(f.stackResults=C.map((D,g)=>D??u[g]))}}if(Array.isArray(t.testDefs)){const u=t.testDefs,C=u.filter(D=>D==null||typeof D.testNumber!="number"||de(D.testNumber));for(const D of u)C.includes(D)||r.add(String(D.testNumber));C.length!==u.length&&(f.testDefs=C)}const y=t.waferConfig?.orientation;if(typeof y=="number"){const u=Number.isFinite(y)?(y%360+360)%360:NaN;u===0||u===90||u===180||u===270?f.orientation=u:(o.orientation++,f.orientation=0)}const m=(u,C,D=`${C}s`)=>`${u} ${u===1?C:D}`,c=[];if(i.hbin&&c.push(m(i.hbin,"hard bin")),i.sbin&&c.push(m(i.sbin,"soft bin")),i.siteNum&&c.push(m(i.siteNum,"site number")),i.testValues&&c.push(m(i.testValues,"test value")),i.testPass&&c.push(m(i.testPass,"pass/fail verdict")),c.length){const u=`buildWaferMap received ${c.join(", ")} of the wrong type (for example ${a}), treated as missing. Bins, sites and test values must be numbers and verdicts true/false \u2014 a bin of "1" is not pass bin 1 \u2014 so those dies have no bin, no site, no value or no verdict, and yield and every chart leave them out. Convert them with Number() (and verdicts to booleans) and rebuild.`;console.warn(`[wafermap] ${u}`),f.warnings.push({code:"input-values-not-numbers",message:u,severity:"error"})}const w=[];if(o.bins&&w.push(`${m(o.bins,"bin")} (legal: whole numbers 0\u2013${qe}) \u2014 those dies have no bin`),o.positions&&w.push(`${m(o.positions,"coordinate")} (legal: whole numbers \u2212${fe} to ${fe}) \u2014 those dies have no position`),r.size&&w.push(`${m(r.size,"test number")} (legal: whole numbers 0\u2013${Je}) \u2014 those tests are left out`),o.values&&w.push(`${m(o.values,"test value")} that ${o.values===1?"is":"are"} not finite \u2014 left out`),o.sites&&w.push(`${m(o.sites,"site number")} (legal: 0\u2013${Qe}) \u2014 those dies have no site`),o.orientation&&w.push("a waferConfig.orientation other than 0, 90, 180 or 270 \u2014 the map is built at 0"),w.length||p){const u=[];w.length&&u.push(`buildWaferMap received values outside the STDF V4 ranges, treated as missing: ${w.join("; ")}.`),p&&u.push(`${m(p,"bin was","bins were")} NaN and ${p===1?"is":"are"} treated as no bin.`);const C=u.join(" ");console.warn(`[wafermap] ${C}`),f.warnings.push({code:"input-values-outside-stdf",message:C,severity:"warning"})}return f}function pe(n){const e=(h,l)=>h!==null&&typeof h=="object"&&h[l]!==void 0,t=Array.isArray(n)?{}:n,i=[],a=(h,l,f)=>{h&&i.push(`\`${l}\` (now \`${f}\`)`)};a(e(t,"data"),"data","results"),a(e(t,"die"),"die","dieConfig"),a(e(t,"stack"),"stack","lotStack"),a(e(t.dieConfig,"origin"),"dieConfig.origin","dieConfig.coordinateOrigin"),a(e(t.waferConfig,"flat"),"waferConfig.flat","waferConfig.notch"),a(e(t.reticleConfig,"anchor"),"reticleConfig.anchor","reticleConfig.anchorDie"),a(e(t.lotStack,"aggr"),"lotStack.aggr","lotStack.method"),a(Array.isArray(t.testDefs)&&t.testDefs.some(h=>e(h,"index")&&!e(h,"testNumber")),"TestDef.index","TestDef.testNumber");const d=e(t.lotStack,"results")?t.lotStack.results:[],o=(Array.isArray(n)?[n]:[t.results,...Array.isArray(d)?d:[]]).filter(h=>Array.isArray(h));if(a(o.some(h=>h.slice(0,100).some(l=>e(l,"values"))),"values","testValues"),!i.length)return;const r=i.length>1,p=`buildWaferMap ignored ${i.join(", ")}: ${r?"these names were":"that name was"} removed in an earlier release, so what ${r?"they":"it"} described is not on this map. Rename and rebuild.`;return console.warn(`[wafermap] ${p}`),{code:"input-field-removed",message:p,severity:"error"}}function ft(n){if(n.results!==void 0||n.lotStack!==void 0)throw new Error("buildWaferMap: pass `layout`, `results` or `lotStack` \u2014 only one.");const e=n.waferConfig?.diameter,t=n.dieConfig?.width,i=n.dieConfig?.height;if(!(e>0&&t>0&&i>0))throw new Error("buildWaferMap: `layout` needs waferConfig.diameter and dieConfig.width and height, all positive.");const a=Q({diameter:e,notch:n.waferConfig?.notch,orientation:0}),d=ke(Oe(a,{width:t,height:i}),a,{width:t,height:i}).filter(l=>!l.partial),{flipX:o,flipY:r}=me(n.dieConfig,{type:"center"}),{layout:p,...h}=n;return{...h,results:d.map(l=>({x:o?-l.x:l.x,y:r?-l.y:l.y})),waferConfig:{...n.waferConfig,center:{x:0,y:0}},dieConfig:{...n.dieConfig,coordinateOrigin:{type:"center"}}}}function lt(n){if(!Array.isArray(n)&&"results"in n&&n.results!==void 0&&"lotStack"in n&&n.lotStack!==void 0)throw new Error("buildWaferMap: pass either `results` or `lotStack`, not both.");const e={wrongVerdicts:0,wrongValues:0,nonFinite:0,badTestNumbers:[]},t=!Array.isArray(n)&&_e(n.results)?{...n,results:Pe(n.results,e).records}:n,i=dt(t,e);return Array.isArray(t)?{results:ne(i.results??t),waferOpts:void 0,dieOpts:void 0,explicitDies:void 0,reticleOpts:void 0,lotStackOpts:void 0,passBins:ce(void 0),ringCount:te(),valueFilter:"validity",ringCountWarning:void 0,removedFieldWarning:pe(t),inputValueWarnings:i.warnings,standardDiameters:void 0,testDefs:void 0,hbinDefs:void 0,sbinDefs:void 0,metadataFields:void 0,derivedTests:void 0,retestPolicy:"last",edgeDieYieldMode:"exclude"}:{results:ne(i.results??t.results??[]),waferOpts:i.orientation===void 0||t.waferConfig===void 0?t.waferConfig:{...t.waferConfig,orientation:i.orientation},dieOpts:t.dieConfig,explicitDies:i.dies??t.dies,reticleOpts:t.reticleConfig,lotStackOpts:t.lotStack?{...t.lotStack,results:(i.stackResults??t.lotStack.results).map(ne)}:void 0,passBins:ce(t.passBins),valueFilter:t.valueFilter??"validity",...at(t.ringCount),removedFieldWarning:pe(t),inputValueWarnings:i.warnings,standardDiameters:t.standardDiameters,testDefs:(i.testDefs??t.testDefs)?.length?i.testDefs??t.testDefs:void 0,hbinDefs:t.hbinDefs,sbinDefs:t.sbinDefs,metadataFields:t.metadataFields,derivedTests:t.derivedTests?.length?t.derivedTests:void 0,retestPolicy:t.retestPolicy??"last",edgeDieYieldMode:t.edgeDieYieldMode??"exclude"}}function ne(n){return n.length>0&&U(n[0])!==void 0?n:re(n).records}function ut(n,e){return e?.coordinateOrigin?e.coordinateOrigin:{type:"center"}}function ct(n,e,t){if(e.type==="custom"&&e.offset)return{offsetX:e.offset.x,offsetY:e.offset.y};if(e.type!=="center"){let i=1/0,a=-1/0,d=1/0,o=-1/0;for(const r of n)r.x<i&&(i=r.x),r.x>a&&(a=r.x),r.y<d&&(d=r.y),r.y>o&&(o=r.y);return{offsetX:Math.round((a+i)/2),offsetY:Math.round((o+d)/2)}}return{offsetX:t.offsetX,offsetY:t.offsetY}}function pt(n,e){if(n.length<xe)return!1;const t=he(n),i=(a,d,o)=>{const r=o-d+1;return a<d-r||a>o+r};return i(Math.round(e.x),t.xMin,t.xMax)||i(Math.round(e.y),t.yMin,t.yMax)}function he(n){let e=1/0,t=-1/0,i=1/0,a=-1/0;for(const d of n){const o=Math.round(d.x),r=Math.round(d.y);o<e&&(e=o),o>t&&(t=o),r<i&&(i=r),r>a&&(a=r)}return{xMin:e,xMax:t,yMin:i,yMax:a}}const ht="The supplied wafer centre";function mt(n,e){const t=he(n);return`${ht} (${e.x}, ${e.y}) is far outside the probed dies (X ${t.xMin}\u2026${t.xMax}, Y ${t.yMin}\u2026${t.yMax}), so it was ignored and the centre was inferred from the dies. Used as given, it would draw a wafer many times the die extent with the dies in one corner. If it is the real centre, supply waferConfig.diameter as well.`}function gt(n,e,t,i,a,d){if(d)return{colMidX:(Math.round(d.x)-e)*i,colMidY:(Math.round(d.y)-t)*a,anchored:!0};if(n.length===0)return{colMidX:0,colMidY:0,anchored:!1};let o=1/0,r=-1/0,p=1/0,h=-1/0;for(const l of n){const f=Math.round(l.x)-e,y=Math.round(l.y)-t;f<o&&(o=f),f>r&&(r=f),y<p&&(p=y),y>h&&(h=y)}return{colMidX:(o+r)/2*i,colMidY:(p+h)/2*a,anchored:!1}}function yt(n,e,t){let i=1/0,a=-1/0,d=1/0,o=-1/0,r=0,p=0;for(const f of n){const y=Math.round(f.x)-e,m=Math.round(f.y)-t;r+=y,p+=m,y<i&&(i=y),y>a&&(a=y),m<d&&(d=m),m>o&&(o=m)}const h=n.length,l=(f,y,m)=>{const c=(m-y)/2;return c<=0?0:Math.abs(f/h-(y+m)/2)/c};return l(r,i,a)>.11||l(p,d,o)>.11}function me(n,e){let t=n?.xAxisDirection==="left",i=n?.yAxisDirection==="down";return(e.type==="UL"||e.type==="UR")&&(i=!0),(e.type==="LR"||e.type==="UR")&&(t=!0),{flipX:t,flipY:i}}function bt(n){const e={...n};return delete e.limitLow,delete e.limitHigh,delete e.limitLowInclusive,delete e.limitHighInclusive,delete e.specLow,delete e.specHigh,e}function wt(n,e){const{method:t,targetBin:i}=n,a=n.results.map(d=>d.filter(W));if(t==="mean"||t==="median"||t==="stddev"||t==="min"||t==="max"||t==="count"){const d=new Set((e??[]).filter(l=>!isParametricTest(l)).map(l=>l.testNumber)),o=new Set;for(const l of a)for(const f of Ee(l,"values"))d.has(f)||o.add(f);if(o.size===0)return ue(a,t);const r=[...o],p=r.map(l=>ue(a,t,l)),h=new Map;for(let l=0;l<r.length;l++){const f=r[l];for(const y of p[l]){const m=X(y);h.has(m)||h.set(m,{template:y,testValues:{}});const c=h.get(m),w=y.testValues?.[0];w!==void 0&&(c.testValues[f]=w)}}return[...h.values()].map(({template:l,testValues:f})=>({...l,testValues:Ze(f)?f:void 0}))}if(t==="countBin"||t==="percent"){if(i===void 0)return[];const d=tt(a,i,"hard");if(t==="countBin")return d;const o=a.length;return d.map(r=>({...r,testValues:{0:o>0?(r.testValues?.[0]??0)/o*100:0}}))}if(t==="mode"){const d=new Map;for(const r of a)for(const p of r){const h=X(p);d.has(h)||d.set(h,[]),d.get(h).push(p)}const o=[];for(const[r,p]of d){const h=r.split(","),l=Number(h[0]),f=Number(h[1]),y=p.map(c=>c.hbin).filter(c=>c!==void 0),m=et(y);m!==null&&o.push({x:l,y:f,hbin:m})}return o}return[]}export function computeCoverage(n){const e=n.filter(W),t=e.length,i=e.filter(d=>d.edgeExcluded).length,a=e.filter(d=>d.hbin!==void 0||d.sbin!==void 0||dieHasTestData(d)).length;return{filledDies:a,totalDies:t,edgeExcludedDies:i,unpositionedDies:n.length-e.length,ratio:t>0?a/t:0}}export function computeYield(n,e,t="exclude",i=!0){const a=new Set(e),o=n.filter(c=>!c.partial).filter(c=>c.edgeExcluded&&!c.filteredOut).length,r=n.filter(c=>c.partial).length;if(!i)return{passDies:0,failDies:0,edgeExcludedDies:o,partialDies:r,totalDies:0,yieldPercent:null,yieldPercentGross:null};let p=0,h=0,l=!1;for(const c of n){if(!ve(c))continue;const w=c.hbin??c.sbin;w!==void 0&&(l=!0,a.has(w)?p++:h++)}const f=p+h,y=l&&f>0?p/f*100:null;let m=null;if(t==="denominator-only"){const c=f+o;m=l&&c>0?p/c*100:null}return{passDies:p,failDies:h,edgeExcludedDies:o,partialDies:r,totalDies:f,yieldPercent:y,yieldPercentGross:m}}function ge(n,e,t,i,a,d=0,o=0,r=0,p=0,h=0,l=!1,f=!1){if(!n)return[];const y=n.anchorDie??{x:0,y:0},m=He(e,{width:n.width,height:n.height,diePitchX:i,diePitchY:a,anchorDie:{x:y.x-d,y:y.y-o},gridOrigin:{x:-r,y:-p}}),c=Le(Be(l,f,e.center.x,e.center.y),Ve(h,e.center.x,e.center.y));return m.filter(w=>{const u=w.width/2,C=w.height/2,D=[[w.x-u,w.y-C],[w.x+u,w.y-C],[w.x+u,w.y+C],[w.x-u,w.y+C]].map(([v,T])=>Ye(c,v,T)),g=le(D.map(v=>v.x)),b=ee(D.map(v=>v.x)),k=le(D.map(v=>v.y)),R=ee(D.map(v=>v.y));return t.some(v=>v.physX>=g&&v.physX<b&&v.physY>=k&&v.physY<R)})}function xt(n,e,t){const a=Math.max(0,e.radius-t)**2;return n.map(d=>{const o=d.physX-e.center.x,r=d.physY-e.center.y;return o*o+r*r>a?{...d,edgeExcluded:!0}:d})}const Dt=.2;function Mt(n){const e=new Set;for(const t of n){if(t.supersedes!==void 0||!W(t))return!1;const i=Se(t);if(e.has(i))return!1;e.add(i)}return!0}function vt(n,e,t){if(Mt(n))return{results:n.slice(),warning:void 0};const i=new Set(t);function a(g,b){if(e==="last")return!0;if(e==="first")return!1;const k=G(g.hbin),R=G(b.hbin);if(k===void 0||R===void 0)return!1;const v=i.has(k),T=i.has(R);return e==="best"?T!==v?T:R<k:T!==v?v:R>k}const d=(g,b)=>b.supersedes!==void 0||a(g,b),o=g=>{const b=g.partId===void 0?"":String(g.partId).trim();return b===""?void 0:b},r=n.filter(g=>!W(g)),p=new Map;for(const g of r){const b=o(g);b!==void 0&&p.set(b,(p.get(b)??0)+1)}const l=(r.length===0?0:Math.max(0,...p.values())/r.length)<=Dt,f=new Map,y=[],m=new Map;let c=0,w=0;for(const g of n){const b=o(g);let k;if(W(g)?k=`p:${X(g)}`:l&&b!==void 0?k=`i:${b}`:k=`u:${w++}`,g.supersedes==="partId"&&b!==void 0){const v=m.get(b);v!==void 0&&v!==k&&f.has(v)&&f.delete(v)}const R=f.get(k);R===void 0?(f.set(k,{winner:g,count:1}),y.push(k)):(R.count++,k.startsWith("i:")&&c++,d(R.winner,g)&&(R.winner=g)),b!==void 0&&m.set(b,k)}const u=[],C=[...y.filter(g=>g.startsWith("p:")),...y.filter(g=>!g.startsWith("p:"))];for(const g of C){const b=f.get(g);b!==void 0&&u.push(b.count>1?{...b.winner,retestCount:b.count}:b.winner)}const D=c>0?{code:"retests-by-part-id",severity:"info",message:`${c} record${c===1?"":"s"} with no position shared a part ID with an earlier record and ${c===1?"was":"were"} treated as a retest of it.`}:void 0;return{results:u,warning:D}}export function getDieTestValue(n,e){return Z(n,e)}export function getTestPassStatus(n,e,t){const i=Ne(n,e);return i!==void 0?i:t!==void 0&&!isParametricTest(t)?ye(Z(n,e)):void 0}function ye(n){return n===0||n===1?n===1:void 0}export function testPassStatusReader(n){const e=n.map(a=>a.testNumber),t=Re(e),i=n.map(a=>!isParametricTest(a));return function(d,o){t(d,o);for(let r=0;r<o.length;r++){if(o[r]!==We||!i[r])continue;const p=ye(Z(d,e[r]));p!==void 0&&(o[r]=p?Ie:Te)}return o}}export function dieHasTestData(n){return Ae(n)}function G(n){return n===void 0||Number.isNaN(n)?void 0:n}function q(n,e){const t={},i=G(e.hbin),a=G(e.sbin);i!==void 0&&(t.hbin=i),a!==void 0&&(t.sbin=a),e.retestCount!==void 0&&(t.retestCount=e.retestCount),e.siteNum!==void 0&&(t.siteNum=e.siteNum),e.partId!==void 0&&(t.partId=e.partId),e.metadata!==void 0&&(t.metadata=e.metadata);const d=U(e);return $e({...n,...t},d.table,d.row)}function be(n){return n.some(dieHasTestData)?"value":defaultBinMode([n])}export function defaultBinMode(n){const e=t=>n.some(i=>i.some(a=>t(a)!=null));return e(t=>t.hbin)?"hardBin":e(t=>t.sbin)?"softBin":"hardBin"}function we(n,e){return n.map(({code:t,message:i})=>({code:t,message:i,severity:t==="non-standard-diameter"||t==="diameter-exceeds-die-extent"||t==="implausible-center"?"warning":"error",confidence:e.wafer.confidence}))}const St="do not fit inside the supplied",Ct="Inferred wafer diameter",kt="The probed dies reach only",Ot=.75,xe=20;export const STANDARD_WAFER_DIAMETERS_MM=[100,125,150,200,300];const At=.02;function De(n,e){return e.reduce((t,i)=>Math.abs(i-n)<Math.abs(t-n)?i:t)}function $t(n,e){if(!e.length)return!0;const t=De(n,e);return Math.abs(t-n)/t<=At}function Nt(n){return n===void 0?STANDARD_WAFER_DIAMETERS_MM:n.filter(e=>Number.isFinite(e)&&e>0)}export function buildWaferMap(n){const e=lt(!Array.isArray(n)&&n.layout?ft(n):n),t=[];let i;if(e.valueFilter!=="none"&&e.testDefs){const s=e.valueFilter,x=(e.lotStackOpts?e.lotStackOpts.results:[e.results]).map(O=>{const _=O.length>0?U(O[0]):void 0;if(!_)return[];const E=st(_.table,e.testDefs,s);return E.tests.length>0&&oe(O,E.table),E.tests}),A=rt(x);if(A.length>0){i={mode:s,tests:A};const O=ot(s,A,e.testDefs);O&&t.push(O)}}if(e.derivedTests){const s=new Set(e.passBins),x=_=>{const E=_.length>0?U(_[0]):void 0,H=Ue(_,E?.table??Fe([]),e.testDefs,e.derivedTests,s);return E&&oe(_,H.table),H},O=(e.lotStackOpts?e.lotStackOpts.results:[e.results]).map(x);e.testDefs=O[0]?.testDefs??e.testDefs,t.push(...O[0]?.warnings??[])}e.lotStackOpts&&!nt(e.lotStackOpts.method)&&(e.testDefs=e.testDefs?.map(bt));const a=e.lotStackOpts?re(wt(e.lotStackOpts,e.testDefs)).records:e.results;for(let s=0;s<Math.min(5,a.length);s++){const x=a[s];if(typeof x.x=="string"||typeof x.y=="string")throw new TypeError("buildWaferMap: x and y must be numbers, received strings. Did you forget to cast CSV values? e.g. { x: +row.x, y: +row.y }")}for(const s of a)if(s.x==null!=(s.y==null))throw new TypeError(`buildWaferMap: die has only one of x/y set (x=${String(s.x)}, y=${String(s.y)}). A die must be either fully positioned (both x and y) or fully unpositioned (neither) \u2014 omit both to mark a die as having no reported position.`);const{results:d,warning:o}=vt(a,e.retestPolicy,e.passBins),r={wafer:{confidence:1,method:"provided"},diePitch:{confidence:1,units:"mm"},grid:{confidence:1}},p=[];if(e.explicitDies){let s=e.explicitDies.filter(W);const x=e.explicitDies.filter(B=>!W(B)),A=d.filter(W),O=d.filter(B=>!W(B));if(A.length>0){const B=new Map(A.map(V=>[X(V),V]));s=s.map(V=>{const ie=B.get(X(V));return ie?q(V,ie):V})}const _=e.waferOpts?.diameter??300,E=Q({diameter:_,notch:e.waferOpts?.notch,orientation:e.waferOpts?.orientation??0,metadata:e.waferOpts?.metadata,reticle:e.reticleOpts});E.orientation!==0&&(s=se(s,E)),s=s.map(z);const H=ge(e.reticleOpts,E,s,1,1,0,0,0,0,E.orientation),Me=O.map((B,V)=>z(q({id:`unpositioned_${V}`,width:s[0]?.width??1,height:s[0]?.height??1},B))),J=[...s,...x,...Me];return{wafer:E,dies:J,dataAxisFlip:{x:!1,y:!1},reticleConfig:e.reticleOpts,units:"mm",inference:r,warnings:[...e.removedFieldWarning?[e.removedFieldWarning]:[],...e.inputValueWarnings,...o?[o]:[],...we(p,r),...t,...e.ringCountWarning?[e.ringCountWarning]:[]],plotMode:be(d),metadata:E.metadata??null,isLotStack:!1,dataCoverage:computeCoverage(J),passBins:e.passBins,...i?{valueFilter:i}:{},ringCount:e.ringCount,yield:computeYield(J,e.passBins,e.edgeDieYieldMode),reticles:H,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,metadataFields:e.metadataFields}}const h=d.filter(W),l=d.filter(s=>!W(s)),f=h.map(s=>({x:s.x,y:s.y})),y=Ke(f,e.dieOpts,e.waferOpts?.diameter);r.diePitch={confidence:y.confidence,units:y.units};const{pitchX:m,pitchY:c}=y,w=y.units,u=ut(h,e.dieOpts),C=je(f);r.grid={confidence:C.confidence};const{offsetX:D,offsetY:g}=ct(f,u,C),{flipX:b,flipY:k}=me(e.dieOpts,u),R=e.waferOpts?.diameter===void 0&&e.waferOpts?.center!==void 0&&pt(f,e.waferOpts.center),v=R?void 0:e.waferOpts?.center;R&&p.push({code:"implausible-center",message:mt(f,e.waferOpts.center)});const{colMidX:T,colMidY:L,anchored:K}=gt(f,D,g,m,c,v);let S=e.waferOpts?.diameter;const N=f.map(s=>({x:(Math.round(s.x)-D)*m-T,y:(Math.round(s.y)-g)*c-L})),M=ee(N.map(({x:s,y:x})=>Math.hypot(Math.abs(s)+m/2,Math.abs(x)+c/2)));if(S===void 0)if(f.length>0)if(w==="mm"){const s=Xe(N,{minRadius:M});S=s.diameter,r.wafer={confidence:s.confidence,method:s.method};const x=Nt(e.standardDiameters);if(!$t(S,x)){const A=De(S,x);p.push({code:"non-standard-diameter",message:`${Ct} ${S.toFixed(1)} mm is not a standard wafer size (nearest is ${A} mm). The diameter was derived from the die extent, which assumes the probed grid reaches the wafer edge \u2014 a non-standard result usually means it does not, because the outer dies were never probed. Every die is then placed against a wafer that is too small, which moves dies between rings and changes ring and edge findings. Supply waferConfig.diameter.`})}}else S=M*2,r.wafer={confidence:y.confidence*.8,method:"extent"};else S=w==="mm"?300:30,r.wafer={confidence:0,method:"default"};if(!K&&f.length>0&&yt(f,D,g)&&(r.wafer.method="inferred-partial",p.push({code:"partial-coverage",message:"Wafer geometry was inferred from die positions alone. The data does not span a full symmetric wafer, so the inferred diameter and centre may be wrong and dies may be mis-positioned relative to the true wafer boundary. Supply waferConfig.diameter and waferConfig.center (the prober coordinate of the wafer centre) to position partial data correctly."})),e.waferOpts?.diameter!==void 0&&v===void 0&&M>0&&f.length>=xe){const s=M/(S/2);s<Ot&&p.push({code:"diameter-exceeds-die-extent",message:`${kt} ${(s*100).toFixed(0)}% of the ${S} mm wafer's radius. Either the diameter is larger than the real one, or this is a partial map covering only part of the wafer. Ring bands are equal-radius, so the outer rings are mostly or entirely empty and ring, quadrant and edge findings describe the assumed wafer rather than the probed area. Check waferConfig.diameter, or drop it and let the diameter be inferred from the die extent.`})}if(e.waferOpts?.diameter!==void 0){const s=e.dieOpts?.width!==void 0&&e.dieOpts?.height!==void 0;if(s&&M>S/2+1e-9){const x=N.filter(({x:A,y:O})=>Math.hypot(Math.abs(A)+m/2,Math.abs(O)+c/2)>S/2+1e-9).length;p.push({code:"geometry-conflict",message:`${x} of ${N.length} probed die positions ${St} ${S} mm wafer at the supplied die pitch of ${m} \xD7 ${c} mm. A die with test results is a real prober position and is always fully on the wafer, so one of the two supplied values must be wrong: containing these dies at this pitch would need a diameter of at least ${(M*2).toFixed(1)} mm. Check waferConfig.diameter and dieConfig.width/height against the real device.`})}}const F=Q({diameter:S,units:w,notch:e.waferOpts?.notch,orientation:e.waferOpts?.orientation??0,metadata:e.waferOpts?.metadata,reticle:e.reticleOpts});let $=h.map(s=>{const x=Math.round(s.x)-D,A=Math.round(s.y)-g,O={id:`${x}_${A}`,x,y:A,physX:x*m-T,physY:A*c-L,width:m,height:c,insideWafer:!0,partial:!1};return q(O,s)});(D!==0||g!==0)&&($=$.map(s=>({...s,x:s.x+D,y:s.y+g,id:`${s.x+D}_${s.y+g}`}))),$=se($,F),(b||k)&&($=Ce($,{flipX:b,flipY:k},F.center));const Y=[];e.waferOpts?.edgeExclusion&&e.waferOpts.edgeExclusion>0&&($=xt($,F,e.waferOpts.edgeExclusion),e.waferOpts.edgeExclusion>F.radius&&Y.push({code:"edge-exclusion-exceeds-radius",message:`edgeExclusion (${e.waferOpts.edgeExclusion}mm) exceeds the resolved wafer radius (${F.radius}mm) \u2014 the entire wafer is excluded.`,severity:"warning"})),$=$.map(z);const j=ge(e.reticleOpts,F,$,m,c,D,g,T,L,F.orientation,b,k),P=l.map((s,x)=>z(q({id:`unpositioned_${x}`,width:m,height:c},s))),I=[...$,...P];return{wafer:F,dies:I,dataAxisFlip:{x:b,y:k},reticleConfig:e.reticleOpts,units:w,inference:r,warnings:[...e.removedFieldWarning?[e.removedFieldWarning]:[],...e.inputValueWarnings,...o?[o]:[],...we(p,r),...Y,...t,...e.ringCountWarning?[e.ringCountWarning]:[]],plotMode:be(d),metadata:F.metadata??null,isLotStack:e.lotStackOpts!==void 0,dataCoverage:computeCoverage(I),passBins:e.passBins,...i?{valueFilter:i}:{},ringCount:e.ringCount,yield:computeYield(I,e.passBins,e.edgeDieYieldMode,it(e.lotStackOpts!==void 0,e.lotStackOpts?.method)),reticles:j,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,metadataFields:e.metadataFields,aggrMethod:e.lotStackOpts?.method,lotSize:e.lotStackOpts?.results.length}}
|
|
1
|
+
import{createWafer as Q}from"../core/wafer.js";import{isYieldEligibleDie as ve,getDieKey as X,hasPosition as I,positionKey as Se}from"../core/dies.js";import{applyOrientation as se,transformDies as Ce,clipDiesToWafer as ke}from"../core/transforms.js";import{generateDies as Oe}from"../core/dies.js";import{dieHasAnyTestData as Ae,dieLink as U,finaliseDie as z,linkDie as $e,recordedVerdict as Ne,recordedVerdictsReader as Re,tableFromRows as Ee,testValue as Z,testsPresent as Te,VERDICT_FAIL as Fe,VERDICT_NONE as Ie,VERDICT_PASS as We}from"../core/dieTable.js";import{isDieColumns as _e,linkColumns as Pe,linkRows as re,relink as oe}from"./columnarInput.js";import{affineRotation as Be,affineMirror as Ve,affineCompose as Le,affinePoint as Ye}from"../core/transforms.js";import{inferWaferFromXY as Xe}from"../core/inference/wafer.js";import{resolveGridPitch as Ke}from"../core/inference/pitch.js";import{assignGridIndices as je}from"../core/inference/grid.js";import{generateReticleGrid as He}from"../core/reticle.js";import{applyDerivedTests as Ue}from"./derivedTests/apply.js";import{isStdfBin as ze,isStdfCoord as ae,isStdfTestNumber as de,isStdfSite as Ge,STDF_BIN_MAX as qe,STDF_COORD_MAX as fe,STDF_TEST_NUM_MAX as Je,STDF_SITE_MAX as Qe}from"../core/stdf.js";import{hasAnyKey as Ze,maxOf as ee,minOf as le,modeOf as et}from"../core/utils.js";import{aggregateValues as ue,aggregateBinCounts as tt,stackHoldsMeasurements as nt,stackBinsAreData as it}from"../core/aggregates.js";import{normalizePassBins as ce}from"../core/passBins.js";import{defaultRingCount as te}from"../core/ringCount.js";import{applyValueFilter as st,mergeValueFilterTests as rt,valueFilterWarning as ot}from"./valueFilter.js";export function isParametricTest(n){return n?.testType!=="F"}export function isBuiltMap(n){return"wafer"in n&&"dies"in n&&"dataAxisFlip"in n}function at(n){const e=(i,a)=>({ringCount:i,ringCountWarning:{code:"analysis-option-corrected",severity:"warning",message:`ringCount=${String(n)} ${a} (using ${i}).`}});if(n===void 0)return{ringCount:te(),ringCountWarning:void 0};if(typeof n!="number"||!Number.isFinite(n))return e(te(),"is not a finite number");const t=Math.max(1,Math.round(n));return t===n?{ringCount:n,ringCountWarning:void 0}:e(t,"is not a whole number of at least 1")}function dt(n,e){const t=Array.isArray(n)?{}:n,i={hbin:0,sbin:0,siteNum:0,testValues:0,testPass:0};let a;const d=(u,C)=>{i[u]++,a??=`${u} ${JSON.stringify(C)}`},o={bins:0,positions:0,values:0,sites:0,orientation:0},r=new Set;let p=0;if(e){i.testValues+=e.wrongValues,i.testPass+=e.wrongVerdicts,e.example!==void 0&&(a??=e.example),o.values+=e.nonFinite;for(const u of e.badTestNumbers)r.add(u)}const h=u=>u==null?!0:typeof u!="number"?!1:Number.isNaN(u)?(p++,!1):ze(u)?!0:(o.bins++,!1);function l(u){const C=new Set,D=new Set;for(let S=0;S<u.length;S+=S<50?1:100){const N=u[S];if(!(N===null||typeof N!="object")){if(N.testValues&&typeof N.testValues=="object")for(const M of Object.keys(N.testValues))C.add(M);if(N.testPass&&typeof N.testPass=="object")for(const M of Object.keys(N.testPass))D.add(M)}}const g=[...C],b=[...D],k=S=>de(Number(S));for(const S of new Set([...g,...b]))k(S)||r.add(S);const R=g.map(k),v=b.map(k),F=g.map(Number),L=b.map(Number);let K;for(let S=0;S<u.length;S++){const N=u[S];if(N===null||typeof N!="object")continue;const M=N;let E;const $=()=>E??={...M};M.hbin!=null&&typeof M.hbin!="number"&&d("hbin",M.hbin),M.sbin!=null&&typeof M.sbin!="number"&&d("sbin",M.sbin),h(M.hbin)||($().hbin=void 0),h(M.sbin)||($().sbin=void 0);const Y=typeof M.x=="number"&&!ae(M.x),j=typeof M.y=="number"&&!ae(M.y);if(Y||j){o.positions+=(Y?1:0)+(j?1:0);const s=$();s.x=void 0,s.y=void 0}M.siteNum!=null&&typeof M.siteNum!="number"?(d("siteNum",M.siteNum),$().siteNum=void 0):typeof M.siteNum=="number"&&!Ge(M.siteNum)&&(o.sites++,$().siteNum=void 0);const P=M.testValues;if(P&&typeof P=="object"){let s;for(let x=0;x<g.length;x++){const A=g[x],O=P[F[x]];if(O!=null){if(!R[x]){s??={...P},delete s[A];continue}typeof O!="number"?(d("testValues",O),s??={...P},delete s[A]):Number.isFinite(O)||(o.values++,s??={...P},delete s[A])}}s&&($().testValues=s)}const W=M.testPass;if(W&&typeof W=="object"){let s;for(let x=0;x<b.length;x++){const A=b[x],O=W[L[x]];if(O!=null){if(!v[x]){s??={...W},delete s[A];continue}typeof O!="boolean"&&(d("testPass",O),s??={...W},delete s[A])}}s&&($().testPass=s)}E&&((K??=u.slice())[S]=E)}return K}const f={warnings:[]};if(Array.isArray(n))f.results=l(n);else{Array.isArray(t.results)&&(f.results=l(t.results)),Array.isArray(t.dies)&&(f.dies=l(t.dies));const u=t.lotStack?.results;if(Array.isArray(u)){const C=u.map(D=>Array.isArray(D)?l(D):void 0);C.some(Boolean)&&(f.stackResults=C.map((D,g)=>D??u[g]))}}if(Array.isArray(t.testDefs)){const u=t.testDefs,C=u.filter(D=>D==null||typeof D.testNumber!="number"||de(D.testNumber));for(const D of u)C.includes(D)||r.add(String(D.testNumber));C.length!==u.length&&(f.testDefs=C)}const y=t.waferConfig?.orientation;if(typeof y=="number"){const u=Number.isFinite(y)?(y%360+360)%360:NaN;u===0||u===90||u===180||u===270?f.orientation=u:(o.orientation++,f.orientation=0)}const m=(u,C,D=`${C}s`)=>`${u} ${u===1?C:D}`,c=[];if(i.hbin&&c.push(m(i.hbin,"hard bin")),i.sbin&&c.push(m(i.sbin,"soft bin")),i.siteNum&&c.push(m(i.siteNum,"site number")),i.testValues&&c.push(m(i.testValues,"test value")),i.testPass&&c.push(m(i.testPass,"pass/fail verdict")),c.length){const u=`buildWaferMap received ${c.join(", ")} of the wrong type (for example ${a}), treated as missing. Bins, sites and test values must be numbers and verdicts true/false \u2014 a bin of "1" is not pass bin 1 \u2014 so those dies have no bin, no site, no value or no verdict, and yield and every chart leave them out. Convert them with Number() (and verdicts to booleans) and rebuild.`;console.warn(`[wafermap] ${u}`),f.warnings.push({code:"input-values-not-numbers",message:u,severity:"error"})}const w=[];if(o.bins&&w.push(`${m(o.bins,"bin")} (legal: whole numbers 0\u2013${qe}) \u2014 those dies have no bin`),o.positions&&w.push(`${m(o.positions,"coordinate")} (legal: whole numbers \u2212${fe} to ${fe}) \u2014 those dies have no position`),r.size&&w.push(`${m(r.size,"test number")} (legal: whole numbers 0\u2013${Je}) \u2014 those tests are left out`),o.values&&w.push(`${m(o.values,"test value")} that ${o.values===1?"is":"are"} not finite \u2014 left out`),o.sites&&w.push(`${m(o.sites,"site number")} (legal: 0\u2013${Qe}) \u2014 those dies have no site`),o.orientation&&w.push("a waferConfig.orientation other than 0, 90, 180 or 270 \u2014 the map is built at 0"),w.length||p){const u=[];w.length&&u.push(`buildWaferMap received values outside the STDF V4 ranges, treated as missing: ${w.join("; ")}.`),p&&u.push(`${m(p,"bin was","bins were")} NaN and ${p===1?"is":"are"} treated as no bin.`);const C=u.join(" ");console.warn(`[wafermap] ${C}`),f.warnings.push({code:"input-values-outside-stdf",message:C,severity:"warning"})}return f}function pe(n){const e=(h,l)=>h!==null&&typeof h=="object"&&h[l]!==void 0,t=Array.isArray(n)?{}:n,i=[],a=(h,l,f)=>{h&&i.push(`\`${l}\` (now \`${f}\`)`)};a(e(t,"data"),"data","results"),a(e(t,"die"),"die","dieConfig"),a(e(t,"stack"),"stack","lotStack"),a(e(t.dieConfig,"origin"),"dieConfig.origin","dieConfig.coordinateOrigin"),a(e(t.waferConfig,"flat"),"waferConfig.flat","waferConfig.notch"),a(e(t.reticleConfig,"anchor"),"reticleConfig.anchor","reticleConfig.anchorDie"),a(e(t.lotStack,"aggr"),"lotStack.aggr","lotStack.method"),a(Array.isArray(t.testDefs)&&t.testDefs.some(h=>e(h,"index")&&!e(h,"testNumber")),"TestDef.index","TestDef.testNumber");const d=e(t.lotStack,"results")?t.lotStack.results:[],o=(Array.isArray(n)?[n]:[t.results,...Array.isArray(d)?d:[]]).filter(h=>Array.isArray(h));if(a(o.some(h=>h.slice(0,100).some(l=>e(l,"values"))),"values","testValues"),!i.length)return;const r=i.length>1,p=`buildWaferMap ignored ${i.join(", ")}: ${r?"these names were":"that name was"} removed in an earlier release, so what ${r?"they":"it"} described is not on this map. Rename and rebuild.`;return console.warn(`[wafermap] ${p}`),{code:"input-field-removed",message:p,severity:"error"}}function ft(n){if(n.results!==void 0||n.lotStack!==void 0)throw new Error("buildWaferMap: pass `layout`, `results` or `lotStack` \u2014 only one.");const e=n.waferConfig?.diameter,t=n.dieConfig?.width,i=n.dieConfig?.height;if(!(e>0&&t>0&&i>0))throw new Error("buildWaferMap: `layout` needs waferConfig.diameter and dieConfig.width and height, all positive.");const a=Q({diameter:e,notch:n.waferConfig?.notch,orientation:0}),d=ke(Oe(a,{width:t,height:i}),a,{width:t,height:i}).filter(l=>!l.partial),{flipX:o,flipY:r}=me(n.dieConfig,{type:"center"}),{layout:p,...h}=n;return{...h,results:d.map(l=>({x:o?-l.x:l.x,y:r?-l.y:l.y})),waferConfig:{...n.waferConfig,center:{x:0,y:0}},dieConfig:{...n.dieConfig,coordinateOrigin:{type:"center"}}}}function lt(n){if(!Array.isArray(n)&&"results"in n&&n.results!==void 0&&"lotStack"in n&&n.lotStack!==void 0)throw new Error("buildWaferMap: pass either `results` or `lotStack`, not both.");const e={wrongVerdicts:0,wrongValues:0,nonFinite:0,badTestNumbers:[]},t=!Array.isArray(n)&&_e(n.results)?{...n,results:Pe(n.results,e).records}:n,i=dt(t,e);return Array.isArray(t)?{results:ne(i.results??t),waferOpts:void 0,dieOpts:void 0,explicitDies:void 0,reticleOpts:void 0,lotStackOpts:void 0,passBins:ce(void 0),ringCount:te(),valueFilter:"validity",ringCountWarning:void 0,removedFieldWarning:pe(t),inputValueWarnings:i.warnings,standardDiameters:void 0,testDefs:void 0,hbinDefs:void 0,sbinDefs:void 0,metadataFields:void 0,derivedTests:void 0,retestPolicy:"last",edgeDieYieldMode:"exclude"}:{results:ne(i.results??t.results??[]),waferOpts:i.orientation===void 0||t.waferConfig===void 0?t.waferConfig:{...t.waferConfig,orientation:i.orientation},dieOpts:t.dieConfig,explicitDies:i.dies??t.dies,reticleOpts:t.reticleConfig,lotStackOpts:t.lotStack?{...t.lotStack,results:(i.stackResults??t.lotStack.results).map(ne)}:void 0,passBins:ce(t.passBins),valueFilter:t.valueFilter??"validity",...at(t.ringCount),removedFieldWarning:pe(t),inputValueWarnings:i.warnings,standardDiameters:t.standardDiameters,testDefs:(i.testDefs??t.testDefs)?.length?i.testDefs??t.testDefs:void 0,hbinDefs:t.hbinDefs,sbinDefs:t.sbinDefs,metadataFields:t.metadataFields,derivedTests:t.derivedTests?.length?t.derivedTests:void 0,retestPolicy:t.retestPolicy??"last",edgeDieYieldMode:t.edgeDieYieldMode??"exclude"}}function ne(n){return n.length>0&&U(n[0])!==void 0?n:re(n).records}function ut(n,e){return e?.coordinateOrigin?e.coordinateOrigin:{type:"center"}}function ct(n,e,t){if(e.type==="custom"&&e.offset)return{offsetX:e.offset.x,offsetY:e.offset.y};if(e.type!=="center"){let i=1/0,a=-1/0,d=1/0,o=-1/0;for(const r of n)r.x<i&&(i=r.x),r.x>a&&(a=r.x),r.y<d&&(d=r.y),r.y>o&&(o=r.y);return{offsetX:Math.round((a+i)/2),offsetY:Math.round((o+d)/2)}}return{offsetX:t.offsetX,offsetY:t.offsetY}}function pt(n,e){if(n.length<xe)return!1;const t=he(n),i=(a,d,o)=>{const r=o-d+1;return a<d-r||a>o+r};return i(Math.round(e.x),t.xMin,t.xMax)||i(Math.round(e.y),t.yMin,t.yMax)}function he(n){let e=1/0,t=-1/0,i=1/0,a=-1/0;for(const d of n){const o=Math.round(d.x),r=Math.round(d.y);o<e&&(e=o),o>t&&(t=o),r<i&&(i=r),r>a&&(a=r)}return{xMin:e,xMax:t,yMin:i,yMax:a}}const ht="The supplied wafer centre";function mt(n,e){const t=he(n);return`${ht} (${e.x}, ${e.y}) is far outside the tested dies (X ${t.xMin}\u2026${t.xMax}, Y ${t.yMin}\u2026${t.yMax}), so it was ignored and the centre was worked out from the dies. Used as given, it would draw a wafer many times the size of the dies, with all of them in one corner.`}const gt="If the supplied centre is correct, also supply waferConfig.diameter.";function yt(n,e,t,i,a,d){if(d)return{colMidX:(Math.round(d.x)-e)*i,colMidY:(Math.round(d.y)-t)*a,anchored:!0};if(n.length===0)return{colMidX:0,colMidY:0,anchored:!1};let o=1/0,r=-1/0,p=1/0,h=-1/0;for(const l of n){const f=Math.round(l.x)-e,y=Math.round(l.y)-t;f<o&&(o=f),f>r&&(r=f),y<p&&(p=y),y>h&&(h=y)}return{colMidX:(o+r)/2*i,colMidY:(p+h)/2*a,anchored:!1}}function bt(n,e,t){let i=1/0,a=-1/0,d=1/0,o=-1/0,r=0,p=0;for(const f of n){const y=Math.round(f.x)-e,m=Math.round(f.y)-t;r+=y,p+=m,y<i&&(i=y),y>a&&(a=y),m<d&&(d=m),m>o&&(o=m)}const h=n.length,l=(f,y,m)=>{const c=(m-y)/2;return c<=0?0:Math.abs(f/h-(y+m)/2)/c};return l(r,i,a)>.11||l(p,d,o)>.11}function me(n,e){let t=n?.xAxisDirection==="left",i=n?.yAxisDirection==="down";return(e.type==="UL"||e.type==="UR")&&(i=!0),(e.type==="LR"||e.type==="UR")&&(t=!0),{flipX:t,flipY:i}}function wt(n){const e={...n};return delete e.limitLow,delete e.limitHigh,delete e.limitLowInclusive,delete e.limitHighInclusive,delete e.specLow,delete e.specHigh,e}function xt(n,e){const{method:t,targetBin:i}=n,a=n.results.map(d=>d.filter(I));if(t==="mean"||t==="median"||t==="stddev"||t==="min"||t==="max"||t==="count"){const d=new Set((e??[]).filter(l=>!isParametricTest(l)).map(l=>l.testNumber)),o=new Set;for(const l of a)for(const f of Te(l,"values"))d.has(f)||o.add(f);if(o.size===0)return ue(a,t);const r=[...o],p=r.map(l=>ue(a,t,l)),h=new Map;for(let l=0;l<r.length;l++){const f=r[l];for(const y of p[l]){const m=X(y);h.has(m)||h.set(m,{template:y,testValues:{}});const c=h.get(m),w=y.testValues?.[0];w!==void 0&&(c.testValues[f]=w)}}return[...h.values()].map(({template:l,testValues:f})=>({...l,testValues:Ze(f)?f:void 0}))}if(t==="countBin"||t==="percent"){if(i===void 0)return[];const d=tt(a,i,"hard");if(t==="countBin")return d;const o=a.length;return d.map(r=>({...r,testValues:{0:o>0?(r.testValues?.[0]??0)/o*100:0}}))}if(t==="mode"){const d=new Map;for(const r of a)for(const p of r){const h=X(p);d.has(h)||d.set(h,[]),d.get(h).push(p)}const o=[];for(const[r,p]of d){const h=r.split(","),l=Number(h[0]),f=Number(h[1]),y=p.map(c=>c.hbin).filter(c=>c!==void 0),m=et(y);m!==null&&o.push({x:l,y:f,hbin:m})}return o}return[]}export function computeCoverage(n){const e=n.filter(I),t=e.length,i=e.filter(d=>d.edgeExcluded).length,a=e.filter(d=>d.hbin!==void 0||d.sbin!==void 0||dieHasTestData(d)).length;return{filledDies:a,totalDies:t,edgeExcludedDies:i,unpositionedDies:n.length-e.length,ratio:t>0?a/t:0}}export function computeYield(n,e,t="exclude",i=!0){const a=new Set(e),o=n.filter(c=>!c.partial).filter(c=>c.edgeExcluded&&!c.filteredOut).length,r=n.filter(c=>c.partial).length;if(!i)return{passDies:0,failDies:0,edgeExcludedDies:o,partialDies:r,totalDies:0,yieldPercent:null,yieldPercentGross:null};let p=0,h=0,l=!1;for(const c of n){if(!ve(c))continue;const w=c.hbin??c.sbin;w!==void 0&&(l=!0,a.has(w)?p++:h++)}const f=p+h,y=l&&f>0?p/f*100:null;let m=null;if(t==="denominator-only"){const c=f+o;m=l&&c>0?p/c*100:null}return{passDies:p,failDies:h,edgeExcludedDies:o,partialDies:r,totalDies:f,yieldPercent:y,yieldPercentGross:m}}function ge(n,e,t,i,a,d=0,o=0,r=0,p=0,h=0,l=!1,f=!1){if(!n)return[];const y=n.anchorDie??{x:0,y:0},m=He(e,{width:n.width,height:n.height,diePitchX:i,diePitchY:a,anchorDie:{x:y.x-d,y:y.y-o},gridOrigin:{x:-r,y:-p}}),c=Le(Ve(l,f,e.center.x,e.center.y),Be(h,e.center.x,e.center.y));return m.filter(w=>{const u=w.width/2,C=w.height/2,D=[[w.x-u,w.y-C],[w.x+u,w.y-C],[w.x+u,w.y+C],[w.x-u,w.y+C]].map(([v,F])=>Ye(c,v,F)),g=le(D.map(v=>v.x)),b=ee(D.map(v=>v.x)),k=le(D.map(v=>v.y)),R=ee(D.map(v=>v.y));return t.some(v=>v.physX>=g&&v.physX<b&&v.physY>=k&&v.physY<R)})}function Dt(n,e,t){const a=Math.max(0,e.radius-t)**2;return n.map(d=>{const o=d.physX-e.center.x,r=d.physY-e.center.y;return o*o+r*r>a?{...d,edgeExcluded:!0}:d})}const Mt=.2;function vt(n){const e=new Set;for(const t of n){if(t.supersedes!==void 0||!I(t))return!1;const i=Se(t);if(e.has(i))return!1;e.add(i)}return!0}function St(n,e,t){if(vt(n))return{results:n.slice(),warning:void 0};const i=new Set(t);function a(g,b){if(e==="last")return!0;if(e==="first")return!1;const k=G(g.hbin),R=G(b.hbin);if(k===void 0||R===void 0)return!1;const v=i.has(k),F=i.has(R);return e==="best"?F!==v?F:R<k:F!==v?v:R>k}const d=(g,b)=>b.supersedes!==void 0||a(g,b),o=g=>{const b=g.partId===void 0?"":String(g.partId).trim();return b===""?void 0:b},r=n.filter(g=>!I(g)),p=new Map;for(const g of r){const b=o(g);b!==void 0&&p.set(b,(p.get(b)??0)+1)}const l=(r.length===0?0:Math.max(0,...p.values())/r.length)<=Mt,f=new Map,y=[],m=new Map;let c=0,w=0;for(const g of n){const b=o(g);let k;if(I(g)?k=`p:${X(g)}`:l&&b!==void 0?k=`i:${b}`:k=`u:${w++}`,g.supersedes==="partId"&&b!==void 0){const v=m.get(b);v!==void 0&&v!==k&&f.has(v)&&f.delete(v)}const R=f.get(k);R===void 0?(f.set(k,{winner:g,count:1}),y.push(k)):(R.count++,k.startsWith("i:")&&c++,d(R.winner,g)&&(R.winner=g)),b!==void 0&&m.set(b,k)}const u=[],C=[...y.filter(g=>g.startsWith("p:")),...y.filter(g=>!g.startsWith("p:"))];for(const g of C){const b=f.get(g);b!==void 0&&u.push(b.count>1?{...b.winner,retestCount:b.count}:b.winner)}const D=c>0?{code:"retests-by-part-id",severity:"info",message:`${c} record${c===1?"":"s"} with no position shared a part ID with an earlier record and ${c===1?"was":"were"} treated as a retest of it.`}:void 0;return{results:u,warning:D}}export function getDieTestValue(n,e){return Z(n,e)}export function getTestPassStatus(n,e,t){const i=Ne(n,e);return i!==void 0?i:t!==void 0&&!isParametricTest(t)?ye(Z(n,e)):void 0}function ye(n){return n===0||n===1?n===1:void 0}export function testPassStatusReader(n){const e=n.map(a=>a.testNumber),t=Re(e),i=n.map(a=>!isParametricTest(a));return function(d,o){t(d,o);for(let r=0;r<o.length;r++){if(o[r]!==Ie||!i[r])continue;const p=ye(Z(d,e[r]));p!==void 0&&(o[r]=p?We:Fe)}return o}}export function dieHasTestData(n){return Ae(n)}function G(n){return n===void 0||Number.isNaN(n)?void 0:n}function q(n,e){const t={},i=G(e.hbin),a=G(e.sbin);i!==void 0&&(t.hbin=i),a!==void 0&&(t.sbin=a),e.retestCount!==void 0&&(t.retestCount=e.retestCount),e.siteNum!==void 0&&(t.siteNum=e.siteNum),e.partId!==void 0&&(t.partId=e.partId),e.metadata!==void 0&&(t.metadata=e.metadata);const d=U(e);return $e({...n,...t},d.table,d.row)}function be(n){return n.some(dieHasTestData)?"value":defaultBinMode([n])}export function defaultBinMode(n){const e=t=>n.some(i=>i.some(a=>t(a)!=null));return e(t=>t.hbin)?"hardBin":e(t=>t.sbin)?"softBin":"hardBin"}function we(n,e){return n.map(({code:t,message:i})=>({code:t,message:i,severity:t==="non-standard-diameter"||t==="diameter-exceeds-die-extent"||t==="implausible-center"?"warning":"error",confidence:e.wafer.confidence}))}const Ct="do not fit inside the supplied",kt="Inferred wafer diameter",Ot="The probed dies reach only",At=.75,xe=20;export const STANDARD_WAFER_DIAMETERS_MM=[100,125,150,200,300];const $t=.02;function De(n,e){return e.reduce((t,i)=>Math.abs(i-n)<Math.abs(t-n)?i:t)}function Nt(n,e){if(!e.length)return!0;const t=De(n,e);return Math.abs(t-n)/t<=$t}function Rt(n){return n===void 0?STANDARD_WAFER_DIAMETERS_MM:n.filter(e=>Number.isFinite(e)&&e>0)}export function buildWaferMap(n){const e=lt(!Array.isArray(n)&&n.layout?ft(n):n),t=[];let i;if(e.valueFilter!=="none"&&e.testDefs){const s=e.valueFilter,x=(e.lotStackOpts?e.lotStackOpts.results:[e.results]).map(O=>{const _=O.length>0?U(O[0]):void 0;if(!_)return[];const T=st(_.table,e.testDefs,s);return T.tests.length>0&&oe(O,T.table),T.tests}),A=rt(x);if(A.length>0){i={mode:s,tests:A};const O=ot(s,A,e.testDefs);O&&t.push(O)}}if(e.derivedTests){const s=new Set(e.passBins),x=_=>{const T=_.length>0?U(_[0]):void 0,H=Ue(_,T?.table??Ee([]),e.testDefs,e.derivedTests,s);return T&&oe(_,H.table),H},O=(e.lotStackOpts?e.lotStackOpts.results:[e.results]).map(x);e.testDefs=O[0]?.testDefs??e.testDefs,t.push(...O[0]?.warnings??[])}e.lotStackOpts&&!nt(e.lotStackOpts.method)&&(e.testDefs=e.testDefs?.map(wt));const a=e.lotStackOpts?re(xt(e.lotStackOpts,e.testDefs)).records:e.results;for(let s=0;s<Math.min(5,a.length);s++){const x=a[s];if(typeof x.x=="string"||typeof x.y=="string")throw new TypeError("buildWaferMap: x and y must be numbers, received strings. Did you forget to cast CSV values? e.g. { x: +row.x, y: +row.y }")}for(const s of a)if(s.x==null!=(s.y==null))throw new TypeError(`buildWaferMap: die has only one of x/y set (x=${String(s.x)}, y=${String(s.y)}). A die must be either fully positioned (both x and y) or fully unpositioned (neither) \u2014 omit both to mark a die as having no reported position.`);const{results:d,warning:o}=St(a,e.retestPolicy,e.passBins),r={wafer:{confidence:1,method:"provided"},diePitch:{confidence:1,units:"mm"},grid:{confidence:1}},p=[];if(e.explicitDies){let s=e.explicitDies.filter(I);const x=e.explicitDies.filter(V=>!I(V)),A=d.filter(I),O=d.filter(V=>!I(V));if(A.length>0){const V=new Map(A.map(B=>[X(B),B]));s=s.map(B=>{const ie=V.get(X(B));return ie?q(B,ie):B})}const _=e.waferOpts?.diameter??300,T=Q({diameter:_,notch:e.waferOpts?.notch,orientation:e.waferOpts?.orientation??0,metadata:e.waferOpts?.metadata,reticle:e.reticleOpts});T.orientation!==0&&(s=se(s,T)),s=s.map(z);const H=ge(e.reticleOpts,T,s,s[0]?.width??1,s[0]?.height??1,0,0,0,0,T.orientation),Me=O.map((V,B)=>z(q({id:`unpositioned_${B}`,width:s[0]?.width??1,height:s[0]?.height??1},V))),J=[...s,...x,...Me];return{wafer:T,dies:J,dataAxisFlip:{x:!1,y:!1},reticleConfig:e.reticleOpts,units:"mm",inference:r,warnings:[...e.removedFieldWarning?[e.removedFieldWarning]:[],...e.inputValueWarnings,...o?[o]:[],...we(p,r),...t,...e.ringCountWarning?[e.ringCountWarning]:[]],plotMode:be(d),metadata:T.metadata??null,isLotStack:!1,dataCoverage:computeCoverage(J),passBins:e.passBins,...i?{valueFilter:i}:{},ringCount:e.ringCount,yield:computeYield(J,e.passBins,e.edgeDieYieldMode),reticles:H,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,metadataFields:e.metadataFields}}const h=d.filter(I),l=d.filter(s=>!I(s)),f=h.map(s=>({x:s.x,y:s.y})),y=Ke(f,e.dieOpts,e.waferOpts?.diameter);r.diePitch={confidence:y.confidence,units:y.units};const{pitchX:m,pitchY:c}=y,w=y.units,u=ut(h,e.dieOpts),C=je(f);r.grid={confidence:C.confidence};const{offsetX:D,offsetY:g}=ct(f,u,C),{flipX:b,flipY:k}=me(e.dieOpts,u),R=e.waferOpts?.diameter===void 0&&e.waferOpts?.center!==void 0&&pt(f,e.waferOpts.center),v=R?void 0:e.waferOpts?.center;if(R){const s=mt(f,e.waferOpts.center);console.warn(`[wafermap] ${s} ${gt}`),p.push({code:"implausible-center",message:s})}const{colMidX:F,colMidY:L,anchored:K}=yt(f,D,g,m,c,v);let S=e.waferOpts?.diameter;const N=f.map(s=>({x:(Math.round(s.x)-D)*m-F,y:(Math.round(s.y)-g)*c-L})),M=ee(N.map(({x:s,y:x})=>Math.hypot(Math.abs(s)+m/2,Math.abs(x)+c/2)));if(S===void 0)if(f.length>0)if(w==="mm"){const s=Xe(N,{minRadius:M});S=s.diameter,r.wafer={confidence:s.confidence,method:s.method};const x=Rt(e.standardDiameters);if(!Nt(S,x)){const A=De(S,x);p.push({code:"non-standard-diameter",message:`${kt} ${S.toFixed(1)} mm is not a standard wafer size (nearest is ${A} mm). The diameter was derived from the die extent, which assumes the probed grid reaches the wafer edge \u2014 a non-standard result usually means it does not, because the outer dies were never probed. Every die is then placed against a wafer that is too small, which moves dies between rings and changes ring and edge findings. Supply waferConfig.diameter.`})}}else S=M*2,r.wafer={confidence:y.confidence*.8,method:"extent"};else S=w==="mm"?300:30,r.wafer={confidence:0,method:"default"};if(!K&&f.length>0&&bt(f,D,g)&&(r.wafer.method="inferred-partial",p.push({code:"partial-coverage",message:"Wafer geometry was inferred from die positions alone. The data does not span a full symmetric wafer, so the inferred diameter and centre may be wrong and dies may be mis-positioned relative to the true wafer boundary. Supply waferConfig.diameter and waferConfig.center (the prober coordinate of the wafer centre) to position partial data correctly."})),e.waferOpts?.diameter!==void 0&&v===void 0&&M>0&&f.length>=xe){const s=M/(S/2);s<At&&p.push({code:"diameter-exceeds-die-extent",message:`${Ot} ${(s*100).toFixed(0)}% of the ${S} mm wafer's radius. Either the diameter is larger than the real one, or this is a partial map covering only part of the wafer. Ring bands are equal-radius, so the outer rings are mostly or entirely empty and ring, quadrant and edge findings describe the assumed wafer rather than the probed area. Check waferConfig.diameter, or drop it and let the diameter be inferred from the die extent.`})}if(e.waferOpts?.diameter!==void 0){const s=e.dieOpts?.width!==void 0&&e.dieOpts?.height!==void 0;if(s&&M>S/2+1e-9){const x=N.filter(({x:A,y:O})=>Math.hypot(Math.abs(A)+m/2,Math.abs(O)+c/2)>S/2+1e-9).length;p.push({code:"geometry-conflict",message:`${x} of ${N.length} probed die positions ${Ct} ${S} mm wafer at the supplied die pitch of ${m} \xD7 ${c} mm. A die with test results is a real prober position and is always fully on the wafer, so one of the two supplied values must be wrong: containing these dies at this pitch would need a diameter of at least ${(M*2).toFixed(1)} mm. Check waferConfig.diameter and dieConfig.width/height against the real device.`})}}const E=Q({diameter:S,units:w,notch:e.waferOpts?.notch,orientation:e.waferOpts?.orientation??0,metadata:e.waferOpts?.metadata,reticle:e.reticleOpts});let $=h.map(s=>{const x=Math.round(s.x)-D,A=Math.round(s.y)-g,O={id:`${x}_${A}`,x,y:A,physX:x*m-F,physY:A*c-L,width:m,height:c,insideWafer:!0,partial:!1};return q(O,s)});(D!==0||g!==0)&&($=$.map(s=>({...s,x:s.x+D,y:s.y+g,id:`${s.x+D}_${s.y+g}`}))),$=se($,E),(b||k)&&($=Ce($,{flipX:b,flipY:k},E.center));const Y=[];e.waferOpts?.edgeExclusion&&e.waferOpts.edgeExclusion>0&&($=Dt($,E,e.waferOpts.edgeExclusion),e.waferOpts.edgeExclusion>E.radius&&Y.push({code:"edge-exclusion-exceeds-radius",message:`edgeExclusion (${e.waferOpts.edgeExclusion}mm) exceeds the resolved wafer radius (${E.radius}mm) \u2014 the entire wafer is excluded.`,severity:"warning"})),$=$.map(z);const j=ge(e.reticleOpts,E,$,m,c,D,g,F,L,E.orientation,b,k),P=l.map((s,x)=>z(q({id:`unpositioned_${x}`,width:m,height:c},s))),W=[...$,...P];return{wafer:E,dies:W,dataAxisFlip:{x:b,y:k},reticleConfig:e.reticleOpts,units:w,inference:r,warnings:[...e.removedFieldWarning?[e.removedFieldWarning]:[],...e.inputValueWarnings,...o?[o]:[],...we(p,r),...Y,...t,...e.ringCountWarning?[e.ringCountWarning]:[]],plotMode:be(d),metadata:E.metadata??null,isLotStack:e.lotStackOpts!==void 0,dataCoverage:computeCoverage(W),passBins:e.passBins,...i?{valueFilter:i}:{},ringCount:e.ringCount,yield:computeYield(W,e.passBins,e.edgeDieYieldMode,it(e.lotStackOpts!==void 0,e.lotStackOpts?.method)),reticles:j,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,metadataFields:e.metadataFields,aggrMethod:e.lotStackOpts?.method,lotSize:e.lotStackOpts?.results.length}}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* with no further change.
|
|
22
22
|
*/
|
|
23
23
|
import type { DieResult, TestDef, WaferWarning } from '../buildWaferMap.js';
|
|
24
|
+
import { type ExprNode } from './parser.js';
|
|
24
25
|
import type { DieTable } from '../../core/dieTable.js';
|
|
25
26
|
/**
|
|
26
27
|
* A test whose values are computed from other tests on the same die, rather than
|
|
@@ -77,6 +78,15 @@ export interface ApplyResult {
|
|
|
77
78
|
testDefs: TestDef[] | undefined;
|
|
78
79
|
warnings: WaferWarning[];
|
|
79
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Unit agreement across `+` and `-`. The library knows the units, so staying
|
|
83
|
+
* silent about a volts-minus-amps subtraction would be exactly the kind of
|
|
84
|
+
* unlabelled nonsense the design principles forbid. It is a warning rather than
|
|
85
|
+
* a rejection: unit strings are free text and a site may legitimately use
|
|
86
|
+
* `"uA"` and `"µA"` for the same thing, so refusing to build would be worse than
|
|
87
|
+
* saying so.
|
|
88
|
+
*/
|
|
89
|
+
export declare function unitMismatch(node: ExprNode, defs: Map<number, TestDef>): string[];
|
|
80
90
|
/**
|
|
81
91
|
* Apply `derivedTests` to a wafer's records: `records[i]` is row `i` of
|
|
82
92
|
* `table` (its bins give `diePass()`). Returns a copy of the table with a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isStdfTestNumber as D,STDF_TEST_NUM_MAX as T}from"../../core/stdf.js";import{diePassStatus as M}from"../../core/dies.js";import{getTestPassStatus as F,isParametricTest as V}from"../buildWaferMap.js";import{classifySpec as _}from"../spec.js";import{parseExpression as P}from"./parser.js";import{evaluate as A}from"./evaluate.js";import{extendTable as E,rowView as O,testValue as I,HAS_VALUES as k,HAS_VERDICTS as C,VERDICT_FAIL as L,VERDICT_NONE as S,VERDICT_PASS as R}from"../../core/dieTable.js";function l(w){return{code:"derived-test-invalid",message:w,severity:"warning"}}function
|
|
1
|
+
import{isStdfTestNumber as D,STDF_TEST_NUM_MAX as T}from"../../core/stdf.js";import{diePassStatus as M}from"../../core/dies.js";import{getTestPassStatus as F,isParametricTest as V}from"../buildWaferMap.js";import{classifySpec as _}from"../spec.js";import{parseExpression as P}from"./parser.js";import{evaluate as A}from"./evaluate.js";import{extendTable as E,rowView as O,testValue as I,HAS_VALUES as k,HAS_VERDICTS as C,VERDICT_FAIL as L,VERDICT_NONE as S,VERDICT_PASS as R}from"../../core/dieTable.js";function l(w){return{code:"derived-test-invalid",message:w,severity:"warning"}}export function unitMismatch(w,p){const m=[],n=r=>{switch(r.k){case"acc":{if(r.kind!=="t")return;const o=p.get(r.test)?.unit;return o?new Set([o]):void 0}case"unary":return r.op==="-"?n(r.arg):void 0;case"binary":{const o=n(r.left),a=n(r.right);if(r.op==="+"||r.op==="-"){if(o&&a){const d=new Set([...o,...a]);return d.size>1&&m.push(`${[...d].join(" and ")} are combined by "${r.op}"`),d}return o??a}return}case"call":{if(r.name==="min"||r.name==="max"||r.name==="mean"||r.name==="sum"){const o=r.args[0];if(o?.k==="vec"&&o.kind==="t"){const a=new Set(o.tests.map(d=>p.get(d)?.unit).filter(d=>!!d));return a.size>1&&m.push(`${[...a].join(" and ")} are combined by "${r.name}"`),a}}return}default:return}};return n(w),m}function j(w,p,m){const n=[],r=new Map((p??[]).map(e=>[e.testNumber,e])),o=e=>`${JSON.stringify(e.name??"")} (test ${e.testNumber})`,a=[],d=new Set;for(const e of w){const s=o(e);if(!D(e.testNumber)){n.push(l(`Derived test ${s} was dropped: \`testNumber\` must be a whole number from 0 to ${T}, as STDF stores it.`));continue}if(m.has(e.testNumber)||r.has(e.testNumber)){n.push(l(`Derived test ${s} was dropped: test number ${e.testNumber} already exists in the data. Measured values are never replaced by a derived test \u2014 give it an unused number.`));continue}if(d.has(e.testNumber)){n.push(l(`Derived test ${s} was dropped: test number ${e.testNumber} is used by an earlier derived test.`));continue}if(typeof e.expression!="string"||e.expression.trim()===""){n.push(l(`Derived test ${s} was dropped: \`expression\` is empty.`));continue}d.add(e.testNumber),a.push(e)}const g=new Map(r);for(const e of a){const{expression:s,constants:u,...c}=e;g.set(e.testNumber,{...c,testType:e.testType??"P"})}const h=new Map,f=new Set;for(const e of a){const s=o(e),u={testDefs:g,constants:e.constants??{}},c=P(e.expression,u);if(!c.ok){n.push(l(`Derived test ${s} was dropped: ${c.message}`)),f.add(e.testNumber);continue}const t=c.type==="boolean",i=!V(e);if(t!==i){n.push(l(t?`Derived test ${s} was dropped: its expression produces a true/false verdict, so it must declare \`testType: 'F'\`.`:`Derived test ${s} was dropped: it declares \`testType: 'F'\` but its expression produces a number. Functional tests carry a verdict, not a measurement.`)),f.add(e.testNumber);continue}if(t&&(e.limitLow!==void 0||e.limitHigh!==void 0)&&n.push(l(`Derived test ${s}: test limits are ignored on a true/false derived test.`)),e.testNumber===void 0)continue;const N=e.testNumber,x=[...new Set(c.reads.map(v=>v.test))].filter(v=>v!==N&&d.has(v));if(c.reads.some(v=>v.test===N)){n.push(l(`Derived test ${s} was dropped: its expression reads itself.`)),f.add(N);continue}for(const v of unitMismatch(c.ast,g))n.push(l(`Derived test ${s} combines different units \u2014 ${v}. The result is computed as written; set \`unit\` on the derived test to say what it is.`));h.set(N,{raw:e,compiled:{def:{...e,testType:t?"F":"P",derived:!0},ast:c.ast,boolean:t},deps:x})}const y=[],b=new Map,$=(e,s)=>{if(b.get(e)==="done")return!f.has(e);if(b.get(e)==="visiting"){const t=[...s.slice(s.indexOf(e)),e].join(" \u2192 ");for(const i of s.slice(s.indexOf(e)))f.has(i)||(f.add(i),n.push(l(`Derived test ${o(h.get(i).raw)} was dropped: its expression depends on itself through ${t}.`)));return!1}const u=h.get(e);if(u===void 0)return!1;b.set(e,"visiting");let c=!0;for(const t of u.deps)if(!$(t,[...s,e])){if(!f.has(e)){f.add(e);const i=h.get(t)?.raw.name??`test ${t}`;n.push(l(`Derived test ${o(u.raw)} was dropped: it reads ${JSON.stringify(i)} (test ${t}), which was itself dropped.`))}c=!1;break}return b.set(e,"done"),!c||f.has(e)?!1:(y.push(u.compiled),!0)};for(const e of a)$(e.testNumber,[]);return{compiled:y,warnings:n}}export function applyDerivedTests(w,p,m,n,r){if(n===void 0||n.length===0)return{table:p,testDefs:m,warnings:[]};const o=new Set;for(const[e,s]of p.values)s.some(u=>!Number.isNaN(u))&&o.add(e);for(const[e,s]of p.verdicts)s.some(u=>u!==S)&&o.add(e);const{compiled:a,warnings:d}=j(n,m,o);if(a.length===0)return{table:p,testDefs:m,warnings:d};const g=new Map((m??[]).map(e=>[e.testNumber,e]));for(const e of a)g.set(e.def.testNumber,e.def);const h=p.rows,f=new Map,y=new Map;for(const e of a)e.boolean?y.set(e.def.testNumber,new Int8Array(h).fill(S)):f.set(e.def.testNumber,new Float64Array(h).fill(NaN));const b=E(p,f,y),$=O(b);for(let e=0;e<h;e++){const s=$(e),u=t=>I(s,t),c={value:u,testPass:t=>F(s,t,g.get(t)),specPass:t=>{const i=_(u(t),g.get(t));return i===null?void 0:i==="pass"},diePass:()=>M(w[e],r),field:t=>{const i=w[e],N=t==="x"?i.x:t==="y"?i.y:t==="hbin"?i.hbin:t==="sbin"?i.sbin:i.siteNum;return typeof N=="number"&&Number.isFinite(N)?N:void 0}};for(const t of a){const i=A(t.ast,c);i!==void 0&&(t.boolean?(y.get(t.def.testNumber)[e]=i?R:L,b.fields[e]|=C):(f.get(t.def.testNumber)[e]=i,b.fields[e]|=k))}}return{table:b,testDefs:[...m??[],...a.map(e=>e.def)],warnings:d}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TestDef } from '../buildWaferMap.js';
|
|
2
|
+
import { type AccessorKind } from './parser.js';
|
|
3
|
+
import { type DerivedTestDef } from './apply.js';
|
|
4
|
+
export interface DerivedCheckInput {
|
|
5
|
+
expression: string;
|
|
6
|
+
/** The number the derived test will have; a derived test may not read itself. */
|
|
7
|
+
testNumber: number;
|
|
8
|
+
/** The declared kind. Omitted: not checked against what the expression produces. */
|
|
9
|
+
testType?: 'P' | 'F';
|
|
10
|
+
constants?: Record<string, number>;
|
|
11
|
+
}
|
|
12
|
+
export type DerivedCheck = {
|
|
13
|
+
ok: true;
|
|
14
|
+
/** What the expression produces: a measurement, or a true/false verdict (which needs `testType: 'F'`). */
|
|
15
|
+
produces: 'number' | 'verdict';
|
|
16
|
+
/** Every test the expression reads, and how, in order of appearance. */
|
|
17
|
+
reads: {
|
|
18
|
+
kind: AccessorKind;
|
|
19
|
+
test: number;
|
|
20
|
+
}[];
|
|
21
|
+
/** Advice that does not stop the test being built, such as units combined by `+`. */
|
|
22
|
+
warnings: string[];
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
message: string;
|
|
26
|
+
/** 0-based character offset into `expression`, when the problem has one. */
|
|
27
|
+
position?: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* `testDefs` are the measured tests the expression may read; `otherDerived` are the host's *other* derived
|
|
31
|
+
* tests, which it may read too. The identity rules are the build's: a test number is a whole number from 0 to
|
|
32
|
+
* the STDF maximum, and neither a measured test nor another derived test may already have it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkDerivedExpression(input: DerivedCheckInput, testDefs: readonly TestDef[], otherDerived?: readonly DerivedTestDef[]): DerivedCheck;
|
|
35
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isStdfTestNumber as f,STDF_TEST_NUM_MAX as u}from"../../core/stdf.js";import{parseExpression as c}from"./parser.js";import{unitMismatch as d}from"./apply.js";export function checkDerivedExpression(e,n,a=[]){if(typeof e.expression!="string"||e.expression.trim()==="")return{ok:!1,message:"The expression is empty."};if(!f(e.testNumber))return{ok:!1,message:`The test number must be a whole number from 0 to ${u}, as STDF stores it.`};const r=new Map(n.map(s=>[s.testNumber,s]));if(r.has(e.testNumber))return{ok:!1,message:`Test number ${e.testNumber} already exists in the data; give the derived test an unused number.`};for(const s of a){if(s.testNumber===e.testNumber)return{ok:!1,message:`Test number ${e.testNumber} is used by another derived test.`};const{expression:b,constants:p,...m}=s;r.set(s.testNumber,{...m,testType:s.testType??"P"})}const t=c(e.expression,{testDefs:r,constants:e.constants??{}});if(!t.ok)return{ok:!1,message:t.message,position:t.position};const o=t.type==="boolean";if(e.testType!==void 0&&o!==(e.testType==="F"))return{ok:!1,message:o?"The expression produces a true/false verdict, so the test must be functional.":"The test is functional but its expression produces a number; a functional test carries a verdict."};if(t.reads.some(s=>s.test===e.testNumber))return{ok:!1,message:"The expression reads the test it defines."};const i=d(t.ast,r).map(s=>`Different units are combined: ${s}.`);return{ok:!0,produces:o?"verdict":"number",reads:t.reads,warnings:i}}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* agree on every prefix. Internal — not re-exported from the package. */
|
|
4
4
|
export declare const SI_PREFIX_SCALE: Record<string, number>;
|
|
5
5
|
export declare const KNOWN_BASE_UNITS: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Whether a test's name already ends with its own unit as a separate token (`fmax_MHz`, `Vth (mV)`, `Idsat uA`). Such
|
|
8
|
+
* a name states its unit, so an axis title must not append a differently scaled one ("fmax_MHz (GHz)").
|
|
9
|
+
*/
|
|
10
|
+
export declare function nameStatesUnit(name: string | null | undefined, unit: string | undefined): boolean;
|
|
6
11
|
/**
|
|
7
12
|
* Plain-language labels for lot-stack aggregation methods. Maps internal API terms to the words
|
|
8
13
|
* shown to the user (e.g. `countBin` → "occurrence count"). Shared by the canvas map title and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stepDecimals as
|
|
1
|
+
import{stepDecimals as m}from"./axisTicks.js";const M=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"],[1,""],[.001,"m"],[1e-6,"\xB5"],[1e-9,"n"],[1e-12,"p"],[1e-15,"f"]];export const SI_PREFIX_SCALE={T:1e12,G:1e9,M:1e6,k:1e3,m:.001,\u00B5:1e-6,u:1e-6,n:1e-9,p:1e-12,f:1e-15},KNOWN_BASE_UNITS=["Hz","V","A","W","F","\u03A9","Ohm","ohm","S","H","J","C","s"];function p(t){for(const e of KNOWN_BASE_UNITS)if(t.length===e.length+1&&t.endsWith(e)){const n=t[0];if(n in SI_PREFIX_SCALE)return{preScale:SI_PREFIX_SCALE[n],base:e}}return{preScale:1,base:t}}export function nameStatesUnit(t,e){if(!t||!e)return!1;let n=t.trimEnd();if((n.endsWith(")")||n.endsWith("]"))&&(n=n.slice(0,-1)),!n.endsWith(e))return!1;const r=n.length===e.length?"":n[n.length-e.length-1];return r===""||/[\s_\-/([]/.test(r)}function S(t,e){const{preScale:n,base:r}=p(e),i=t*n,o=Math.abs(i),[c,l]=M.find(([s])=>o>=s*.9999)??[1e-15,"f"],a=i/c,x=Math.abs(a),d=x>=100?0:x>=10?1:2;return`${a.toFixed(d)} ${l}${r}`}function $(t){const e=Math.abs(t);if(e===0)return"0%";const n=e>=100?0:e>=10?1:e>=1?2:Math.min(6,1-Math.floor(Math.log10(e)));return`${t.toFixed(n)}%`}function E(t){const e=Math.abs(t),n=Math.floor(Math.log10(e)/3)*3,r=Math.max(-15,Math.min(12,n)),i=t/Math.pow(10,r),o=Math.abs(i),c=o>=100?0:o>=10?1:2,l=r===0?"":`E${r>0?"+":""}${r}`;return`${i.toFixed(c)}${l}`}export const AGGREGATION_METHOD_LABELS={mean:"mean",median:"median",stddev:"std dev",min:"min",max:"max",count:"count",countBin:"occurrence count",percent:"occurrence %"};export function fmtAggregationMethod(t){return AGGREGATION_METHOD_LABELS[t??""]??t??"aggregated"}export function plainBinTerms(t){return t.replace(/\bHBin\b/g,"hard bin").replace(/\bSBin\b/g,"soft bin")}export function fmtExact(t){if(!Number.isFinite(t)||Math.fround(t)!==t)return String(t);for(let e=1;e<=9;e++){const n=Number(t.toPrecision(e));if(Math.fround(n)===t)return String(n)}return String(t)}export function fmt(t,e,n){if(!isFinite(t))return String(t);if(e==="%")return $(t);const r=Math.abs(t);return r===0?e?`0 ${e}`:"0":e!==void 0?S(t,e):n==="si"?S(t,""):r>=.1&&r<1e4?r>=1e3?t.toFixed(0):r>=100?t.toFixed(1):r>=10?t.toFixed(2):t.toFixed(3):E(t)}function A(t,e){const n=e!==void 0&&e>0?m(e/t):void 0;return r=>{if(!isFinite(r))return String(r);if(r===0)return"0";const i=r/t;if(n!==void 0)return i.toFixed(n);const o=Math.abs(i),c=o>=100?0:o>=10?1:2;return i.toFixed(c)}}function _(t,e,n){if(e===void 0||!(e>0))return n;const r=m(e/t)+1;return i=>{if(!isFinite(i))return String(i);if(i===0)return"0";const o=(i/t).toFixed(r);return o.endsWith("0")?o.slice(0,r===1?-2:-1):o}}export function fmtColorbarAxis(t,e,n,r="engineering",i){const o=Math.abs(t),c=(s,u,f,h)=>{const g=h&&i===void 0?h:A(s,i);return{tickFmt:g,edgeFmt:_(s,i,g),axisLabel:u,scaledUnit:f}};if(n==="%")return c(1,e?`${e} (%)`:"%","%");if(n&&nameStatesUnit(e,n)){const s=o===0||o>=.1&&o<1e4;return p(n).preScale!==1||s?c(1,e,n):fmtColorbarAxis(t,e,void 0,r,i)}if(n){const{preScale:s,base:u}=p(n),f=o*s,[h,g]=f===0?[1,""]:M.find(([F])=>f>=F*.9999)??[1e-15,"f"],b=`${g}${u}`;return c(h/s,e?`${e} (${b})`:b,b)}if(o===0||o>=.1&&o<1e4)return c(1,e??"","",s=>fmt(s,void 0,r));if(r==="si"){const[s]=M.find(([h])=>o>=h*.9999)??[1e-15,"f"],u=Math.round(Math.log10(s)),f=u===0?"":`\xD710E${u}`;return c(s,e?f?`${e} (${f})`:e:f,f)}const l=Math.floor(Math.log10(o)/3)*3,a=Math.max(-15,Math.min(12,l)),x=Math.pow(10,a),d=a===0?"":`\xD710E${a}`;return c(x,e?d?`${e} (${d})`:e:d,d)}
|
|
@@ -10,4 +10,6 @@ export type { BinColors, BinColorSource, MapBinColorOptions } from './binColors.
|
|
|
10
10
|
export { binColorsForMaps } from './binColors.js';
|
|
11
11
|
export { DERIVED_MARK, DERIVED_KEY } from './testLabel.js';
|
|
12
12
|
export { fmtExact } from './fmt.js';
|
|
13
|
+
export { checkDerivedExpression } from './derivedTests/check.js';
|
|
14
|
+
export type { DerivedCheck, DerivedCheckInput } from './derivedTests/check.js';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getDieKey}from"./buildView.js";export{buildWaferMap,getTestPassStatus}from"./buildWaferMap.js";export{registerValueColorScheme,listValueColorSchemes,resolveValueColorFn,registerBinColorScheme,listBinColorSchemes}from"./colorSchemes.js";export{binColorsForMaps}from"./binColors.js";export{DERIVED_MARK,DERIVED_KEY}from"./testLabel.js";export{fmtExact}from"./fmt.js";
|
|
1
|
+
export{getDieKey}from"./buildView.js";export{buildWaferMap,getTestPassStatus}from"./buildWaferMap.js";export{registerValueColorScheme,listValueColorSchemes,resolveValueColorFn,registerBinColorScheme,listBinColorSchemes}from"./colorSchemes.js";export{binColorsForMaps}from"./binColors.js";export{DERIVED_MARK,DERIVED_KEY}from"./testLabel.js";export{fmtExact}from"./fmt.js";export{checkDerivedExpression}from"./derivedTests/check.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{waferDisplayLabel as oe}from"../core/waferLabel.js";import{requireRingCount as ce}from"../core/ringCount.js";import{analyzeWaferMapDecided as F,candidatesOf as H,describeRegional as U,resolveOptions as le,adjustPValues as fe,testValueSize as de,recordedOptions as ue,twoProportionZ as Q,welchOfSums as X,rateRelativeEffect as me,passesRateGate as pe,severityForFinding as Z,severityForScore as J,collapseRedundantFindings as ge,findContiguousRuns as he,mergedRegionLabel as ye}from"./analyzeWaferMap.js";import{normalizeInput as ee}from"./normalizeInput.js";import{autoDecision as we,lotTestValueStatus as be}from"./testValueBudget.js";import{poolCapability as Se,poolRegionYield as ve,poolPassRates as ze}from"./summaryFigures.js";import{mergeTestDefs as Ie}from"./mergeTestDefs.js";import{findingPatternKey as ke}from"./filterFindings.js";import{median as te}from"../core/utils.js";import{robustFence as ne,zPValue as T}from"./math.js";import{findLotPattern as xe}from"./lotPattern.js";import{buildDriftFindings as Pe}from"./lotDrift.js";import{claimForPattern as Re,confirmRegionalFindings as Me,weakestMultiplier as $e}from"./analyzeWaferMap.js";import{PATTERN_LABELS as De}from"./patternClassification.js";import{describeWaferPopulation as Be,populationStat as We}from"./population.js";const N=8,Le={3:[.97,.994],4:[.829,.926],5:[.71,.821],6:[.625,.74],7:[.568,.68]},Ke=3;export function outlierWafers(e){const o=e.length;if(o<3)return null;const s=te([...e]),t=n=>Math.abs(n-s)>=Ke;if(o>=N){const n=ne(e,1.5,N),d=ne(e,3,N);if(!n||!d)return null;const m=(n.hi-n.lo)/4,w=[];return e.forEach((y,l)=>{if(y>=n.lo&&y<=n.hi||!t(y))return;const f=y<d.lo||y>d.hi?"unusual":"notable";w.push({index:l,severity:f,statistic:(y-s)/m})}),{method:"tukey-fence",outliers:w}}const a=e.map((n,d)=>d).sort((n,d)=>e[n]-e[d]),u=e[a[o-1]]-e[a[0]];if(u===0)return null;const[r,c]=Le[o],p=[],h=(n,d)=>{const m=Math.abs(e[n]-e[d])/u;m>r&&t(e[n])&&p.push({index:n,severity:m>c?"unusual":"notable",statistic:m})};return h(a[0],a[1]),h(a[o-1],a[o-2]),{method:"dixon-q",outliers:p}}const q=2;function O(e,o){const s={info:0,notable:1,unusual:2};return s[e]>=s[o]?e:o}const Ee=new Set(["ring","quadrant","sector"]),Te=new Set(["ring","quadrant","sector","reticle-position","test-site"]),qe=new Set(["yield","hardBin","softBin","functionalTest","test"]);function Ae(e){return Te.has(e.comparison.family)&&qe.has(e.variable.kind)}function Fe(e,o){const s=e.map(r=>r.facts);if(!s.length||s.some(r=>!r))return{coincident:new Set,yieldSoftBin:void 0,passBins:[],sectorCount:o};const[t,...a]=s,u=a.every(r=>r.passBins.length===t.passBins.length&&r.passBins.every(c=>t.passBins.includes(c)));return{coincident:new Set([...t.coincident].filter(r=>a.every(c=>c.coincident.has(r)))),yieldSoftBin:a.every(r=>r.yieldSoftBin===t.yieldSoftBin)?t.yieldSoftBin:void 0,passBins:u?t.passBins:[],sectorCount:o}}function j(e,o){let s=0,t=0,a=0,u=0,r=0,c=0,p=0,h=0,n=0,d=!0,m=0;for(const{waferIndex:l,c:f}of e){const i=o(l,f),g=f.rate??f.mean,b=Math.sqrt(g.n+i.n);if(f.rate)s+=b*Q(f.rate.hits,f.rate.n,i.hits,i.n),a+=f.rate.hits,u+=f.rate.n,r+=i.hits,c+=i.n;else{const v=X(f.mean,i.n,i.sum,i.sq);s+=b*v.z,p+=f.mean.n*v.effectSize,h+=f.mean.n*v.delta,m+=f.mean.n,f.relativeDelta===void 0?d=!1:n+=f.mean.n*f.relativeDelta}t+=b*b}const w=t>0?s/Math.sqrt(t):0,y=e[0].c;if(y.rate){const l=r/c,f=a/u-l;return{z:w,delta:f,relativeDelta:l===0?void 0:f/l,size:me({hits:a,n:u,restHits:r,restN:c,passRate:y.rate.passRate})}}return{z:w,delta:h/m,relativeDelta:d?n/m:void 0,size:p/m}}function V(e,o,s,t){return e.rate?pe(o,s.delta,s.size,t):o<=t.significanceLevel&&Math.abs(s.size)>=t.minimumEffectSize}function Ne(e,o,s,t){const a=new Map;for(const{waferIndex:l,byKey:f}of e)for(const i of f.values())(a.get(i.key)??a.set(i.key,[]).get(i.key)).push({waferIndex:l,c:i});const u=new Map(e.map(l=>[l.waferIndex,l.byKey])),r=(l,f)=>f.rate?{hits:f.rate.restHits,n:f.rate.restN,sum:0,sq:0}:{hits:0,n:f.mean.restN,sum:f.mean.restSum,sq:f.mean.restSq},c=[];for(const[l,f]of a){if(f.length<q)continue;const i=j(f,r);if(i.z===0)continue;const g=f[0].c;c.push({key:l,entries:f,combined:i,finding:{id:`lot-region:${l}`,level:"lot",severity:"info",variable:{...g.variable,label:g.label},comparison:{...g.comparison},effect:{direction:i.z>0?"higher":"lower",absoluteDelta:i.delta,relativeDelta:i.relativeDelta,effectSize:g.rate?i.delta:i.size},stats:{method:"stouffer-z",pValue:T(i.z),sampleSizeLeft:0,sampleSizeRight:0},summary:"",highlight:{kind:"wafer",waferIndices:[]}}})}fe(c.map(l=>l.finding));const p=c.filter(l=>V(l.entries[0].c,l.finding.stats.adjustedPValue??1,l.combined,o)),d=Me(p,l=>{const f=l.entries[0].c;return[f.source,f.variable.kind,f.variable.bin??"",f.variable.index??"",f.region.family].join("\0")},(l,f)=>{const i=(R,D)=>{const k=r(R,D);for(const z of f){const P=u.get(R)?.get(z.key);P&&(P.rate?(k.hits-=P.rate.hits,k.n-=P.rate.n):(k.n-=P.mean.n,k.sum-=P.mean.sum,k.sq-=P.mean.sq))}return k},g=l.entries.filter(R=>i(R.waferIndex,R.c).n>=o.minimumSampleSize);if(!g.length)return"baseline-too-small";const b=j(g,i),v=l.finding.stats.pValue??1,x=v>0?(l.finding.stats.adjustedPValue??v)/v:1,S=Math.min(1,T(b.z)*x);return{pValue:S,passes:Math.sign(b.z)===Math.sign(l.combined.z)&&V(l.entries[0].c,S,b,o)}},l=>{const f=l.entries[0].c.rate;return f!==void 0&&(f.passRate?l.combined.z<0:l.combined.z>0)},c),m=[],w=new Map;for(const l of p){if(!d.has(l))continue;const f=l.finding.stats.pValue??1,i=Math.sign(l.combined.z),g=l.entries.filter(z=>Math.sign(z.c.delta)===i),b=e.length,v=l.entries[0].c,x=l.finding.stats.adjustedPValue??f,S=v.rate?Z(x,l.combined.delta,l.combined.size):J(x,l.combined.size),R=O(S,g.length/b>=.6?"unusual":"info"),D={};for(const z of g)D[z.waferIndex]=[...z.c.region.dieKeys];const k={...l.finding,severity:R,stats:{...l.finding.stats,sampleSizeLeft:g.length,sampleSizeRight:b-g.length},summary:`${U(v,l.combined.delta,l.combined.relativeDelta)} \u2014 ${l.finding.effect.direction} on ${g.length}/${b} wafers, all wafers' data combined`,highlight:{kind:"wafer",waferIndices:g.map(z=>z.waferIndex),dieKeysByWafer:D}};m.push(k),w.set(k,l)}const y=Oe(w,u,e.length,o,t,r);return m.splice(0,m.length,...m.filter(l=>!y.replaced.has(l)),...y.findings),ge(m,s),m}function Oe(e,o,s,t,a,u){const r=new Map;for(const[h,n]of e){const d=n.entries[0].c;if(!Ee.has(d.region.family))continue;const m=[d.source,d.variable.kind,d.variable.bin??"",d.variable.index??"",d.region.family,h.effect.direction].join("|");(r.get(m)??r.set(m,[]).get(m)).push({finding:h,c:d,key:n.key})}const c=[],p=new Set;for(const h of r.values()){if(h.length<2)continue;const n=h[0].c.region.family;for(const d of he(h,n,t.sectorCount,m=>m.c.region.key)){if(d.length<2)continue;const m=je(d,o,s,t,a,u);if(m){c.push(m);for(const w of d)p.add(w.finding)}}}return{findings:c,replaced:p}}function je(e,o,s,t,a,u){const r=e[0].c,c=e[0].finding.effect.direction==="higher"?1:-1,p=ye(r.region.family,e.map(S=>S.c.region.key),a),h=[];for(const[S,R]of o){const D=e.map(I=>R.get(I.key));if(D.some(I=>!I))continue;const k=D,z=k[0];let P,A;if(z.rate){const I=k.reduce(($,B)=>$+B.rate.hits,0),M=k.reduce(($,B)=>$+B.rate.n,0),L=z.rate.hits+z.rate.restHits-I,W=z.rate.n+z.rate.restN-M;if(M<t.minimumSampleSize||W<t.minimumSampleSize)continue;P={...z,rate:{hits:I,n:M,restHits:L,restN:W,passRate:z.rate.passRate}},A=Q(I,M,L,W)}else{const I=z.mean,M=k.reduce((K,E)=>K+E.mean.n,0),L=k.reduce((K,E)=>K+E.mean.sum,0),W=k.reduce((K,E)=>K+E.mean.sq,0),$=I.n+I.restN-M,B=I.sum+I.restSum-L,_=I.sq+I.restSq-W;if(M<t.minimumSampleSize||$<t.minimumSampleSize)continue;const Y={n:M,sum:L,sq:W,restN:$,restSum:B,restSq:_,shift:I.shift},C=X(Y,$,B,_),G=B/$+I.shift;P={...z,mean:Y,relativeDelta:G!==0?C.delta/Math.abs(G):void 0},A=C.z}const re=[...new Set(k.flatMap(I=>[...I.region.dieKeys]))];h.push({waferIndex:S,c:P,z:A,dieKeys:re})}if(h.length<q)return;const n=j(h,u);if(n.z===0||Math.sign(n.z)!==c)return;const d=T(n.z),m=$e(e.map(S=>S.finding)),w=Math.min(1,d*m);if(!V(r,w,n,t))return;const y=h.filter(S=>Math.sign(S.z)===c&&T(S.z)<=t.significanceLevel);if(!y.length)return;const l=r.rate?Z(w,n.delta,n.size):J(w,n.size),f=O(l,y.length/s>=.6?"unusual":"info"),i={};for(const S of y)i[S.waferIndex]=S.dieKeys;const g=e.map(S=>S.c.region.key.slice(S.c.region.key.indexOf(":")+1)).join("-"),b={...r,comparison:{...r.comparison,left:p}},v=e[0].finding,x=v.effect.direction;return{...v,id:`lot-region:${e[0].key.split("|").slice(0,-1).join("|")}|${r.region.family}:${g}`,severity:f,comparison:{...v.comparison,left:p},effect:{direction:x,absoluteDelta:n.delta,relativeDelta:n.relativeDelta,effectSize:r.rate?n.delta:n.size},stats:{method:"stouffer-z",pValue:d,adjustedPValue:w,sampleSizeLeft:y.length,sampleSizeRight:s-y.length},summary:`${U(b,n.delta,n.relativeDelta)} \u2014 ${x} on ${y.length}/${s} wafers, all wafers' data combined`,highlight:{kind:"wafer",waferIndices:y.map(S=>S.waferIndex),dieKeysByWafer:i},relatedIds:e.map(S=>S.finding.id)}}const ie={"Edge-ring":"edge","Edge-local":"edge","Center cluster":"centre or donut",Donut:"centre or donut"};function Ve(e,o){const s=new Map,t=r=>{const c=r.variable.kind==="spatialPattern"?ie[r.comparison.left]:void 0;return c?`spatialPattern|${c}`:ke(r)};for(const r of e){const c=new Set,p=new Map;for(const n of r.summary.findings)if(n.variable.kind==="spatialPattern")for(const d of n.relatedIds??[])p.set(d,t(n));const h=new Set(r.summary.findings.flatMap(n=>n.absorbedIds??[]));for(const n of r.summary.findings){if(h.has(n.id)||Ae(n)||n.variable.kind==="spatialPattern"&&o?.carriers.has(r.waferIndex))continue;const d=t(n);if(c.has(d))continue;c.add(d);const m=s.get(d)??{finding:n,waferIndices:[],severity:n.severity,labels:new Map,dieKeysByWafer:{},explainedBy:new Map};m.waferIndices.push(r.waferIndex);const w=p.get(n.id);if(w&&m.explainedBy.set(w,(m.explainedBy.get(w)??0)+1),n.variable.kind==="spatialPattern"){m.labels.set(n.comparison.left,(m.labels.get(n.comparison.left)??0)+1);const y=n.highlight.dieKeys;y&&(m.dieKeysByWafer[r.waferIndex]=y)}m.severity=O(m.severity,n.severity),s.set(d,m)}}const a=[];for(const[r,c]of s){if(c.waferIndices.length<q)continue;const p=c.waferIndices.length/Math.max(1,e.length),h=p>=.6||c.severity==="unusual"?"unusual":"notable",n=c.finding;a.push({id:`lot-repeat:${r}`,level:"lot",severity:h,variable:{...n.variable},comparison:{...n.comparison},effect:{direction:n.effect.direction,absoluteDelta:n.effect.absoluteDelta,relativeDelta:n.effect.relativeDelta,effectSize:n.effect.effectSize},stats:{method:"wafer-finding-frequency",sampleSizeLeft:c.waferIndices.length,sampleSizeRight:e.length-c.waferIndices.length},summary:`${Ce(n,c.labels)} \u2014 seen on ${c.waferIndices.length}/${e.length} wafers (${Math.round(p*100)}%)`,highlight:{kind:"wafer",waferIndices:c.waferIndices,...c.labels.size?{dieKeysByWafer:c.dieKeysByWafer}:{}}})}const u=new Map(a.map(r=>[r.id,r]));for(const[r,c]of s){const p=u.get(`lot-repeat:${r}`);if(p)for(const[h,n]of c.explainedBy){const d=u.get(`lot-repeat:${h}`);!d||n!==c.waferIndices.length||(d.relatedIds??=[]).push(p.id)}}return a}function _e(e,o){const{classification:s,carriers:t}=e,a=De[s.pattern],u=t.size/Math.max(1,o),r={};for(const[c,p]of t)r[c]=p;return{id:"lot-repeat:spatialPattern|lot",level:"lot",severity:u>=.6||s.confidence==="high"?"unusual":"notable",variable:{kind:"spatialPattern",label:a},comparison:{family:"spatial-pattern",left:a,right:"Wafer"},effect:{direction:"different",effectSize:s.features.globalRdd},stats:{method:"wafer-finding-frequency",sampleSizeLeft:t.size,sampleSizeRight:o-t.size},summary:`Spatial pattern: ${a.toLowerCase()} \u2014 seen on ${t.size}/${o} wafers (${Math.round(u*100)}%)`,highlight:{kind:"wafer",waferIndices:[...t.keys()].sort((c,p)=>c-p),dieKeysByWafer:r}}}function Ye(e){const o=/^Rings? (\d+)(?:\s*[–-]\s*(\d+))?/.exec(e.comparison.left);if(!o)return[];const s=+o[1],t=o[2]?+o[2]:s;return Array.from({length:Math.max(0,t-s+1)},(a,u)=>s+u)}function Ce(e,o){if(!o.size)return e.summary;const s=u=>u.toLowerCase();if(o.size===1)return`Spatial pattern: ${s([...o.keys()][0])}`;const t=ie[e.comparison.left],a=[...o].sort((u,r)=>r[1]-u[1]).map(([u,r])=>`${s(u)} on ${r}`);return`Spatial pattern: ${t} (${a.join(", ")})`}function Ge(e,o){const s=We(o,"median"),t=e.map(p=>({waferIndex:p.waferIndex,yieldPercent:p.summary.stats.yieldPercent})).filter(p=>p.yieldPercent!==null),a=t.map(p=>p.yieldPercent),u=outlierWafers(a);if(!u)return[];const r=te(a),c=[];for(const{index:p,severity:h,statistic:n}of u.outliers){const d=t[p],m=d.yieldPercent-r,w=oe({wafer:{metadata:e.find(y=>y.waferIndex===d.waferIndex)?.summary.wafer}},d.waferIndex);c.push({id:`inter-wafer:yield:${d.waferIndex}`,level:"inter-wafer",severity:h,variable:{kind:"yield",label:"Yield"},comparison:{family:"wafer",left:w,right:s.charAt(0).toUpperCase()+s.slice(1)},effect:{direction:m>0?"higher":"lower",absoluteDelta:m/100,relativeDelta:r===0?void 0:m/r,effectSize:n},stats:{method:u.method,sampleSizeLeft:1,sampleSizeRight:t.length-1},summary:`${w} yield is ${Math.abs(m).toFixed(1)} percentage points ${m>0?"higher":"lower"} than the ${s}`,highlight:{kind:"wafer",waferIndices:[d.waferIndex]}})}return c}function se(e,o){if((o.enableTestValueAnalysis??"auto")!=="auto")return;let s=0;for(const t of e){const{tests:a,dies:u}=de(t,o);s+=a*u}return we(s)}export function analyzeWaferLot(e,o={}){const s=e.map(ee),t=se(s,o),a=s.map((i,g)=>({waferIndex:g,summary:o.perWaferSummaries?.[g]??F(i,o,t)})),u=a.map(({waferIndex:i,summary:g})=>H(g)??H(F(s[i],o,t))),r=u.map((i,g)=>({waferIndex:g,byKey:new Map(i.candidates.map(b=>[b.key,b]))})),c=le(o).resolved,p=s.length>0?ce(s[0],"analyzeWaferLot"):void 0,h=xe(s,c),n=h&&h.carriers.size>=q?h:null,d=[...p===void 0?[]:Ne(r,c,Fe(u,c.sectorCount),p),...Ve(a,n),...Ge(a,Be(a.map(i=>i.summary.wafer))),...Pe(a,c.significanceLevel)];if(n&&p!==void 0){const i=_e(n,a.length);i.relatedIds=Re([n.classification.pattern],i.severity,d,Ye,p),i.relatedIds.length||delete i.relatedIds,d.push(i)}d.sort((i,g)=>{const b=i.severity==="unusual"?2:i.severity==="notable"?1:0,v=g.severity==="unusual"?2:g.severity==="notable"?1:0;return b!==v?v-b:i.summary.localeCompare(g.summary,"en")});const m=a.map(i=>i.summary.wafer).filter(i=>!!i),w={},y=[];if(m.length>0){const i=new Set;for(const g of m)for(const b of Object.keys(g))i.add(b);i.delete("wafer"),i.delete("waferId");for(const g of i){const b=m.filter(x=>g in x).map(x=>x[g]);b.every(x=>x===b[0])?w[g]=b[0]:y.push(g)}}const l=a.map(({waferIndex:i,summary:g})=>({waferIndex:i,yieldPercent:g.stats.yieldPercent})),f=a.map(({waferIndex:i,summary:g})=>g.stats.perTestStats?.length?{waferIndex:i,tests:g.stats.perTestStats}:null).filter(i=>i!==null);return{level:"lot",hasNotableFindings:d.some(i=>i.severity!=="info")||a.some(i=>i.summary.hasNotableFindings),findings:d,lot:Object.keys(w).length>0?w:void 0,...y.length>0?{mixedIdentityFields:y}:{},analysisOptions:ue(o),stats:{waferCount:e.length,...He(s,a.map(i=>i.summary)),...Ue(be(a.map(i=>i.summary)))},lotYieldSeries:l,perWafer:a,...f.length>0?{perWaferTestStats:f}:{}}}function He(e,o){const s={...ze(o)},t=Se(o,Ie(e).defs);t&&(s.capability=t);const a=ve(o,e.map(u=>u.ringCount));return a&&(s.regionYield=a),s}const Ue=e=>e?{testValueAnalysis:e}:{},ae=()=>new Promise(e=>setTimeout(e,0));export async function analyzeWaferLotAsync(e,o={}){const{onProgress:s,signal:t,...a}=o,u=e.map(ee),r=se(u,a),c=[];let p=Date.now();for(let h=0;h<u.length;h++)t?.throwIfAborted(),c.push(a.perWaferSummaries?.[h]??F(u[h],a,r)),s?.(h+1,u.length),Date.now()-p>100&&(await ae(),p=Date.now());return await ae(),t?.throwIfAborted(),analyzeWaferLot(u,{...a,perWaferSummaries:c})}export function remapLotWaferIndices(e,o){const s=t=>o[t]??t;return{...e,perWafer:e.perWafer.map(t=>({...t,waferIndex:s(t.waferIndex)})),lotYieldSeries:e.lotYieldSeries.map(t=>({...t,waferIndex:s(t.waferIndex)})),...e.perWaferTestStats?{perWaferTestStats:e.perWaferTestStats.map(t=>({...t,waferIndex:s(t.waferIndex)}))}:{},findings:e.findings.map(t=>{const a=t.highlight;if(!a||a.kind!=="wafer")return t;const u=a.dieKeysByWafer?Object.fromEntries(Object.entries(a.dieKeysByWafer).map(([r,c])=>[s(Number(r)),c])):void 0;return{...t,highlight:{...a,waferIndices:a.waferIndices.map(s),...u?{dieKeysByWafer:u}:{}}}})}}
|
|
1
|
+
import{waferDisplayLabel as le}from"../core/waferLabel.js";import{requireRingCount as fe}from"../core/ringCount.js";import{isPositionedDie as de}from"../core/dies.js";import{analyzeWaferMapDecided as N,candidatesOf as Q,describeRegional as X,resolveOptions as ue,adjustPValues as me,testValueSize as pe,recordedOptions as ge,twoProportionZ as Z,welchOfSums as J,rateRelativeEffect as he,passesRateGate as ye,severityForFinding as ee,severityForScore as te,collapseRedundantFindings as we,findContiguousRuns as be,mergedRegionLabel as Se}from"./analyzeWaferMap.js";import{normalizeInput as ne}from"./normalizeInput.js";import{autoDecision as ve,lotTestValueStatus as ze}from"./testValueBudget.js";import{poolCapability as Ie,poolRegionYield as ke,poolPassRates as xe}from"./summaryFigures.js";import{mergeTestDefs as Pe}from"./mergeTestDefs.js";import{findingPatternKey as Re}from"./filterFindings.js";import{median as ie}from"../core/utils.js";import{robustFence as se,zPValue as q}from"./math.js";import{findLotPattern as Me}from"./lotPattern.js";import{buildDriftFindings as $e}from"./lotDrift.js";import{claimForPattern as De,confirmRegionalFindings as Be,weakestMultiplier as We}from"./analyzeWaferMap.js";import{PATTERN_LABELS as Le}from"./patternClassification.js";import{describeWaferPopulation as Ke,populationStat as Ee}from"./population.js";const O=8,Te={3:[.97,.994],4:[.829,.926],5:[.71,.821],6:[.625,.74],7:[.568,.68]},qe=3;export function outlierWafers(e){const s=e.length;if(s<3)return null;const i=ie([...e]),r=o=>Math.abs(o-i)>=qe;if(s>=O){const o=se(e,1.5,O),f=se(e,3,O);if(!o||!f)return null;const u=(o.hi-o.lo)/4,y=[];return e.forEach((w,v)=>{if(w>=o.lo&&w<=o.hi||!r(w))return;const n=w<f.lo||w>f.hi?"unusual":"notable";y.push({index:v,severity:n,statistic:(w-i)/u})}),{method:"tukey-fence",outliers:y}}const t=e.map((o,f)=>f).sort((o,f)=>e[o]-e[f]),d=e[t[s-1]]-e[t[0]];if(d===0)return null;const[l,c]=Te[s],m=[],h=(o,f)=>{const u=Math.abs(e[o]-e[f])/d;u>l&&r(e[o])&&m.push({index:o,severity:u>c?"unusual":"notable",statistic:u})};return h(t[0],t[1]),h(t[s-1],t[s-2]),{method:"dixon-q",outliers:m}}const A=2;function j(e,s){const i={info:0,notable:1,unusual:2};return i[e]>=i[s]?e:s}const Ae=new Set(["ring","quadrant","sector"]),Fe=new Set(["ring","quadrant","sector","reticle-position","test-site"]),Ne=new Set(["yield","hardBin","softBin","functionalTest","test"]);function Oe(e){return Fe.has(e.comparison.family)&&Ne.has(e.variable.kind)}function je(e,s){const i=e.map(l=>l.facts);if(!i.length||i.some(l=>!l))return{coincident:new Set,yieldSoftBin:void 0,passBins:[],sectorCount:s};const[r,...t]=i,d=t.every(l=>l.passBins.length===r.passBins.length&&l.passBins.every(c=>r.passBins.includes(c)));return{coincident:new Set([...r.coincident].filter(l=>t.every(c=>c.coincident.has(l)))),yieldSoftBin:t.every(l=>l.yieldSoftBin===r.yieldSoftBin)?r.yieldSoftBin:void 0,passBins:d?r.passBins:[],sectorCount:s}}function V(e,s){let i=0,r=0,t=0,d=0,l=0,c=0,m=0,h=0,o=0,f=!0,u=0;for(const{waferIndex:v,c:n}of e){const g=s(v,n),a=n.rate??n.mean,p=Math.sqrt(a.n+g.n);if(n.rate)i+=p*Z(n.rate.hits,n.rate.n,g.hits,g.n),t+=n.rate.hits,d+=n.rate.n,l+=g.hits,c+=g.n;else{const b=J(n.mean,g.n,g.sum,g.sq);i+=p*b.z,m+=n.mean.n*b.effectSize,h+=n.mean.n*b.delta,u+=n.mean.n,n.relativeDelta===void 0?f=!1:o+=n.mean.n*n.relativeDelta}r+=p*p}const y=r>0?i/Math.sqrt(r):0,w=e[0].c;if(w.rate){const v=l/c,n=t/d-v;return{z:y,delta:n,relativeDelta:v===0?void 0:n/v,size:he({hits:t,n:d,restHits:l,restN:c,passRate:w.rate.passRate})}}return{z:y,delta:h/u,relativeDelta:f?o/u:void 0,size:m/u}}function _(e,s,i,r){return e.rate?ye(s,i.delta,i.size,r):s<=r.significanceLevel&&Math.abs(i.size)>=r.minimumEffectSize}function Y(e,s){return s<e?` with positions, ${e-s} without`:""}function Ve(e,s,i,r,t){const d=new Map;for(const{waferIndex:n,byKey:g}of e)for(const a of g.values())(d.get(a.key)??d.set(a.key,[]).get(a.key)).push({waferIndex:n,c:a});const l=new Map(e.map(n=>[n.waferIndex,n.byKey])),c=(n,g)=>g.rate?{hits:g.rate.restHits,n:g.rate.restN,sum:0,sq:0}:{hits:0,n:g.mean.restN,sum:g.mean.restSum,sq:g.mean.restSq},m=[];for(const[n,g]of d){if(g.length<A)continue;const a=V(g,c);if(a.z===0)continue;const p=g[0].c;m.push({key:n,entries:g,combined:a,finding:{id:`lot-region:${n}`,level:"lot",severity:"info",variable:{...p.variable,label:p.label},comparison:{...p.comparison},effect:{direction:a.z>0?"higher":"lower",absoluteDelta:a.delta,relativeDelta:a.relativeDelta,effectSize:p.rate?a.delta:a.size},stats:{method:"stouffer-z",pValue:q(a.z),sampleSizeLeft:0,sampleSizeRight:0},summary:"",highlight:{kind:"wafer",waferIndices:[]}}})}me(m.map(n=>n.finding));const h=m.filter(n=>_(n.entries[0].c,n.finding.stats.adjustedPValue??1,n.combined,s)),u=Be(h,n=>{const g=n.entries[0].c;return[g.source,g.variable.kind,g.variable.bin??"",g.variable.index??"",g.region.family].join("\0")},(n,g)=>{const a=(M,B)=>{const k=c(M,B);for(const z of g){const R=l.get(M)?.get(z.key);R&&(R.rate?(k.hits-=R.rate.hits,k.n-=R.rate.n):(k.n-=R.mean.n,k.sum-=R.mean.sum,k.sq-=R.mean.sq))}return k},p=n.entries.filter(M=>a(M.waferIndex,M.c).n>=s.minimumSampleSize);if(!p.length)return"baseline-too-small";const b=V(p,a),x=n.finding.stats.pValue??1,P=x>0?(n.finding.stats.adjustedPValue??x)/x:1,S=Math.min(1,q(b.z)*P);return{pValue:S,passes:Math.sign(b.z)===Math.sign(n.combined.z)&&_(n.entries[0].c,S,b,s)}},n=>{const g=n.entries[0].c.rate;return g!==void 0&&(g.passRate?n.combined.z<0:n.combined.z>0)},m),y=[],w=new Map;for(const n of h){if(!u.has(n))continue;const g=n.finding.stats.pValue??1,a=Math.sign(n.combined.z),p=n.entries.filter(z=>Math.sign(z.c.delta)===a),b=t,x=n.entries[0].c,P=n.finding.stats.adjustedPValue??g,S=x.rate?ee(P,n.combined.delta,n.combined.size):te(P,n.combined.size),M=j(S,p.length/b>=.6?"unusual":"info"),B={};for(const z of p)B[z.waferIndex]=[...z.c.region.dieKeys];const k={...n.finding,severity:M,stats:{...n.finding.stats,sampleSizeLeft:p.length,sampleSizeRight:b-p.length},summary:`${X(x,n.combined.delta,n.combined.relativeDelta)} \u2014 ${n.finding.effect.direction} on ${p.length}/${b} wafers${Y(e.length,b)}, all wafers' data combined`,highlight:{kind:"wafer",waferIndices:p.map(z=>z.waferIndex),dieKeysByWafer:B}};y.push(k),w.set(k,n)}const v=_e(w,l,t,e.length,s,r,c);return y.splice(0,y.length,...y.filter(n=>!v.replaced.has(n)),...v.findings),we(y,i),y}function _e(e,s,i,r,t,d,l){const c=new Map;for(const[o,f]of e){const u=f.entries[0].c;if(!Ae.has(u.region.family))continue;const y=[u.source,u.variable.kind,u.variable.bin??"",u.variable.index??"",u.region.family,o.effect.direction].join("|");(c.get(y)??c.set(y,[]).get(y)).push({finding:o,c:u,key:f.key})}const m=[],h=new Set;for(const o of c.values()){if(o.length<2)continue;const f=o[0].c.region.family;for(const u of be(o,f,t.sectorCount,y=>y.c.region.key)){if(u.length<2)continue;const y=Ye(u,s,i,r,t,d,l);if(y){m.push(y);for(const w of u)h.add(w.finding)}}}return{findings:m,replaced:h}}function Ye(e,s,i,r,t,d,l){const c=e[0].c,m=e[0].finding.effect.direction==="higher"?1:-1,h=Se(c.region.family,e.map(S=>S.c.region.key),d),o=[];for(const[S,M]of s){const B=e.map(I=>M.get(I.key));if(B.some(I=>!I))continue;const k=B,z=k[0];let R,F;if(z.rate){const I=k.reduce((D,W)=>D+W.rate.hits,0),$=k.reduce((D,W)=>D+W.rate.n,0),K=z.rate.hits+z.rate.restHits-I,L=z.rate.n+z.rate.restN-$;if($<t.minimumSampleSize||L<t.minimumSampleSize)continue;R={...z,rate:{hits:I,n:$,restHits:K,restN:L,passRate:z.rate.passRate}},F=Z(I,$,K,L)}else{const I=z.mean,$=k.reduce((E,T)=>E+T.mean.n,0),K=k.reduce((E,T)=>E+T.mean.sum,0),L=k.reduce((E,T)=>E+T.mean.sq,0),D=I.n+I.restN-$,W=I.sum+I.restSum-K,C=I.sq+I.restSq-L;if($<t.minimumSampleSize||D<t.minimumSampleSize)continue;const G={n:$,sum:K,sq:L,restN:D,restSum:W,restSq:C,shift:I.shift},H=J(G,D,W,C),U=W/D+I.shift;R={...z,mean:G,relativeDelta:U!==0?H.delta/Math.abs(U):void 0},F=H.z}const ce=[...new Set(k.flatMap(I=>[...I.region.dieKeys]))];o.push({waferIndex:S,c:R,z:F,dieKeys:ce})}if(o.length<A)return;const f=V(o,l);if(f.z===0||Math.sign(f.z)!==m)return;const u=q(f.z),y=We(e.map(S=>S.finding)),w=Math.min(1,u*y);if(!_(c,w,f,t))return;const v=o.filter(S=>Math.sign(S.z)===m&&q(S.z)<=t.significanceLevel);if(!v.length)return;const n=c.rate?ee(w,f.delta,f.size):te(w,f.size),g=j(n,v.length/i>=.6?"unusual":"info"),a={};for(const S of v)a[S.waferIndex]=S.dieKeys;const p=e.map(S=>S.c.region.key.slice(S.c.region.key.indexOf(":")+1)).join("-"),b={...c,comparison:{...c.comparison,left:h}},x=e[0].finding,P=x.effect.direction;return{...x,id:`lot-region:${e[0].key.split("|").slice(0,-1).join("|")}|${c.region.family}:${p}`,severity:g,comparison:{...x.comparison,left:h},effect:{direction:P,absoluteDelta:f.delta,relativeDelta:f.relativeDelta,effectSize:c.rate?f.delta:f.size},stats:{method:"stouffer-z",pValue:u,adjustedPValue:w,sampleSizeLeft:v.length,sampleSizeRight:i-v.length},summary:`${X(b,f.delta,f.relativeDelta)} \u2014 ${P} on ${v.length}/${i} wafers${Y(r,i)}, all wafers' data combined`,highlight:{kind:"wafer",waferIndices:v.map(S=>S.waferIndex),dieKeysByWafer:a},relatedIds:e.map(S=>S.finding.id)}}const ae={"Edge-ring":"edge","Edge-local":"edge","Center cluster":"centre or donut",Donut:"centre or donut"};function Ce(e,s){const i=new Map,r=l=>{const c=l.variable.kind==="spatialPattern"?ae[l.comparison.left]:void 0;return c?`spatialPattern|${c}`:Re(l)};for(const l of e){const c=new Set,m=new Map;for(const o of l.summary.findings)if(o.variable.kind==="spatialPattern")for(const f of o.relatedIds??[])m.set(f,r(o));const h=new Set(l.summary.findings.flatMap(o=>o.absorbedIds??[]));for(const o of l.summary.findings){if(h.has(o.id)||Oe(o)||o.variable.kind==="spatialPattern"&&s?.carriers.has(l.waferIndex))continue;const f=r(o);if(c.has(f))continue;c.add(f);const u=i.get(f)??{finding:o,waferIndices:[],severity:o.severity,labels:new Map,dieKeysByWafer:{},explainedBy:new Map};u.waferIndices.push(l.waferIndex);const y=m.get(o.id);if(y&&u.explainedBy.set(y,(u.explainedBy.get(y)??0)+1),o.variable.kind==="spatialPattern"){u.labels.set(o.comparison.left,(u.labels.get(o.comparison.left)??0)+1);const w=o.highlight.dieKeys;w&&(u.dieKeysByWafer[l.waferIndex]=w)}u.severity=j(u.severity,o.severity),i.set(f,u)}}const t=[];for(const[l,c]of i){if(c.waferIndices.length<A)continue;const m=c.waferIndices.length/Math.max(1,e.length),h=m>=.6||c.severity==="unusual"?"unusual":"notable",o=c.finding;t.push({id:`lot-repeat:${l}`,level:"lot",severity:h,variable:{...o.variable},comparison:{...o.comparison},effect:{direction:o.effect.direction,absoluteDelta:o.effect.absoluteDelta,relativeDelta:o.effect.relativeDelta,effectSize:o.effect.effectSize},stats:{method:"wafer-finding-frequency",sampleSizeLeft:c.waferIndices.length,sampleSizeRight:e.length-c.waferIndices.length},summary:`${Ue(o,c.labels)} \u2014 seen on ${c.waferIndices.length}/${e.length} wafers (${Math.round(m*100)}%)`,highlight:{kind:"wafer",waferIndices:c.waferIndices,...c.labels.size?{dieKeysByWafer:c.dieKeysByWafer}:{}}})}const d=new Map(t.map(l=>[l.id,l]));for(const[l,c]of i){const m=d.get(`lot-repeat:${l}`);if(m)for(const[h,o]of c.explainedBy){const f=d.get(`lot-repeat:${h}`);!f||o!==c.waferIndices.length||(f.relatedIds??=[]).push(m.id)}}return t}function Ge(e,s,i){const{classification:r,carriers:t}=e,d=Le[r.pattern],l=t.size/Math.max(1,s),c={};for(const[m,h]of t)c[m]=h;return{id:"lot-repeat:spatialPattern|lot",level:"lot",severity:l>=.6||r.confidence==="high"?"unusual":"notable",variable:{kind:"spatialPattern",label:d},comparison:{family:"spatial-pattern",left:d,right:"Wafer"},effect:{direction:"different",effectSize:r.features.globalRdd},stats:{method:"wafer-finding-frequency",sampleSizeLeft:t.size,sampleSizeRight:s-t.size},summary:`Spatial pattern: ${d.toLowerCase()} \u2014 seen on ${t.size}/${s} wafers${Y(i,s)} (${Math.round(l*100)}%)`,highlight:{kind:"wafer",waferIndices:[...t.keys()].sort((m,h)=>m-h),dieKeysByWafer:c}}}function He(e){const s=/^Rings? (\d+)(?:\s*[–-]\s*(\d+))?/.exec(e.comparison.left);if(!s)return[];const i=+s[1],r=s[2]?+s[2]:i;return Array.from({length:Math.max(0,r-i+1)},(t,d)=>i+d)}function Ue(e,s){if(!s.size)return e.summary;const i=d=>d.toLowerCase();if(s.size===1)return`Spatial pattern: ${i([...s.keys()][0])}`;const r=ae[e.comparison.left],t=[...s].sort((d,l)=>l[1]-d[1]).map(([d,l])=>`${i(d)} on ${l}`);return`Spatial pattern: ${r} (${t.join(", ")})`}function Qe(e,s){const i=Ee(s,"median"),r=e.map(m=>({waferIndex:m.waferIndex,yieldPercent:m.summary.stats.yieldPercent})).filter(m=>m.yieldPercent!==null),t=r.map(m=>m.yieldPercent),d=outlierWafers(t);if(!d)return[];const l=ie(t),c=[];for(const{index:m,severity:h,statistic:o}of d.outliers){const f=r[m],u=f.yieldPercent-l,y=le({wafer:{metadata:e.find(w=>w.waferIndex===f.waferIndex)?.summary.wafer}},f.waferIndex);c.push({id:`inter-wafer:yield:${f.waferIndex}`,level:"inter-wafer",severity:h,variable:{kind:"yield",label:"Yield"},comparison:{family:"wafer",left:y,right:i.charAt(0).toUpperCase()+i.slice(1)},effect:{direction:u>0?"higher":"lower",absoluteDelta:u/100,relativeDelta:l===0?void 0:u/l,effectSize:o},stats:{method:d.method,sampleSizeLeft:1,sampleSizeRight:r.length-1},summary:`${y} yield is ${Math.abs(u).toFixed(1)} percentage points ${u>0?"higher":"lower"} than the ${i}`,highlight:{kind:"wafer",waferIndices:[f.waferIndex]}})}return c}function re(e,s){if((s.enableTestValueAnalysis??"auto")!=="auto")return;let i=0;for(const r of e){const{tests:t,dies:d}=pe(r,s);i+=t*d}return ve(i)}export function analyzeWaferLot(e,s={}){const i=e.map(ne),r=re(i,s),t=i.map((a,p)=>({waferIndex:p,summary:s.perWaferSummaries?.[p]??N(a,s,r)})),d=t.map(({waferIndex:a,summary:p})=>Q(p)??Q(N(i[a],s,r))),l=d.map((a,p)=>({waferIndex:p,byKey:new Map(a.candidates.map(b=>[b.key,b]))})),c=ue(s).resolved,m=i.filter(a=>a.dies.some(de)).length,h=i.length>0?fe(i[0],"analyzeWaferLot"):void 0,o=Me(i,c),f=o&&o.carriers.size>=A?o:null,u=[...h===void 0?[]:Ve(l,c,je(d,c.sectorCount),h,m),...Ce(t,f),...Qe(t,Ke(t.map(a=>a.summary.wafer))),...$e(t,c.significanceLevel)];if(f&&h!==void 0){const a=Ge(f,m,t.length);a.relatedIds=De([f.classification.pattern],a.severity,u,He,h),a.relatedIds.length||delete a.relatedIds,u.push(a)}u.sort((a,p)=>{const b=a.severity==="unusual"?2:a.severity==="notable"?1:0,x=p.severity==="unusual"?2:p.severity==="notable"?1:0;return b!==x?x-b:a.summary.localeCompare(p.summary,"en")});const y=t.map(a=>a.summary.wafer).filter(a=>!!a),w={},v=[];if(y.length>0){const a=new Set;for(const p of y)for(const b of Object.keys(p))a.add(b);a.delete("wafer"),a.delete("waferId");for(const p of a){const b=y.filter(P=>p in P).map(P=>P[p]);b.every(P=>P===b[0])?w[p]=b[0]:v.push(p)}}const n=t.map(({waferIndex:a,summary:p})=>({waferIndex:a,yieldPercent:p.stats.yieldPercent})),g=t.map(({waferIndex:a,summary:p})=>p.stats.perTestStats?.length?{waferIndex:a,tests:p.stats.perTestStats}:null).filter(a=>a!==null);return{level:"lot",hasNotableFindings:u.some(a=>a.severity!=="info")||t.some(a=>a.summary.hasNotableFindings),findings:u,lot:Object.keys(w).length>0?w:void 0,...v.length>0?{mixedIdentityFields:v}:{},analysisOptions:ge(s),stats:{waferCount:e.length,...Xe(i,t.map(a=>a.summary)),...Ze(ze(t.map(a=>a.summary)))},lotYieldSeries:n,perWafer:t,...g.length>0?{perWaferTestStats:g}:{}}}function Xe(e,s){const i={...xe(s)},r=Ie(s,Pe(e).defs);r&&(i.capability=r);const t=ke(s,e.map(d=>d.ringCount));return t&&(i.regionYield=t),i}const Ze=e=>e?{testValueAnalysis:e}:{},oe=()=>new Promise(e=>setTimeout(e,0));export async function analyzeWaferLotAsync(e,s={}){const{onProgress:i,signal:r,...t}=s,d=e.map(ne),l=re(d,t),c=[];let m=Date.now();for(let h=0;h<d.length;h++)r?.throwIfAborted(),c.push(t.perWaferSummaries?.[h]??N(d[h],t,l)),i?.(h+1,d.length),Date.now()-m>100&&(await oe(),m=Date.now());return await oe(),r?.throwIfAborted(),analyzeWaferLot(d,{...t,perWaferSummaries:c})}export function remapLotWaferIndices(e,s){const i=r=>s[r]??r;return{...e,perWafer:e.perWafer.map(r=>({...r,waferIndex:i(r.waferIndex)})),lotYieldSeries:e.lotYieldSeries.map(r=>({...r,waferIndex:i(r.waferIndex)})),...e.perWaferTestStats?{perWaferTestStats:e.perWaferTestStats.map(r=>({...r,waferIndex:i(r.waferIndex)}))}:{},findings:e.findings.map(r=>{const t=r.highlight;if(!t||t.kind!=="wafer")return r;const d=t.dieKeysByWafer?Object.fromEntries(Object.entries(t.dieKeysByWafer).map(([l,c])=>[i(Number(l)),c])):void 0;return{...r,highlight:{...t,waferIndices:t.waferIndices.map(i),...d?{dieKeysByWafer:d}:{}}}})}}
|