@wafertools/wafermap 0.39.0 → 0.40.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +24 -3
  2. package/README.md +2 -2
  3. package/dist/packages/canvas-adapter/charts/commonality.js +4 -1
  4. package/dist/packages/canvas-adapter/charts/plotChart.d.ts +5 -0
  5. package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
  6. package/dist/packages/canvas-adapter/charts/regionYieldDiagram.js +1 -1
  7. package/dist/packages/canvas-adapter/charts/sweep.js +1 -1
  8. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  9. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  10. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  11. package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
  12. package/dist/packages/canvas-adapter/sweepEditor.js +1 -1
  13. package/dist/packages/canvas-adapter/toCanvas.d.ts +1 -0
  14. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  15. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  16. package/dist/packages/canvas-adapter/userGuideHtml.js +44 -28
  17. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  18. package/dist/packages/canvas-adapter/version.js +1 -1
  19. package/dist/packages/core/compact.js +2 -2
  20. package/dist/packages/core/dieTable.js +1 -1
  21. package/dist/packages/stats/commonality.d.ts +37 -4
  22. package/dist/packages/stats/commonality.js +1 -1
  23. package/dist/packages/stats/dieRegions.d.ts +2 -0
  24. package/dist/packages/stats/dieRegions.js +1 -1
  25. package/dist/packages/stats/examplePicks.d.ts +6 -0
  26. package/dist/packages/stats/examplePicks.js +1 -1
  27. package/dist/packages/stats/groupEffects.d.ts +66 -0
  28. package/dist/packages/stats/groupEffects.js +1 -0
  29. package/dist/packages/stats/plotData.js +1 -1
  30. package/dist/packages/stats/renderFindingsReport.js +1 -1
  31. package/dist/packages/stats/renderSummaryReport.js +7 -7
  32. package/dist/packages/stats/reportHtml.js +18 -13
  33. package/dist/packages/stats/sweep.d.ts +3 -3
  34. package/dist/packages/stats/sweepXFromName.js +1 -1
  35. package/dist/packages/stats/synthesis.d.ts +13 -0
  36. package/dist/packages/stats/synthesis.js +1 -1
  37. package/package.json +1 -1
@@ -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-31T09:06:32.439Z">v0.39.0</span></h1>
75
+ <h1 id="wmap-wafer-map-user-guide">Wafer Map \u2014 User Guide<span class="wmap-guide-version" title="Built 2026-11-06T15:52:39.996Z">v0.40.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
@@ -163,7 +163,7 @@ results with no X/Y coordinates at all, for some or every die on a wafer.</p>
163
163
  fabricated positions would risk being misread as real spatial layout. Instead the card shows a
164
164
  compact summary matching the active plot mode: a <strong>bin breakdown</strong> (coloured the same as a
165
165
  positioned card&#39;s own bin legend) for hard/soft-bin modes, or a <strong>histogram</strong> for value mode \u2014
166
- coloured through the same colour scheme, log-scale, and spec/data-range settings the map itself
166
+ coloured through the same colour scheme, log-scale, and limit/data-range settings the map itself
167
167
  uses, so switching those in the toolbar updates the chart the same way it would a real map. A
168
168
  <strong>View die list</strong> toggle switches to the full per-die table (position/site, hard bin, soft bin,
169
169
  every test value) with its own CSV export; <strong>View chart</strong> switches back.</p>
@@ -415,10 +415,11 @@ highlighting one bin at a time.</p>
415
415
  <p>Use the <strong>Overlays</strong> menu to toggle optional display layers on and off:</p>
416
416
  <ul>
417
417
  <li><strong>Axis labels</strong> \u2014 the die coordinates along the bottom and left edges. They appear when you zoom; this row shows
418
- them all the time, or hides them. <strong>Clear overlays</strong> returns to showing them on zoom</li>
419
- <li><strong>XY axis indicator</strong> \u2014 shows X and Y axis lines through the wafer centre</li>
418
+ them all the time, or hides them. <strong>Clear overlays</strong> returns to showing them on zoom. Labels run across the dies
419
+ and no further, and sit clear of the legend wherever it is placed</li>
420
+ <li><strong>XY axis indicator</strong> \u2014 arrows showing which way the X and Y die coordinates run</li>
420
421
  <li><strong>Ring boundaries</strong> \u2014 concentric ring divisions that match the spatial analysis zones</li>
421
- <li><strong>Quadrant lines</strong> \u2014 divides the wafer into N, S, E, W quadrants</li>
422
+ <li><strong>Quadrant lines</strong> \u2014 divides the wafer into NE, NW, SE and SW quadrants</li>
422
423
  <li><strong>Die coordinate labels</strong> \u2014 draws the (x, y) grid position inside each die (useful at high zoom)</li>
423
424
  <li><strong>Reticle grid</strong> \u2014 stepper field grid (only shown when reticle geometry is configured)</li>
424
425
  <li><strong>Limit pass/fail</strong> \u2014 pass/fail colouring for Test Value mode, judged against the test limits, when the active test defines them</li>
@@ -776,8 +777,8 @@ than measured dies.</li>
776
777
  <strong>Dies</strong>: the selected dies, or the whole wafer, as a table.</p>
777
778
  <hr>
778
779
  <h2 id="wmap-findings-panel">5. Findings panel</h2>
779
- <p>When spatial analysis has been run, the <strong>Findings</strong> panel lists statistically
780
- detected patterns on the wafer. Open it from the toolbar.</p>
780
+ <p>When spatial analysis has been run, the <strong>Findings</strong> section of the Summary panel lists statistically
781
+ detected patterns on the wafer. Open the panel with the toolbar&#39;s <strong>Summary</strong> button.</p>
781
782
  <p>Each finding shows:</p>
782
783
  <ul>
783
784
  <li><strong>Severity</strong> \u2014 Unusual, Notable, or Minor (ordered most to least significant)</li>
@@ -790,7 +791,7 @@ filter. Changing the selection or the legend filter yourself releases the findin
790
791
  <p><strong>Severity</strong> reflects how strong the statistical evidence is. <em>Unusual</em> findings
791
792
  have both a very low adjusted p-value and a large effect size \u2014 they are reliably
792
793
  important. <em>Notable</em> findings are statistically significant with a meaningful
793
- effect but not as extreme. <em>Info</em> findings pass the significance threshold at
794
+ effect but not as extreme. <em>Minor</em> findings pass the significance threshold at
794
795
  lower strength and are worth reviewing but may reflect smaller or noisier patterns.</p>
795
796
  <p><strong>Test-value findings</strong> (a region reading high or low on a test) take the longest to compute, so
796
797
  they are included automatically only when the data is small enough to take about a second. On
@@ -815,7 +816,7 @@ next to other failures (a spot touching a failing edge, say) is still reported a
815
816
  </tr>
816
817
  <tr>
817
818
  <td><strong>Quadrant</strong></td>
818
- <td>Yield or value difference between N, S, E, or W quadrants</td>
819
+ <td>Yield or value difference between NE, NW, SE or SW quadrants</td>
819
820
  </tr>
820
821
  <tr>
821
822
  <td><strong>Sector</strong></td>
@@ -887,7 +888,7 @@ field Group by offers (a process split, a lot, a test program). A group is judge
887
888
  one value, the way Insights compares groups, adjusted over every field and test compared, and its size
888
889
  is the shift in the test&#39;s within-wafer standard deviations, the scale a region&#39;s shift is measured on.
889
890
  A field is one item however many tests it moves (&quot;34 tests differ by Split. Largest: \u2026; next: \u2026&quot;), with the tests
890
- that moved most as its chips, so a corner lot does not fill the list with one split. Its chart is a grid of the field&#39;s values by those tests, in z-scores (and a card that shows a bar per wafer draws the wafers under their group, in the group&#39;s colour, when Group by is on): blue where a group sits below the lot&#39;s average on a test, red where it sits above, so a process corner reads as a pattern of cells. Both are ranked on one scale, the share of the dies an item
891
+ that moved most as its chips, so a corner lot does not fill the list with one split. The same comparison is made on the wafers&#39; yield and on the pass rate of the lot&#39;s weakest ring (&quot;Yield is 4.7 points lower on probe card PC-B than on PC-A&quot;); each set of groups is read after allowing for the strongest other one, and says so, and fields that group the wafers identically are one item that names them together. Groups that differ on two or more measures with no overlap but that the sample is too small to confirm are listed apart, under <em>Possible, not confirmed</em>. Its chart is a grid of the field&#39;s values by those tests, in z-scores (and a card that shows a bar per wafer draws the wafers under their group, in the group&#39;s colour, when Group by is on): blue where a group sits below the lot&#39;s average on a test, red where it sits above, so a process corner reads as a pattern of cells. Both are ranked on one scale, the share of the dies an item
891
892
  affects: a loss by the dies it cost; a shift by its dies, counted in full from two standard deviations
892
893
  and by the square of its size below that (a one-sigma shift counts a quarter of its dies); a trend by
893
894
  how far it moved; a group&#39;s shift by the dies of the wafers that moved, weighted as a shift is; a Ppk under 1.0 by
@@ -1054,10 +1055,9 @@ bin 1 (Pass) or bin 2 (Fail) at that location.</em></p>
1054
1055
  <h2 id="wmap-insights-tab">8. Insights tab</h2>
1055
1056
  <p>The <strong>Insights</strong> side of the <strong>Maps | Insights</strong> switch (at the far right of the toolbar row, single map or
1056
1057
  gallery) swaps the wafer view for a chart suite computed from the same die data \u2014 without leaving the
1057
- toolbar. Choose <strong>Maps</strong> to return to the map; the switch stays where it is. Independent of the Findings
1058
- sidebar (see <a href="#wmap-summary-panel" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'wmap-summary-panel\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Summary panel</a>) \u2014 the two toggle independently, and opening one never
1059
- hides the other&#39;s toolbar button, since Findings has nothing to highlight
1060
- against once the map is replaced.</p>
1058
+ toolbar. Choose <strong>Maps</strong> to return to the map; the switch stays where it is. While Insights is open the
1059
+ buttons that act on the map, the <strong>Summary</strong> button among them, are hidden, since there is no map for the
1060
+ <a href="#wmap-summary-panel" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'wmap-summary-panel\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Summary panel</a> to highlight; <strong>Maps</strong> brings them back.</p>
1061
1061
  <p>The <a href="https://wafertools.github.io/wafermap/charts/">Chart reference</a> describes every chart, plot and table: what it
1062
1062
  shows, how to read it, when to reach for it and where to find it. This section covers how the tab works.</p>
1063
1063
  <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
@@ -1077,7 +1077,7 @@ own charts and sweeps (see <em>Plots</em> and <em>Sweep cards</em> below):</p>
1077
1077
  <a href="https://wafertools.github.io/wafermap/charts/#reticle-cell-yield">Reticle cell yield</a>. With four or more wafers and wafer fields to compare, <a href="https://wafertools.github.io/wafermap/charts/#what-divides-yield">What divides yield</a>
1078
1078
  ranks the fields by how clearly their groups differ; <strong>Group by</strong> on its row groups the whole tab by that field. With
1079
1079
  Group by on, the yield bar and the pareto draw a bar per group (click a group&#39;s bar to see its wafers, <strong>Back</strong> to return). The
1080
- pass-rate card offers up to three ways of judging, whichever the data supports: <strong>Spec limits</strong>, <strong>Tester flag</strong> and
1080
+ pass-rate card offers up to three ways of judging, whichever the data supports: <strong>Test limits</strong>, <strong>Tester flag</strong> and
1081
1081
  <strong>Functional</strong>; when the first two disagree it says how many dies they judged differently. The card is the size of the
1082
1082
  others whatever the number of tests: more than fit scroll. With nothing to judge it is left out.</p>
1083
1083
  </li>
@@ -1172,7 +1172,7 @@ positive, blue = negative; intensity = strength) and a die-level scatter
1172
1172
  plot coloured by hard bin. Clicking a matrix cell drives the scatter plot
1173
1173
  onto that pair.</em></p>
1174
1174
  <h3 id="wmap-what-a-click-does">What a click does</h3>
1175
- <p>Every mark on an Insights chart stands for something, and a click opens it:</p>
1175
+ <p>Every mark on an Insights chart stands for something, and a click opens it. A <strong>right-click</strong> on any mark opens the menu on what it counts, so on a mark that stands for dies a click and a right-click do the same; on a wafer&#39;s own mark, a click opens the wafer&#39;s map and a right-click its menu. The tooltip says which.</p>
1176
1176
  <table>
1177
1177
  <thead>
1178
1178
  <tr>
@@ -1209,6 +1209,14 @@ onto that pair.</em></p>
1209
1209
  <td>the menu on the dies it counts</td>
1210
1210
  </tr>
1211
1211
  <tr>
1212
+ <td>A cell of a <strong>heatmap</strong> (yield by ring or quadrant and wafer, re-probed dies, tests by wafer), or a bar of <strong>Yield by site</strong></td>
1213
+ <td>the menu on the dies the cell or bar counts (on every die of the wafer, for a cell of tests by wafer)</td>
1214
+ </tr>
1215
+ <tr>
1216
+ <td>The chart on a <strong>Worth a look</strong> card</td>
1217
+ <td>as the same chart anywhere else in Insights</td>
1218
+ </tr>
1219
+ <tr>
1212
1220
  <td>A cell of the correlation matrix</td>
1213
1221
  <td>that pair in the scatter</td>
1214
1222
  </tr>
@@ -1227,7 +1235,7 @@ onto that pair.</em></p>
1227
1235
  </tbody></table>
1228
1236
  <p>The menu offers the charts and tables for just those dies (and your own plots), and its heading names
1229
1237
  them, for example &quot;412 dies in hard bin 3, across 13 wafers&quot;. A mark that has no dies behind it does nothing.
1230
- Right-click on any wafer&#39;s bar, box or point opens the same menu for the whole wafer.</p>
1238
+ Right-click on any wafer&#39;s bar, box or point opens the same menu for the whole wafer. The exceptions only move within Insights and have no menu: a test in the process-capability chart and a cell of the correlation matrix.</p>
1231
1239
  <h3 id="wmap-data-tables">Data tables</h3>
1232
1240
  <p>The <strong>Data</strong> sub-tab shows the wafers Insights is scoped to as tables, one at a
1233
1241
  time, chosen with the <strong>Statistics | Wafers | Dies</strong> control. It follows the
@@ -1273,9 +1281,9 @@ copy of the chart. <strong>Edit as plot</strong>, in the \u22EF menu of an Insig
1273
1281
  <em>A chart&#39;s buttons</em> below). The <strong>My plots | Examples</strong> switch above the list shows one or the other, never both: <strong>Examples</strong> shows plots to start from, or to see what each chart and
1274
1282
  setting is for, each marked as an example; none is saved until you add it. They are chosen from the lot in view: the <em>lead</em> test is the one that varies most from wafer to
1275
1283
  wafer (for a single wafer, the one that follows distance from the centre most), its partner the test that tracks it
1276
- best, and the split is the lot field that best explains the lead test. The examples are a scatter of the lead
1284
+ best, and the split is the lot field that best explains the lead test. Each other lot field that divides the wafers&#39; yield (a probe card, a tester) gets a bar of yield by its groups too; fields that group the wafers identically, such as a tester and the handler docked to it, each get one, so you can follow either. The examples are a scatter of the lead
1277
1285
  test against its partner with a fitted line, a histogram with its
1278
- normal curve, a box of the lead test by wafer, a bar of yield by the split, a line over wafer order with a \xB11 SD band, and a probability plot. It shows one of each newer
1286
+ normal curve, a box of the lead test by wafer, a bar of yield by the split, a line over wafer order with a \xB11 SD band, and a probability plot. The examples also show one of each newer
1279
1287
  feature the lot can show: the most telling tests as one set rescaled to z-scores (a box per test, and a heatmap of
1280
1288
  tests by wafer), the lead test by split and by wafer nested in split, panels by ring, the lead test by ranges of its
1281
1289
  partner and of the distance from the centre, a pareto of the hard bins and each wafer&#39;s bin mix, the
@@ -1337,6 +1345,11 @@ button, and the plot is kept as you go.</p>
1337
1345
  <td>every test with both limits as a point: how far off centre and how wide</td>
1338
1346
  <td>the tests (all by default)</td>
1339
1347
  </tr>
1348
+ <tr>
1349
+ <td><strong>Sweep</strong></td>
1350
+ <td>a run of tests read as one response curve, and the pair of curves measured against each other (see <a href="#wmap-sweep-cards" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'wmap-sweep-cards\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Sweep cards</a>)</td>
1351
+ <td>the series of tests and where each one&#39;s X comes from</td>
1352
+ </tr>
1340
1353
  </tbody></table>
1341
1354
  <ul>
1342
1355
  <li><strong>X axis</strong> and <strong>Y axis</strong> (a histogram has one <strong>Values</strong> field; a box or bar has
@@ -1586,8 +1599,7 @@ questions:</p>
1586
1599
  <p><strong>Plots in the right-click menu.</strong> Every saved plot is also a row in the menu that
1587
1600
  opens on a selection or a wafer (<strong>Plots</strong> section), drawn over just those dies and
1588
1601
  captioned with them.</p>
1589
- <p><img src="images/guide-plot-drilldown.png" alt="The right-click menu on a selection, with the Plots section"> <strong>New plot\u2026</strong> and <strong>New sweep\u2026</strong> in the same menu start a draft on the selection;
1590
- a draft is kept only if you press <strong>Add to my plots</strong>.</p>
1602
+ <p>.</p>
1591
1603
  <p>Every change is kept as you make it. If you make a mistake, <strong>Reset</strong> (under the settings) puts the plot back as it was
1592
1604
  when you opened the editor, and <strong>Cancel</strong> does the same and closes it. Closing the window with its own button keeps what
1593
1605
  you changed.</p>
@@ -1629,7 +1641,7 @@ test numbers and ranges, such as <code>1010, 1011, 1020..1030</code> (a range me
1629
1641
  tests declared between its ends). Then choose where each test&#39;s X comes from:
1630
1642
  <strong>Test order</strong> (the position in the run, labelled by test), <strong>Values</strong> (one
1631
1643
  number per test, in the same order) or <strong>From test name</strong> (a pattern such as
1632
- <code>LRS_STATS_{x}</code>, for programs that record the swept value only in the test
1644
+ <code>LEVEL_{x}</code>, for programs that record the swept value only in the test
1633
1645
  text). The editor lists the first few test names with what your pattern reads
1634
1646
  from each as you type, and <strong>Pattern examples</strong> shows worked ones: <code>@ {x}</code>
1635
1647
  reads 0.55 from <code>Fmax @ 0.55 V</code>, and <code>-{x}</code> reads 5 from <code>1234-5</code>). Text that is not a test number or a range is flagged under the box,
@@ -1713,7 +1725,7 @@ exposure field from the lithography stepper \u2014 the group of dies exposed in
1713
1725
  single step. This lets you correlate failure patterns with specific reticle
1714
1726
  positions \u2014 useful for identifying stepper field signatures, alignment drift, or
1715
1727
  mask defects.</p>
1716
- <div data-wmap-demo="reticle" class="wmap-demo"></div><p>Reticle-position findings in the Findings panel highlight the specific field
1728
+ <div data-wmap-demo="reticle" class="wmap-demo"></div><p>Reticle-position findings in the Summary panel&#39;s Findings section highlight the specific field
1717
1729
  positions that show elevated failure rates. Hovering any die also shows its
1718
1730
  <strong>Reticle (column, row)</strong> position \u2014 its location within its own stepper
1719
1731
  field \u2014 just below the die&#39;s coordinate in the tooltip.</p>
@@ -1750,10 +1762,14 @@ symmetric; the rank p is the check. Nothing here says <em>why</em> groups differ
1750
1762
  </ul>
1751
1763
  <h3 id="wmap-what-divides-yield">10.3 What divides yield</h3>
1752
1764
  <p>The <strong>What divides yield</strong> card makes the comparison <a href="#wmap-comparing-groups-of-wafers" onclick="(function(e){e.preventDefault();var g=e.target.closest('.wmap-guide');var el=g&&g.querySelector('[id=\\'wmap-comparing-groups-of-wafers\\']');if(el)el.scrollIntoView({behavior:'smooth'});})(event)">Comparing groups of wafers</a> describes for every wafer field at once, for yield and for each of the five most
1753
- common fail bins (a bin&#39;s value is its share of a wafer&#39;s judged dies). Rows are ranked by q, so the fields at the top
1754
- separate the wafers more clearly than wafer-to-wafer noise would. The <strong>Group by</strong> button regroups every chart by that
1755
- field. Two limits are stated on the card itself: a field that gives every wafer its own value cannot be tested, and
1756
- two fields that change together (a lot and its start date) cannot be told apart by the wafers. A low q points to where
1765
+ common fail bins (a bin&#39;s value is its share of a wafer&#39;s judged dies). It has one row per field, showing its yield,
1766
+ or a fail bin when that differs more clearly. The <strong>Effect</strong> column draws the worst and the best group as two bars on a
1767
+ scale of 0 to 100%, each with its mean, with a sentence giving the gap in percentage points; hover a bar for the group&#39;s median,
1768
+ spread and wafer count. <strong>Confidence</strong> is <strong>Clear</strong> (q under 0.05),
1769
+ <strong>Possible</strong> (under 0.2) or <strong>Not clear</strong>, so the fields at the top separate the wafers more clearly than wafer-to-wafer
1770
+ noise would; hover it for q, Welch&#39;s p and the rank p. A button on a field opens its other measures. The <strong>Group by</strong>
1771
+ button regroups every chart by that field. Each field is read after allowing for the strongest other field that explains the same measure (and does not contain it): a probe card on wafers that also differ by recipe is ranked by what the recipe leaves, and its row says &quot;allowing for&quot; that field, with the degrees of freedom the removed means used charged to the p. Two limits are stated on the card itself: a field that gives every wafer its own value cannot be tested, and
1772
+ fields that change together (a lot and its start date, or a tester and the handler docked to it) cannot be told apart by the wafers; the card names each set of them, and names fields that nearly match (most wafers in matching groups) with how many wafers agree. A low q points to where
1757
1773
  to look; it is not a cause. Tool, chamber and probe-card fields appear only when the host supplies them as wafer
1758
1774
  attributes.</p>
1759
1775
  <h3 id="wmap-the-cumulative-probability-plot">10.4 The cumulative probability plot</h3>
@@ -1861,7 +1877,7 @@ wafers; it does not change their limits, and it sees the body of the distributio
1861
1877
  outlier analysis, and lists tests that shall use PAT limits at test (pin leakage, standby supply current, IDDQ, output
1862
1878
  levels, propagation delays and others, in its Appendix 2). Nothing here checks a test&#39;s distribution or matches tests
1863
1879
  to that list.</li>
1864
- <li><strong>A floor of 30 passing values per wafer.</strong> That floor is ours. The guideline&#39;s 1.35 is inexact for under 20 values,
1880
+ <li><strong>A floor of 30 passing values per wafer.</strong> That floor is this library&#39;s own choice. The guideline&#39;s 1.35 is inexact for under 20 values,
1865
1881
  and sets sample sizes only for static limits.</li>
1866
1882
  <li><strong>Quartiles</strong> are found by interpolation between the ranked values, which the guideline does not specify.</li>
1867
1883
  </ul>
@@ -1,3 +1,3 @@
1
- export declare const WMAP_VERSION = "0.39.0";
2
- export declare const WMAP_BUILD_TIME = "2026-11-01T07:39:49.203Z";
1
+ export declare const WMAP_VERSION = "0.40.0";
2
+ export declare const WMAP_BUILD_TIME = "2026-11-06T15:57:00.349Z";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- export const WMAP_VERSION="0.39.0",WMAP_BUILD_TIME="2026-11-01T07:39:49.203Z";
1
+ export const WMAP_VERSION="0.40.0",WMAP_BUILD_TIME="2026-11-06T15:57:00.349Z";
@@ -1,3 +1,3 @@
1
- import{hasPosition as a}from"./dies.js";const h={minRepeats:3,minScore:.75,maxDensity:.8};function w(t,e){const s=t.length-e;if(s<2)return 0;let r=0,o=0,n=0,i=0,d=0;for(let u=0;u<s;u++){const p=t[u],l=t[u+e];r+=p,o+=l,n+=p*p,i+=l*l,d+=p*l}const f=n-r*r/s,c=i-o*o/s;return f<=0||c<=0?0:(d-r*o/s)/Math.sqrt(f*c)}function x(t,e,s){const r=Math.floor(t/e),o=[];if(s!==void 0&&s>=1){const n=Math.floor(s);for(let i=n;i<=r;i+=n)i>=2&&o.push(i)}else for(let n=2;n<=r;n++)o.push(n);return o}function g(t){if(t.length===0)return null;let e=1/0,s=-1/0;for(const n of t)n<e&&(e=n),n>s&&(s=n);const r=new Uint8Array(s-e+1);let o=0;for(const n of t)r[n-e]||(r[n-e]=1,o++);return{signal:r,count:o}}export function detectMpwPeriod(t,e={}){const{minRepeats:s,minScore:r,maxDensity:o}={...h,...e},{expectedPeriod:n}=e,i=g(t);if(!i)return null;const d=i.signal.length,f=i.count/d;if(f>o)return null;for(const c of x(d,s,n)){const u=w(i.signal,c);if(u>=r)return{period:c,score:u,repeats:Math.floor(d/c),occupiedFraction:f}}return null}function m(t,e){const{minRepeats:s,maxDensity:r}={...h,...e},o=detectMpwPeriod(t,e);if(o)return{kind:"periodic",...o};const n=g(t);return n&&n.count>=s&&n.count/n.signal.length>r?{kind:"dense",occupiedFraction:n.count/n.signal.length}:{kind:"none"}}export function detectMpwLayout(t,e={}){const{reticle:s,...r}=e,o=new Set,n=new Set;for(const c of t)a(c)&&(o.add(c.x),n.add(c.y));const i=m([...o],{...r,expectedPeriod:s?.width}),d=m([...n],{...r,expectedPeriod:s?.height}),f=i.kind==="periodic"&&(d.kind==="periodic"||d.kind==="dense")||d.kind==="periodic"&&i.kind==="dense";return{x:i,y:d,offered:f}}function y(t,e){const s=[0,...e,t],r=new Int32Array(t);for(let o=0;o+1<s.length;o++)r.fill(o,s[o],s[o+1]);return{ids:r,bounds:s}}function $(t){const e=[...t].sort((o,n)=>o-n),s=[],r=new Map;return e.forEach((o,n)=>{r.set(o,n),n>0&&o-e[n-1]>1&&s.push(n)}),{sorted:e,breaks:s,indexOf:r}}export function buildCompactMap(t){const e=new Set,s=new Set;for(const c of t)a(c)&&(e.add(c.x),s.add(c.y));const r=$(e),o=$(s),n=y(r.sorted.length,r.breaks),i=y(o.sorted.length,o.breaks),d=new Set;for(const c of t)a(c)&&d.add(n.ids[r.indexOf.get(c.x)]*i.bounds.length+i.ids[o.indexOf.get(c.y)]);return{groups:[...d].sort((c,u)=>c-u).map(c=>{const u=Math.floor(c/i.bounds.length),p=c%i.bounds.length;return{columns:[n.bounds[u],n.bounds[u+1]],rows:[i.bounds[p],i.bounds[p+1]]}}),columns:r.sorted,rows:o.sorted,columnBreaks:r.breaks,rowBreaks:o.breaks,columnOf:c=>r.indexOf.get(c),rowOf:c=>o.indexOf.get(c)}}export function compactDies(t,e){const s=e&&"columnOf"in e?e:buildCompactMap(e??t),r=[];for(const o of t){if(!a(o))continue;const n=s.columnOf(o.x),i=s.rowOf(o.y);if(n===void 0||i===void 0)throw new RangeError(`compactDies: die (${o.x}, ${o.y}) is outside the compact layout`);r.push({die:o,column:n,row:i})}return{placements:r,map:s}}export function compactLayoutOffered(t,e,s={}){return detectMpwLayout(t,{...s,reticle:b(e)}).offered}function b(t){const e=t[0];return e&&t.every(s=>s&&s.width===e.width&&s.height===e.height)?{width:e.width,height:e.height}:void 0}function k(t,e){const{minRepeats:s}={...h,...e},r=g(t);if(!r)return{occupied:0,span:0,runs:0,pattern:{kind:"none"},bestPeriods:[]};let o=0;r.signal.forEach((i,d)=>{i&&!r.signal[d-1]&&o++});const n=[];for(const i of x(r.signal.length,s,e.expectedPeriod))n.push({period:i,score:w(r.signal,i)});return n.sort((i,d)=>d.score-i.score||i.period-d.period),{occupied:r.count,span:r.signal.length,runs:o,pattern:m(t,e),bestPeriods:n.slice(0,5)}}export function diagnoseMpwLayout(t,e,s={}){const r=b(e),o=new Set,n=new Set;let i=0;for(const d of t)a(d)&&(i++,o.add(d.x),n.add(d.y));return{wafers:e.length,positionedDies:i,unpositionedDies:t.length-i,groups:buildCompactMap(t).groups.length,reticle:r,offered:detectMpwLayout(t,{...s,reticle:r}).offered,thresholds:{...h,...s},columns:k([...o],{...s,expectedPeriod:r?.width}),rows:k([...n],{...s,expectedPeriod:r?.height})}}function D(t,e){const s=e.span>0?` (${(100*e.occupied/e.span).toFixed(1)}%)`:"",r=e.pattern.kind==="periodic"?`periodic, period ${e.pattern.period}, score ${e.pattern.score.toFixed(3)}, ${e.pattern.repeats} repeats`:e.pattern.kind==="dense"?"dense, nothing to compact":"no repeating pattern found",o=e.bestPeriods.length?`
2
- best periods: ${e.bestPeriods.map(n=>`${n.period} (${n.score.toFixed(3)})`).join(", ")}`:"";return`${t}: ${e.occupied} occupied of ${e.span}${s}, ${e.runs} runs; ${r}${o}`}export function formatMpwDiagnostics(t,e){return["wafermap compact-layout diagnostics (format 1)",`library: ${e}`,"Counts and scores only: no die coordinates, bins, test values or wafer identity.",`wafers: ${t.wafers}`,`dies: ${t.positionedDies} positioned, ${t.unpositionedDies} without a position`,`reticle size: ${t.reticle?`${t.reticle.width} x ${t.reticle.height} (supplied by every wafer)`:"not supplied"}`,`compact layout offered: ${t.offered?"yes":"no"}`,`groups of dies: ${t.groups}`,`thresholds: minRepeats ${t.thresholds.minRepeats}, minScore ${t.thresholds.minScore}, maxDensity ${t.thresholds.maxDensity}`,D("columns",t.columns),D("rows",t.rows)].join(`
1
+ import{hasPosition as a}from"./dies.js";const h={minRepeats:3,minScore:.75,maxDensity:.8};function x(t,e){const s=t.length-e;if(s<2)return 0;let r=0,o=0,n=0,i=0,d=0;for(let u=0;u<s;u++){const p=t[u],l=t[u+e];r+=p,o+=l,n+=p*p,i+=l*l,d+=p*l}const f=n-r*r/s,c=i-o*o/s;return f<=0||c<=0?0:(d-r*o/s)/Math.sqrt(f*c)}function w(t,e,s){const r=Math.floor(t/e),o=[];if(s!==void 0&&s>=1){const n=Math.floor(s);for(let i=n;i<=r;i+=n)i>=2&&o.push(i)}else for(let n=2;n<=r;n++)o.push(n);return o}function g(t){if(t.length===0)return null;let e=1/0,s=-1/0;for(const n of t)n<e&&(e=n),n>s&&(s=n);const r=new Uint8Array(s-e+1);let o=0;for(const n of t)r[n-e]||(r[n-e]=1,o++);return{signal:r,count:o}}export function detectMpwPeriod(t,e={}){const{minRepeats:s,minScore:r,maxDensity:o}={...h,...e},{expectedPeriod:n}=e,i=g(t);if(!i)return null;const d=i.signal.length,f=i.count/d;if(f>o)return null;for(const c of w(d,s,n)){const u=x(i.signal,c);if(u>=r)return{period:c,score:u,repeats:Math.floor(d/c),occupiedFraction:f}}return null}function m(t,e){const{minRepeats:s,maxDensity:r}={...h,...e},o=detectMpwPeriod(t,e);if(o)return{kind:"periodic",...o};const n=g(t);return n&&n.count>=s&&n.count/n.signal.length>r?{kind:"dense",occupiedFraction:n.count/n.signal.length}:{kind:"none"}}export function detectMpwLayout(t,e={}){const{reticle:s,...r}=e,o=new Set,n=new Set;for(const c of t)a(c)&&(o.add(c.x),n.add(c.y));const i=m([...o],{...r,expectedPeriod:s?.width}),d=m([...n],{...r,expectedPeriod:s?.height}),f=i.kind==="periodic"&&(d.kind==="periodic"||d.kind==="dense")||d.kind==="periodic"&&i.kind==="dense";return{x:i,y:d,offered:f}}function y(t,e){const s=[0,...e,t],r=new Int32Array(t);for(let o=0;o+1<s.length;o++)r.fill(o,s[o],s[o+1]);return{ids:r,bounds:s}}function $(t){const e=[...t].sort((o,n)=>o-n),s=[],r=new Map;return e.forEach((o,n)=>{r.set(o,n),n>0&&o-e[n-1]>1&&s.push(n)}),{sorted:e,breaks:s,indexOf:r}}export function buildCompactMap(t){const e=new Set,s=new Set;for(const c of t)a(c)&&(e.add(c.x),s.add(c.y));const r=$(e),o=$(s),n=y(r.sorted.length,r.breaks),i=y(o.sorted.length,o.breaks),d=new Set;for(const c of t)a(c)&&d.add(n.ids[r.indexOf.get(c.x)]*i.bounds.length+i.ids[o.indexOf.get(c.y)]);return{groups:[...d].sort((c,u)=>c-u).map(c=>{const u=Math.floor(c/i.bounds.length),p=c%i.bounds.length;return{columns:[n.bounds[u],n.bounds[u+1]],rows:[i.bounds[p],i.bounds[p+1]]}}),columns:r.sorted,rows:o.sorted,columnBreaks:r.breaks,rowBreaks:o.breaks,columnOf:c=>r.indexOf.get(c),rowOf:c=>o.indexOf.get(c)}}export function compactDies(t,e){const s=e&&"columnOf"in e?e:buildCompactMap(e??t),r=[];for(const o of t){if(!a(o))continue;const n=s.columnOf(o.x),i=s.rowOf(o.y);if(n===void 0||i===void 0)throw new RangeError(`compactDies: die (${o.x}, ${o.y}) is outside the compact layout`);r.push({die:o,column:n,row:i})}return{placements:r,map:s}}export function compactLayoutOffered(t,e,s={}){return detectMpwLayout(t,{...s,reticle:b(e)}).offered}function b(t){const e=t[0];return e&&t.every(s=>s&&s.width===e.width&&s.height===e.height)?{width:e.width,height:e.height}:void 0}function k(t,e){const{minRepeats:s}={...h,...e},r=g(t);if(!r)return{occupied:0,span:0,runs:0,pattern:{kind:"none"},bestPeriods:[]};let o=0;r.signal.forEach((i,d)=>{i&&!r.signal[d-1]&&o++});const n=[];for(const i of w(r.signal.length,s,e.expectedPeriod))n.push({period:i,score:x(r.signal,i)});return n.sort((i,d)=>d.score-i.score||i.period-d.period),{occupied:r.count,span:r.signal.length,runs:o,pattern:m(t,e),bestPeriods:n.slice(0,5)}}export function diagnoseMpwLayout(t,e,s={}){const r=b(e),o=new Set,n=new Set;let i=0;for(const d of t)a(d)&&(i++,o.add(d.x),n.add(d.y));return{wafers:e.length,positionedDies:i,unpositionedDies:t.length-i,groups:buildCompactMap(t).groups.length,reticle:r,offered:detectMpwLayout(t,{...s,reticle:r}).offered,thresholds:{...h,...s},columns:k([...o],{...s,expectedPeriod:r?.width}),rows:k([...n],{...s,expectedPeriod:r?.height})}}function D(t,e){const s=e.span>0?` (${(100*e.occupied/e.span).toFixed(1)}%)`:"",r=e.pattern.kind==="periodic"?`periodic, period ${e.pattern.period}, score ${e.pattern.score.toFixed(3)}, ${e.pattern.repeats} repeats`:e.pattern.kind==="dense"?"dense, nothing to compact":"no repeating pattern found",o=e.bestPeriods.length?`
2
+ best periods: ${e.bestPeriods.map(n=>`${n.period} (${n.score.toFixed(3)})`).join(", ")}`:"";return`${t}: ${e.occupied} occupied of ${e.span}${s}, ${e.runs} runs; ${r}${o}`}export function formatMpwDiagnostics(t,e){return["compact-layout diagnostics (format 1)",`library: ${e}`,"Counts and scores only: no die coordinates, bins, test values or wafer identity.",`wafers: ${t.wafers}`,`dies: ${t.positionedDies} positioned, ${t.unpositionedDies} without a position`,`reticle size: ${t.reticle?`${t.reticle.width} x ${t.reticle.height} (supplied by every wafer)`:"not supplied"}`,`compact layout offered: ${t.offered?"yes":"no"}`,`groups of dies: ${t.groups}`,`thresholds: minRepeats ${t.thresholds.minRepeats}, minScore ${t.thresholds.minScore}, maxDensity ${t.thresholds.maxDensity}`,D("columns",t.columns),D("rows",t.rows)].join(`
3
3
  `)}
@@ -1 +1 @@
1
- import{hasAnyKey as N}from"./utils.js";const O=NaN;export const VERDICT_NONE=-1,VERDICT_FAIL=0,VERDICT_PASS=1,HAS_VALUES=1,HAS_VERDICTS=2;const l=Symbol("wmap.dieTable"),a=Symbol("wmap.dieRow");export function linkDie(e,t,s){return e[l]=t,e[a]=s,e}export function dieLink(e){const t=e[l];return t===void 0?void 0:{table:t,row:e[a]}}export function tableFromRows(e){const t=e.length,s=new Map,o=new Map,r=new Uint8Array(t),n=P(s,()=>new Float64Array(t).fill(O)),c=P(o,()=>new Int8Array(t).fill(VERDICT_NONE));for(let u=0;u<t;u++){const f=e[u].testValues;if(f){r[u]|=HAS_VALUES;const d=n(f),x=Object.values(f);for(let b=0;b<d.length;b++)d[b][u]=x[b]}const i=e[u].testPass;if(i){r[u]|=HAS_VERDICTS;const d=c(i),x=Object.values(i);for(let b=0;b<d.length;b++)d[b][u]=x[b]?VERDICT_PASS:VERDICT_FAIL}}return{rows:t,values:g(s),verdicts:g(o),fields:r}}function P(e,t){let s=[],o=[];return r=>{const n=Object.keys(r);let c=n.length===s.length;for(let u=0;c&&u<n.length;u++)c=n[u]===s[u];return c||(s=n,o=n.map(u=>{let f=e.get(u);return f===void 0&&e.set(u,f=t()),f})),o}}function g(e){return new Map([...e].map(([t,s])=>[Number(t),s]).sort((t,s)=>t[0]-s[0]))}export function extendTable(e,t,s){const o=new Map(e.values),r=new Map(e.verdicts);for(const[n,c]of t)o.set(n,c);for(const[n,c]of s)r.set(n,c);return{rows:e.rows,values:new Map([...o].sort((n,c)=>n[0]-c[0])),verdicts:new Map([...r].sort((n,c)=>n[0]-c[0])),fields:e.fields.slice(),...e.excluded?{excluded:e.excluded,excludedBy:e.excludedBy}:{}}}export function withExcluded(e,t,s,o){const r=new Map(e.values);for(const[c,u]of t)r.set(c,u);const n=new Map(e.excluded??[]);for(const[c,u]of s)n.set(c,u);return{...e,values:r,excluded:n,excludedBy:o}}export function excludedCounts(e){const t=new Map;let s;for(const o of e){const r=o[l];if(r?.excluded===void 0)continue;const n=o[a];for(const[c,u]of r.excluded)Number.isNaN(u[n])||(t.set(c,(t.get(c)??0)+1),s??=r.excludedBy)}return t.size===0||s===void 0?void 0:{counts:t,by:s}}export function excludedCountFor(e,t){let s=0,o;for(const r of e){const n=r[l],c=n?.excluded?.get(t);c===void 0||Number.isNaN(c[r[a]])||(s++,o??=n.excludedBy)}return s>0&&o!==void 0?{count:s,by:o}:void 0}export function excludedBy(e){return e[l]?.excludedBy}export function excludedValue(e,t){const o=e[l]?.excluded?.get(t)?.[e[a]];return o===void 0||Number.isNaN(o)?void 0:o}export function rowView(e){const t=linkDie({},e,0);return s=>(t[a]=s,t)}function w(e,t){const s={},o=[...e.values];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];Number.isNaN(n)||(s[o[r][0]]=n)}return s}function v(e,t){const s={},o=[...e.verdicts];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];n!==VERDICT_NONE&&(s[o[r][0]]=n===VERDICT_PASS)}return s}function j(){return Object.freeze(w(this[l],this[a]))}function k(){return Object.freeze(v(this[l],this[a]))}function m(e){return function(){throw new TypeError(`wafermap: die.${e} is read-only on a die built by buildWaferMap (die ${this.id}). Pass the values you want to buildWaferMap, or copy the die: { ...die, ${e}: yours }.`)}}const y={get:j,set:m("testValues"),enumerable:!0,configurable:!0},V={get:k,set:m("testPass"),enumerable:!0,configurable:!0},p=e=>({value:e,writable:!0,enumerable:!1,configurable:!0});export function finaliseDie(e){const t=e[l];if(t===void 0)return e;const s=e[a],o=t.fields[s],r=e.testValues!==void 0&&!(o&HAS_VALUES)||e.testPass!==void 0&&!(o&HAS_VERDICTS),n={};for(const c of Object.keys(e))c==="testValues"&&o&HAS_VALUES||c==="testPass"&&o&HAS_VERDICTS||(n[c]=e[c]);return r?(o&HAS_VALUES&&(n.testValues=w(t,s)),o&HAS_VERDICTS&&(n.testPass=v(t,s)),n):(Object.defineProperty(n,l,p(t)),Object.defineProperty(n,a,p(s)),o&HAS_VALUES&&Object.defineProperty(n,"testValues",y),o&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function copyDie(e,t){const s=e[l];if(s===void 0)return{...e,...t};const o=e[a],r=s.fields[o],n={};for(const c of Object.keys(e))c!=="testValues"&&c!=="testPass"&&(n[c]=e[c]);return"testValues"in t||"testPass"in t?(r&HAS_VALUES&&!("testValues"in t)&&(n.testValues=w(s,o)),r&HAS_VERDICTS&&!("testPass"in t)&&(n.testPass=v(s,o)),Object.assign(n,t)):(Object.assign(n,t),Object.defineProperty(n,l,p(s)),Object.defineProperty(n,a,p(o)),r&HAS_VALUES&&Object.defineProperty(n,"testValues",y),r&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function detachTables(e){const t=[],s=new Map,o=e.reduce((u,f)=>u+f.length,0),r=new Int32Array(o*2);let n=0;for(const u of e)for(const f of u){const i=dieLink(f);if(i===void 0){r[n++]=-1,r[n++]=0;continue}let d=s.get(i.table);d===void 0&&(s.set(i.table,d=t.length),t.push(i.table)),r[n++]=d,r[n++]=i.row,delete f.testValues,delete f.testPass}const c=new Set;for(const u of t){for(const f of u.values.values())c.add(f.buffer);for(const f of u.verdicts.values())c.add(f.buffer);if(c.add(u.fields.buffer),u.excluded)for(const f of u.excluded.values())c.add(f.buffer)}return{tables:t,links:r,transfer:[...c]}}export function attachTables(e,t){let s=0;for(const o of e)for(const r of o){const n=t.links[s++],c=t.links[s++];if(n<0)continue;const u=t.tables[n],f=u.fields[c];Object.defineProperty(r,l,p(u)),Object.defineProperty(r,a,p(c)),f&HAS_VALUES&&Object.defineProperty(r,"testValues",y),f&HAS_VERDICTS&&Object.defineProperty(r,"testPass",V)}}export function testValue(e,t){const s=e[l];if(s===void 0)return e.testValues?.[t];const o=s.values.get(t)?.[e[a]];return o===void 0||Number.isNaN(o)?void 0:o}export function recordedVerdict(e,t){const s=e[l];if(s===void 0)return e.testPass?.[t];const o=s.verdicts.get(t)?.[e[a]];return o===void 0||o===VERDICT_NONE?void 0:o===VERDICT_PASS}export function dieHasAnyTestData(e){return dieHasValues(e)||dieHasVerdicts(e)}export function dieHasValues(e){const t=dieLink(e);if(t===void 0)return N(e.testValues);for(const s of t.table.values.values())if(!Number.isNaN(s[t.row]))return!0;return!1}export function dieHasVerdicts(e){const t=dieLink(e);if(t===void 0)return N(e.testPass);for(const s of t.table.verdicts.values())if(s[t.row]!==VERDICT_NONE)return!0;return!1}export function dieValueEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testValues;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.values){const n=r[t.row];Number.isNaN(n)||s.push([o,n])}return s}export function dieVerdictEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testPass;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.verdicts){const n=r[t.row];n!==VERDICT_NONE&&s.push([o,n===VERDICT_PASS])}return s}export function testValuesReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testValues;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?NaN:i}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.values.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?NaN:f[c.row]}return n}}export function recordedVerdictsReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testPass;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?VERDICT_NONE:i?VERDICT_PASS:VERDICT_FAIL}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.verdicts.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?VERDICT_NONE:f[c.row]}return n}}export function testsPresent(e,t="all"){const s=new Set,o=new Map;for(const r of e){const n=dieLink(r);if(n===void 0){if(r.testValues)for(const u in r.testValues)s.add(Number(u));if(t==="all"&&r.testPass)for(const u in r.testPass)s.add(Number(u));continue}let c=o.get(n.table);c===void 0&&o.set(n.table,c=[]),c.push(n.row)}for(const[r,n]of o){for(const[c,u]of r.values)!s.has(c)&&n.some(f=>!Number.isNaN(u[f]))&&s.add(c);if(t!=="values")for(const[c,u]of r.verdicts)!s.has(c)&&n.some(f=>u[f]!==VERDICT_NONE)&&s.add(c)}return[...s].sort((r,n)=>r-n)}
1
+ import{hasAnyKey as N}from"./utils.js";const O=NaN;export const VERDICT_NONE=-1,VERDICT_FAIL=0,VERDICT_PASS=1,HAS_VALUES=1,HAS_VERDICTS=2;const l=Symbol("wmap.dieTable"),d=Symbol("wmap.dieRow");export function linkDie(e,t,s){return e[l]=t,e[d]=s,e}export function dieLink(e){const t=e[l];return t===void 0?void 0:{table:t,row:e[d]}}export function tableFromRows(e){const t=e.length,s=new Map,o=new Map,r=new Uint8Array(t),n=P(s,()=>new Float64Array(t).fill(O)),c=P(o,()=>new Int8Array(t).fill(VERDICT_NONE));for(let u=0;u<t;u++){const f=e[u].testValues;if(f){r[u]|=HAS_VALUES;const a=n(f),x=Object.values(f);for(let b=0;b<a.length;b++)a[b][u]=x[b]}const i=e[u].testPass;if(i){r[u]|=HAS_VERDICTS;const a=c(i),x=Object.values(i);for(let b=0;b<a.length;b++)a[b][u]=x[b]?VERDICT_PASS:VERDICT_FAIL}}return{rows:t,values:g(s),verdicts:g(o),fields:r}}function P(e,t){let s=[],o=[];return r=>{const n=Object.keys(r);let c=n.length===s.length;for(let u=0;c&&u<n.length;u++)c=n[u]===s[u];return c||(s=n,o=n.map(u=>{let f=e.get(u);return f===void 0&&e.set(u,f=t()),f})),o}}function g(e){return new Map([...e].map(([t,s])=>[Number(t),s]).sort((t,s)=>t[0]-s[0]))}export function extendTable(e,t,s){const o=new Map(e.values),r=new Map(e.verdicts);for(const[n,c]of t)o.set(n,c);for(const[n,c]of s)r.set(n,c);return{rows:e.rows,values:new Map([...o].sort((n,c)=>n[0]-c[0])),verdicts:new Map([...r].sort((n,c)=>n[0]-c[0])),fields:e.fields.slice(),...e.excluded?{excluded:e.excluded,excludedBy:e.excludedBy}:{}}}export function withExcluded(e,t,s,o){const r=new Map(e.values);for(const[c,u]of t)r.set(c,u);const n=new Map(e.excluded??[]);for(const[c,u]of s)n.set(c,u);return{...e,values:r,excluded:n,excludedBy:o}}export function excludedCounts(e){const t=new Map;let s;for(const o of e){const r=o[l];if(r?.excluded===void 0)continue;const n=o[d];for(const[c,u]of r.excluded)Number.isNaN(u[n])||(t.set(c,(t.get(c)??0)+1),s??=r.excludedBy)}return t.size===0||s===void 0?void 0:{counts:t,by:s}}export function excludedCountFor(e,t){let s=0,o;for(const r of e){const n=r[l],c=n?.excluded?.get(t);c===void 0||Number.isNaN(c[r[d]])||(s++,o??=n.excludedBy)}return s>0&&o!==void 0?{count:s,by:o}:void 0}export function excludedBy(e){return e[l]?.excludedBy}export function excludedValue(e,t){const o=e[l]?.excluded?.get(t)?.[e[d]];return o===void 0||Number.isNaN(o)?void 0:o}export function rowView(e){const t=linkDie({},e,0);return s=>(t[d]=s,t)}function w(e,t){const s={},o=[...e.values];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];Number.isNaN(n)||(s[o[r][0]]=n)}return s}function v(e,t){const s={},o=[...e.verdicts];for(let r=o.length-1;r>=0;r--){const n=o[r][1][t];n!==VERDICT_NONE&&(s[o[r][0]]=n===VERDICT_PASS)}return s}function j(){return Object.freeze(w(this[l],this[d]))}function k(){return Object.freeze(v(this[l],this[d]))}function m(e){return function(){throw new TypeError(`die.${e} is read-only on a die built by buildWaferMap (die ${this.id}). Pass the values you want to buildWaferMap, or copy the die: { ...die, ${e}: yours }.`)}}const y={get:j,set:m("testValues"),enumerable:!0,configurable:!0},V={get:k,set:m("testPass"),enumerable:!0,configurable:!0},p=e=>({value:e,writable:!0,enumerable:!1,configurable:!0});export function finaliseDie(e){const t=e[l];if(t===void 0)return e;const s=e[d],o=t.fields[s],r=e.testValues!==void 0&&!(o&HAS_VALUES)||e.testPass!==void 0&&!(o&HAS_VERDICTS),n={};for(const c of Object.keys(e))c==="testValues"&&o&HAS_VALUES||c==="testPass"&&o&HAS_VERDICTS||(n[c]=e[c]);return r?(o&HAS_VALUES&&(n.testValues=w(t,s)),o&HAS_VERDICTS&&(n.testPass=v(t,s)),n):(Object.defineProperty(n,l,p(t)),Object.defineProperty(n,d,p(s)),o&HAS_VALUES&&Object.defineProperty(n,"testValues",y),o&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function copyDie(e,t){const s=e[l];if(s===void 0)return{...e,...t};const o=e[d],r=s.fields[o],n={};for(const c of Object.keys(e))c!=="testValues"&&c!=="testPass"&&(n[c]=e[c]);return"testValues"in t||"testPass"in t?(r&HAS_VALUES&&!("testValues"in t)&&(n.testValues=w(s,o)),r&HAS_VERDICTS&&!("testPass"in t)&&(n.testPass=v(s,o)),Object.assign(n,t)):(Object.assign(n,t),Object.defineProperty(n,l,p(s)),Object.defineProperty(n,d,p(o)),r&HAS_VALUES&&Object.defineProperty(n,"testValues",y),r&HAS_VERDICTS&&Object.defineProperty(n,"testPass",V),n)}export function detachTables(e){const t=[],s=new Map,o=e.reduce((u,f)=>u+f.length,0),r=new Int32Array(o*2);let n=0;for(const u of e)for(const f of u){const i=dieLink(f);if(i===void 0){r[n++]=-1,r[n++]=0;continue}let a=s.get(i.table);a===void 0&&(s.set(i.table,a=t.length),t.push(i.table)),r[n++]=a,r[n++]=i.row,delete f.testValues,delete f.testPass}const c=new Set;for(const u of t){for(const f of u.values.values())c.add(f.buffer);for(const f of u.verdicts.values())c.add(f.buffer);if(c.add(u.fields.buffer),u.excluded)for(const f of u.excluded.values())c.add(f.buffer)}return{tables:t,links:r,transfer:[...c]}}export function attachTables(e,t){let s=0;for(const o of e)for(const r of o){const n=t.links[s++],c=t.links[s++];if(n<0)continue;const u=t.tables[n],f=u.fields[c];Object.defineProperty(r,l,p(u)),Object.defineProperty(r,d,p(c)),f&HAS_VALUES&&Object.defineProperty(r,"testValues",y),f&HAS_VERDICTS&&Object.defineProperty(r,"testPass",V)}}export function testValue(e,t){const s=e[l];if(s===void 0)return e.testValues?.[t];const o=s.values.get(t)?.[e[d]];return o===void 0||Number.isNaN(o)?void 0:o}export function recordedVerdict(e,t){const s=e[l];if(s===void 0)return e.testPass?.[t];const o=s.verdicts.get(t)?.[e[d]];return o===void 0||o===VERDICT_NONE?void 0:o===VERDICT_PASS}export function dieHasAnyTestData(e){return dieHasValues(e)||dieHasVerdicts(e)}export function dieHasValues(e){const t=dieLink(e);if(t===void 0)return N(e.testValues);for(const s of t.table.values.values())if(!Number.isNaN(s[t.row]))return!0;return!1}export function dieHasVerdicts(e){const t=dieLink(e);if(t===void 0)return N(e.testPass);for(const s of t.table.verdicts.values())if(s[t.row]!==VERDICT_NONE)return!0;return!1}export function dieValueEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testValues;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.values){const n=r[t.row];Number.isNaN(n)||s.push([o,n])}return s}export function dieVerdictEntries(e){const t=dieLink(e);if(t===void 0){const o=e.testPass;return o===void 0?[]:Object.keys(o).map(r=>[Number(r),o[Number(r)]])}const s=[];for(const[o,r]of t.table.verdicts){const n=r[t.row];n!==VERDICT_NONE&&s.push([o,n===VERDICT_PASS])}return s}export function testValuesReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testValues;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?NaN:i}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.values.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?NaN:f[c.row]}return n}}export function recordedVerdictsReader(e){let t,s=[];return function(r,n){const c=dieLink(r);if(c===void 0){const u=r.testPass;for(let f=0;f<e.length;f++){const i=u?.[e[f]];n[f]=i===void 0?VERDICT_NONE:i?VERDICT_PASS:VERDICT_FAIL}return n}c.table!==t&&(t=c.table,s=e.map(u=>c.table.verdicts.get(u)));for(let u=0;u<s.length;u++){const f=s[u];n[u]=f===void 0?VERDICT_NONE:f[c.row]}return n}}export function testsPresent(e,t="all"){const s=new Set,o=new Map;for(const r of e){const n=dieLink(r);if(n===void 0){if(r.testValues)for(const u in r.testValues)s.add(Number(u));if(t==="all"&&r.testPass)for(const u in r.testPass)s.add(Number(u));continue}let c=o.get(n.table);c===void 0&&o.set(n.table,c=[]),c.push(n.row)}for(const[r,n]of o){for(const[c,u]of r.values)!s.has(c)&&n.some(f=>!Number.isNaN(u[f]))&&s.add(c);if(t!=="values")for(const[c,u]of r.verdicts)!s.has(c)&&n.some(f=>u[f]!==VERDICT_NONE)&&s.add(c)}return[...s].sort((r,n)=>r-n)}
@@ -34,7 +34,15 @@ export interface CommonalityRow {
34
34
  };
35
35
  /** `worst` to `best` in percentage points, always positive. */
36
36
  spread: number;
37
- /** Benjamini–Hochberg q of Welch's p (Kruskal–Wallis's where Welch cannot be computed), over every row. */
37
+ /**
38
+ * The comparison the p and q come from, when the field was read after allowing for another (the strongest other field that
39
+ * explains the same measure): its groups' values less that field's group means. Absent when `comparison` is what was ranked.
40
+ * `comparison` always holds the measure's own means, so a row reads in percent whichever way it was ranked.
41
+ */
42
+ adjusted?: GroupComparison;
43
+ /** The fields allowed for, when `adjusted` is set. */
44
+ allowedFor?: CommonalityField[];
45
+ /** Benjamini–Hochberg q of Welch's p (Kruskal–Wallis's where Welch cannot be computed) of `adjusted ?? comparison`, over every row. */
38
46
  pAdjusted: number;
39
47
  }
40
48
  export interface CommonalityResult {
@@ -44,10 +52,17 @@ export interface CommonalityResult {
44
52
  /** The fail bins compared, most dies first. */
45
53
  bins: number[];
46
54
  /**
47
- * Pairs of fields that divide the wafers identically (every group of one is a group of the other): the wafers cannot
48
- * say which of the two it is.
55
+ * Sets of fields that divide the wafers identically (every group of one is a group of the other), each of two or more
56
+ * fields: the wafers cannot say which of them it is.
49
57
  */
50
- confounded: Array<[CommonalityField, CommonalityField]>;
58
+ tied: CommonalityField[][];
59
+ /** Sets of fields that nearly match without being identical: how many of the wafers they put in matching groups. */
60
+ overlapping: Array<{
61
+ fields: CommonalityField[];
62
+ with: CommonalityField[];
63
+ agree: number;
64
+ of: number;
65
+ }>;
51
66
  }
52
67
  /** How many of the most common fail bins are compared, besides yield. */
53
68
  export declare const COMMONALITY_BINS = 5;
@@ -59,4 +74,22 @@ export declare const COMMONALITY_BINS = 5;
59
74
  export declare function rankCommonality(wafers: readonly CommonalityWafer[], fields: readonly CommonalityField[], curation?: Record<string, FacetCuration>): CommonalityResult;
60
75
  /** A measure as the reader names it: "Yield", "Hard bin 2". */
61
76
  export declare const measureLabel: (m: CommonalityMeasure, binName?: (bin: number) => string | undefined) => string;
77
+ /** How plainly a row's groups differ, from its q: the word the card shows in place of the p-values. */
78
+ export type CommonalityConfidence = 'clear' | 'possible' | 'none';
79
+ /** q under 0.05 is clear, under 0.2 possible; a q that could not be computed is not clear. */
80
+ export declare const commonalityConfidence: (q: number) => CommonalityConfidence;
81
+ export declare const CONFIDENCE_LABEL: Record<CommonalityConfidence, string>;
82
+ /** One field with its strongest measure, and its other measures behind it. */
83
+ export interface CommonalityFieldRows {
84
+ field: CommonalityField;
85
+ /** Every field that gives the same groups of wafers, `field` first: one row stands for all of them. */
86
+ fields: CommonalityField[];
87
+ primary: CommonalityRow;
88
+ others: CommonalityRow[];
89
+ }
90
+ /**
91
+ * The rows as one entry per field: yield leads unless a fail bin is clearer, then the measure with the lowest q, the field's other measures follow it.
92
+ * Fields are ordered clear, then possible, then not clear, and within each by the size of the leading difference.
93
+ */
94
+ export declare function groupCommonalityRows(rows: readonly CommonalityRow[], tied?: readonly (readonly CommonalityField[])[]): CommonalityFieldRows[];
62
95
  //# sourceMappingURL=commonality.d.ts.map
@@ -1 +1 @@
1
- import{diePassStatus as I,isYieldEligibleDie as B}from"../core/dies.js";import{benjaminiHochberg as Y}from"./math.js";import{compareGroups as $,comparisonP as C}from"./groupCompare.js";import{facetValueOf as z}from"./facets.js";import{yieldCounts as E}from"./yield.js";import{compareNatural as H}from"../core/utils.js";export const COMMONALITY_BINS=5;function L(s,f){let r=0,a=0;for(const c of s.dies)!B(c)||c.hbin===void 0||(a++,c.hbin===f&&r++);return a?r/a*100:NaN}export function rankCommonality(s,f,r){const a=s.map(e=>{const{pass:n,total:o}=E(e.dies,e.passBins);return o?n/o*100:NaN}),c=new Map;for(const e of s){const n=new Set(e.passBins);for(const o of e.dies)B(o)&&o.hbin!==void 0&&I(o,n)===!1&&c.set(o.hbin,(c.get(o.hbin)??0)+1)}const p=[...c].sort((e,n)=>n[1]-e[1]||e[0]-n[0]).slice(0,COMMONALITY_BINS).map(([e])=>e),t=new Map(p.map(e=>[e,s.map(n=>L(n,e))])),u=[],w=[],h=new Map;for(const e of f){const n=s.map(i=>z(i.metadata,e.key,r)),o=[...new Set(n.filter(i=>i!==void 0))].sort(H);if(o.filter(i=>n.filter(y=>y===i).length>=2).length<2){w.push(e);continue}h.set(e.key,n.map(i=>i===void 0?"":String(o.indexOf(i))).join("|"));const P=[[{kind:"yield"},a],...p.map(i=>[{kind:"bin",bin:i},t.get(i)])];for(const[i,y]of P){const b=$(o.map(d=>({key:d,values:y.filter((l,F)=>n[F]===d)}))),g=b.groups.filter(d=>!b.tooSmall.includes(d.key)&&Number.isFinite(d.mean));if(g.length<2)continue;const k=g.reduce((d,l)=>l.mean<d.mean?l:d),N=g.reduce((d,l)=>l.mean>d.mean?l:d),[x,A]=i.kind==="yield"?[k,N]:[N,k];u.push({field:e,measure:i,comparison:b,worst:{key:x.key,mean:x.mean},best:{key:A.key,mean:A.mean},spread:N.mean-k.mean,pAdjusted:NaN})}}const j=u.filter(e=>Number.isFinite(C(e.comparison))),O=Y(j.map(e=>C(e.comparison)));j.forEach((e,n)=>{e.pAdjusted=O[n]});const M=e=>Number.isFinite(e.pAdjusted)?e.pAdjusted:1/0;u.sort((e,n)=>M(e)-M(n)||n.spread-e.spread);const S=[],m=f.filter(e=>h.has(e.key));for(let e=0;e<m.length;e++)for(let n=e+1;n<m.length;n++)_(h.get(m[e].key),h.get(m[n].key))&&S.push([m[e],m[n]]);return{rows:u,untestable:w,bins:p,confounded:S}}function _(s,f){const r=s.split("|"),a=f.split("|"),c=new Map,p=new Map;for(let t=0;t<r.length;t++){if(c.has(r[t])&&c.get(r[t])!==a[t]||p.has(a[t])&&p.get(a[t])!==r[t])return!1;c.set(r[t],a[t]),p.set(a[t],r[t])}return!0}export const measureLabel=(s,f)=>s.kind==="yield"?"Yield":`Hard bin ${s.bin}${f?.(s.bin)?` (${f(s.bin)})`:""}`;
1
+ import{diePassStatus as _,isYieldEligibleDie as B}from"../core/dies.js";import{benjaminiHochberg as $}from"./math.js";import{compareGroups as I,comparisonP as z}from"./groupCompare.js";import{adjustedFits as D,mergePartitions as H,overlapping as G,partitionId as T}from"./groupEffects.js";import{facetValueOf as V}from"./facets.js";import{yieldCounts as q}from"./yield.js";import{compareNatural as J}from"../core/utils.js";export const COMMONALITY_BINS=5;function K(s,p){let m=0,d=0;for(const l of s.dies)!B(l)||l.hbin===void 0||(d++,l.hbin===p&&m++);return d?m/d*100:NaN}export function rankCommonality(s,p,m){const d=s.map(e=>{const{pass:n,total:o}=q(e.dies,e.passBins);return o?n/o*100:NaN}),l=new Map;for(const e of s){const n=new Set(e.passBins);for(const o of e.dies)B(o)&&o.hbin!==void 0&&_(o,n)===!1&&l.set(o.hbin,(l.get(o.hbin)??0)+1)}const k=[...l].sort((e,n)=>n[1]-e[1]||e[0]-n[0]).slice(0,COMMONALITY_BINS).map(([e])=>e),w=new Map(k.map(e=>[e,s.map(n=>K(n,e))])),t=[],r=[],h=[];for(const e of p){const n=s.map(c=>V(c.metadata,e.key,m)),o=[...new Set(n.filter(c=>c!==void 0))].sort(J);if(o.filter(c=>n.filter(N=>N===c).length>=2).length<2){r.push(e);continue}h.push({field:e,value:n,keys:o})}const u=H(h.map(e=>({key:e.field.key,groupOf:e.value}))),f=new Map(p.map(e=>[e.key,e])),L=[[{kind:"yield"},d],...k.map(e=>[{kind:"bin",bin:e},w.get(e)])];for(const[e,n]of L){const o=new Map(D(n.map(a=>Number.isFinite(a)?a:void 0),u).map(a=>[a.partition.id,a]));for(const{field:a,value:c,keys:N}of h){const F=I(N.map(i=>({key:i,values:n.filter((y,x)=>c[x]===i)}))),j=F.groups.filter(i=>!F.tooSmall.includes(i.key)&&Number.isFinite(i.mean));if(j.length<2)continue;const C=j.reduce((i,y)=>y.mean<i.mean?y:i),O=j.reduce((i,y)=>y.mean>i.mean?y:i),[P,S]=e.kind==="yield"?[C,O]:[O,C],g=o.get(T(c));let b=g?.allowedFor?I(N.map(i=>({key:i,values:g.used.filter((y,x)=>c[x]===i&&y!==void 0)}))):void 0;b?.welch&&g?.fitted&&(b={...b,welch:{...b.welch,p:g.fitted.p}}),t.push({field:a,measure:e,comparison:F,worst:{key:P.key,mean:P.mean},best:{key:S.key,mean:S.mean},spread:O.mean-C.mean,pAdjusted:NaN,...b&&g?.allowedFor?{adjusted:b,allowedFor:g.allowedFor.map(i=>f.get(i)??{key:i,label:i})}:{}})}}const M=e=>z(e.adjusted??e.comparison),v=t.filter(e=>Number.isFinite(M(e))),R=$(v.map(M));v.forEach((e,n)=>{e.pAdjusted=R[n]});const A=e=>Number.isFinite(e.pAdjusted)?e.pAdjusted:1/0;t.sort((e,n)=>A(e)-A(n)||n.spread-e.spread);const Y=u.filter(e=>e.keys.length>1).map(e=>e.keys.map(n=>f.get(n))),E=[];return u.forEach((e,n)=>{for(const o of G(e,u))u.indexOf(o.partition)>n&&E.push({fields:e.keys.map(a=>f.get(a)),with:o.partition.keys.map(a=>f.get(a)),agree:o.agree,of:o.of})}),{rows:t,untestable:r,bins:k,tied:Y,overlapping:E}}export const measureLabel=(s,p)=>s.kind==="yield"?"Yield":`Hard bin ${s.bin}${p?.(s.bin)?` (${p(s.bin)})`:""}`,commonalityConfidence=s=>s<.05?"clear":s<.2?"possible":"none",CONFIDENCE_LABEL={clear:"Clear",possible:"Possible",none:"Not clear"};export function groupCommonalityRows(s,p=[]){const m=new Map;for(const t of s)(m.get(t.field.key)??m.set(t.field.key,[]).get(t.field.key)).push(t);const d=t=>["clear","possible","none"].indexOf(commonalityConfidence(t.pAdjusted)),l=new Map;for(const t of p)for(const r of t)l.set(r.key,t);const k=new Set,w=[];for(const t of m.values()){const r=l.get(t[0].field.key);if(r){if(k.has(r))continue;k.add(r)}const h=t.find(f=>f.measure.kind==="yield"),u=h&&d(h)<=d(t[0])?h:t[0];w.push({field:t[0].field,fields:r?[t[0].field,...r.filter(f=>f.key!==t[0].field.key)]:[t[0].field],primary:u,others:t.filter(f=>f!==u)})}return w.sort((t,r)=>d(t.primary)-d(r.primary)||r.primary.spread-t.primary.spread)}
@@ -39,6 +39,8 @@ export interface DieRegionDef {
39
39
  export declare function dieRadialPosition(d: Die, ctx: {
40
40
  wafer?: Wafer;
41
41
  }): number | undefined;
42
+ /** The value a plot's Ring field gives ring `ring`: the one name a ring condition in a plot spec must use. */
43
+ export declare const ringPlotValue: (ring: number) => string;
42
44
  export declare const DIE_REGIONS: Record<DieRegionKey, DieRegionDef>;
43
45
  /** The regions this population offers, in the order they are listed. */
44
46
  export declare function availableRegions(ctx: RegionContext, anyPositioned: boolean): DieRegionDef[];
@@ -1 +1 @@
1
- import{classifyDie as c}from"../core/classify.js";import{getReticleCell as f,getReticleShot as d}from"../core/reticle.js";import{requireRingCount as g}from"../core/ringCount.js";import{hasPosition as a}from"../core/dies.js";import{getRingLabel as s,radialPosition as p}from"../core/classify.js";export const DIE_REGION_KEYS=["ring","quadrant","reticleCell","reticleShot"];function m(e,r){return!!r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0}export function dieRadialPosition(e,r){return r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0?p(e,r.wafer):void 0}function i(e,r,n){if(m(e,r))return c(e,r.wafer,{ringCount:g(r,n)})}const l=new Map([["quadrant:NE",0],["quadrant:NW",1],["quadrant:SE",2],["quadrant:SW",3]]);function t(e,r){const n=r.reticle??r.wafer?.reticle;return n&&a(e)?f(e,n):void 0}export const DIE_REGIONS={ring:{key:"ring",label:"Ring",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?`Ring ${n.ring}`:void 0},rawOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?String(n.ring):void 0},grouping:{family:"ring",place:(e,r)=>{const n=i(e,r,"a ring");return n?{key:`ring:${n.ring}`,label:s(n.ring,r.ringCount)}:void 0},order:(e,r)=>e.localeCompare(r)}},quadrant:{key:"quadrant",label:"Quadrant",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>i(e,r,"a quadrant of a plot")?.quadrant,grouping:{family:"quadrant",place:(e,r)=>{const n=i(e,r,"a quadrant");return n?{key:`quadrant:${n.quadrant}`,label:n.quadrant}:void 0},order:(e,r)=>(l.get(e)??4)-(l.get(r)??4)}},reticleCell:{key:"reticleCell",label:"Reticle cell",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=t(e,r);return n?`Reticle cell (${n.column}, ${n.row})`:void 0},grouping:{family:"reticle-position",place:(e,r)=>{const n=t(e,r);return n?{key:`reticle-position:cell:${n.column},${n.row}`,label:`Reticle cell (${n.column}, ${n.row})`}:void 0},order:(e,r)=>e.localeCompare(r,void 0,{numeric:!0})}},reticleShot:{key:"reticleShot",label:"Reticle shot",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=r.reticle??r.wafer?.reticle;if(!n||!a(e))return;const{column:o,row:u}=d(e,n);return`Reticle shot (${o}, ${u})`}}};export function availableRegions(e,r){return DIE_REGION_KEYS.map(n=>DIE_REGIONS[n]).filter(n=>n.available(e,r))}
1
+ import{classifyDie as c}from"../core/classify.js";import{getReticleCell as f,getReticleShot as d}from"../core/reticle.js";import{requireRingCount as g}from"../core/ringCount.js";import{hasPosition as a}from"../core/dies.js";import{getRingLabel as s,radialPosition as p}from"../core/classify.js";export const DIE_REGION_KEYS=["ring","quadrant","reticleCell","reticleShot"];function m(e,r){return!!r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0}export function dieRadialPosition(e,r){return r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0?p(e,r.wafer):void 0}function i(e,r,n){if(m(e,r))return c(e,r.wafer,{ringCount:g(r,n)})}const t=new Map([["quadrant:NE",0],["quadrant:NW",1],["quadrant:SE",2],["quadrant:SW",3]]);function l(e,r){const n=r.reticle??r.wafer?.reticle;return n&&a(e)?f(e,n):void 0}export const ringPlotValue=e=>`Ring ${e}`,DIE_REGIONS={ring:{key:"ring",label:"Ring",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?ringPlotValue(n.ring):void 0},rawOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?String(n.ring):void 0},grouping:{family:"ring",place:(e,r)=>{const n=i(e,r,"a ring");return n?{key:`ring:${n.ring}`,label:s(n.ring,r.ringCount)}:void 0},order:(e,r)=>e.localeCompare(r)}},quadrant:{key:"quadrant",label:"Quadrant",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>i(e,r,"a quadrant of a plot")?.quadrant,grouping:{family:"quadrant",place:(e,r)=>{const n=i(e,r,"a quadrant");return n?{key:`quadrant:${n.quadrant}`,label:n.quadrant}:void 0},order:(e,r)=>(t.get(e)??4)-(t.get(r)??4)}},reticleCell:{key:"reticleCell",label:"Reticle cell",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=l(e,r);return n?`Reticle cell (${n.column}, ${n.row})`:void 0},grouping:{family:"reticle-position",place:(e,r)=>{const n=l(e,r);return n?{key:`reticle-position:cell:${n.column},${n.row}`,label:`Reticle cell (${n.column}, ${n.row})`}:void 0},order:(e,r)=>e.localeCompare(r,void 0,{numeric:!0})}},reticleShot:{key:"reticleShot",label:"Reticle shot",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=r.reticle??r.wafer?.reticle;if(!n||!a(e))return;const{column:o,row:u}=d(e,n);return`Reticle shot (${o}, ${u})`}}};export function availableRegions(e,r){return DIE_REGION_KEYS.map(n=>DIE_REGIONS[n]).filter(n=>n.available(e,r))}
@@ -12,6 +12,12 @@ export interface ExamplePicks {
12
12
  partner?: number;
13
13
  /** The lot field whose values best separate the wafers' means of the lead test. */
14
14
  splitKey?: string;
15
+ /**
16
+ * The lot fields whose groups differ in yield, strongest set of groups first. Fields that group the wafers identically (a
17
+ * tester and the handler docked to it) are listed together, so each is offered; a set is read after allowing for the
18
+ * strongest other one, as in What stands out. Absent when no field divides the wafers' yield.
19
+ */
20
+ yieldKeys?: string[];
15
21
  }
16
22
  /**
17
23
  * `tests` in order of how much each has to show: the share of its variation that lies between wafers (a shift, a drift,
@@ -1 +1 @@
1
- import{testValuesReader as K}from"../core/dieTable.js";import{facetValueOf as L}from"./facets.js";import{dieRadialPosition as U}from"./dieRegions.js";import{pearsonOfPairs as W}from"./correlation.js";import{sampleVariance as j}from"./math.js";const v=4e3,O=60,z=20,I=c=>Math.sqrt(j(c));function P(c,f){const u=Math.min(c.length,f.length);return u<z?0:W(Array.from({length:u},(E,a)=>({x:c[a],y:f[a]}))).r??0}export function pickExamples(c,f,u,E){const a=f.slice(0,O),N=c.reduce((n,e)=>n+e.dies.length,0);if(a.length===0||N===0)return{ranked:[...f]};const T=Math.max(1,Math.ceil(N/v)),X=K(a),_=new Float64Array(a.length),i=a.map(()=>[]),b=[],x=[],A=c.map(()=>[]);let q=0;c.forEach((n,e)=>{for(const o of n.dies){if(q++%T)continue;X(o,_);const t=b.length;b.push(e),A[e].push(t),x.push(U(o,{wafer:n.wafer})??NaN);for(let r=0;r<a.length;r++)i[r].push(_[r])}});const k=n=>i[n].reduce((e,o,t)=>(Number.isFinite(o)&&e.push(t),e),[]),F=n=>A.map(e=>{const o=e.map(t=>i[n][t]).filter(Number.isFinite);return o.length>=3?o.reduce((t,r)=>t+r,0)/o.length:void 0}),p=a.map((n,e)=>{const o=k(e);if(o.length<z)return 0;if(c.length===1)return Math.abs(P(o.map(s=>i[e][s]),o.map(s=>x[s]))||0);const t=I(o.map(s=>i[e][s])),r=F(e).filter(s=>s!==void 0);return t>0&&r.length>=2?Math.min(1,I(r)/t):0}),m=a.map((n,e)=>e).sort((n,e)=>p[e]-p[n]||n-e),B=[...m.map(n=>a[n]),...f.slice(O)],d=m[0];if(p[d]<=0)return{ranked:[...f]};let g,R=.3;const D=k(d);for(const n of m.slice(1)){const e=D.filter(t=>Number.isFinite(i[n][t])),o=Math.abs(P(e.map(t=>i[d][t]),e.map(t=>i[n][t])));o>R&&(R=o,g=a[n])}let M,w=0;const S=F(d),l=S.filter(n=>n!==void 0),V=l.length?l.reduce((n,e)=>n+e,0)/l.length:0,y=l.reduce((n,e)=>n+(e-V)**2,0);if(y>0)for(const n of u){const e=new Map;if(c.forEach((t,r)=>{const s=L(t.metadata,n,E),h=S[r];s!==void 0&&h!==void 0&&e.set(s,[...e.get(s)??[],h])}),e.size<2||e.size>Math.max(2,Math.floor(l.length/2)))continue;const o=[...e.values()].reduce((t,r)=>t+r.length*(r.reduce((s,h)=>s+h,0)/r.length-V)**2,0);o/y>w&&(w=o/y,M=n)}return{ranked:B,...g!==void 0?{partner:g}:{},...M&&w>.05?{splitKey:M}:{}}}
1
+ import{testValuesReader as z}from"../core/dieTable.js";import{facetValueOf as T}from"./facets.js";import{dieRadialPosition as j}from"./dieRegions.js";import{pearsonOfPairs as B}from"./correlation.js";import{benjaminiHochberg as G,sampleVariance as I}from"./math.js";import{adjustedFits as U,mergePartitions as X}from"./groupEffects.js";import{yieldCounts as C}from"./yield.js";const D=4e3,F=60,q=20,H=.1,O=o=>Math.sqrt(I(o));function P(o,l){const d=Math.min(o.length,l.length);return d<q?0:B(Array.from({length:d},(u,i)=>({x:o[i],y:l[i]}))).r??0}export function pickExamples(o,l,d,u){const i=l.slice(0,F),h=o.reduce((e,t)=>e+t.dies.length,0);if(i.length===0||h===0)return{ranked:[...l],...N(o,d,u)};const w=Math.max(1,Math.ceil(h/D)),_=z(i),g=new Float64Array(i.length),r=i.map(()=>[]),c=[],f=[],n=o.map(()=>[]);let M=0;o.forEach((e,t)=>{for(const s of e.dies){if(M++%w)continue;_(s,g);const a=c.length;c.push(t),n[t].push(a),f.push(j(s,{wafer:e.wafer})??NaN);for(let p=0;p<i.length;p++)r[p].push(g[p])}});const S=e=>r[e].reduce((t,s,a)=>(Number.isFinite(s)&&t.push(a),t),[]),x=e=>n.map(t=>{const s=t.map(a=>r[e][a]).filter(Number.isFinite);return s.length>=3?s.reduce((a,p)=>a+p,0)/s.length:void 0}),b=i.map((e,t)=>{const s=S(t);if(s.length<q)return 0;if(o.length===1)return Math.abs(P(s.map(m=>r[t][m]),s.map(m=>f[m]))||0);const a=O(s.map(m=>r[t][m])),p=x(t).filter(m=>m!==void 0);return a>0&&p.length>=2?Math.min(1,O(p)/a):0}),k=i.map((e,t)=>t).sort((e,t)=>b[t]-b[e]||e-t),R=[...k.map(e=>i[e]),...l.slice(F)],y=k[0];if(b[y]<=0)return{ranked:[...l],...N(o,d,u)};let E,A=.3;const V=S(y);for(const e of k.slice(1)){const t=V.filter(a=>Number.isFinite(r[e][a])),s=Math.abs(P(t.map(a=>r[y][a]),t.map(a=>r[e][a])));s>A&&(A=s,E=i[e])}const v=N(o,d,u,x(y));return{ranked:R,...E!==void 0?{partner:E}:{},...v}}function N(o,l,d,u){if(o.length<4)return{};const i=X(l.flatMap(r=>{const c=o.map(n=>T(n.metadata,r,d)),f=new Map;for(const n of c)n!==void 0&&f.set(n,(f.get(n)??0)+1);return f.size>=2&&f.size<=Math.max(2,Math.floor(o.length/2))&&[...f.values()].every(n=>n>=2)?[{key:r,groupOf:c}]:[]}));if(i.length===0)return{};const h=r=>{const c=U(r,i).filter(n=>n.fitted),f=G(c.map(n=>n.fitted.p));return c.map((n,M)=>({f:n,q:f[M]})).filter(n=>n.q<H).sort((n,M)=>n.f.fitted.p-M.f.fitted.p).map(n=>n.f.partition)},w=u?h(u)[0]?.keys[0]:void 0,_=o.map(r=>{const{pass:c,total:f}=C(r.dies,r.passBins);return f?c/f:void 0}),g=h(_).flatMap(r=>r.keys);return{...w?{splitKey:w}:{},...g.length?{yieldKeys:g}:{}}}
@@ -0,0 +1,66 @@
1
+ /** The group each wafer is in on one field (undefined: no value for it). */
2
+ export type GroupOf = ReadonlyArray<string | undefined>;
3
+ /** A set of groups, and every field that puts the wafers in exactly those groups. */
4
+ export interface Partition {
5
+ /** Which wafers are together, whatever the groups are called: equal for fields that group the wafers identically. */
6
+ id: string;
7
+ /** The fields, in the order given; the first names the set. */
8
+ keys: string[];
9
+ groupOf: GroupOf;
10
+ }
11
+ /** The wafers grouped as a number per group in order of first appearance, so equal groupings compare equal whatever their labels. */
12
+ export declare function partitionId(groupOf: GroupOf): string;
13
+ /** Fields that group the wafers identically are one partition. */
14
+ export declare function mergePartitions(fields: ReadonlyArray<{
15
+ key: string;
16
+ groupOf: GroupOf;
17
+ }>): Partition[];
18
+ /** Whether every group of `fine` lies inside one group of `coarse`: allowing for a finer set (a probe session) would remove the coarser one (its tester). */
19
+ export declare function nested(fine: GroupOf, coarse: GroupOf): boolean;
20
+ /** The wafers of each group that have a value, and the groups' comparison (undefined when it cannot be made). */
21
+ export interface GroupFit {
22
+ byGroup: Map<string, number[]>;
23
+ p: number;
24
+ }
25
+ /**
26
+ * `lostDf`: degrees of freedom already spent estimating means that were taken out of `values` (see {@link adjustedFits}), so
27
+ * a difference read from what is left is judged on the wafers that remain free, not as if no mean had been estimated.
28
+ */
29
+ export declare function fitGroups(values: ReadonlyArray<number | undefined>, groupOf: GroupOf, lostDf?: number): GroupFit | undefined;
30
+ /** The p below which another set of groups is allowed for before a set is read. */
31
+ export declare const ALLOW_FOR_P = 0.25;
32
+ /** One set of groups read against a measure. */
33
+ export interface AdjustedFit {
34
+ partition: Partition;
35
+ /** The values compared: the measure's own, or what is left of them after allowing for other sets of groups. */
36
+ used: Array<number | undefined>;
37
+ fitted?: GroupFit;
38
+ /** The first field of each set allowed for, when `used` is not the measure's own values. */
39
+ allowedFor?: string[];
40
+ }
41
+ /**
42
+ * Every partition read against `values`. Each is read after allowing for the strongest other set that explains the measure
43
+ * at all (a raw p under {@link ALLOW_FOR_P}) and does not sit inside it, and for every coarser set it divides, so a field
44
+ * another hides (a weak card on wafers that also differ by recipe) is still found, and a probe session is read beyond its
45
+ * card. A set read this way says which it allowed for.
46
+ */
47
+ export declare function adjustedFits(values: ReadonlyArray<number | undefined>, partitions: readonly Partition[]): AdjustedFit[];
48
+ /** How closely two sets of groups agree: wafers in matching groups, and wafers compared. */
49
+ export interface Overlap {
50
+ agree: number;
51
+ of: number;
52
+ }
53
+ /** Overlaps this share of wafers or more, short of identical, is worth saying (a tester and an operator who mostly go together). */
54
+ export declare const MIN_OVERLAP_SHARE = 0.75;
55
+ /**
56
+ * The wafers two sets of groups put in matching groups, when they have the same number of groups and each group of one matches a
57
+ * different group of the other (its commonest partner). Undefined when they cannot be matched that way: different numbers of
58
+ * groups, or two groups with the same partner (one set nests inside the other, which is a different thing to say). Identical
59
+ * sets agree on every wafer; they are one partition (see {@link mergePartitions}) and not reported as an overlap.
60
+ */
61
+ export declare function overlapOf(a: GroupOf, b: GroupOf): Overlap | undefined;
62
+ /** The sets among `partitions` that overlap `partition` without being identical to it, strongest first. */
63
+ export declare function overlapping(partition: Partition, partitions: readonly Partition[]): Array<{
64
+ partition: Partition;
65
+ } & Overlap>;
66
+ //# sourceMappingURL=groupEffects.d.ts.map
@@ -0,0 +1 @@
1
+ import{compareGroups as k}from"./groupCompare.js";import{fUpperTail as y,tTwoSided as z}from"./math.js";export function partitionId(r){const i=new Map;return r.map(t=>t===void 0?"-":String(i.get(t)??i.set(t,i.size).get(t))).join(",")}export function mergePartitions(r){const i=new Map;for(const t of r){const n=partitionId(t.groupOf),e=i.get(n);e?e.keys.push(t.key):i.set(n,{id:n,keys:[t.key],groupOf:t.groupOf})}return[...i.values()]}export function nested(r,i){const t=new Map;return r.every((n,e)=>n===void 0||(t.has(n)?t.get(n)===i[e]:(t.set(n,i[e]),!0)))}export function fitGroups(r,i,t=0){const n=new Map;if(r.forEach((s,a)=>{const o=i[a];s===void 0||!Number.isFinite(s)||o===void 0||(n.get(o)??n.set(o,[]).get(o)).push(a)}),n.size<2)return;const e=k([...n].map(([s,a])=>({key:s,values:a.map(o=>r[o])})));let p=e.welch?.p??e.kruskal?.p;if(e.welch&&t>0){const s=e.welch.df2-t;p=s<1?1:e.welch.method==="welch-t"?z(e.welch.statistic,s):y(e.welch.statistic,e.welch.df1,s)}return p===void 0||!Number.isFinite(p)?void 0:{byGroup:n,p}}export const ALLOW_FOR_P=.25;function S(r,i){const t=overlapOf(r,i);return!!t&&t.agree/t.of>=MIN_OVERLAP_SHARE}export function adjustedFits(r,i){const t=i.map(e=>({partition:e,fitted:fitGroups(r,e.groupOf)})),n=t.filter(e=>e.fitted).sort((e,p)=>e.fitted.p-p.fitted.p);return t.map(e=>{const p=n.filter(f=>f.partition.id!==e.partition.id&&f.fitted.p<ALLOW_FOR_P&&!nested(f.partition.groupOf,e.partition.groupOf)&&!S(f.partition.groupOf,e.partition.groupOf)),s=p.filter(f=>nested(e.partition.groupOf,f.partition.groupOf)),a=p.find(f=>!nested(e.partition.groupOf,f.partition.groupOf)),o=[...a?[a]:[],...s];let u=[...r],d=e.fitted,w;if(o.length>0){let f=0;for(const g of o){f+=Math.max(0,(g.fitted?.byGroup.size??1)-1);const h=new Map;u.forEach((l,m)=>{const c=g.partition.groupOf[m];l!==void 0&&c!==void 0&&(h.get(c)??h.set(c,[]).get(c)).push(l)});const O=new Map([...h].map(([l,m])=>[l,m.reduce((c,M)=>c+M,0)/m.length]));u=u.map((l,m)=>{const c=g.partition.groupOf[m];return l===void 0||c===void 0?void 0:l-O.get(c)})}d=fitGroups(u,e.partition.groupOf,f)??e.fitted,d!==e.fitted&&(w=o.map(g=>g.partition.keys[0]))}return{partition:e.partition,used:d===e.fitted?[...r]:u,fitted:d,...w?{allowedFor:w}:{}}})}export const MIN_OVERLAP_SHARE=.75;export function overlapOf(r,i){const t=r.flatMap((o,u)=>o!==void 0&&i[u]!==void 0?[[o,i[u]]]:[]),n=new Set(t.map(o=>o[0])),e=new Set(t.map(o=>o[1]));if(t.length===0||n.size<2||n.size!==e.size)return;const p=new Map;for(const[o,u]of t){const d=p.get(o)??p.set(o,new Map).get(o);d.set(u,(d.get(u)??0)+1)}const s=new Map;let a=0;for(const[o,u]of p){const[d,w]=[...u].sort((f,g)=>g[1]-f[1]||(f[0]<g[0]?-1:1))[0];s.set(o,d),a+=w}return new Set(s.values()).size===n.size?{agree:a,of:t.length}:void 0}export function overlapping(r,i){return i.filter(t=>t.id!==r.id).flatMap(t=>{const n=overlapOf(r.groupOf,t.groupOf);return n&&n.agree<n.of&&n.agree/n.of>=MIN_OVERLAP_SHARE?[{partition:t,...n}]:[]}).sort((t,n)=>n.agree/n.of-t.agree/t.of)}