@wafertools/wafermap 0.35.1 → 0.36.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 (73) hide show
  1. package/AGENTS.md +11 -8
  2. package/CHANGELOG.md +117 -0
  3. package/README.md +3 -3
  4. package/dist/packages/canvas-adapter/chartPrefs.d.ts +16 -0
  5. package/dist/packages/canvas-adapter/chartPrefs.js +1 -0
  6. package/dist/packages/canvas-adapter/charts/boxplot.js +1 -1
  7. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  8. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  9. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  10. package/dist/packages/canvas-adapter/index.d.ts +1 -0
  11. package/dist/packages/canvas-adapter/index.js +1 -1
  12. package/dist/packages/canvas-adapter/insightsTab.d.ts +7 -0
  13. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  14. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +20 -5
  15. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  16. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +71 -37
  17. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  18. package/dist/packages/canvas-adapter/summaryPanel.d.ts +7 -4
  19. package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
  20. package/dist/packages/canvas-adapter/testValueOffer.d.ts +14 -0
  21. package/dist/packages/canvas-adapter/testValueOffer.js +1 -0
  22. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  23. package/dist/packages/canvas-adapter/toolbar.d.ts +0 -6
  24. package/dist/packages/canvas-adapter/toolbar.js +1 -1
  25. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  26. package/dist/packages/canvas-adapter/userGuideHtml.js +10 -3
  27. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  28. package/dist/packages/canvas-adapter/version.js +1 -1
  29. package/dist/packages/canvas-adapter/warnings.js +1 -1
  30. package/dist/packages/core/aggregates.d.ts +10 -0
  31. package/dist/packages/core/aggregates.js +1 -1
  32. package/dist/packages/core/dieTable.d.ts +5 -0
  33. package/dist/packages/core/dieTable.js +1 -1
  34. package/dist/packages/core/wafer.d.ts +10 -1
  35. package/dist/packages/core/wafer.js +1 -1
  36. package/dist/packages/renderer/buildView.d.ts +5 -0
  37. package/dist/packages/renderer/buildView.js +1 -1
  38. package/dist/packages/renderer/buildWaferMap.d.ts +19 -4
  39. package/dist/packages/renderer/buildWaferMap.js +1 -1
  40. package/dist/packages/renderer/derivedTests/parser.js +1 -1
  41. package/dist/packages/renderer/fmt.d.ts +10 -0
  42. package/dist/packages/renderer/fmt.js +1 -1
  43. package/dist/packages/renderer/index.d.ts +1 -0
  44. package/dist/packages/renderer/index.js +1 -1
  45. package/dist/packages/renderer/valueFilter.d.ts +1 -1
  46. package/dist/packages/renderer/valueFilter.js +1 -1
  47. package/dist/packages/stats/analyzeWaferLot.d.ts +16 -0
  48. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  49. package/dist/packages/stats/analyzeWaferMap.d.ts +18 -1
  50. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  51. package/dist/packages/stats/clusterDetection.js +1 -1
  52. package/dist/packages/stats/connectedComponents.js +1 -1
  53. package/dist/packages/stats/correlation.d.ts +36 -4
  54. package/dist/packages/stats/correlation.js +1 -1
  55. package/dist/packages/stats/filterFindings.d.ts +1 -1
  56. package/dist/packages/stats/filterFindings.js +1 -1
  57. package/dist/packages/stats/findingText.d.ts +8 -0
  58. package/dist/packages/stats/findingText.js +2 -2
  59. package/dist/packages/stats/index.d.ts +2 -1
  60. package/dist/packages/stats/index.js +1 -1
  61. package/dist/packages/stats/lotDrift.js +1 -1
  62. package/dist/packages/stats/mergeTestDefs.js +1 -1
  63. package/dist/packages/stats/plotData.js +1 -1
  64. package/dist/packages/stats/renderSummaryReport.js +27 -27
  65. package/dist/packages/stats/reportHtml.d.ts +5 -12
  66. package/dist/packages/stats/reportHtml.js +96 -34
  67. package/dist/packages/stats/synthesis.d.ts +4 -0
  68. package/dist/packages/stats/synthesis.js +1 -1
  69. package/dist/packages/stats/testPassRate.js +1 -1
  70. package/dist/packages/stats/testValueBudget.d.ts +15 -0
  71. package/dist/packages/stats/testValueBudget.js +1 -0
  72. package/dist/packages/stats/types.d.ts +77 -22
  73. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
- import{SYNTHESIS_ALSO_HEADING as f,synthesisRowShare as x}from"./synthesis.js";import{formatFindingTooltip as v}from"./findingText.js";import{arrangeFindings as $}from"./filterFindings.js";import{SEVERITY_MARK as b,METER_DOTS as w,filledDots as y,impactWord as k,impactShortWord as S,shortfallColor as h,shortfallStep as z,formatPoints as j,barPercent as M}from"./presentation.js";import{fmt as u,plainBinTerms as T}from"../renderer/fmt.js";import{buildFacetTable as F,attributeLabel as N}from"./facets.js";import{escHtml as o}from"../core/utils.js";import{derivedKeyText as A,derivedFields as D}from"../renderer/testLabel.js";export function renderSection(t,r,e="",a){return`<section class="${["report-section",e].filter(Boolean).join(" ")}"${a?` id="${o(a)}"`:""}>
2
- <h2>${o(t)}</h2>
1
+ import{SYNTHESIS_ALSO_HEADING as v,synthesisMoreTests as w,synthesisRowShare as $}from"./synthesis.js";import{formatFindingTooltip as y,findingMetricLabel as k,isProportionFinding as S}from"./findingText.js";import{arrangeFindings as z}from"./filterFindings.js";import{SEVERITY_MARK as b,METER_DOTS as j,filledDots as T,impactWord as N,impactShortWord as I,shortfallColor as h,shortfallStep as M,formatPoints as F,barPercent as A}from"./presentation.js";import{fmt as f,plainBinTerms as E}from"../renderer/fmt.js";import{buildFacetTable as L,attributeLabel as D}from"./facets.js";import{escHtml as o}from"../core/utils.js";import{derivedKeyText as _,derivedFields as R}from"../renderer/testLabel.js";export function renderSection(e,r,t="",a){return`<section class="${["report-section",t].filter(Boolean).join(" ")}"${a?` id="${o(a)}"`:""}>
2
+ <h2>${o(e)}</h2>
3
3
  ${r}
4
- </section>`}export function renderDefinitionList(t,r="meta-list"){if(!t.length)return"";const e=t.map(a=>`<div class="definition-item"><dt>${o(a.label)}</dt><dd>${o(a.value)}</dd></div>`).join(`
4
+ </section>`}export function renderDefinitionList(e,r="meta-list"){if(!e.length)return"";const t=e.map(a=>`<div class="definition-item"><dt>${o(a.label)}</dt><dd>${o(a.value)}</dd></div>`).join(`
5
5
  `);return`<dl class="${r}">
6
- ${e}
7
- </dl>`}export function buildMetadataRows(t){return F(t,{facetableOnly:t.length>1}).map(e=>({label:N(e.key),value:e.values.map(a=>a.value).join(", ")}))}export function renderMetadataSection(t){const r=buildMetadataRows(t);return r.length?renderSection("Wafer Info",renderDefinitionList(r)):""}export function renderMetricGrid(t){return t.length?`<dl class="metric-grid">
8
- ${t.map(e=>`<div class="metric">
9
- <dt>${o(e.label)}</dt>
10
- <dd>${o(e.value)}</dd>
11
- ${e.hint?`<span class="metric-hint">${o(e.hint)}</span>`:""}
6
+ ${t}
7
+ </dl>`}export function buildMetadataRows(e){return L(e,{facetableOnly:e.length>1}).map(t=>({label:D(t.key),value:t.values.map(a=>a.value).join(", ")}))}export function renderMetadataSection(e){const r=buildMetadataRows(e);return r.length?renderSection("Wafer Info",renderDefinitionList(r)):""}export function renderMetricGrid(e){return e.length?`<dl class="metric-grid">
8
+ ${e.map(t=>`<div class="metric">
9
+ <dt>${o(t.label)}</dt>
10
+ <dd>${o(t.value)}</dd>
11
+ ${t.hint?`<span class="metric-hint">${o(t.hint)}</span>`:""}
12
12
  </div>`).join(`
13
13
  `)}
14
- </dl>`:""}export function renderTable(t,r,e={}){if(!r.length)return`<p class="no-data">${o(e.emptyMessage??"No data")}</p>`;const a=["report-table",e.className].filter(Boolean).join(" "),l=t.map(s=>`<th>${o(s)}</th>`).join(""),c=s=>typeof s=="string"?`<td>${s}</td>`:`<td${s.className?` class="${s.className}"`:""}>${s.html}</td>`,p=r.map(s=>`<tr>${s.map(c).join("")}</tr>`).join(`
14
+ </dl>`:""}export function renderTable(e,r,t={}){if(!r.length)return`<p class="no-data">${o(t.emptyMessage??"No data")}</p>`;const a=["report-table",t.className].filter(Boolean).join(" "),l=e.map(s=>`<th>${o(s)}</th>`).join(""),c=s=>typeof s=="string"?`<td>${s}</td>`:`<td${s.className?` class="${s.className}"`:""}>${s.html}</td>`,p=r.map(s=>`<tr>${s.map(c).join("")}</tr>`).join(`
15
15
  `);return`<table class="${a}">
16
16
  <thead><tr>${l}</tr></thead>
17
17
  <tbody>${p}</tbody>
18
- </table>`}export function renderMeter(t,r){const e=y(t);return`<span class="meter"><span class="meter-dots" aria-hidden="true">${"\u25CF".repeat(e)}${"\u25CB".repeat(w-e)}</span><span class="meter-word">${o(r)}</span></span>`}export function renderSeverityMeter(t){const{tier:r,word:e}=b[t];return renderMeter(r,e)}export const severityTier=t=>b[t].tier;export function barCell(t,r,e="",a){const l=a?`;background:${o(a)}`:"";return{html:`<span class="cellbar"><i style="width:${M(t).toFixed(1)}%${l}"></i><span>${o(r)}</span></span>`,className:["barcell",e].filter(Boolean).join(" ")}}export function deltaCell(t){const r=z(t);return{html:o(j(t)),className:["numeric",r?`low-${r}`:""].filter(Boolean).join(" ")}}export function withSectionNav(t,r=""){const e=[];let a=0;const l=t.replace(/<section class="(report-section[^"]*)"(?: id="([^"]*)")?>(\s*<h2>)(.*?)(<\/h2>)/g,(p,s,i,d,n,g)=>{++a;const m=i??`sec-${r}${a}`;return e.push({id:m,title:n}),`<section class="${s}" id="${m}">${d}${n}${g}`});return e.length<4?t:`<nav class="report-toc" aria-label="Sections">${e.map(p=>`<a href="#${p.id}">${p.title}</a>`).join("")}</nav>
19
- ${l}`}export function formatFindingDelta(t){const r=t.effect.absoluteDelta??0,e=r>0?"+":r<0?"\u2212":"";if(t.variable.kind==="yield"||t.variable.kind==="hardBin"||t.variable.kind==="softBin")return`${e}${Math.abs(r*100).toFixed(1)} pp`;if(t.variable.kind==="test"){if(t.effect.relativeDelta!==void 0&&Number.isFinite(t.effect.relativeDelta)){const a=Math.abs(t.effect.relativeDelta*100).toFixed(1);return`${e}${a}%`}return`${e}${u(Math.abs(r),t.variable.unit)}`}return`${e}${u(Math.abs(r),t.variable.unit)}`}export function derivedFindingsKeyHtml(t){const r=A(t.map(e=>({label:e.variable.label,...D(e.variable)})));return r?`<p class="report-note">${o(r)}</p>`:""}export function findingAnchor(t,r=""){return`finding-${r}`+t.replace(/[^A-Za-z0-9]/g,e=>`_${e.charCodeAt(0).toString(16)}_`)}export function findingsTableHtml(t,r,e,a=!1){const l=$(t),c=[...l.patterns.flatMap(i=>[{f:i.finding,nested:!1},...i.children.map(d=>({f:d,nested:!0}))]),...l.groups.flatMap(i=>i.findings.map(d=>({f:d,nested:!1})))],p=c.length?c.map(({f:i,nested:d})=>`<tr class="tier-${severityTier(i.severity)}${d?" nested":""}${a?" live":""}"${e!==void 0?` id="${findingAnchor(i.id,e)}"`:""}${a?` data-finding="${o(i.id)}"`:""} title="${o(v(i))}${a?`
18
+ </table>`}export function renderMeter(e,r){const t=T(e);return`<span class="meter"><span class="meter-dots" aria-hidden="true">${"\u25CF".repeat(t)}${"\u25CB".repeat(j-t)}</span><span class="meter-word">${o(r)}</span></span>`}export function renderSeverityMeter(e){const{tier:r,word:t}=b[e];return renderMeter(r,t)}export const severityTier=e=>b[e].tier;export function barCell(e,r,t="",a){const l=a?`;background:${o(a)}`:"";return{html:`<span class="cellbar"><span class="cellbar-value">${o(r)}</span><span class="cellbar-track" aria-hidden="true"><i style="width:${A(e).toFixed(1)}%${l}"></i></span></span>`,className:["barcell",t].filter(Boolean).join(" ")}}export function deltaCell(e){const r=M(e);return{html:o(F(e)),className:["numeric",r?`low-${r}`:""].filter(Boolean).join(" ")}}export function withSectionNav(e,r=""){const t=[];let a=0;const l=e.replace(/<section class="(report-section[^"]*)"(?: id="([^"]*)")?>(\s*<h2>)(.*?)(<\/h2>)/g,(p,s,n,d,m,i)=>{++a;const g=n??`sec-${r}${a}`;return t.push({id:g,title:m}),`<section class="${s}" id="${g}">${d}${m}${i}`});return t.length<4?e:`<nav class="report-toc" aria-label="Sections">${t.map(p=>`<a href="#${p.id}">${p.title}</a>`).join("")}</nav>
19
+ ${l}`}export function formatFindingDelta(e){if(e.variable.kind==="spatialPattern")return"\u2014";const r=e.effect.absoluteDelta??0,t=r>0?"+":r<0?"\u2212":"";if(S(e))return`${t}${Math.abs(r*100).toFixed(1)} pp`;if(e.variable.kind==="test"){if(e.effect.relativeDelta!==void 0&&Number.isFinite(e.effect.relativeDelta)){const a=Math.abs(e.effect.relativeDelta*100).toFixed(1);return`${t}${a}%`}return`${t}${f(Math.abs(r),e.variable.unit)}`}return`${t}${f(Math.abs(r),e.variable.unit)}`}export function derivedFindingsKeyHtml(e){const r=_(e.map(t=>({label:t.variable.label,...R(t.variable)})));return r?`<p class="report-note">${o(r)}</p>`:""}export function findingAnchor(e,r=""){return`finding-${r}`+e.replace(/[^A-Za-z0-9]/g,t=>`_${t.charCodeAt(0).toString(16)}_`)}const B="Indented rows are the findings a pattern explains, most severe first. The other findings follow, grouped by region, most severe first.";export function findingsTableHtml(e,r,t,a=!1){const l=z(e),c=[...l.patterns.flatMap(n=>[{f:n.finding,nested:!1},...n.children.map(d=>({f:d,nested:!0}))]),...l.groups.flatMap(n=>n.findings.map(d=>({f:d,nested:!1})))],p=c.length?c.map(({f:n,nested:d})=>`<tr class="tier-${severityTier(n.severity)}${d?" nested":""}${a?" live":""}"${t!==void 0?` id="${findingAnchor(n.id,t)}"`:""}${a?` data-finding="${o(n.id)}"`:""} title="${o(y(n))}${a?`
20
20
  Click to show it on the map`:""}">
21
- <td class="tight">${renderSeverityMeter(i.severity)}</td>
22
- <td class="tight">${o(i.comparison.left)}</td>
23
- <td>${o(T(i.variable.label))}</td>
24
- <td class="numeric">${o(formatFindingDelta(i))}</td>
25
- <td class="numeric">${o(formatFindingCoverage(i,r))}</td>
21
+ <td class="tight">${renderSeverityMeter(n.severity)}</td>
22
+ <td class="tight">${o(n.comparison.left)}</td>
23
+ <td>${o(E(k(n)))}</td>
24
+ <td class="numeric">${o(formatFindingDelta(n))}</td>
25
+ <td class="numeric">${o(formatFindingCoverage(n,r))}</td>
26
26
  </tr>`).join(`
27
27
  `):'<tr><td colspan="5" class="no-data">No significant findings</td></tr>';return`<table class="report-table findings-table compact">
28
28
  <thead>
@@ -37,23 +37,68 @@ Click to show it on the map`:""}">
37
37
  <tbody>
38
38
  ${p}
39
39
  </tbody>
40
- </table>${derivedFindingsKeyHtml(t)}`}export function synthesisSectionHtml(t,r){const e=(n,g)=>{const m=r(g);return m?`<a href="#${o(m)}">${o(n)}</a>`:o(n)},[a,...l]=t.items,c=[...l,...t.also?.items??[]],p=t.also?.more??0,s=a?[e(a.subject,a.target),...a.chips.map(n=>e(n.label,n.target))]:[],i=a?`<ol class="synthesis-items">
41
- <li class="tier-${a.impact}">${renderMeter(a.impact,k(a.impact))}<span>${o(a.text)}<span class="synthesis-see">See: ${s.join(" \xB7 ")}</span></span></li>
42
- </ol>`:`<p class="synthesis-none">${o(t.nothing??"Nothing stands out.")}</p>`,d=c.length?`<p class="synthesis-smaller">${o(f)}</p>
40
+ </table>${l.patterns.length?`<p class="report-note">${o(B)}</p>`:""}${derivedFindingsKeyHtml(e)}`}export function synthesisSectionHtml(e,r){const t=(i,g)=>{const u=r(g);return u?`<a href="#${o(u)}">${o(i)}</a>`:o(i)},[a,...l]=e.items,c=[...l,...e.also?.items??[]],p=e.also?.more??0,s=a?[t(a.subject,a.target),...a.chips.map(i=>t(i.label,i.target))]:[],n=a&&w(a);n&&s.push(o(n));const d=a?`<ol class="synthesis-items">
41
+ <li class="tier-${a.impact}">${renderMeter(a.impact,N(a.impact))}<span>${o(a.text)}<span class="synthesis-see">See: ${s.join(" \xB7 ")}</span></span></li>
42
+ </ol>`:`<p class="synthesis-none">${o(e.nothing??"Nothing stands out.")}</p>`,m=c.length?`<p class="synthesis-smaller">${o(v)}</p>
43
43
  <ul class="synthesis-more">
44
- ${c.map(n=>`<li>${renderMeter(n.impact,S(n.impact))}<span>${e(n.brief,n.target)}</span><span class="synthesis-share">${o(x(n))}</span></li>`).join(`
44
+ ${c.map(i=>`<li>${renderMeter(i.impact,I(i.impact))}<span>${t(i.brief,i.target)}</span><span class="synthesis-share">${o($(i))}</span></li>`).join(`
45
45
  `)}${p?`
46
46
  <li class="synthesis-rest"><span></span><span>and ${p} more</span><span></span></li>`:""}
47
- </ul>`:"";return renderSection("What stands out",`<p class="synthesis-headline">${o(t.headline)}</p>
48
- ${i}
47
+ </ul>`:"";return renderSection("What stands out",`<p class="synthesis-headline">${o(e.headline)}</p>
49
48
  ${d}
50
- ${t.watch?`<ul class="synthesis-watch">${t.watch.map(n=>`<li><strong>Watch</strong> ${e(n.text,n.target)}</li>`).join("")}</ul>`:""}
51
- <p class="synthesis-checked">${o(t.checked)}</p>`,"synthesis")}export const LIVE_FINDINGS_SCRIPT=`<script>
49
+ ${m}
50
+ ${e.watch?`<ul class="synthesis-watch">${e.watch.map(i=>`<li><strong>Watch</strong> ${t(i.text,i.target)}</li>`).join("")}</ul>`:""}
51
+ <p class="synthesis-checked">${o(e.checked)}</p>`,"synthesis")}const x=`<script>
52
+ (function () {
53
+ var embedded = location.href === 'about:srcdoc';
54
+ var stack = [];
55
+ var btn = document.createElement('button');
56
+ btn.type = 'button';
57
+ btn.className = 'report-back';
58
+ btn.textContent = '\u2190 Back';
59
+ btn.title = 'Back to where you were (Alt+\u2190)';
60
+ btn.hidden = true;
61
+ document.body.appendChild(btn);
62
+ function restore() {
63
+ var from = stack.pop();
64
+ if (!from) return;
65
+ window.scrollTo(0, from.y);
66
+ if (from.link) from.link.focus({ preventScroll: true });
67
+ btn.hidden = stack.length === 0;
68
+ }
69
+ function goBack() { if (stack.length) { if (embedded) restore(); else history.back(); } }
70
+ document.addEventListener('click', function (e) {
71
+ var a = e.target.closest && e.target.closest('a[href^="#"]');
72
+ if (!a) return;
73
+ var id = decodeURIComponent(a.getAttribute('href').slice(1));
74
+ var target = document.getElementById(id);
75
+ if (!target) return;
76
+ e.preventDefault();
77
+ stack.push({ y: window.scrollY, link: a });
78
+ if (!embedded) history.pushState({ wmapReportJump: stack.length }, '', '#' + id);
79
+ target.scrollIntoView({ block: 'start' });
80
+ if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');
81
+ target.focus({ preventScroll: true });
82
+ // Marked for a moment: near the end of the page the target cannot reach the top, and
83
+ // without the mark nothing says which row the link meant.
84
+ target.classList.remove('report-jumped');
85
+ void target.offsetWidth;
86
+ target.classList.add('report-jumped');
87
+ btn.hidden = false;
88
+ });
89
+ btn.addEventListener('click', goBack);
90
+ document.addEventListener('keydown', function (e) {
91
+ if (e.altKey && e.key === 'ArrowLeft' && stack.length) { e.preventDefault(); goBack(); }
92
+ });
93
+ window.addEventListener('popstate', function () { if (stack.length) restore(); });
94
+ })();
95
+ <\/script>`;export function reportScripts(e){return e?`${x}
96
+ ${LIVE_FINDINGS_SCRIPT}`:x}export const LIVE_FINDINGS_SCRIPT=`<script>
52
97
  document.addEventListener('click', function (e) {
53
98
  var row = e.target.closest && e.target.closest('[data-finding]');
54
99
  if (row && window.parent !== window) window.parent.postMessage({ wmapFinding: row.getAttribute('data-finding') }, '*');
55
100
  });
56
- <\/script>`;export function formatFindingCoverage(t,r){return r!==void 0?`${t.stats.sampleSizeLeft}/${r}`:`${t.stats.sampleSizeLeft}/${t.stats.sampleSizeRight}`}export function reportStyles(){return`
101
+ <\/script>`;export function formatFindingCoverage(e,r){return r!==void 0?`${e.stats.sampleSizeLeft}/${r}`:`${e.stats.sampleSizeLeft}/${e.stats.sampleSizeRight}`}export function reportStyles(){return`
57
102
  :root {
58
103
  --report-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
59
104
  --report-text: #1f2328;
@@ -336,19 +381,35 @@ document.addEventListener('click', function (e) {
336
381
  .report-toc a { color: var(--report-muted); text-decoration: none; }
337
382
  .report-toc a:hover { color: var(--report-text); text-decoration: underline; }
338
383
 
339
- /* The value is always printed; the bar behind it is for scanning a column. */
384
+ /* Shown after an in-page jump; returns to where the reader was. */
385
+ .report-back {
386
+ position: fixed; right: 16px; bottom: 16px; z-index: 10;
387
+ font: 600 13px var(--report-font); color: var(--report-link);
388
+ background: #fff; border: 1px solid var(--report-line-strong); border-radius: 4px;
389
+ padding: 6px 12px; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
390
+ }
391
+ .report-back:hover { background: var(--report-surface); }
392
+ .report-back:focus-visible { outline: 2px solid var(--report-link); outline-offset: 2px; }
393
+ .report-back[hidden] { display: none; }
394
+ [tabindex="-1"]:focus { outline: none; }
395
+ .report-jumped { animation: report-jumped 2s ease-out; }
396
+ @keyframes report-jumped {
397
+ 0%, 60% { outline: 2px solid var(--report-link); outline-offset: -2px; }
398
+ 100% { outline: 2px solid transparent; outline-offset: -2px; }
399
+ }
400
+ @media (prefers-reduced-motion: reduce) { .report-jumped { animation-duration: 0.01s; animation-delay: 1.5s; animation-fill-mode: backwards; } }
401
+
402
+ /* The value is always printed; the bar beside it is for scanning a column. */
340
403
  table.report-table td.barcell { min-width: 150px; }
341
- .cellbar { position: relative; display: block; }
404
+ .cellbar { display: flex; align-items: center; gap: 8px; }
405
+ .cellbar-value { flex: none; min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
406
+ .cellbar-track { flex: 1; height: 12px; }
342
407
  .cellbar i {
343
- position: absolute;
344
- left: 0;
345
- top: 50%;
346
- height: 12px;
347
- transform: translateY(-50%);
408
+ display: block;
409
+ height: 100%;
348
410
  background: var(--report-bar);
349
411
  border-radius: 0 2px 2px 0;
350
412
  }
351
- .cellbar span { position: relative; padding-left: 4px; }
352
413
 
353
414
  /* Shortfall below the reference, light to strong. Full ink on every tint (see the tier tokens). */
354
415
  table.report-table td.low-1 { background: var(--report-low-1); }
@@ -416,6 +477,7 @@ document.addEventListener('click', function (e) {
416
477
  }
417
478
 
418
479
  .report-toc { display: none; }
480
+ .report-back { display: none; }
419
481
 
420
482
  section.report-section,
421
483
  tr {
@@ -41,6 +41,8 @@ export interface SynthesisItem {
41
41
  target: SynthesisTarget;
42
42
  /** Its parts that can be shown alone, in the order the sentence names them. Empty for a single-part item. */
43
43
  chips: SynthesisChip[];
44
+ /** Tests folded into the item beyond its chips, counted rather than listed. Absent when every test is a chip. */
45
+ moreTests?: number;
44
46
  /** The leading finding, then the others that stand on the same dies. */
45
47
  findingIds: string[];
46
48
  /** Tests the item names: its own test, or tests whose failing dies lie mostly on its dies. */
@@ -98,6 +100,8 @@ export declare function buildSynthesis(input: StatsSummary | LotStatsSummary, ct
98
100
  export declare const SYNTHESIS_ALSO_HEADING: string;
99
101
  /** A compact-list row: the item in a few words, then its share of the analysed dies. Plain text. */
100
102
  export declare const synthesisRowShare: (it: SynthesisItem) => string;
103
+ /** After an item's chips: the folded tests not shown as one. Undefined when every test is a chip. Plain text. */
104
+ export declare const synthesisMoreTests: (it: SynthesisItem) => string | undefined;
101
105
  /** A synthesis as plain text, one line per item, for tests and for any surface that is not HTML. */
102
106
  export declare function synthesisText(s: Synthesis): string;
103
107
  //# sourceMappingURL=synthesis.d.ts.map
@@ -1,2 +1,2 @@
1
- import{maxOf as ee,minOf as te}from"../core/utils.js";import{isPassBin as se,passBinsLabel as ie}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as ne}from"./lotDrift.js";import{plainBinTerms as oe}from"../renderer/fmt.js";const ae=2,T=1,Y=3,q=5,D=.01,re=.02,le=.04,de=.15,ce=.4,fe=.5,he=.1,ue=2,pe=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function ge(e){const i=e.highlight;return"dieKeysByWafer"in i&&i.dieKeysByWafer?Object.values(i.dieKeysByWafer).reduce((s,o)=>s+o.length,0):"dieKeys"in i&&i.dieKeys&&i.dieKeys.length>0?i.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function X(e){const i=e.highlight,s=new Set;if("dieKeysByWafer"in i&&i.dieKeysByWafer)for(const[o,l]of Object.entries(i.dieKeysByWafer))for(const t of l)s.add(`${o}:${t}`);else if("dieKeys"in i&&i.dieKeys)for(const o of i.dieKeys)s.add(o);return s}const $=e=>Math.abs(e.effect.absoluteDelta??0),_=e=>$(e)*(ge(e)??0),v=e=>(e*100).toFixed(1),x=e=>{const i=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return oe(i)},p=e=>Math.round(e).toLocaleString("en-GB"),k=(e,i,s=`${i}s`)=>`${p(e)} ${e===1?i:s}`;function F(e){const i=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(i)?`${i} quadrant`:i}function $e(e){const i=e.map((t,r)=>r),s=t=>i[t]===t?t:i[t]=s(i[t]),o=e.map(X);for(let t=0;t<e.length;t++)for(let r=t+1;r<e.length;r++){const n=o[t].size<=o[r].size?o[t]:o[r],d=n===o[t]?o[r]:o[t];if(n.size===0)continue;let c=0;for(const h of n)d.has(h)&&c++;c>=fe*n.size&&(i[s(t)]=s(r))}const l=new Map;return e.forEach((t,r)=>{const n=s(r);(l.get(n)??l.set(n,[]).get(n)).push(r)}),[...l.values()]}const G=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",P=(e,i)=>e.level===i.level&&e.comparison.family===i.comparison.family&&e.comparison.left===i.comparison.left;function me(e,i,s){const o=t=>i.filter(r=>r.variable.kind===t&&P(r,e)&&r.effect.direction==="higher"&&s(r));return(o("hardBin").length>0?o("hardBin"):o("softBin")).filter(t=>t!==e).sort((t,r)=>$(r)-$(t))}const we={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},be=2;function ye(e){const i=new Map;for(const o of e){const l=o.comparison.family;(i.get(l)??i.set(l,new Set).get(l)).add(F(o))}const s=[];for(const[o,l]of i)l.size<=be?s.push(...l):s.push(`${l.size} ${we[o]??o}`);return s.join(", ")}const Se=e=>e.charAt(0).toUpperCase()+e.slice(1),E=e=>({kind:"finding",id:e.id}),Ie=e=>({label:Se(x(e)),target:E(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function ve(e,i,s,o){const l=[...e].sort((f,y)=>_(y)-_(f))[0],t=e.find(f=>o.isPassRate(f)&&P(f,l))??l,r=e.filter(f=>f!==t),n=t.level==="lot"&&"waferIndices"in t.highlight?t.highlight.waferIndices?.length:void 0,d=n!==void 0&&s?` on ${n}/${s} wafers`:"",c=!o.isPassRate(t),h=t.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let m=c?`${F(t)}: ${x(t)} ${v($(t))} points higher than ${h}${d}`:`${F(t)}: pass rate ${v($(t))} points below ${h}${d}`;const u=me(t,i,o.isFailBin).map(f=>({f,share:$(f)/($(t)||1)})).filter(f=>c||f.share>=he).slice(0,ue);if(c)for(const{f}of u)m+=`, ${x(f)} ${v($(f))} points higher`;else if(u.length>0){const f=u.reduce((I,B)=>I+B.share,0)<=1.000000001,y=f&&u[0].share>.5?"mostly ":"";u.forEach(({f:I},B)=>{m+=B===0?`; ${f?y:""}`:", ",m+=x(I)+(B===0?f?` accounts for ${v($(I))} of those points`:` is ${v($(I))} points higher`:f?` for ${v($(I))}`:` ${v($(I))} points higher`)})}m+=` \u2014 about ${p(_(t))} dies lost`;const g=r.filter(f=>!P(f,t));g.length>0&&(m+=` (also seen as ${ye(g)})`);const b=c?x(t):"pass rate";return{impact:"low",shareOfDies:0,diesLost:_(t),severity:t.severity,text:m,brief:`${F(t)}: ${b}, ${p(_(t))} dies`,subject:F(t),target:E(t),chips:[...c?[t]:[],...u.map(({f})=>f)].map(Ie),findingIds:[t.id,...r.map(f=>f.id)],testNumbers:[]}}function ke(e,i){return e>=le||i>=ce?"high":e>=re||i>=de?"medium":"low"}function Be(e){const i=s=>s.stats.yieldPercent==null?0:s.stats.analyzedDies*(1-s.stats.yieldPercent/100);return e.level==="wafer"?i(e):e.perWafer.reduce((s,o)=>s+i(o.summary),0)}function De(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((i,s)=>i+s.summary.stats.analyzedDies,0)}const U=e=>e.id.startsWith("inter-wafer:yield:");function _e(e){const i=[];for(const s of e.findings){if(!U(s)||s.effect.direction!=="lower")continue;const o="waferIndices"in s.highlight?s.highlight.waferIndices?.[0]:void 0,l=o===void 0?void 0:e.perWafer.find(t=>t.waferIndex===o)?.summary.stats.analyzedDies;l!==void 0&&i.push({impact:"low",shareOfDies:0,diesLost:$(s)*l,severity:s.severity,text:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${p($(s)*l)} dies lost`,brief:`${s.comparison.left}: yield, ${p($(s)*l)} dies`,subject:s.comparison.left,target:E(s),chips:[],findingIds:[s.id],testNumbers:[]})}return i}function Me(e,i){if(e.level==="wafer"){const t=e.stats.testFailures?.[i];return t?{keys:new Set(t.dieKeys),lost:t.lostDies}:void 0}const s=new Set;let o=0,l=!1;for(const t of e.perWafer){const r=t.summary.stats.testFailures?.[i];if(r){l=!0,o+=r.lostDies;for(const n of r.dieKeys)s.add(`${t.waferIndex}:${n}`)}}return l?{keys:s,lost:o}:void 0}function Ae(e,i){const s=e.stats,o=[],l=(t,r,n,d,c,h,m=c)=>{if(n<=0||d<=0)return;i.add(t);const u=Me(e,t),g=u?Math.min(u.lost,n):n,b=n-g,f=n/d*100;o.push({testNumber:t,label:r,verb:c,plainVerb:m,failDies:n,passingDies:b,keys:u?.keys,item:{impact:"low",shareOfDies:0,diesLost:g,severity:"info",text:`${r} ${c} on ${p(n)} of ${p(d)} dies (${f.toFixed(1)}%)`+(b>0?`; ${p(b)} of them are binned as passing, so about ${p(g)} dies lost`:""),brief:b>0?`${r}: ${h}, ${p(g)} dies lost`:`${r}: ${p(n)} dies ${h}`,subject:r,target:{kind:"test",testNumber:t},chips:[],findingIds:[],testNumbers:[t]}})};for(const t of s.testSpecYield??[]){const r=t.failHighDies===0?"is below its low limit":t.failLowDies===0?"is above its high limit":`is outside its limits (${p(t.failLowDies)} low, ${p(t.failHighDies)} high)`;l(t.testNumber,t.label,t.failLowDies+t.failHighDies,t.totalDies,r,"outside limits",t.failLowDies>0&&t.failHighDies>0?"is outside its limits":r)}for(const t of s.functionalYield??[])l(t.testNumber,t.label,t.failDies,t.totalDies,"fails","fail");return o}const Le=.5,xe=2,Fe=2;function Ee(e,i,s,o){const l=[],t=new Map;for(const r of e){const n=r.keys;if(o>0&&r.failDies/o<D){l.push(r);continue}let d;if(n&&n.size>0&&o>0)for(const h of i){const m=s.get(h);if(!m||m.size===0)continue;let u=0;for(const b of n)m.has(b)&&u++;const g=u/n.size;g>=Le&&g>=xe*(m.size/o)&&(!d||u>d.inside)&&(d={item:h,inside:u})}if(!d){l.push(r);continue}const c=t.get(d.item)??0;if(c<Fe){const h=d.inside===r.failDies?"all":p(d.inside);d.item.text+=`. ${r.label} ${r.verb} on ${k(r.failDies,"die")}, ${h} of them in ${d.item.subject}`,t.set(d.item,c+1)}d.item.chips.push({label:r.label,target:r.item.target}),d.item.testNumbers.push(r.testNumber)}return l}function He(e,i,s){const o=[],l={unusual:0,notable:1,info:2},t=e.findings.filter(n=>n.id.startsWith("drift:")).sort((n,d)=>l[n.severity]-l[d.severity]||(n.stats.adjustedPValue??1)-(d.stats.adjustedPValue??1));for(const n of t)o.push({text:n.summary,target:E(n),findingIds:[n.id]});for(const n of[...s].sort((d,c)=>c.passingDies-d.passingDies))o.push({text:`${n.label} ${n.plainVerb} on ${p(n.passingDies)} dies binned as passing`,target:n.item.target,findingIds:[]});const r=(e.stats.capability??[]).filter(n=>n.hasSpec&&n.ppk!==null&&n.ppk!==void 0&&n.ppk<T&&!i.has(n.testNumber)).sort((n,d)=>(n.ppk??0)-(d.ppk??0));for(const n of r)o.push({text:`${n.label} has Ppk ${n.ppk.toFixed(2)} against its limits (below ${T.toFixed(1)})`,target:{kind:"test",testNumber:n.testNumber},findingIds:[]});return o.slice(0,ae)}function Ne(e,i){const s=i.passBins&&i.passBins.length>0?`; pass ${ie([i.passBins])}`:"";if(e.level==="wafer"){const c=e.stats.yieldPercent;return c==null?`${p(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${c.toFixed(1)}% (${p(e.stats.totalDies)} dies${s}).`}const o=e.lotYieldSeries.map(c=>c.yieldPercent).filter(c=>typeof c=="number");if(o.length===0)return`${k(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const l=o.reduce((c,h)=>c+h,0)/o.length,t=e.perWafer.reduce((c,h)=>c+h.summary.stats.totalDies,0),[r,n]=[te(o).toFixed(1),ee(o).toFixed(1)],d=r!==n?`, range ${r}\u2013${n}%`:"";return`Yield ${l.toFixed(1)}% (mean of ${k(o.length,"wafer")}, ${p(t)} dies${s})${d}.`}function We(e,i){const s=[],o=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.testsConsidered)).size,l=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.hardBinsConsidered)).size;if(o>0&&s.push(k(o,"test")),l>0&&s.push(k(l,"hard bin")),s.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const n=e.findings.filter(U);s.push(n.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${k(n.length,"outlier wafer")})`),e.stats.waferCount>=ne&&s.push("the yield trend across the wafers (input order)")}const t=e.findings.filter(n=>!i.has(n.id)).length,r=t>0?` ${k(t,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${s.join(", ")}.${r}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}export function buildSynthesis(e,i={}){const s=synthesisSource(e),o=s.findings,l=s.level==="lot"?s.stats.waferCount:void 0,t=i.passBins,r=new Map(o.map(a=>[a.id,a])),n=(s.level==="wafer"?[s]:s.perWafer.map(a=>a.summary)).every(a=>(a.stats.hardBinsConsidered??[]).length===0),d=a=>t!==void 0&&G(a)&&se(a.variable.kind,a.variable.bin??NaN,t,!n),c={isPassRate:a=>a.variable.kind==="yield"||t?.length===1&&d(a),isFailBin:a=>t!==void 0&&G(a)&&!d(a)},h=o.filter(a=>pe.has(a.comparison.family)&&_(a)>0&&(c.isPassRate(a)&&a.effect.direction==="lower"||c.isFailBin(a)&&a.effect.direction==="higher")),u=h.some(a=>a.variable.kind==="hardBin")?h.filter(a=>a.variable.kind!=="softBin"):h,g=[],b=new Map,f=new Set;for(const a of $e(u)){const w=a.map(A=>u[A]),S=ve(w,o,l,c);g.push(S);const W=S.target.kind==="finding"?S.target.id:void 0;b.set(S,X(w.find(A=>A.id===W)??w[0]))}for(const a of o.filter(w=>w.variable.kind==="spatialPattern")){const w=new Set((a.relatedIds??[]).filter(L=>r.has(L))),S=g.find(L=>L.findingIds.some(Z=>w.has(Z)));if(!S)continue;const W=a.level==="lot"&&"waferIndices"in a.highlight?a.highlight.waferIndices?.length:void 0,A=W!==void 0&&l?` on ${W}/${l} wafers`:"";S.text=`${a.variable.label} pattern${A}. ${S.text}`,S.chips.unshift({label:`${a.variable.label} pattern`,target:E(a)}),S.findingIds.unshift(a.id,...[...w].filter(L=>!S.findingIds.includes(L)))}const y=De(s),I=new Set,B=Ae(s,I),V=Ee(B,[...g],b,y);s.level==="lot"&&g.push(..._e(s)),g.push(...V.map(a=>a.item));const z=Be(s),H=g.filter(a=>y>0&&a.diesLost/y>=D);for(const a of H)a.shareOfDies=a.diesLost/y,a.impact=ke(a.diesLost/y,z>0?a.diesLost/z:0);H.sort((a,w)=>w.diesLost-a.diesLost);const M=H.slice(0,Y),N=H.slice(Y);for(const a of[...M,...N])for(const w of a.findingIds)f.add(w);const K=N.length>0?{items:N.slice(0,q),more:Math.max(0,N.length-q)}:void 0,J=M[0]?.target.kind==="test"?M[0].target.testNumber:void 0,Q=B.filter(a=>a.testNumber!==J&&y>0&&a.passingDies/y>=D),O=He(s,I,Q);for(const a of O)for(const w of a.findingIds)f.add(w);const j=s.level==="lot"?"region, fail bin or wafer":"region or fail bin",R=o.filter(a=>a.severity==="unusual"&&!f.has(a.id)).length,C=M.length===0?R>0?`No ${j} costs as much as ${v(D)} yield points, though ${k(R,"finding")} below ${R===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${j} costs as much as ${v(D)} yield points.`:void 0;return{headline:Ne(s,i),items:M,...K?{also:K}:{},...O.length?{watch:O}:{},...C?{nothing:C}:{},checked:We(s,f)}}export const SYNTHESIS_ALSO_HEADING=`Also, each costing at least ${(D*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>`${(e.shareOfDies*100).toFixed(1)}%`;export function synthesisText(e){return[e.headline,...e.nothing?[e.nothing]:[],...e.items.map((i,s)=>`${s+1}. ${i.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(i=>`${i.brief} (${synthesisRowShare(i)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],...e.watch?e.watch.map(i=>`Watch: ${i.text}`):[],e.checked].join(`
1
+ import{maxOf as ee,minOf as te}from"../core/utils.js";import{isPassBin as se,passBinsLabel as ie}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as ne}from"./lotDrift.js";import{plainBinTerms as oe}from"../renderer/fmt.js";const ae=2,j=1,Y=3,q=5,B=.01,re=.02,le=.04,de=.15,ce=.4,fe=.5,he=.1,ue=2,pe=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function ge(e){const i=e.highlight;return"dieKeysByWafer"in i&&i.dieKeysByWafer?Object.values(i.dieKeysByWafer).reduce((s,n)=>s+n.length,0):"dieKeys"in i&&i.dieKeys&&i.dieKeys.length>0?i.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function X(e){const i=e.highlight,s=new Set;if("dieKeysByWafer"in i&&i.dieKeysByWafer)for(const[n,d]of Object.entries(i.dieKeysByWafer))for(const t of d)s.add(`${n}:${t}`);else if("dieKeys"in i&&i.dieKeys)for(const n of i.dieKeys)s.add(n);return s}const $=e=>Math.abs(e.effect.absoluteDelta??0),_=e=>$(e)*(ge(e)??0),v=e=>(e*100).toFixed(1),x=e=>{const i=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return oe(i)},p=e=>Math.round(e).toLocaleString("en-GB"),k=(e,i,s=`${i}s`)=>`${p(e)} ${e===1?i:s}`;function E(e){const i=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(i)?`${i} quadrant`:i}function $e(e){const i=e.map((t,r)=>r),s=t=>i[t]===t?t:i[t]=s(i[t]),n=e.map(X);for(let t=0;t<e.length;t++)for(let r=t+1;r<e.length;r++){const a=n[t].size<=n[r].size?n[t]:n[r],l=a===n[t]?n[r]:n[t];if(a.size===0)continue;let c=0;for(const h of a)l.has(h)&&c++;c>=fe*a.size&&(i[s(t)]=s(r))}const d=new Map;return e.forEach((t,r)=>{const a=s(r);(d.get(a)??d.set(a,[]).get(a)).push(r)}),[...d.values()]}const G=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",R=(e,i)=>e.level===i.level&&e.comparison.family===i.comparison.family&&e.comparison.left===i.comparison.left;function me(e,i,s){const n=t=>i.filter(r=>r.variable.kind===t&&R(r,e)&&r.effect.direction==="higher"&&s(r));return(n("hardBin").length>0?n("hardBin"):n("softBin")).filter(t=>t!==e).sort((t,r)=>$(r)-$(t))}const we={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},be=2;function ye(e){const i=new Map;for(const n of e){const d=n.comparison.family;(i.get(d)??i.set(d,new Set).get(d)).add(E(n))}const s=[];for(const[n,d]of i)d.size<=be?s.push(...d):s.push(`${d.size} ${we[n]??n}`);return s.join(", ")}const Se=e=>e.charAt(0).toUpperCase()+e.slice(1),F=e=>({kind:"finding",id:e.id}),Ie=e=>({label:Se(x(e)),target:F(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function ve(e,i,s,n){const d=[...e].sort((f,w)=>_(w)-_(f))[0],t=e.find(f=>n.isPassRate(f)&&R(f,d))??d,r=e.filter(f=>f!==t),a=t.level==="lot"&&"waferIndices"in t.highlight?t.highlight.waferIndices?.length:void 0,l=a!==void 0&&s?` on ${a}/${s} wafers`:"",c=!n.isPassRate(t),h=t.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let y=c?`${E(t)}: ${x(t)} ${v($(t))} points higher than ${h}${l}`:`${E(t)}: pass rate ${v($(t))} points below ${h}${l}`;const g=me(t,i,n.isFailBin).map(f=>({f,share:$(f)/($(t)||1)})).filter(f=>c||f.share>=he).slice(0,ue);if(c)for(const{f}of g)y+=`, ${x(f)} ${v($(f))} points higher`;else if(g.length>0){const f=g.reduce((S,D)=>S+D.share,0)<=1.000000001,w=f&&g[0].share>.5?"mostly ":"";g.forEach(({f:S},D)=>{y+=D===0?`; ${f?w:""}`:", ",y+=x(S)+(D===0?f?` accounts for ${v($(S))} of those points`:` is ${v($(S))} points higher`:f?` for ${v($(S))}`:` ${v($(S))} points higher`)})}y+=` \u2014 about ${p(_(t))} dies lost`;const u=r.filter(f=>!R(f,t));u.length>0&&(y+=` (also seen as ${ye(u)})`);const m=c?x(t):"pass rate";return{impact:"low",shareOfDies:0,diesLost:_(t),severity:t.severity,text:y,brief:`${E(t)}: ${m}, ${p(_(t))} dies`,subject:E(t),target:F(t),chips:[...c?[t]:[],...g.map(({f})=>f)].map(Ie),findingIds:[t.id,...r.map(f=>f.id)],testNumbers:[]}}function ke(e,i){return e>=le||i>=ce?"high":e>=re||i>=de?"medium":"low"}function De(e){const i=s=>s.stats.yieldPercent==null?0:s.stats.analyzedDies*(1-s.stats.yieldPercent/100);return e.level==="wafer"?i(e):e.perWafer.reduce((s,n)=>s+i(n.summary),0)}function Be(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((i,s)=>i+s.summary.stats.analyzedDies,0)}const U=e=>e.id.startsWith("inter-wafer:yield:");function _e(e){const i=[];for(const s of e.findings){if(!U(s)||s.effect.direction!=="lower")continue;const n="waferIndices"in s.highlight?s.highlight.waferIndices?.[0]:void 0,d=n===void 0?void 0:e.perWafer.find(t=>t.waferIndex===n)?.summary.stats.analyzedDies;d!==void 0&&i.push({impact:"low",shareOfDies:0,diesLost:$(s)*d,severity:s.severity,text:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${p($(s)*d)} dies lost`,brief:`${s.comparison.left}: yield, ${p($(s)*d)} dies`,subject:s.comparison.left,target:F(s),chips:[],findingIds:[s.id],testNumbers:[]})}return i}function Me(e,i){if(e.level==="wafer"){const t=e.stats.testFailures?.[i];return t?{keys:new Set(t.dieKeys),lost:t.lostDies}:void 0}const s=new Set;let n=0,d=!1;for(const t of e.perWafer){const r=t.summary.stats.testFailures?.[i];if(r){d=!0,n+=r.lostDies;for(const a of r.dieKeys)s.add(`${t.waferIndex}:${a}`)}}return d?{keys:s,lost:n}:void 0}function Ae(e,i){const s=e.stats,n=[],d=(t,r,a,l,c,h,y=c)=>{if(a<=0||l<=0)return;i.add(t);const g=Me(e,t),u=g?Math.min(g.lost,a):a,m=a-u,f=a/l*100;n.push({testNumber:t,label:r,verb:c,plainVerb:y,failDies:a,passingDies:m,keys:g?.keys,item:{impact:"low",shareOfDies:0,diesLost:u,severity:"info",text:`${r} ${c} on ${p(a)} of ${p(l)} dies (${f.toFixed(1)}%)`+(m>0?`; ${p(m)} of them are binned as passing, so about ${p(u)} dies lost`:""),brief:m>0?`${r}: ${h}, ${p(u)} dies lost`:`${r}: ${p(a)} dies ${h}`,subject:r,target:{kind:"test",testNumber:t},chips:[],findingIds:[],testNumbers:[t]}})};for(const t of s.testSpecYield??[]){const r=t.failHighDies===0?"is below its low limit":t.failLowDies===0?"is above its high limit":`is outside its limits (${p(t.failLowDies)} low, ${p(t.failHighDies)} high)`;d(t.testNumber,t.label,t.failLowDies+t.failHighDies,t.totalDies,r,"outside limits",t.failLowDies>0&&t.failHighDies>0?"is outside its limits":r)}for(const t of s.functionalYield??[])d(t.testNumber,t.label,t.failDies,t.totalDies,"fails","fail");return n}const Le=.5,xe=2,Ee=2,Fe=5;function He(e,i,s,n){const d=new Set,t=new Map,r=new Map,a=[...e].sort((l,c)=>c.failDies-l.failDies||l.testNumber-c.testNumber);for(const l of a){const c=l.keys;if(n>0&&l.failDies/n<B){d.add(l);continue}let h;if(c&&c.size>0&&n>0)for(const u of i){const m=s.get(u);if(!m||m.size===0)continue;let f=0;for(const S of c)m.has(S)&&f++;const w=f/c.size;w>=Le&&w>=xe*(m.size/n)&&(!h||f>h.inside)&&(h={item:u,inside:f})}if(!h){d.add(l);continue}const y=t.get(h.item)??0;if(y<Ee){const u=h.inside===l.failDies?"all":p(h.inside);h.item.text+=`. ${l.label} ${l.verb} on ${k(l.failDies,"die")}, ${u} of them in ${h.item.subject}`,t.set(h.item,y+1)}const g=r.get(h.item)??0;g<Fe?(h.item.chips.push({label:l.label,target:l.item.target}),r.set(h.item,g+1)):h.item.moreTests=(h.item.moreTests??0)+1,h.item.testNumbers.push(l.testNumber)}return e.filter(l=>d.has(l))}function Ne(e,i,s){const n=[],d={unusual:0,notable:1,info:2},t=e.findings.filter(a=>a.id.startsWith("drift:")).sort((a,l)=>d[a.severity]-d[l.severity]||(a.stats.adjustedPValue??1)-(l.stats.adjustedPValue??1));for(const a of t)n.push({text:a.summary,target:F(a),findingIds:[a.id]});for(const a of[...s].sort((l,c)=>c.passingDies-l.passingDies))n.push({text:`${a.label} ${a.plainVerb} on ${p(a.passingDies)} dies binned as passing`,target:a.item.target,findingIds:[]});const r=(e.stats.capability??[]).filter(a=>a.hasSpec&&a.ppk!==null&&a.ppk!==void 0&&a.ppk<j&&!i.has(a.testNumber)).sort((a,l)=>(a.ppk??0)-(l.ppk??0));for(const a of r)n.push({text:`${a.label} has Ppk ${a.ppk.toFixed(2)} against its limits (below ${j.toFixed(1)})`,target:{kind:"test",testNumber:a.testNumber},findingIds:[]});return n.slice(0,ae)}function Te(e,i){const s=i.passBins&&i.passBins.length>0?`; pass ${ie([i.passBins])}`:"";if(e.level==="wafer"){const c=e.stats.yieldPercent;return c==null?`${p(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${c.toFixed(1)}% (${p(e.stats.totalDies)} dies${s}).`}const n=e.lotYieldSeries.map(c=>c.yieldPercent).filter(c=>typeof c=="number");if(n.length===0)return`${k(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const d=n.reduce((c,h)=>c+h,0)/n.length,t=e.perWafer.reduce((c,h)=>c+h.summary.stats.totalDies,0),[r,a]=[te(n).toFixed(1),ee(n).toFixed(1)],l=r!==a?`, range ${r}\u2013${a}%`:"";return`Yield ${d.toFixed(1)}% (mean of ${k(n.length,"wafer")}, ${p(t)} dies${s})${l}.`}function We(e,i){const s=[],n=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(l=>l.summary.stats.testsConsidered)).size,d=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(l=>l.summary.stats.hardBinsConsidered)).size,t=e.stats.testValueAnalysis?.state;if(n>0&&t!=="off"&&s.push(k(n,"test")+(t==="skipped"?" (against their limits only)":"")),d>0&&s.push(k(d,"hard bin")),s.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const l=e.findings.filter(U);s.push(l.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${k(l.length,"outlier wafer")})`),e.stats.waferCount>=ne&&s.push("the yield trend across the wafers (input order)")}const r=e.findings.filter(l=>!i.has(l.id)).length,a=r>0?` ${k(r,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${s.join(", ")}.${a}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}export function buildSynthesis(e,i={}){const s=synthesisSource(e),n=s.findings,d=s.level==="lot"?s.stats.waferCount:void 0,t=i.passBins,r=new Map(n.map(o=>[o.id,o])),a=(s.level==="wafer"?[s]:s.perWafer.map(o=>o.summary)).every(o=>(o.stats.hardBinsConsidered??[]).length===0),l=o=>t!==void 0&&G(o)&&se(o.variable.kind,o.variable.bin??NaN,t,!a),c={isPassRate:o=>o.variable.kind==="yield"||t?.length===1&&l(o),isFailBin:o=>t!==void 0&&G(o)&&!l(o)},h=n.filter(o=>pe.has(o.comparison.family)&&_(o)>0&&(c.isPassRate(o)&&o.effect.direction==="lower"||c.isFailBin(o)&&o.effect.direction==="higher")),g=h.some(o=>o.variable.kind==="hardBin")?h.filter(o=>o.variable.kind!=="softBin"):h,u=[],m=new Map,f=new Set;for(const o of $e(g)){const b=o.map(A=>g[A]),I=ve(b,n,d,c);u.push(I);const T=I.target.kind==="finding"?I.target.id:void 0;m.set(I,X(b.find(A=>A.id===T)??b[0]))}for(const o of n.filter(b=>b.variable.kind==="spatialPattern")){const b=new Set((o.relatedIds??[]).filter(L=>r.has(L))),I=u.find(L=>L.findingIds.some(Z=>b.has(Z)));if(!I)continue;const T=o.level==="lot"&&"waferIndices"in o.highlight?o.highlight.waferIndices?.length:void 0,A=T!==void 0&&d?` on ${T}/${d} wafers`:"";I.text=`${o.variable.label} pattern${A}. ${I.text}`,I.chips.unshift({label:`${o.variable.label} pattern`,target:F(o)}),I.findingIds.unshift(o.id,...[...b].filter(L=>!I.findingIds.includes(L)))}const w=Be(s),S=new Set,D=Ae(s,S),V=He(D,[...u],m,w);s.level==="lot"&&u.push(..._e(s)),u.push(...V.map(o=>o.item));const P=De(s),H=u.filter(o=>w>0&&o.diesLost/w>=B);for(const o of H)o.shareOfDies=o.diesLost/w,o.impact=ke(o.diesLost/w,P>0?o.diesLost/P:0);H.sort((o,b)=>b.diesLost-o.diesLost);const M=H.slice(0,Y),N=H.slice(Y);for(const o of[...M,...N])for(const b of o.findingIds)f.add(b);const z=N.length>0?{items:N.slice(0,q),more:Math.max(0,N.length-q)}:void 0,J=M[0]?.target.kind==="test"?M[0].target.testNumber:void 0,Q=D.filter(o=>o.testNumber!==J&&w>0&&o.passingDies/w>=B),W=Ne(s,S,Q);for(const o of W)for(const b of o.findingIds)f.add(b);const K=s.level==="lot"?"region, fail bin or wafer":"region or fail bin",O=n.filter(o=>o.severity==="unusual"&&!f.has(o.id)).length,C=M.length===0?O>0?`No ${K} costs as much as ${v(B)} yield points, though ${k(O,"finding")} below ${O===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${K} costs as much as ${v(B)} yield points.`:void 0;return{headline:Te(s,i),items:M,...z?{also:z}:{},...W.length?{watch:W}:{},...C?{nothing:C}:{},checked:We(s,f)}}export const SYNTHESIS_ALSO_HEADING=`Also, each costing at least ${(B*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>`${(e.shareOfDies*100).toFixed(1)}%`,synthesisMoreTests=e=>e.moreTests?`and ${e.moreTests} more test${e.moreTests===1?"":"s"}`:void 0;export function synthesisText(e){return[e.headline,...e.nothing?[e.nothing]:[],...e.items.map((i,s)=>`${s+1}. ${i.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(i=>`${i.brief} (${synthesisRowShare(i)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],...e.watch?e.watch.map(i=>`Watch: ${i.text}`):[],e.checked].join(`
2
2
  `)}
@@ -1 +1 @@
1
- import{isYieldEligibleDie as R}from"../core/dies.js";import{dieHasVerdicts as E,testValue as z,testValuesReader as C}from"../core/dieTable.js";import{isParametricTest as T,getTestPassStatus as V,testPassStatusReader as I}from"../renderer/buildWaferMap.js";import{classifySpec as F}from"../renderer/spec.js";import{testLabel as J,derivedFields as K}from"../renderer/testLabel.js";const O=(s,n)=>n===0?null:s/n*100;export function buildTestPassRateData(s,n,r){const o=s.map(e=>e.key),t={groups:o,rows:[],disagreementDies:null};if(!n?.length)return t;const i=n.filter(e=>e.testNumber!==void 0&&G(e,r));if(!i.length)return t;const g=()=>({pass:0,fail:0,failLow:0,failHigh:0}),D=new Map;for(const e of i){const a=e.testNumber;D.set(a,{label:J(e,a),overall:g(),perGroup:o.map(()=>g())})}const N=(e,a,u)=>{const f=D.get(e);if(f)for(const p of[f.overall,f.perGroup[a]])p.pass+=u.pass??0,p.fail+=u.fail??0,p.failLow+=u.failLow??0,p.failHigh+=u.failHigh??0},x=C(i.map(e=>e.testNumber)),L=new Float64Array(i.length),A=I(i),w=new Int8Array(i.length),H=r==="spec"||r==="testFlag";let y=0,P=0;s.forEach(function(a,u){for(const f of a.items){if(r==="spec"&&f.testSpecYield&&!j(f)){for(const l of f.testSpecYield)N(l.testNumber,u,{pass:l.passDies,fail:l.failLowDies+l.failHighDies,failLow:l.failLowDies,failHigh:l.failHighDies});continue}if(r==="functional"&&f.functionalYield){for(const l of f.functionalYield)N(l.testNumber,u,{pass:l.passDies,fail:l.failDies});continue}const p=i.map(l=>D.get(l.testNumber).overall),M=i.map(l=>D.get(l.testNumber).perGroup[u]);for(const l of f.dies??[])if(R(l)){x(l,L),A(l,w);for(let c=0;c<i.length;c++){const S=i[c],b=F(L[c],S),h=w[c]===-1?void 0:w[c]===1;H&&b!==null&&h!==void 0&&(y++,b==="pass"!==h&&P++);const d=p[c],m=M[c];if(r==="spec"){if(b===null)continue;if(b==="pass"){d.pass++,m.pass++;continue}d.fail++,m.fail++,b==="failLow"?(d.failLow++,m.failLow++):(d.failHigh++,m.failHigh++)}else{if(h===void 0)continue;h?(d.pass++,m.pass++):(d.fail++,m.fail++)}}}}});const Y=e=>({passDies:e.pass,failDies:e.fail,totalDies:e.pass+e.fail,passRatePercent:O(e.pass,e.pass+e.fail)}),v=[];for(const[e,a]of D)a.overall.pass+a.overall.fail!==0&&v.push({testNumber:e,label:a.label,overall:Y(a.overall),byGroup:a.perGroup.map(Y),...r==="spec"?{failLowDies:a.overall.failLow,failHighDies:a.overall.failHigh}:{}});return v.sort((e,a)=>(e.overall.passRatePercent??101)-(a.overall.passRatePercent??101)||e.testNumber-a.testNumber),{groups:o,rows:v,disagreementDies:H&&y>0?P:null}}export function dieFailsTest(s,n,r){const o=n.testNumber;if(o===void 0||!R(s))return;if(r==="spec"){const i=z(s,o),g=i===void 0?null:F(i,n);return g===null?void 0:g!=="pass"}const t=V(s,o,n);return t===void 0?void 0:!t}function j(s){return(s.dies??[]).some(E)}function G(s,n){return n==="functional"?!T(s):T(s)?n==="spec"?s.limitLow!==void 0||s.limitHigh!==void 0:!0:!1}export function hasJudgeableTests(s,n,r){if(!s?.length)return!1;const o=s.filter(t=>t.testNumber!==void 0&&G(t,n));return o.length?n!=="testFlag"?!0:(r??[]).some(t=>o.some(i=>V(t,i.testNumber,i)!==void 0)):!1}export function poolFunctionalYield(s){if(!s?.length||!s.every(o=>o.stats.functionalYield!==void 0))return;const n=new Map;for(const o of s)for(const t of o.stats.functionalYield??[]){const i=n.get(t.testNumber)??{label:t.label,...K(t),passDies:0,failDies:0,totalDies:0};i.passDies+=t.passDies,i.failDies+=t.failDies,i.totalDies+=t.totalDies,n.set(t.testNumber,i)}const r=[...n.entries()].map(([o,t])=>({testNumber:o,...t,passRatePercent:t.totalDies>0?t.passDies/t.totalDies*100:null}));return r.length?r:void 0}
1
+ import{isYieldEligibleDie as H}from"../core/dies.js";import{dieHasVerdicts as M,testValue as V,testValuesReader as $}from"../core/dieTable.js";import{isParametricTest as P,getTestPassStatus as N,testPassStatusReader as C}from"../renderer/buildWaferMap.js";import{classifySpec as I}from"../renderer/spec.js";import{testLabel as x,derivedFields as O}from"../renderer/testLabel.js";const K=(e,t)=>t===0?null:e/t*100;export function buildTestPassRateData(e,t,r){const i=e.map(a=>a.key),s={groups:i,rows:[],disagreementDies:null};if(!t?.length)return s;const l=t.filter(a=>a.testNumber!==void 0&&_(a,r));if(!l.length)return s;const p=()=>({pass:0,fail:0,failLow:0,failHigh:0}),u=new Map;for(const a of l){const c=a.testNumber;u.set(c,{label:x(a,c),overall:p(),perGroup:i.map(()=>p())})}const w=(a,c,b)=>{const d=u.get(a);if(d)for(const m of[d.overall,d.perGroup[c]])m.pass+=b.pass??0,m.fail+=b.fail??0,m.failLow+=b.failLow??0,m.failHigh+=b.failHigh??0},n=r==="spec"||r==="testFlag";let o=0,g=0;e.forEach(function(c,b){for(const d of c.items){if(r==="spec"&&d.testSpecYield&&!j(d)){for(const f of d.testSpecYield)w(f.testNumber,b,{pass:f.passDies,fail:f.failLowDies+f.failHighDies,failLow:f.failLowDies,failHigh:f.failHighDies});continue}if(r==="functional"&&d.functionalYield){for(const f of d.functionalYield)w(f.testNumber,b,{pass:f.passDies,fail:f.failDies});continue}const m=B(d.dies??[],l,r);o+=m.comparable,g+=m.disagreements;for(let f=0;f<l.length;f++){const A=u.get(l[f].testNumber);for(const L of[A.overall,A.perGroup[b]])L.pass+=m.pass[f],L.fail+=m.fail[f],L.failLow+=m.failLow[f],L.failHigh+=m.failHigh[f]}}});const h=a=>({passDies:a.pass,failDies:a.fail,totalDies:a.pass+a.fail,passRatePercent:K(a.pass,a.pass+a.fail)}),D=[];for(const[a,c]of u)c.overall.pass+c.overall.fail!==0&&D.push({testNumber:a,label:c.label,overall:h(c.overall),byGroup:c.perGroup.map(h),...r==="spec"?{failLowDies:c.overall.failLow,failHighDies:c.overall.failHigh}:{}});return D.sort((a,c)=>(a.overall.passRatePercent??101)-(c.overall.passRatePercent??101)||a.testNumber-c.testNumber),{groups:i,rows:D,disagreementDies:n&&o>0?g:null}}const S=0,v=1,y=2,F=3,T=4,G=5,E=6,z=7,R=new WeakMap,Y=e=>`${e.testNumber},${e.limitLow},${e.limitHigh},${e.limitLowInclusive},${e.limitHighInclusive},${e.testType}`;function B(e,t,r){let i=R.get(e);i||(i=new Map,R.set(e,i));const s=t.map(Y),l=t.filter((n,o)=>!i.has(s[o]));l.length&&J(e,l,i);const p=t.length,u={pass:new Int32Array(p),fail:new Int32Array(p),failLow:new Int32Array(p),failHigh:new Int32Array(p),comparable:0,disagreements:0},w=r==="spec"||r==="testFlag";for(let n=0;n<p;n++){const o=i.get(s[n]);w&&(u.comparable+=o[G],u.disagreements+=o[E]),r==="spec"?(u.pass[n]=o[S],u.failLow[n]=o[v],u.failHigh[n]=o[y],u.fail[n]=o[v]+o[y]):(u.pass[n]=o[F],u.fail[n]=o[T])}return u}function J(e,t,r){const i=t.length,s=t.map(()=>new Int32Array(z)),l=$(t.map(n=>n.testNumber)),p=new Float64Array(i),u=C(t),w=new Int8Array(i);for(const n of e)if(H(n)){l(n,p),u(n,w);for(let o=0;o<i;o++){const g=s[o],h=I(p[o],t[o]),D=w[o];h!==null&&(h==="pass"?g[S]++:h==="failLow"?g[v]++:g[y]++),D!==-1&&(D===1?g[F]++:g[T]++,h!==null&&(g[G]++,h==="pass"!=(D===1)&&g[E]++))}}for(let n=0;n<i;n++)r.set(Y(t[n]),s[n])}export function dieFailsTest(e,t,r){const i=t.testNumber;if(i===void 0||!H(e))return;if(r==="spec"){const l=V(e,i),p=l===void 0?null:I(l,t);return p===null?void 0:p!=="pass"}const s=N(e,i,t);return s===void 0?void 0:!s}function j(e){return(e.dies??[]).some(M)}function _(e,t){return t==="functional"?!P(e):P(e)?t==="spec"?e.limitLow!==void 0||e.limitHigh!==void 0:!0:!1}export function hasJudgeableTests(e,t,r){if(!e?.length)return!1;const i=e.filter(s=>s.testNumber!==void 0&&_(s,t));return i.length?t!=="testFlag"?!0:(r??[]).some(s=>i.some(l=>N(s,l.testNumber,l)!==void 0)):!1}export function poolFunctionalYield(e){if(!e?.length||!e.every(i=>i.stats.functionalYield!==void 0))return;const t=new Map;for(const i of e)for(const s of i.stats.functionalYield??[]){const l=t.get(s.testNumber)??{label:s.label,...O(s),passDies:0,failDies:0,totalDies:0};l.passDies+=s.passDies,l.failDies+=s.failDies,l.totalDies+=s.totalDies,t.set(s.testNumber,l)}const r=[...t.entries()].map(([i,s])=>({testNumber:i,...s,passRatePercent:s.totalDies>0?s.passDies/s.totalDies*100:null}));return r.length?r:void 0}
@@ -0,0 +1,15 @@
1
+ import type { StatsSummary, TestValueAnalysisStatus } from './types.js';
2
+ /**
3
+ * How many test values (dies × parametric tests) the test-value analysis takes on when `enableTestValueAnalysis`
4
+ * is `'auto'`, summed over a lot's wafers so a lot decides once. The pass is a linear scan of every value, at
5
+ * {@link TEST_VALUE_US_PER_VALUE} in the slower engine, so this is about a second there: 150 tests on a
6
+ * 10,000-die wafer, 500 on a 3,000-die one. Above it the analysis is skipped and the renderers offer to run it.
7
+ */
8
+ export declare const TEST_VALUE_AUTO_BUDGET = 1500000;
9
+ /** The size of a test-value analysis over `dies` and `tests`, and what became of it. */
10
+ export declare function testValueStatus(state: TestValueAnalysisStatus['state'], tests: number, dies: number): TestValueAnalysisStatus;
11
+ /** `'auto'` decided over `values`: run it when the values fit the budget. */
12
+ export declare function autoDecision(values: number): 'done' | 'skipped';
13
+ /** A lot's test-value status from its wafers': sizes and time summed (tests: the most on any wafer). */
14
+ export declare function lotTestValueStatus(summaries: StatsSummary[]): TestValueAnalysisStatus | undefined;
15
+ //# sourceMappingURL=testValueBudget.d.ts.map
@@ -0,0 +1 @@
1
+ export const TEST_VALUE_AUTO_BUDGET=15e5;const a=.65;export function testValueStatus(n,t,u){const e=t*u;return{state:n,tests:t,dies:u,values:e,estimateMs:e*.65/1e3}}export function autoDecision(n){return n<=15e5?"done":"skipped"}export function lotTestValueStatus(n){const t=n.map(e=>e.stats.testValueAnalysis).filter(e=>e!==void 0);return t.length?{state:t.every(e=>e.state==="done")?"done":t.some(e=>e.state==="skipped")?"skipped":"off",tests:t.reduce((e,s)=>Math.max(e,s.tests),0),dies:t.reduce((e,s)=>e+s.dies,0),values:t.reduce((e,s)=>e+s.values,0),estimateMs:t.reduce((e,s)=>e+s.estimateMs,0)}:void 0}
@@ -77,6 +77,14 @@ export interface StatsFinding {
77
77
  index?: number;
78
78
  /** For bin kinds, the bin number this finding is about. */
79
79
  bin?: number;
80
+ /**
81
+ * For `kind: 'test'`, which statistic of the test was compared: `'mean'`
82
+ * (its values, in the test's unit) or `'limitFailRate'` (the share of dies
83
+ * outside its limits, a proportion like a bin rate). The two read alike
84
+ * otherwise — same `index`, same `label` — so a host showing `effect` reads
85
+ * this to know whether `absoluteDelta` is in `unit` or is a fraction.
86
+ */
87
+ measure?: 'mean' | 'limitFailRate';
80
88
  /**
81
89
  * Display name, already resolved through any supplied bin/test definitions.
82
90
  * For a derived test (`derived`) it starts with `"† "`, as does the test's name
@@ -85,7 +93,7 @@ export interface StatsFinding {
85
93
  * string should show the key ("† Derived, not measured") with it.
86
94
  */
87
95
  label: string;
88
- /** Unit of `effect.absoluteDelta`, when the variable has one. */
96
+ /** Unit of `effect.absoluteDelta`, when the variable has one (never for a `'limitFailRate'`, which is a fraction). */
89
97
  unit?: string;
90
98
  /**
91
99
  * True when the finding is about a test computed from other tests rather
@@ -110,15 +118,19 @@ export interface StatsFinding {
110
118
  /** Which way `left` differs from `right`. */
111
119
  direction: 'higher' | 'lower' | 'different';
112
120
  /**
113
- * Difference in the measured quantity. For proportions (yield, bin rates)
114
- * this is a FRACTION, not a percentage: 0.20 is 20 percentage points.
121
+ * Difference in the measured quantity. For proportions (yield, bin rates,
122
+ * functional pass rates, a test's `'limitFailRate'`) this is a FRACTION, not
123
+ * a percentage: 0.20 is 20 percentage points. For a test's `'mean'` it is in
124
+ * the test's `unit`.
115
125
  */
116
126
  absoluteDelta?: number;
117
127
  /**
118
- * `absoluteDelta` as a multiple of the background rate — a RATIO, not a
128
+ * `absoluteDelta` as a multiple of the background — a RATIO, not a
119
129
  * percentage. **1.0 means a doubling**, not "1%" and not "100% of
120
- * background left unchanged". Set for proportion findings only. This is the
121
- * field most often misread; the gate it feeds is documented in §7.3.2.
130
+ * background left unchanged". For a proportion, relative to the background
131
+ * rate (undefined when that rate is 0); for a test's `'mean'`, relative to
132
+ * the background mean's magnitude. This is the field most often misread;
133
+ * the gate it feeds is documented in §7.3.2.
122
134
  */
123
135
  relativeDelta?: number;
124
136
  /**
@@ -177,6 +189,27 @@ export interface StatsFinding {
177
189
  */
178
190
  absorbedIds?: string[];
179
191
  }
192
+ /**
193
+ * What became of the test-value analysis (`enableTestValueAnalysis`) and how big
194
+ * it is: the dies × parametric tests it covers. A surface that shows findings
195
+ * reads this to say when the test-value findings are missing and what running
196
+ * them would cost.
197
+ */
198
+ export interface TestValueAnalysisStatus {
199
+ /**
200
+ * `'done'`: it ran. `'skipped'`: `'auto'` and over the budget — limit-failure
201
+ * findings still ran. `'off'`: the host passed `false`.
202
+ */
203
+ state: 'done' | 'skipped' | 'off';
204
+ /** Parametric tests it covers (the most on any wafer, for a lot). */
205
+ tests: number;
206
+ /** Dies with test values (summed over the wafers, for a lot). */
207
+ dies: number;
208
+ /** Test values it reads: dies × tests, summed over the wafers for a lot. */
209
+ values: number;
210
+ /** Expected time in the slower browser engine (WebKit), in ms. An estimate, for the offer's "about 2 s". */
211
+ estimateMs: number;
212
+ }
180
213
  export interface StatsSummary {
181
214
  /** Discriminant — always `'wafer'`. Narrow on this to tell a wafer summary from a {@link LotStatsSummary}. */
182
215
  level: 'wafer';
@@ -195,6 +228,12 @@ export interface StatsSummary {
195
228
  findings: StatsFinding[];
196
229
  /** Free-form identity fields from waferConfig.metadata (lot, wafer ID, test date, etc.). */
197
230
  wafer?: Record<string, unknown>;
231
+ /**
232
+ * The options this summary was analysed with, as passed (`perWaferSummaries`
233
+ * aside). The renderers re-run the analysis with them when the reader asks for
234
+ * the skipped test-value analysis, so the re-run matches the host's choices.
235
+ */
236
+ analysisOptions?: AnalyzeWaferMapOptions;
198
237
  /** Engine-computed analysis stats for this wafer. */
199
238
  stats: {
200
239
  totalDies: number;
@@ -217,15 +256,20 @@ export interface StatsSummary {
217
256
  */
218
257
  hardBinCounts?: Record<number, number>;
219
258
  softBinCounts?: Record<number, number>;
259
+ /**
260
+ * Whether the test-value analysis ran, and its size — see
261
+ * {@link TestValueAnalysisStatus}. Absent when the wafer has no parametric
262
+ * test values.
263
+ */
264
+ testValueAnalysis?: TestValueAnalysisStatus;
220
265
  /**
221
266
  * Structured advisories raised during analysis — the same `WaferWarning`
222
267
  * shape used by `WaferMapResult.warnings`, so a host has one warning
223
268
  * vocabulary to handle rather than two. Branch on `warning.code`.
224
269
  *
225
- * The one raised today is `'test-count-capped'`: more tests were found than
226
- * the analysis cap allows, so test-value analysis was skipped and no test
227
- * findings exist. That is a silent absence — nothing throws — so check this
228
- * rather than assuming an empty findings list means "nothing to report".
270
+ * Raised today: `'analysis-option-corrected'`. A skipped test-value analysis
271
+ * is not a warning: it is recorded in `testValueAnalysis`, and the renderers
272
+ * offer to run it (`'test-count-capped'` is no longer raised).
229
273
  *
230
274
  * `renderWaferMap`/`renderWaferGallery` surface these automatically in the
231
275
  * toolbar's warning indicator; a host does not have to render them itself.
@@ -450,9 +494,13 @@ export interface LotStatsSummary {
450
494
  * describing the whole batch.
451
495
  */
452
496
  mixedIdentityFields?: string[];
497
+ /** The options this lot was analysed with, as passed (`perWaferSummaries` aside). See `StatsSummary.analysisOptions`. */
498
+ analysisOptions?: AnalyzeWaferMapOptions;
453
499
  /** Engine-computed analysis stats for this lot. */
454
500
  stats: {
455
501
  waferCount: number;
502
+ /** The lot's test-value analysis: one decision for every wafer, sizes summed over them. */
503
+ testValueAnalysis?: TestValueAnalysisStatus;
456
504
  /**
457
505
  * Cp/Cpk/Pp/Ppk over the whole lot, each wafer as a subgroup — so `stdWithin`
458
506
  * is the pooled within-wafer stddev and Cp and Pp genuinely differ. Present
@@ -513,32 +561,39 @@ export interface AnalyzeWaferMapOptions {
513
561
  /**
514
562
  * Full parametric **spatial significance** analysis: Welch comparisons of each
515
563
  * test's values between every region (ring/quadrant/reticle/site/sector) and
516
- * the rest of the wafer, plus spec-limit region findings. This is the expensive
517
- * pass — it scales with (regions × tests × dies) — so it is **off by default**.
518
- * Enable it only when you display the resulting regional test-value findings.
564
+ * the rest of the wafer, with per-test statistics. It scales with dies × tests,
565
+ * the expensive part of analysis.
566
+ *
567
+ * - `'auto'` (default): run it when the dies × parametric tests analysed is
568
+ * within the test-value budget (1,500,000 values, about a second in the
569
+ * slower browser engine) — summed over the wafers for `analyzeWaferLot`, so a
570
+ * lot decides once. Over the budget it is skipped and the renderers' Findings
571
+ * section offers to run it (see `stats.testValueAnalysis`).
572
+ * - `true`: run it whatever the size.
573
+ * - `false`: do not run it, nor the spec-limit and functional pass-rate region
574
+ * findings that go with it.
519
575
  *
520
- * For per-test descriptive statistics (mean/stddev/quartiles for box plots)
521
- * **without** the spatial comparisons, use {@link computePerTestStats} instead —
522
- * it is an order of magnitude cheaper. Enabling `enableTestValueAnalysis` also
523
- * produces `perTestStats`, so you do not need both.
576
+ * Limit-failure and functional pass-rate findings run unless this is `false`.
577
+ * For per-test statistics without the spatial comparisons, use
578
+ * {@link computePerTestStats}.
524
579
  */
525
- enableTestValueAnalysis?: boolean;
580
+ enableTestValueAnalysis?: boolean | 'auto';
526
581
  /**
527
582
  * Compute per-test descriptive statistics (`count`, `min`, `max`, `mean`,
528
583
  * `stddev`, `median`, `q1`, `q3`) into `StatsSummary.stats.perTestStats` —
529
584
  * the cheap quartile scan only, **without** the expensive regional Welch
530
585
  * comparisons of {@link enableTestValueAnalysis}. Use this for box-plot /
531
586
  * histogram panels that need distribution shape but not spatial findings.
532
- * Off by default. Implied by `enableTestValueAnalysis`.
587
+ * Off by default; produced whenever the test-value analysis runs. Not subject to
588
+ * the test-value budget: asking for it is choosing its cost.
533
589
  */
534
590
  computePerTestStats?: boolean;
535
591
  /** Number of angular sectors for sector analysis. Must be 4, 8 or 16. Default 8. */
536
592
  sectorCount?: number;
537
593
  /**
538
594
  * Restrict test value analysis to a specific subset of test numbers.
539
- * When omitted and more than 250 tests are present in the data, test value
540
- * analysis is skipped automatically with a console warning — pass this option
541
- * to analyse a specific subset in that case.
595
+ * When omitted, every parametric test with values. Naming fewer tests also
596
+ * shrinks the analysis, which can bring an `'auto'` run under its budget.
542
597
  * Example: `testNumbers: [1050, 1060, 1070]`
543
598
  */
544
599
  testNumbers?: number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wafertools/wafermap",
3
- "version": "0.35.1",
3
+ "version": "0.36.0",
4
4
  "description": "Interactive wafer map visualization and yield analysis for semiconductor test data. Hard bins, soft bins, test values, retests, edge exclusion, reticle overlays, spatial statistics, failure clustering, and lot-level trend analysis — pure ES modules, no runtime dependencies, no server required.",
5
5
  "type": "module",
6
6
  "license": "MIT",