@wafertools/wafermap 0.35.0 → 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 (97) hide show
  1. package/AGENTS.md +18 -9
  2. package/CHANGELOG.md +246 -0
  3. package/README.md +7 -4
  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/capability.js +1 -1
  8. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  9. package/dist/packages/canvas-adapter/charts/histogram.js +1 -1
  10. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  11. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  12. package/dist/packages/canvas-adapter/index.d.ts +1 -0
  13. package/dist/packages/canvas-adapter/index.js +1 -1
  14. package/dist/packages/canvas-adapter/insightsTab.d.ts +7 -0
  15. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  16. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +20 -5
  17. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  18. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +85 -38
  19. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  20. package/dist/packages/canvas-adapter/summaryPanel.d.ts +38 -12
  21. package/dist/packages/canvas-adapter/summaryPanel.js +4 -2
  22. package/dist/packages/canvas-adapter/summaryToggle.d.ts +11 -0
  23. package/dist/packages/canvas-adapter/summaryToggle.js +1 -0
  24. package/dist/packages/canvas-adapter/testValueOffer.d.ts +14 -0
  25. package/dist/packages/canvas-adapter/testValueOffer.js +1 -0
  26. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  27. package/dist/packages/canvas-adapter/toolbar.d.ts +2 -0
  28. package/dist/packages/canvas-adapter/toolbar.js +2 -2
  29. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  30. package/dist/packages/canvas-adapter/userGuideHtml.js +46 -23
  31. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  32. package/dist/packages/canvas-adapter/version.js +1 -1
  33. package/dist/packages/canvas-adapter/warnings.js +1 -1
  34. package/dist/packages/core/aggregates.d.ts +10 -0
  35. package/dist/packages/core/aggregates.js +1 -1
  36. package/dist/packages/core/classify.d.ts +5 -0
  37. package/dist/packages/core/classify.js +1 -1
  38. package/dist/packages/core/dieTable.d.ts +31 -0
  39. package/dist/packages/core/dieTable.js +1 -1
  40. package/dist/packages/core/passBins.d.ts +6 -0
  41. package/dist/packages/core/passBins.js +1 -1
  42. package/dist/packages/core/wafer.d.ts +10 -1
  43. package/dist/packages/core/wafer.js +1 -1
  44. package/dist/packages/renderer/buildView.d.ts +5 -0
  45. package/dist/packages/renderer/buildView.js +1 -1
  46. package/dist/packages/renderer/buildWaferMap.d.ts +50 -4
  47. package/dist/packages/renderer/buildWaferMap.js +1 -1
  48. package/dist/packages/renderer/derivedTests/parser.js +1 -1
  49. package/dist/packages/renderer/fmt.d.ts +10 -0
  50. package/dist/packages/renderer/fmt.js +1 -1
  51. package/dist/packages/renderer/index.d.ts +1 -0
  52. package/dist/packages/renderer/index.js +1 -1
  53. package/dist/packages/renderer/spec.d.ts +4 -0
  54. package/dist/packages/renderer/spec.js +1 -1
  55. package/dist/packages/renderer/valueFilter.d.ts +55 -0
  56. package/dist/packages/renderer/valueFilter.js +1 -0
  57. package/dist/packages/stats/analyzeWaferLot.d.ts +16 -0
  58. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  59. package/dist/packages/stats/analyzeWaferMap.d.ts +62 -4
  60. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  61. package/dist/packages/stats/capability.d.ts +5 -0
  62. package/dist/packages/stats/capability.js +1 -1
  63. package/dist/packages/stats/clusterDetection.js +1 -1
  64. package/dist/packages/stats/connectedComponents.d.ts +19 -0
  65. package/dist/packages/stats/connectedComponents.js +1 -1
  66. package/dist/packages/stats/correlation.d.ts +36 -4
  67. package/dist/packages/stats/correlation.js +1 -1
  68. package/dist/packages/stats/filterFindings.d.ts +1 -1
  69. package/dist/packages/stats/filterFindings.js +1 -1
  70. package/dist/packages/stats/findingText.d.ts +8 -0
  71. package/dist/packages/stats/findingText.js +2 -2
  72. package/dist/packages/stats/index.d.ts +2 -1
  73. package/dist/packages/stats/index.js +1 -1
  74. package/dist/packages/stats/lotDrift.js +1 -1
  75. package/dist/packages/stats/lotPattern.js +1 -1
  76. package/dist/packages/stats/math.d.ts +25 -3
  77. package/dist/packages/stats/math.js +1 -1
  78. package/dist/packages/stats/mergeTestDefs.js +1 -1
  79. package/dist/packages/stats/patternClassification.d.ts +44 -18
  80. package/dist/packages/stats/patternClassification.js +1 -1
  81. package/dist/packages/stats/plotData.d.ts +11 -0
  82. package/dist/packages/stats/plotData.js +1 -1
  83. package/dist/packages/stats/regions.d.ts +6 -0
  84. package/dist/packages/stats/regions.js +1 -1
  85. package/dist/packages/stats/renderSummaryReport.js +33 -33
  86. package/dist/packages/stats/reportHtml.d.ts +12 -18
  87. package/dist/packages/stats/reportHtml.js +112 -48
  88. package/dist/packages/stats/synthesis.d.ts +48 -17
  89. package/dist/packages/stats/synthesis.js +1 -1
  90. package/dist/packages/stats/testPassRate.js +1 -1
  91. package/dist/packages/stats/testValueBudget.d.ts +15 -0
  92. package/dist/packages/stats/testValueBudget.js +1 -0
  93. package/dist/packages/stats/types.d.ts +89 -22
  94. package/llms.txt +2 -2
  95. package/package.json +1 -1
  96. package/dist/packages/canvas-adapter/summaryRail.d.ts +0 -7
  97. package/dist/packages/canvas-adapter/summaryRail.js +0 -1
@@ -1,14 +1,25 @@
1
1
  import type { LotStatsSummary, StatsSeverity, StatsSummary } from './types.js';
2
- /** What a sentence fragment points at, so a surface can link it to its evidence. */
3
- export interface SynthesisTarget {
2
+ /**
3
+ * What an item shows when it is chosen: a finding (its dies, as the findings list shows them), or a test
4
+ * (its values, with the dies it fails). Every item and every Watch line has one, so a surface can make
5
+ * every row act the same way rather than linking only the items that happen to rest on a finding.
6
+ */
7
+ export type SynthesisTarget = {
4
8
  kind: 'finding';
5
9
  id: string;
6
- }
7
- /** A run of text, optionally linked. Structured, not a string, so the panel can make
8
- * links and the report can make anchors from the same sentence. */
9
- export interface SynthesisPart {
10
- text: string;
11
- target?: SynthesisTarget;
10
+ } | {
11
+ kind: 'test';
12
+ testNumber: number;
13
+ };
14
+ /** One part of an item that can be shown on its own: a fail bin in its region, the pattern, a test on the same dies. */
15
+ export interface SynthesisChip {
16
+ label: string;
17
+ target: SynthesisTarget;
18
+ /** Set for a bin, so a surface can draw the bin's legend colour beside it. */
19
+ bin?: {
20
+ kind: 'hardBin' | 'softBin';
21
+ bin: number;
22
+ };
12
23
  }
13
24
  /** How much of the lot an item costs, in three steps. Drawn as a meter, never as colour alone. */
14
25
  export type ImpactTier = 'high' | 'medium' | 'low';
@@ -20,11 +31,22 @@ export interface SynthesisItem {
20
31
  /** Estimated dies lost to this item (pass-rate shortfall × dies in the region). */
21
32
  diesLost: number;
22
33
  severity: StatsSeverity;
23
- parts: SynthesisPart[];
34
+ /** The item as a sentence. Plain text: what the item shows is `target`, and its parts are `chips`. */
35
+ text: string;
36
+ /** The item in a few words, for the compact list: `Ring 2: hard bin 4 (Short), 62 dies`. */
37
+ brief: string;
38
+ /** What `target` is, as a reader names it: `Ring 4 (edge)`, `W06`, `IP3_DBM`. */
39
+ subject: string;
40
+ /** What choosing the item shows: the finding whose dies it counts, or the test it is about. */
41
+ target: SynthesisTarget;
42
+ /** Its parts that can be shown alone, in the order the sentence names them. Empty for a single-part item. */
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;
24
46
  /** The leading finding, then the others that stand on the same dies. */
25
47
  findingIds: string[];
26
- /** The item in a few words, for the compact list: `Ring 2: hard bin 4 (Short), 62 dies`. */
27
- brief: SynthesisPart;
48
+ /** Tests the item names: its own test, or tests whose failing dies lie mostly on its dies. */
49
+ testNumbers: number[];
28
50
  }
29
51
  /**
30
52
  * A signal that costs no dies of its own yet but predicts loss: a trend across the wafers, or a test whose
@@ -32,11 +54,12 @@ export interface SynthesisItem {
32
54
  * Ppk of 0.9 with no failures does not belong on the same axis as 400 failing dies.
33
55
  */
34
56
  export interface SynthesisWatch {
35
- parts: SynthesisPart[];
57
+ text: string;
58
+ target: SynthesisTarget;
36
59
  findingIds: string[];
37
60
  }
38
61
  export interface Synthesis {
39
- headline: SynthesisPart[];
62
+ headline: string;
40
63
  items: SynthesisItem[];
41
64
  /**
42
65
  * Items that clear the floor but not the cap, so nothing material goes unmentioned: the ones named
@@ -62,15 +85,23 @@ export interface SynthesisContext {
62
85
  */
63
86
  passBins?: readonly number[];
64
87
  }
88
+ /**
89
+ * The summary a synthesis is written from. A lot of one wafer is that wafer: the lot's own findings need
90
+ * a signal to recur on two wafers, so on one they are always empty and the lot would read as clean while
91
+ * its only wafer is not. Surfaces resolve an item's finding ids against this summary's findings.
92
+ */
93
+ export declare function synthesisSource(summary: StatsSummary | LotStatsSummary): StatsSummary | LotStatsSummary;
65
94
  /**
66
95
  * The synthesis for a wafer or a lot: a headline, up to three loss items ranked by dies
67
96
  * lost, and a line saying what was compared.
68
97
  */
69
- export declare function buildSynthesis(summary: StatsSummary | LotStatsSummary, ctx?: SynthesisContext): Synthesis;
70
- /** The heading over the compact list of smaller items: the floor is the same one that admits an item at all. */
71
- export declare const SYNTHESIS_SMALLER_HEADING: string;
98
+ export declare function buildSynthesis(input: StatsSummary | LotStatsSummary, ctx?: SynthesisContext): Synthesis;
99
+ /** The heading over the compact list of further items: the floor is the same one that admits an item at all. */
100
+ export declare const SYNTHESIS_ALSO_HEADING: string;
72
101
  /** A compact-list row: the item in a few words, then its share of the analysed dies. Plain text. */
73
102
  export declare const synthesisRowShare: (it: SynthesisItem) => string;
74
- /** A synthesis as plain text, one line per part, for tests and for any surface that is not HTML. */
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;
105
+ /** A synthesis as plain text, one line per item, for tests and for any surface that is not HTML. */
75
106
  export declare function synthesisText(s: Synthesis): string;
76
107
  //# sourceMappingURL=synthesis.d.ts.map
@@ -1,2 +1,2 @@
1
- import{maxOf as C,minOf as P}from"../core/utils.js";import{passBinsLabel as T}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as Y}from"./lotDrift.js";import{plainBinTerms as q}from"../renderer/fmt.js";const G=2,N=1,O=3,W=5,H=.01,X=.02,U=.04,V=.15,J=.4,Q=.5,Z=.1,ee=2,te=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function ie(e){const n=e.highlight;return"dieKeysByWafer"in n&&n.dieKeysByWafer?Object.values(n.dieKeysByWafer).reduce((i,a)=>i+a.length,0):"dieKeys"in n&&n.dieKeys&&n.dieKeys.length>0?n.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function ne(e){const n=e.highlight,i=new Set;if("dieKeysByWafer"in n&&n.dieKeysByWafer)for(const[a,l]of Object.entries(n.dieKeysByWafer))for(const t of l)i.add(`${a}:${t}`);else if("dieKeys"in n&&n.dieKeys)for(const a of n.dieKeys)i.add(a);return i}const h=e=>Math.abs(e.effect.absoluteDelta??0),y=e=>h(e)*(ie(e)??0),I=e=>(e*100).toFixed(1),L=e=>{const n=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return q(n)},g=e=>Math.round(e).toLocaleString("en-GB"),v=(e,n,i=`${n}s`)=>`${e} ${e===1?n:i}`;function M(e){const n=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(n)?`${n} quadrant`:n}function se(e){const n=e.map((t,s)=>s),i=t=>n[t]===t?t:n[t]=i(n[t]),a=e.map(ne);for(let t=0;t<e.length;t++)for(let s=t+1;s<e.length;s++){const o=a[t].size<=a[s].size?a[t]:a[s],$=o===a[t]?a[s]:a[t];if(o.size===0)continue;let f=0;for(const c of o)$.has(c)&&f++;f>=Q*o.size&&(n[i(t)]=i(s))}const l=new Map;return e.forEach((t,s)=>{const o=i(s);(l.get(o)??l.set(o,[]).get(o)).push(s)}),[...l.values()]}const oe=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",F=(e,n)=>e.level===n.level&&e.comparison.family===n.comparison.family&&e.comparison.left===n.comparison.left;function ae(e,n,i){if(!i)return[];const a=t=>n.filter(s=>s.variable.kind===t&&F(s,e)&&s.effect.direction==="higher"&&!(t==="hardBin"&&i.includes(s.variable.bin??NaN)));return(a("hardBin").length>0?a("hardBin"):a("softBin")).filter(t=>t!==e).sort((t,s)=>h(s)-h(t))}function re(e,n,i,a){const l=e.filter(d=>d.variable.kind==="yield"),t=[...l.length>0?l:e].sort((d,p)=>y(p)-y(d))[0],s=e.filter(d=>d!==t),o=[],$=t.level==="lot"&&"waferIndices"in t.highlight?t.highlight.waferIndices?.length:void 0,f=$!==void 0&&i?` on ${$}/${i} wafers`:"",c=oe(t),w=(d,p)=>({text:d,target:{kind:"finding",id:p.id}});o.push(w(M(t),t)),o.push({text:c?"":`: pass rate ${I(h(t))} points below the rest of the wafer${f}`}),c&&o.push({text:": "},w(L(t),t),{text:` ${I(h(t))} points higher than the rest of the wafer${f}`});const b=ae(t,n,a).map(d=>({f:d,share:h(d)/(h(t)||1)})).filter(d=>c||d.share>=Z).slice(0,ee);if(c)for(const{f:d}of b)o.push({text:", "},w(L(d),d),{text:` ${I(h(d))} points higher`});else if(b.length>0){const d=b[0].share>.5&&b[0].share<=1?"mostly ":"";b.forEach(({f:p,share:x},B)=>{const m=x<=1;B===0?o.push({text:`; ${m?d:""}`}):o.push({text:", "}),o.push(w(L(p),p)),o.push({text:B===0?m?` accounts for ${I(h(p))} of those points`:` is ${I(h(p))} points higher`:m?` for ${I(h(p))}`:` ${I(h(p))} points higher`})})}o.push({text:` \u2014 about ${g(y(t))} dies lost`});const S=[...new Set(s.filter(d=>!F(d,t)).map(M))];S.length>0&&o.push({text:` (also seen as ${S.join(", ")})`});const _=c?L(t):"pass rate";return{impact:"low",shareOfDies:0,diesLost:y(t),severity:t.severity,parts:o,findingIds:[t.id,...s.map(d=>d.id)],brief:{text:`${M(t)}: ${_}, ${g(y(t))} dies`,target:{kind:"finding",id:t.id}}}}function le(e,n){return e>=U||n>=J?"high":e>=X||n>=V?"medium":"low"}function de(e){const n=i=>i.stats.yieldPercent==null?0:i.stats.analyzedDies*(1-i.stats.yieldPercent/100);return e.level==="wafer"?n(e):e.perWafer.reduce((i,a)=>i+n(a.summary),0)}function fe(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((n,i)=>n+i.summary.stats.analyzedDies,0)}const K=e=>e.id.startsWith("inter-wafer:yield:");function ce(e){const n=[];for(const i of e.findings){if(!K(i)||i.effect.direction!=="lower")continue;const a="waferIndices"in i.highlight?i.highlight.waferIndices?.[0]:void 0,l=a===void 0?void 0:e.perWafer.find(t=>t.waferIndex===a)?.summary.stats.analyzedDies;l!==void 0&&n.push({impact:"low",shareOfDies:0,diesLost:h(i)*l,severity:i.severity,parts:[{text:i.summary.replace(/ percentage points lower than the lot median$/," points below the lot median"),target:{kind:"finding",id:i.id}},{text:` \u2014 about ${g(h(i)*l)} dies lost`}],findingIds:[i.id],brief:{text:`${i.comparison.left}: yield, ${g(h(i)*l)} dies`,target:{kind:"finding",id:i.id}}})}return n}function he(e,n){const i=e.stats,a=[],l=(t,s,o,$,f,c)=>{if(o<=0||$<=0)return;n.add(t);const w=o/$*100;a.push({impact:"low",shareOfDies:0,diesLost:o,severity:"info",parts:[{text:s},{text:` ${f} on ${g(o)} of ${g($)} dies (${w.toFixed(1)}%)`}],findingIds:[],brief:{text:`${s}: ${g(o)} dies ${c}`}})};for(const t of i.testSpecYield??[]){const s=t.failLowDies+t.failHighDies,o=t.failHighDies===0?"is below its low limit":t.failLowDies===0?"is above its high limit":`is outside its limits (${g(t.failLowDies)} low, ${g(t.failHighDies)} high)`;l(t.testNumber,t.label,s,t.totalDies,o,"outside limits")}for(const t of i.functionalYield??[])l(t.testNumber,t.label,t.failDies,t.totalDies,"fails","fail");return a}function pe(e,n){const i=[],a={unusual:0,notable:1,info:2},l=e.findings.filter(s=>s.id.startsWith("drift:")).sort((s,o)=>a[s.severity]-a[o.severity]||(s.stats.adjustedPValue??1)-(o.stats.adjustedPValue??1));for(const s of l){const o=s.variable.label;i.push({parts:[{text:o,target:{kind:"finding",id:s.id}},{text:s.summary.slice(o.length)}],findingIds:[s.id]})}const t=(e.stats.capability??[]).filter(s=>s.hasSpec&&s.ppk!==null&&s.ppk!==void 0&&s.ppk<N&&!n.has(s.testNumber)).sort((s,o)=>(s.ppk??0)-(o.ppk??0));for(const s of t)i.push({parts:[{text:`${s.label} has Ppk ${s.ppk.toFixed(2)} against its limits (below ${N.toFixed(1)})`}],findingIds:[]});return i.slice(0,G)}function ue(e,n){const i=n.passBins&&n.passBins.length>0?`; pass ${T([n.passBins])}`:"";if(e.level==="wafer"){const f=e.stats.yieldPercent;return f==null?[{text:`${g(e.stats.totalDies)} dies, no bin data to judge yield by.`}]:[{text:`Yield ${f.toFixed(1)}% (${g(e.stats.totalDies)} dies${i}).`}]}const a=e.lotYieldSeries.map(f=>f.yieldPercent).filter(f=>typeof f=="number");if(a.length===0)return[{text:`${v(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`}];const l=a.reduce((f,c)=>f+c,0)/a.length,t=e.perWafer.reduce((f,c)=>f+c.summary.stats.totalDies,0),[s,o]=[P(a).toFixed(1),C(a).toFixed(1)],$=s!==o?`, range ${s}\u2013${o}%`:"";return[{text:`Yield ${l.toFixed(1)}% (mean of ${v(a.length,"wafer")}, ${g(t)} dies${i})${$}.`}]}function ge(e,n){const i=[],a=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(o=>o.summary.stats.testsConsidered)).size,l=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(o=>o.summary.stats.hardBinsConsidered)).size;if(a>0&&i.push(v(a,"test")),l>0&&i.push(v(l,"hard bin")),i.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const o=e.findings.filter(K);i.push(o.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${v(o.length,"outlier wafer")})`),e.stats.waferCount>=Y&&i.push("the yield trend across the wafers (input order)")}const t=e.findings.filter(o=>!n.has(o.id)).length,s=t>0?` ${v(t,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${i.join(", ")}.${s}`}export function buildSynthesis(e,n={}){const i=e.findings,a=e.level==="lot"?e.stats.waferCount:void 0,l=n.passBins,t=new Map(i.map(r=>[r.id,r])),s=r=>l!==void 0&&(r.variable.kind==="hardBin"?!l.includes(r.variable.bin??NaN):r.variable.kind==="softBin"),o=i.filter(r=>te.has(r.comparison.family)&&y(r)>0&&(r.variable.kind==="yield"&&r.effect.direction==="lower"||s(r)&&r.effect.direction==="higher")),f=o.some(r=>r.variable.kind==="hardBin")?o.filter(r=>r.variable.kind!=="softBin"):o,c=[],w=new Set;for(const r of se(f))c.push(re(r.map(u=>f[u]),i,a,l));for(const r of i.filter(u=>u.variable.kind==="spatialPattern")){const u=new Set((r.relatedIds??[]).filter(k=>t.has(k))),D=c.find(k=>k.findingIds.some(z=>u.has(z)));if(!D)continue;const A=r.level==="lot"&&"waferIndices"in r.highlight?r.highlight.waferIndices?.length:void 0,j=A!==void 0&&a?` on ${A}/${a} wafers`:"";D.parts.unshift({text:`${r.variable.label} pattern${j}. `,target:{kind:"finding",id:r.id}}),D.findingIds.unshift(r.id,...[...u].filter(k=>!D.findingIds.includes(k)))}e.level==="lot"&&c.push(...ce(e));const b=new Set;c.push(...he(e,b));const S=fe(e),_=de(e),d=c.filter(r=>S>0&&r.diesLost/S>=H);for(const r of d)r.shareOfDies=r.diesLost/S,r.impact=le(r.diesLost/S,_>0?r.diesLost/_:0);d.sort((r,u)=>u.diesLost-r.diesLost);const p=d.slice(0,O),x=d.slice(O);for(const r of[...p,...x])for(const u of r.findingIds)w.add(u);const B=x.length>0?{items:x.slice(0,W),more:Math.max(0,x.length-W)}:void 0,m=pe(e,b);for(const r of m)for(const u of r.findingIds)w.add(u);const R=e.level==="lot"?"region, fail bin or wafer":"region or fail bin",E=p.length===0?`Nothing stands out: no ${R} costs as much as ${I(H)} yield points.`:void 0;return{headline:ue(e,n),items:p,...B?{also:B}:{},...m.length?{watch:m}:{},...E?{nothing:E}:{},checked:ge(e,w)}}export const SYNTHESIS_SMALLER_HEADING=`Smaller, each costing at least ${(H*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>`${(e.shareOfDies*100).toFixed(1)}%`;export function synthesisText(e){const n=i=>i.map(a=>a.text).join("");return[n(e.headline),...e.nothing?[e.nothing]:[],...e.items.map((i,a)=>`${a+1}. ${n(i.parts)}`),...e.also?[`${SYNTHESIS_SMALLER_HEADING}: ${e.also.items.map(i=>`${i.brief.text} (${synthesisRowShare(i)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],...e.watch?e.watch.map(i=>`Watch: ${n(i.parts)}`):[],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.
@@ -251,6 +295,18 @@ export interface StatsSummary {
251
295
  /** `(passDies / totalDies) × 100` in [0, 100], or `null` when no dies had this test. */
252
296
  yieldPercent: number | null;
253
297
  }>;
298
+ /**
299
+ * The dies each test fails, by test number: outside its limits for a parametric test (the dies
300
+ * `testSpecYield` counts in `failLowDies + failHighDies`), failing for a functional test
301
+ * (`functionalYield`'s `failDies`). `dieKeys` are `getDieKey` strings; `lostDies` is how many of
302
+ * them also fail the wafer's yield (not in a pass bin, or with no bin to judge by), so a test's
303
+ * failures on dies binned as passing are told apart from the yield it costs. Only tests with a
304
+ * failing die are present.
305
+ */
306
+ testFailures?: Record<number, {
307
+ dieKeys: string[];
308
+ lostDies: number;
309
+ }>;
254
310
  /**
255
311
  * Per-test pass rate for each functional (`testType: 'F'`) test — "functional
256
312
  * yield" in fab terms. Verdicts are read via `getTestPassStatus` (recorded
@@ -438,9 +494,13 @@ export interface LotStatsSummary {
438
494
  * describing the whole batch.
439
495
  */
440
496
  mixedIdentityFields?: string[];
497
+ /** The options this lot was analysed with, as passed (`perWaferSummaries` aside). See `StatsSummary.analysisOptions`. */
498
+ analysisOptions?: AnalyzeWaferMapOptions;
441
499
  /** Engine-computed analysis stats for this lot. */
442
500
  stats: {
443
501
  waferCount: number;
502
+ /** The lot's test-value analysis: one decision for every wafer, sizes summed over them. */
503
+ testValueAnalysis?: TestValueAnalysisStatus;
444
504
  /**
445
505
  * Cp/Cpk/Pp/Ppk over the whole lot, each wafer as a subgroup — so `stdWithin`
446
506
  * is the pooled within-wafer stddev and Cp and Pp genuinely differ. Present
@@ -501,32 +561,39 @@ export interface AnalyzeWaferMapOptions {
501
561
  /**
502
562
  * Full parametric **spatial significance** analysis: Welch comparisons of each
503
563
  * test's values between every region (ring/quadrant/reticle/site/sector) and
504
- * the rest of the wafer, plus spec-limit region findings. This is the expensive
505
- * pass — it scales with (regions × tests × dies) — so it is **off by default**.
506
- * 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.
507
575
  *
508
- * For per-test descriptive statistics (mean/stddev/quartiles for box plots)
509
- * **without** the spatial comparisons, use {@link computePerTestStats} instead —
510
- * it is an order of magnitude cheaper. Enabling `enableTestValueAnalysis` also
511
- * 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}.
512
579
  */
513
- enableTestValueAnalysis?: boolean;
580
+ enableTestValueAnalysis?: boolean | 'auto';
514
581
  /**
515
582
  * Compute per-test descriptive statistics (`count`, `min`, `max`, `mean`,
516
583
  * `stddev`, `median`, `q1`, `q3`) into `StatsSummary.stats.perTestStats` —
517
584
  * the cheap quartile scan only, **without** the expensive regional Welch
518
585
  * comparisons of {@link enableTestValueAnalysis}. Use this for box-plot /
519
586
  * histogram panels that need distribution shape but not spatial findings.
520
- * 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.
521
589
  */
522
590
  computePerTestStats?: boolean;
523
591
  /** Number of angular sectors for sector analysis. Must be 4, 8 or 16. Default 8. */
524
592
  sectorCount?: number;
525
593
  /**
526
594
  * Restrict test value analysis to a specific subset of test numbers.
527
- * When omitted and more than 250 tests are present in the data, test value
528
- * analysis is skipped automatically with a console warning — pass this option
529
- * 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.
530
597
  * Example: `testNumbers: [1050, 1060, 1070]`
531
598
  */
532
599
  testNumbers?: number[];
package/llms.txt CHANGED
@@ -32,7 +32,7 @@ where repo-relative paths do not resolve.
32
32
  - [Package surface and types](https://wafertools.github.io/wafermap/api/reference/) - exports, helpers, types, limitations.
33
33
  - [Quick start](https://wafertools.github.io/wafermap/quickstart/) - install and first map.
34
34
  - [Troubleshooting](https://wafertools.github.io/wafermap/troubleshooting/) - common failure modes.
35
- - [Examples](https://wafertools.github.io/wafermap/examples/) - 23 runnable demo pages, also downloadable at https://wafertools.github.io/wafermap/wafermap-examples.zip to run offline.
35
+ - [Examples](https://wafertools.github.io/wafermap/examples/) - 25 runnable demo pages, also downloadable at https://wafertools.github.io/wafermap/wafermap-examples.zip to run offline.
36
36
 
37
37
  ## Public package entry points
38
38
  - `@wafertools/wafermap` - `buildWaferMap()`, geometry, colour-scheme registries. Pure, no DOM.
@@ -50,7 +50,7 @@ where repo-relative paths do not resolve.
50
50
  - Recommended path for most users: `buildWaferMap()` + `renderWaferMap()`.
51
51
  - Bins, test values and verdicts must be numbers/booleans. A parser that leaves `hbin` as `"1"` builds a map where those dies count as fails — convert with `Number()` at parse time.
52
52
  - `passBins` and `ringCount` are set once on `buildWaferMap()` and travel on the result. Neither is an option on `analyzeWaferMap`, `analyzeWaferLot`, `renderWaferMap` or `renderWaferGallery`. `passBins` sets both the yield number and the wording of its label — do not assume `[1]`.
53
- - Statistics surfaces are built in: pass `statsSummary` for the Summary panel; the chart suite (Insights) is on by default and `insights: { enabled: false }` removes it (plus sweep plots in `insights.plots` for response curves). Do not rebuild those charts from the deprecated chart-data builders.
53
+ - Statistics surfaces are built in: pass `statsSummary` for the Summary panel; the chart suite (Insights) is on by default and `insights: { enabled: false }` removes it (plus plots and sweeps in `insights.plots`, kept by the host with `insights.onPlotsChange`, for the reader's own charts and response curves). Do not rebuild those charts from the deprecated chart-data builders.
54
54
  - A value computed from other tests goes in `buildWaferMap`'s `derivedTests` (`{ testNumber, name, expression: 'abs(t[1020] - t[1010])' }`), never injected into `testValues` by the host.
55
55
  - `activeTest` takes a test number (e.g. `1050`), not a positional index.
56
56
  - Functional tests (`testType: 'F'`) have no value; read verdicts only via `getTestPassStatus()`. A missing verdict is no-data, never a fail.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wafertools/wafermap",
3
- "version": "0.35.0",
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",
@@ -1,7 +0,0 @@
1
- export interface SummaryRail {
2
- el: HTMLButtonElement;
3
- /** Show while the panel is closed and a Summary exists; `notable` tints it like the toolbar icon. */
4
- sync(visible: boolean, notable: boolean): void;
5
- }
6
- export declare function createSummaryRail(doc: Document, side: 'left' | 'right', onOpen: () => void): SummaryRail;
7
- //# sourceMappingURL=summaryRail.d.ts.map
@@ -1 +0,0 @@
1
- import{CLR as e,FONT as s,RADIUS as d,SPACE as r,wireControlHover as c,wireTooltip as m}from"./toolbar.js";export function createSummaryRail(o,n,i){const t=o.createElement("button");return t.type="button",t.dataset.wmapSummaryRail="1",t.setAttribute("aria-expanded","false"),t.textContent=n==="right"?"\u25C2 Summary":"Summary \u25B8",Object.assign(t.style,{display:"none",flexShrink:"0",alignSelf:"flex-start",writingMode:"vertical-rl",cursor:"pointer",whiteSpace:"nowrap",fontSize:s.body,fontWeight:"600",color:e.icon,background:e.menuBg,border:`1px solid ${e.menuBorder}`,borderRadius:d.control,padding:`${r.md} ${r.sm}`,position:"sticky",top:r.md,order:n==="right"?"10":"-10"}),c(t,"bare"),m(t,"Open the Summary panel: what stands out, findings and statistics"),t.addEventListener("click",i),{el:t,sync(a,l){t.style.display=a?"block":"none",t.style.color=l?e.findingIndicator:e.icon}}}