@wafertools/wafermap 0.35.1 → 0.37.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 (188) hide show
  1. package/AGENTS.md +13 -10
  2. package/CHANGELOG.md +474 -0
  3. package/README.md +7 -7
  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/capability.js +1 -1
  7. package/dist/packages/canvas-adapter/charts/cardAbout.d.ts +21 -0
  8. package/dist/packages/canvas-adapter/charts/cardAbout.js +1 -0
  9. package/dist/packages/canvas-adapter/charts/chartShell.d.ts +65 -12
  10. package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
  11. package/dist/packages/canvas-adapter/charts/commonality.d.ts +18 -0
  12. package/dist/packages/canvas-adapter/charts/commonality.js +1 -0
  13. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  14. package/dist/packages/canvas-adapter/charts/groupComparison.d.ts +31 -0
  15. package/dist/packages/canvas-adapter/charts/groupComparison.js +1 -0
  16. package/dist/packages/canvas-adapter/charts/index.d.ts +0 -10
  17. package/dist/packages/canvas-adapter/charts/index.js +1 -1
  18. package/dist/packages/canvas-adapter/charts/patCard.d.ts +21 -0
  19. package/dist/packages/canvas-adapter/charts/patCard.js +1 -0
  20. package/dist/packages/canvas-adapter/charts/plotChart.d.ts +56 -2
  21. package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
  22. package/dist/packages/canvas-adapter/charts/pointInteractions.d.ts +2 -0
  23. package/dist/packages/canvas-adapter/charts/pointInteractions.js +1 -1
  24. package/dist/packages/canvas-adapter/charts/regionYieldDiagram.js +1 -1
  25. package/dist/packages/canvas-adapter/charts/sweep.js +1 -1
  26. package/dist/packages/canvas-adapter/dataTab.d.ts +3 -0
  27. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  28. package/dist/packages/canvas-adapter/dieList.d.ts +12 -0
  29. package/dist/packages/canvas-adapter/dieList.js +2 -2
  30. package/dist/packages/canvas-adapter/differenceMapPanel.d.ts +26 -0
  31. package/dist/packages/canvas-adapter/differenceMapPanel.js +1 -0
  32. package/dist/packages/canvas-adapter/drilldown.d.ts +3 -0
  33. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  34. package/dist/packages/canvas-adapter/filterButton.d.ts +3 -0
  35. package/dist/packages/canvas-adapter/filterButton.js +1 -0
  36. package/dist/packages/canvas-adapter/filterEditor.d.ts +53 -0
  37. package/dist/packages/canvas-adapter/filterEditor.js +1 -0
  38. package/dist/packages/canvas-adapter/guideWindow.d.ts +9 -1
  39. package/dist/packages/canvas-adapter/guideWindow.js +1 -1
  40. package/dist/packages/canvas-adapter/icons.js +1 -1
  41. package/dist/packages/canvas-adapter/index.d.ts +1 -0
  42. package/dist/packages/canvas-adapter/index.js +1 -1
  43. package/dist/packages/canvas-adapter/insightsTab.d.ts +57 -2
  44. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  45. package/dist/packages/canvas-adapter/pageFilter.d.ts +84 -0
  46. package/dist/packages/canvas-adapter/pageFilter.js +2 -0
  47. package/dist/packages/canvas-adapter/patMaps.d.ts +26 -0
  48. package/dist/packages/canvas-adapter/patMaps.js +1 -0
  49. package/dist/packages/canvas-adapter/plotCard.d.ts +67 -0
  50. package/dist/packages/canvas-adapter/plotCard.js +1 -0
  51. package/dist/packages/canvas-adapter/plotEditor.d.ts +13 -2
  52. package/dist/packages/canvas-adapter/plotEditor.js +1 -1
  53. package/dist/packages/canvas-adapter/plotModal.js +1 -1
  54. package/dist/packages/canvas-adapter/plotStore.js +1 -1
  55. package/dist/packages/canvas-adapter/plotTab.d.ts +6 -0
  56. package/dist/packages/canvas-adapter/plotTab.js +1 -1
  57. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +20 -5
  58. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  59. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +71 -37
  60. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  61. package/dist/packages/canvas-adapter/summaryPanel.d.ts +22 -9
  62. package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
  63. package/dist/packages/canvas-adapter/testValueOffer.d.ts +14 -0
  64. package/dist/packages/canvas-adapter/testValueOffer.js +1 -0
  65. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  66. package/dist/packages/canvas-adapter/toolbar.d.ts +12 -6
  67. package/dist/packages/canvas-adapter/toolbar.js +2 -2
  68. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  69. package/dist/packages/canvas-adapter/userGuideHtml.js +607 -117
  70. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  71. package/dist/packages/canvas-adapter/version.js +1 -1
  72. package/dist/packages/canvas-adapter/warnings.js +1 -1
  73. package/dist/packages/core/aggregates.d.ts +10 -0
  74. package/dist/packages/core/aggregates.js +1 -1
  75. package/dist/packages/core/classify.d.ts +11 -0
  76. package/dist/packages/core/classify.js +1 -1
  77. package/dist/packages/core/dieTable.d.ts +5 -0
  78. package/dist/packages/core/dieTable.js +1 -1
  79. package/dist/packages/core/dies.d.ts +2 -0
  80. package/dist/packages/core/dies.js +1 -1
  81. package/dist/packages/core/wafer.d.ts +10 -1
  82. package/dist/packages/core/wafer.js +1 -1
  83. package/dist/packages/renderer/buildView.d.ts +5 -0
  84. package/dist/packages/renderer/buildView.js +1 -1
  85. package/dist/packages/renderer/buildWaferMap.d.ts +21 -4
  86. package/dist/packages/renderer/buildWaferMap.js +1 -1
  87. package/dist/packages/renderer/deprecate.d.ts +2 -8
  88. package/dist/packages/renderer/deprecate.js +1 -1
  89. package/dist/packages/renderer/derivedTests/parser.js +1 -1
  90. package/dist/packages/renderer/fmt.d.ts +10 -0
  91. package/dist/packages/renderer/fmt.js +1 -1
  92. package/dist/packages/renderer/index.d.ts +1 -0
  93. package/dist/packages/renderer/index.js +1 -1
  94. package/dist/packages/renderer/testLabel.d.ts +0 -11
  95. package/dist/packages/renderer/testLabel.js +1 -1
  96. package/dist/packages/renderer/valueFilter.d.ts +1 -1
  97. package/dist/packages/renderer/valueFilter.js +1 -1
  98. package/dist/packages/stats/analyzeWaferLot.d.ts +22 -0
  99. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  100. package/dist/packages/stats/analyzeWaferMap.d.ts +26 -1
  101. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  102. package/dist/packages/stats/binPareto.d.ts +2 -54
  103. package/dist/packages/stats/binPareto.js +1 -1
  104. package/dist/packages/stats/binRows.js +1 -1
  105. package/dist/packages/stats/capability.d.ts +10 -0
  106. package/dist/packages/stats/capability.js +1 -1
  107. package/dist/packages/stats/cardSpec.d.ts +53 -0
  108. package/dist/packages/stats/cardSpec.js +1 -0
  109. package/dist/packages/stats/chartCatalogue.d.ts +37 -0
  110. package/dist/packages/stats/chartCatalogue.js +1 -0
  111. package/dist/packages/stats/clusterDetection.d.ts +9 -0
  112. package/dist/packages/stats/clusterDetection.js +1 -1
  113. package/dist/packages/stats/commonality.d.ts +62 -0
  114. package/dist/packages/stats/commonality.js +1 -0
  115. package/dist/packages/stats/connectedComponents.js +1 -1
  116. package/dist/packages/stats/control.d.ts +21 -0
  117. package/dist/packages/stats/control.js +1 -0
  118. package/dist/packages/stats/correlation.d.ts +42 -4
  119. package/dist/packages/stats/correlation.js +1 -1
  120. package/dist/packages/stats/dieRegions.d.ts +4 -1
  121. package/dist/packages/stats/dieRegions.js +1 -1
  122. package/dist/packages/stats/differenceMap.d.ts +22 -0
  123. package/dist/packages/stats/differenceMap.js +1 -0
  124. package/dist/packages/stats/examplePicks.d.ts +22 -0
  125. package/dist/packages/stats/examplePicks.js +1 -0
  126. package/dist/packages/stats/filterFile.d.ts +41 -0
  127. package/dist/packages/stats/filterFile.js +2 -0
  128. package/dist/packages/stats/filterFindings.d.ts +21 -6
  129. package/dist/packages/stats/filterFindings.js +1 -1
  130. package/dist/packages/stats/findingText.d.ts +8 -0
  131. package/dist/packages/stats/findingText.js +2 -2
  132. package/dist/packages/stats/groupCompare.d.ts +87 -0
  133. package/dist/packages/stats/groupCompare.js +1 -0
  134. package/dist/packages/stats/guideSections.d.ts +55 -0
  135. package/dist/packages/stats/guideSections.js +1 -0
  136. package/dist/packages/stats/index.d.ts +5 -2
  137. package/dist/packages/stats/index.js +1 -1
  138. package/dist/packages/stats/lotDrift.js +1 -1
  139. package/dist/packages/stats/math.d.ts +29 -4
  140. package/dist/packages/stats/math.js +1 -1
  141. package/dist/packages/stats/mergeTestDefs.js +1 -1
  142. package/dist/packages/stats/metadataColumns.d.ts +3 -0
  143. package/dist/packages/stats/metadataColumns.js +1 -1
  144. package/dist/packages/stats/pat.d.ts +58 -0
  145. package/dist/packages/stats/pat.js +1 -0
  146. package/dist/packages/stats/patSummary.d.ts +45 -0
  147. package/dist/packages/stats/patSummary.js +1 -0
  148. package/dist/packages/stats/patternClassification.d.ts +3 -3
  149. package/dist/packages/stats/patternClassification.js +1 -1
  150. package/dist/packages/stats/plotData.d.ts +294 -17
  151. package/dist/packages/stats/plotData.js +1 -1
  152. package/dist/packages/stats/plotId.d.ts +2 -0
  153. package/dist/packages/stats/plotId.js +1 -1
  154. package/dist/packages/stats/plotReferences.d.ts +17 -0
  155. package/dist/packages/stats/plotReferences.js +1 -0
  156. package/dist/packages/stats/plotSpec.d.ts +239 -3
  157. package/dist/packages/stats/plotSpec.js +4 -4
  158. package/dist/packages/stats/regions.js +1 -1
  159. package/dist/packages/stats/renderSummaryReport.js +33 -33
  160. package/dist/packages/stats/reportHtml.d.ts +5 -12
  161. package/dist/packages/stats/reportHtml.js +98 -40
  162. package/dist/packages/stats/synthesis.d.ts +48 -16
  163. package/dist/packages/stats/synthesis.js +1 -1
  164. package/dist/packages/stats/testPassRate.d.ts +7 -0
  165. package/dist/packages/stats/testPassRate.js +1 -1
  166. package/dist/packages/stats/testValueBudget.d.ts +15 -0
  167. package/dist/packages/stats/testValueBudget.js +1 -0
  168. package/dist/packages/stats/types.d.ts +90 -30
  169. package/dist/packages/stats/yield.d.ts +3 -11
  170. package/dist/packages/stats/yield.js +1 -1
  171. package/llms.txt +1 -1
  172. package/package.json +2 -1
  173. package/dist/packages/canvas-adapter/charts/barPanel.d.ts +0 -83
  174. package/dist/packages/canvas-adapter/charts/barPanel.js +0 -1
  175. package/dist/packages/canvas-adapter/charts/binCluster.d.ts +0 -27
  176. package/dist/packages/canvas-adapter/charts/binCluster.js +0 -1
  177. package/dist/packages/canvas-adapter/charts/boxplot.d.ts +0 -72
  178. package/dist/packages/canvas-adapter/charts/boxplot.js +0 -1
  179. package/dist/packages/canvas-adapter/charts/groupedBarPlot.d.ts +0 -53
  180. package/dist/packages/canvas-adapter/charts/groupedBarPlot.js +0 -1
  181. package/dist/packages/canvas-adapter/charts/histogram.d.ts +0 -61
  182. package/dist/packages/canvas-adapter/charts/histogram.js +0 -1
  183. package/dist/packages/canvas-adapter/charts/scatter.d.ts +0 -80
  184. package/dist/packages/canvas-adapter/charts/scatter.js +0 -1
  185. package/dist/packages/canvas-adapter/charts/testPassRate.d.ts +0 -27
  186. package/dist/packages/canvas-adapter/charts/testPassRate.js +0 -1
  187. package/dist/packages/canvas-adapter/charts/trend.d.ts +0 -50
  188. package/dist/packages/canvas-adapter/charts/trend.js +0 -1
@@ -1,4 +1,6 @@
1
+ import { type FacetCuration } from './facets.js';
1
2
  import type { LotStatsSummary, StatsSeverity, StatsSummary } from './types.js';
3
+ import type { PlotSpec } from './plotSpec.js';
2
4
  /**
3
5
  * What an item shows when it is chosen: a finding (its dies, as the findings list shows them), or a test
4
6
  * (its values, with the dies it fails). Every item and every Watch line has one, so a surface can make
@@ -20,19 +22,41 @@ export interface SynthesisChip {
20
22
  kind: 'hardBin' | 'softBin';
21
23
  bin: number;
22
24
  };
25
+ /** Set for a test whose values shift on the item's dies: the chip shows that region on the test's map. */
26
+ shift?: true;
23
27
  }
24
28
  /** How much of the lot an item costs, in three steps. Drawn as a meter, never as colour alone. */
25
29
  export type ImpactTier = 'high' | 'medium' | 'low';
26
30
  export interface SynthesisItem {
27
- /** From the share of analysed dies lost, the same quantity the items are ranked by. */
31
+ /**
32
+ * `loss`: the item costs dies (a region's shortfall, a fail bin, an outlier wafer, a failing test). `signal`: it costs
33
+ * none of its own but moves the values (a test shifted in a region, a drift across the wafers, a spread too wide for
34
+ * its limits, dies out of limits yet binned as passing). Both are ranked by `affected`.
35
+ */
36
+ kind: 'loss' | 'signal';
37
+ /** From the share of the lot the item affects, the same quantity the items are ranked by. */
28
38
  impact: ImpactTier;
29
- /** Dies lost as a fraction (0–1) of the analysed dies; set once the items are costed. */
39
+ /** `affected` as a fraction (0–1) of the analysed dies; set once the items are ranked. */
30
40
  shareOfDies: number;
31
- /** Estimated dies lost to this item (pass-rate shortfall × dies in the region). */
41
+ /** Estimated dies lost to this item (pass-rate shortfall × dies in the region). 0 for a signal. */
32
42
  diesLost: number;
43
+ /**
44
+ * The dies the item affects, the quantity it is ranked by: a loss, the dies it cost; a shift, the dies it moved
45
+ * weighted by how far (in full from two standard deviations); a spread too wide for its limits, the dies it is
46
+ * expected to put outside them.
47
+ */
48
+ affected: number;
49
+ /** The item's size as its compact row shows it: `2.4%` of the dies for a loss, `1.3σ` for a shift, `Ppk 0.62`. */
50
+ measure: string;
33
51
  severity: StatsSeverity;
34
52
  /** The item as a sentence. Plain text: what the item shows is `target`, and its parts are `chips`. */
35
53
  text: string;
54
+ /**
55
+ * The item in one short sentence, for a card that has a chart to say the rest: its own figure (a region's shortfall
56
+ * and the dies it cost, a test's failures, a shift's size), without the bins, regions and tests `text` goes on to
57
+ * name. Plain text.
58
+ */
59
+ reason: string;
36
60
  /** The item in a few words, for the compact list: `Ring 2: hard bin 4 (Short), 62 dies`. */
37
61
  brief: string;
38
62
  /** What `target` is, as a reader names it: `Ring 4 (edge)`, `W06`, `IP3_DBM`. */
@@ -41,20 +65,18 @@ export interface SynthesisItem {
41
65
  target: SynthesisTarget;
42
66
  /** Its parts that can be shown alone, in the order the sentence names them. Empty for a single-part item. */
43
67
  chips: SynthesisChip[];
68
+ /** Tests folded into the item beyond its chips, counted rather than listed. Absent when every test is a chip. */
69
+ moreTests?: number;
44
70
  /** The leading finding, then the others that stand on the same dies. */
45
71
  findingIds: string[];
46
72
  /** Tests the item names: its own test, or tests whose failing dies lie mostly on its dies. */
47
73
  testNumbers: number[];
48
- }
49
- /**
50
- * A signal that costs no dies of its own yet but predicts loss: a trend across the wafers, or a test whose
51
- * spread leaves little margin to its limits. Kept apart from the items, which are ranked by dies lost: a
52
- * Ppk of 0.9 with no failures does not belong on the same axis as 400 failing dies.
53
- */
54
- export interface SynthesisWatch {
55
- text: string;
56
- target: SynthesisTarget;
57
- findingIds: string[];
74
+ /**
75
+ * The chart that shows the item, as a plot of the lot (Insights' Worth a look card): a region's loss as yield by that
76
+ * kind of region, a fail bin as the bins' shares by it, a shift as the test by it, a failing or too-wide test as its
77
+ * histogram, a trend as a control chart, an outlier wafer as yield by wafer. Its title is the plot's own.
78
+ */
79
+ chart: Omit<PlotSpec, 'id'>;
58
80
  }
59
81
  export interface Synthesis {
60
82
  headline: string;
@@ -68,8 +90,6 @@ export interface Synthesis {
68
90
  items: SynthesisItem[];
69
91
  more: number;
70
92
  };
71
- /** At most two things to keep an eye on, after the items. Absent when there are none. */
72
- watch?: SynthesisWatch[];
73
93
  /** Said instead of the items when none is material, so a good lot reads as one rather than as an empty list. */
74
94
  nothing?: string;
75
95
  /** What was compared and not repeated above. Required: a short synthesis must not read as "not analysed". */
@@ -82,6 +102,11 @@ export interface SynthesisContext {
82
102
  * yield and does not call any bin a failure, rather than assume `[1]`.
83
103
  */
84
104
  passBins?: readonly number[];
105
+ /**
106
+ * The host's wafer attributes (`attributes` on the render options), over the defaults: which wafer fields' groups are
107
+ * compared (those Group by offers) and what each is called. Omitted ⇒ the defaults.
108
+ */
109
+ attributes?: Record<string, FacetCuration>;
85
110
  }
86
111
  /**
87
112
  * The summary a synthesis is written from. A lot of one wafer is that wafer: the lot's own findings need
@@ -94,10 +119,17 @@ export declare function synthesisSource(summary: StatsSummary | LotStatsSummary)
94
119
  * lost, and a line saying what was compared.
95
120
  */
96
121
  export declare function buildSynthesis(input: StatsSummary | LotStatsSummary, ctx?: SynthesisContext): Synthesis;
122
+ /**
123
+ * A stable key for an item: what it shows, the same in the panel and in Insights, so a row's Chart link finds the item's
124
+ * card and a card's Show on map finds its row.
125
+ */
126
+ export declare const synthesisKey: (it: Pick<SynthesisItem, "target">) => string;
97
127
  /** The heading over the compact list of further items: the floor is the same one that admits an item at all. */
98
128
  export declare const SYNTHESIS_ALSO_HEADING: string;
99
- /** A compact-list row: the item in a few words, then its share of the analysed dies. Plain text. */
129
+ /** A compact-list row: the item in a few words, then its size (`2.4%` of the dies, `1.3σ`, `Ppk 0.62`). Plain text. */
100
130
  export declare const synthesisRowShare: (it: SynthesisItem) => string;
131
+ /** After an item's chips: the folded tests not shown as one. Undefined when every test is a chip. Plain text. */
132
+ export declare const synthesisMoreTests: (it: SynthesisItem) => string | undefined;
101
133
  /** A synthesis as plain text, one line per item, for tests and for any surface that is not HTML. */
102
134
  export declare function synthesisText(s: Synthesis): string;
103
135
  //# 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 me,minOf as ge}from"../core/utils.js";import{isPassBin as be,passBinsLabel as $e}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as we}from"./lotDrift.js";import{isOneBinCluster as ye}from"./filterFindings.js";import{plainBinTerms as ve}from"../renderer/fmt.js";import{benjaminiHochberg as Se,normalUpperTail as Ne}from"./math.js";import{compareGroups as Ie,formatP as re}from"./groupCompare.js";import{attributeLabel as oe,buildFacetTable as ke,facetValueOf as xe}from"./facets.js";const Me=1,De=2,Be=.5,le=3,fe=5,K=.01,_e=.02,Fe=.04,Le=.15,Oe=.4,X=.5,ze=.1,Ae=2,ce=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function Z(e){const t=e.highlight;return"dieKeysByWafer"in t&&t.dieKeysByWafer?Object.values(t.dieKeysByWafer).reduce((s,i)=>s+i.length,0):"dieKeys"in t&&t.dieKeys&&t.dieKeys.length>0?t.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function ee(e){const t=e.highlight,s=new Set;if("dieKeysByWafer"in t&&t.dieKeysByWafer)for(const[i,d]of Object.entries(t.dieKeysByWafer))for(const c of d)s.add(`${i}:${c}`);else if("dieKeys"in t&&t.dieKeys)for(const i of t.dieKeys)s.add(i);return s}const D=e=>Math.abs(e.effect.absoluteDelta??0),E=e=>D(e)*(Z(e)??0),A=e=>(e*100).toFixed(1),G=e=>{const t=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return ve(t)},S=e=>Math.round(e).toLocaleString("en-GB"),T=(e,t,s=`${t}s`)=>`${S(e)} ${e===1?t:s}`;function C(e){const t=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(t)?`${t} quadrant`:t}const de=ye;function Te(e){const t=e.map((f,n)=>n),s=f=>t[f]===f?f:t[f]=s(t[f]),i=e.map(ee),d=(f,n)=>{const u=i[f].size<=i[n].size?i[f]:i[n],b=u===i[f]?i[n]:i[f];let p=0;for(const m of u)b.has(m)&&p++;return p},c=e.map((f,n)=>n).filter(f=>de(e[f])),r=e.map((f,n)=>n).filter(f=>!de(e[f]));for(let f=0;f<r.length;f++)for(let n=f+1;n<r.length;n++){const u=Math.min(i[r[f]].size,i[r[n]].size);u>0&&d(r[f],r[n])>=X*u&&(t[s(r[f])]=s(r[n]))}for(const f of c){let n=-1,u=0;for(const b of r){if(te(e[b])&&e[b].variable.bin!==e[f].variable.bin)continue;const p=d(f,b);p>u&&p>=X*i[f].size&&p>=X*E(e[b])&&(n=b,u=p)}n>=0&&(t[f]=s(n))}const h=new Map;return e.forEach((f,n)=>{const u=s(n);(h.get(u)??h.set(u,[]).get(u)).push(n)}),[...h.values()]}const te=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",se=(e,t)=>e.level===t.level&&e.comparison.family===t.comparison.family&&e.comparison.left===t.comparison.left;function Ee(e,t,s){const i=c=>t.filter(r=>r.variable.kind===c&&se(r,e)&&r.effect.direction==="higher"&&s(r));return(i("hardBin").length>0?i("hardBin"):i("softBin")).filter(c=>c!==e).sort((c,r)=>D(r)-D(c))}const We={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},He=2;function ue(e){const t=new Map;for(const i of e){const d=i.comparison.family;(t.get(d)??t.set(d,new Set).get(d)).add(C(i))}const s=[];for(const[i,d]of t)d.size<=He?s.push(...d):s.push(`${d.size} ${We[i]??i}`);return s.join(", ")}const Re=e=>e.charAt(0).toUpperCase()+e.slice(1),P=e=>({kind:"finding",id:e.id}),je=e=>({label:Re(G(e)),target:P(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function ie(e){const t=e.comparison.family;return{builtin:t==="quadrant"||t==="sector"?"quadrant":t==="reticle-position"?"reticleCell":t==="test-site"?"site":"ring"}}const ne=(e,t)=>({chart:"bar",fields:{x:e,y:t,color:{none:!0}},valueLabels:!0,axes:{y:{references:[{stat:"median"}]}}}),V=e=>({test:e}),he=(e,t=!1)=>({chart:"histogram",fields:{y:V(e),color:{none:!0}},...t?{normalCurve:!0}:{}});function Ce(e,t,s,i){const d=[...e].sort((l,g)=>E(g)-E(l))[0],c=e.find(l=>i.isPassRate(l)&&se(l,d))??d,r=e.filter(l=>l!==c),h=c.level==="lot"&&"waferIndices"in c.highlight?c.highlight.waferIndices?.length:void 0,f=h!==void 0&&s?` on ${h}/${s} wafers`:"",n=!i.isPassRate(c),u=c.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let b=n?`${C(c)}: ${G(c)} ${A(D(c))} points higher than ${u}${f}`:`${C(c)}: pass rate ${A(D(c))} points below ${u}${f}`;const p=`${b} \u2014 about ${S(E(c))} dies lost`,m=Ee(c,t,i.isFailBin).map(l=>({f:l,share:D(l)/(D(c)||1)})).filter(l=>n||l.share>=ze).slice(0,Ae);if(n)for(const{f:l}of m)b+=`, ${G(l)} ${A(D(l))} points higher`;else if(m.length>0){const l=m.reduce((N,v)=>N+v.share,0)<=1.000000001,g=l&&m[0].share>.5?"mostly ":"";m.forEach(({f:N},v)=>{b+=v===0?`; ${l?g:""}`:", ",b+=G(N)+(v===0?l?` accounts for ${A(D(N))} of those points`:` is ${A(D(N))} points higher`:l?` for ${A(D(N))}`:` ${A(D(N))} points higher`)})}b+=` \u2014 about ${S(E(c))} dies lost`;const x=r.filter(l=>!se(l,c));x.length>0&&(b+=` (also seen as ${ue(x)})`);const o=n?G(c):"pass rate";return{kind:"loss",impact:"low",shareOfDies:0,diesLost:E(c),affected:E(c),measure:"",severity:c.severity,text:b,reason:p,brief:`${C(c)}: ${o}, ${S(E(c))} dies`,subject:C(c),target:P(c),chips:[...n?[c]:[],...m.map(({f:l})=>l)].map(je),findingIds:[c.id,...r.map(l=>l.id)],testNumbers:[],chart:n?{chart:"bar",fields:{x:ie(c),color:{builtin:c.variable.kind==="softBin"?"sbin":"hbin"}},stack:"percent"}:ne(ie(c),{builtin:"yield"})}}function Pe(e,t){return e>=Fe||t>=Oe?"high":e>=_e||t>=Le?"medium":"low"}function Ke(e){const t=s=>s.stats.yieldPercent==null?0:s.stats.analyzedDies*(1-s.stats.yieldPercent/100);return e.level==="wafer"?t(e):e.perWafer.reduce((s,i)=>s+t(i.summary),0)}function qe(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((t,s)=>t+s.summary.stats.analyzedDies,0)}const pe=e=>e.id.startsWith("inter-wafer:yield:");function Ge(e){const t=[];for(const s of e.findings){if(!pe(s)||s.effect.direction!=="lower")continue;const i="waferIndices"in s.highlight?s.highlight.waferIndices?.[0]:void 0,d=i===void 0?void 0:e.perWafer.find(c=>c.waferIndex===i)?.summary.stats.analyzedDies;d!==void 0&&t.push({kind:"loss",impact:"low",shareOfDies:0,diesLost:D(s)*d,affected:D(s)*d,measure:"",severity:s.severity,text:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,reason:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,brief:`${s.comparison.left}: yield, ${S(D(s)*d)} dies`,subject:s.comparison.left,target:P(s),chips:[],findingIds:[s.id],testNumbers:[],chart:ne({builtin:"wafer"},{builtin:"yield"})})}return t}function Ye(e,t){if(e.level==="wafer"){const c=e.stats.testFailures?.[t];return c?{keys:new Set(c.dieKeys),lost:c.lostDies}:void 0}const s=new Set;let i=0,d=!1;for(const c of e.perWafer){const r=c.summary.stats.testFailures?.[t];if(r){d=!0,i+=r.lostDies;for(const h of r.dieKeys)s.add(`${c.waferIndex}:${h}`)}}return d?{keys:s,lost:i}:void 0}function Ue(e,t){const s=e.stats,i=[],d=r=>ne({builtin:e.level==="lot"?"wafer":"ring"},{passRate:r}),c=(r,h,f,n,u,b,p=u,m=!1)=>{if(f<=0||n<=0)return;t.add(r);const x=Ye(e,r),o=x?Math.min(x.lost,f):f,l=f-o,g=f/n*100;i.push({testNumber:r,label:h,verb:u,plainVerb:p,failDies:f,passingDies:l,keys:x?.keys,item:{kind:"loss",impact:"low",shareOfDies:0,diesLost:o,affected:o,measure:"",severity:"info",text:`${h} ${u} on ${S(f)} of ${S(n)} dies (${g.toFixed(1)}%)`+(l>0?`; ${S(l)} of them are binned as passing, so about ${S(o)} dies lost`:""),reason:`${h} ${u} on ${S(f)} of ${S(n)} dies (${g.toFixed(1)}%)`,brief:l>0?`${h}: ${b}, ${S(o)} dies lost`:`${h}: ${S(f)} dies ${b}`,subject:h,target:{kind:"test",testNumber:r},chips:[],findingIds:[],testNumbers:[r],chart:m?d(r):he(r)}})};for(const r of s.testSpecYield??[]){const h=r.failHighDies===0?"is below its low limit":r.failLowDies===0?"is above its high limit":`is outside its limits (${S(r.failLowDies)} low, ${S(r.failHighDies)} high)`;c(r.testNumber,r.label,r.failLowDies+r.failHighDies,r.totalDies,h,"outside limits",r.failLowDies>0&&r.failHighDies>0?"is outside its limits":h)}for(const r of s.functionalYield??[])c(r.testNumber,r.label,r.failDies,r.totalDies,"fails","fail","fails",!0);return i}const Xe=.5,Ve=2,Je=2,Y=5;function Qe(e,t,s,i){const d=new Set,c=new Map,r=new Map,h=[...e].sort((f,n)=>n.failDies-f.failDies||f.testNumber-n.testNumber);for(const f of h){const n=f.keys;if(i>0&&f.failDies/i<K){d.add(f);continue}let u;if(n&&n.size>0&&i>0)for(const m of t){const x=s.get(m);if(!x||x.size===0)continue;let o=0;for(const g of n)x.has(g)&&o++;const l=o/n.size;l>=Xe&&l>=Ve*(x.size/i)&&(!u||o>u.inside)&&(u={item:m,inside:o})}if(!u){d.add(f);continue}const b=c.get(u.item)??0;if(b<Je){const m=u.inside===f.failDies?"all":S(u.inside);u.item.text+=`. ${f.label} ${f.verb} on ${T(f.failDies,"die")}, ${m} of them in ${u.item.subject}`,c.set(u.item,b+1)}const p=r.get(u.item)??0;p<Y?(u.item.chips.push({label:f.label,target:f.item.target}),r.set(u.item,p+1)):u.item.moreTests=(u.item.moreTests??0)+1,u.item.testNumbers.push(f.testNumber)}return e.filter(f=>d.has(f))}function U(e){return{kind:"signal",impact:"low",shareOfDies:0,diesLost:0,affected:e.affected,measure:e.measure,severity:e.severity,text:e.text,reason:e.reason??e.text,brief:e.brief,subject:e.subject,target:e.target,chips:[],findingIds:e.findingIds??[],testNumbers:e.testNumbers??[],chart:e.chart}}const ae=e=>Math.abs(e)<Be?0:Math.min(1,(Math.abs(e)/De)**2),H=e=>`${Math.abs(e).toFixed(1)}\u03C3`,Ze=e=>e.variable.kind==="test"&&e.variable.measure!=="limitFailRate"&&ce.has(e.comparison.family)&&Number.isFinite(e.effect.effectSize??NaN)&&!e.id.startsWith("drift:");function et(e,t,s){const i=new Map;for(const r of e)!Ze(r)||r.variable.index===void 0||(i.get(r.variable.index)??i.set(r.variable.index,[]).get(r.variable.index)).push(r);const d=r=>(Z(r)??r.stats.sampleSizeLeft)*ae(r.effect.effectSize??0),c=[];for(const[r,h]of[...i].sort((f,n)=>f[0]-n[0])){const f=[...h].sort((o,l)=>d(l)-d(o)),n=f[0],u=n.effect.effectSize??0;if(d(n)===0)continue;const b=ee(n);let p=t.find(o=>o.target.kind==="test"&&o.target.testNumber===r)??t.find(o=>o.testNumbers.includes(r))??t.find(o=>f.some(l=>o.findingIds.includes(l.id))),m=0;for(const o of p?[]:t){const l=s.get(o);if(!l||l.size===0||b.size===0)continue;let g=0;for(const N of b)l.has(N)&&g++;g>=X*Math.min(l.size,b.size)&&g>m&&(m=g,p=o)}if(p){p.text+=`. ${n.summary}`,p.testNumbers.includes(r)||(p.chips.filter(l=>l.target.kind==="test"||l.shift).length<Y?p.chips.push({label:n.variable.label,target:P(n),shift:!0}):p.moreTests=(p.moreTests??0)+1,p.testNumbers.push(r));for(const o of f)p.findingIds.includes(o.id)||p.findingIds.push(o.id);continue}const x=Z(n)??n.stats.sampleSizeLeft;c.push(U({affected:d(n),measure:H(u),severity:n.severity,text:`${n.summary}: a shift of ${H(u)} over ${T(x,"die")}`+(f.length>1?` (also seen as ${ue(f.slice(1))})`:""),reason:`${n.summary}: a shift of ${H(u)} over ${T(x,"die")}`,brief:`${C(n)}: ${n.variable.label} ${n.effect.direction}`,subject:C(n),target:P(n),findingIds:f.map(o=>o.id),testNumbers:[r],chart:{chart:"box",fields:{x:ie(n),y:V(r),color:{none:!0}}}}))}return c}function tt(e,t){return e.filter(s=>s.id.startsWith("drift:")).map(s=>{const i=s.variable.kind==="yield",d=s.effect.effectSize??0;return U({affected:t*(i?Math.abs(d):ae(d)),measure:i?`${A(Math.abs(d))} pts`:H(d),severity:s.severity,text:s.summary,brief:`${s.variable.label}: drifts across the wafers`,subject:s.variable.label,target:P(s),findingIds:[s.id],...s.variable.index!==void 0?{testNumbers:[s.variable.index]}:{},chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:i||s.variable.index===void 0?{builtin:"yield"}:V(s.variable.index)}}})})}function st(e,t,s){return(e.stats.capability??[]).filter(i=>i.hasSpec&&i.ppk!==null&&i.ppk!==void 0&&i.ppk<Me&&!t.has(i.testNumber)).map(i=>{const d=i.ppk,c=Ne(3*d);return U({affected:s*c,measure:`Ppk ${d.toFixed(2)}`,severity:"notable",text:`${i.label} has Ppk ${d.toFixed(2)} against its limits: a spread that would put about ${A(c)}% of the dies outside them`,brief:`${i.label}: Ppk ${d.toFixed(2)}`,subject:i.label,target:{kind:"test",testNumber:i.testNumber},testNumbers:[i.testNumber],chart:he(i.testNumber,!0)})})}const it=.05;function nt(e,t){const s={items:[],compared:[]},i=e.perWafer;if(i.length<4)return s;const d=ke(i.map(o=>({metadata:o.summary.wafer,dieCount:o.summary.stats.totalDies})),{facetableOnly:!0,curation:t}).filter(o=>o.splittable&&o.values.length<=Math.max(2,Math.floor(i.length/2)));if(d.length===0)return s;const c=o=>e.perWaferTestStats?.find(l=>l.waferIndex===o.waferIndex)?.tests??o.summary.stats.perTestStats??[],r=i.map(o=>new Map(c(o).filter(l=>l.count>=2&&Number.isFinite(l.mean)).map(l=>[l.testNumber,l]))),h=new Map;for(const o of r)for(const[l,g]of o)h.has(l)||h.set(l,g.label);const f=i.map(o=>o.summary.stats.analyzedDies),n=[];for(const o of d){const l=i.map(g=>xe(g.summary.wafer,o.key,t));for(const[g,N]of[...h].sort((v,_)=>v[0]-_[0])){const v=new Map,_=[];if(r.forEach((y,I)=>{const k=y.get(g),$=l[I];!k||$===void 0||((v.get($)??v.set($,[]).get($)).push(I),Number.isFinite(k.stddev)&&_.push(k.stddev**2))}),v.size<2)continue;const F=Ie([...v].map(([y,I])=>({key:y,values:I.map(k=>r[k].get(g).mean)}))),O=F.welch?.p??F.kruskal?.p,W=_.length?Math.sqrt(_.reduce((y,I)=>y+I,0)/_.length):NaN;if(O===void 0||!Number.isFinite(O)||!(W>0))continue;let M;for(const[y,I]of v){const k=I.map(a=>r[a].get(g).mean),$=[...v].filter(([a])=>a!==y).flatMap(([,a])=>a.map(w=>r[w].get(g).mean));if(k.length<2||$.length<2)continue;const L=k.reduce((a,w)=>a+w,0)/k.length-$.reduce((a,w)=>a+w,0)/$.length,R=L/W;(!M||Math.abs(R)>Math.abs(M.d)+1e-9||Math.abs(Math.abs(R)-Math.abs(M.d))<=1e-9&&(I.length<M.groupWafers||I.length===M.groupWafers&&L>0))&&(M={testNumber:g,label:N,field:o.key,group:y,groupWafers:I.length,groupDies:I.reduce((a,w)=>a+f[w],0),d:R,higher:L>0,p:O})}if(M&&v.size===2){const[y,I]=[...v].find(([k])=>k!==M.group);M.other={group:y,wafers:I.length}}M&&n.push(M)}}const u=Se(n.map(o=>o.p)),b=new Map;n.forEach((o,l)=>{const g=o.groupDies*ae(o.d);u[l]>=it||g===0||(b.get(o.field)??b.set(o.field,[]).get(o.field)).push({c:o,q:u[l],weight:g})});const p=n.length?[...new Set(n.map(o=>o.field))].map(o=>oe(o,t)):[],m=(o,l)=>o.other?`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} than on ${l} ${o.other.group} (${o.groupWafers} and ${o.other.wafers} wafers)`:`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} (${o.groupWafers} of ${i.length} wafers) than on the other wafers`;return{items:[...b].map(([o,l])=>{l.sort(($,L)=>Math.abs(L.c.d)-Math.abs($.c.d)||L.weight-$.weight||$.c.testNumber-L.c.testNumber);const g=l.reduce(($,L)=>Math.max($,L.weight),0),N=oe(o,t),[v,..._]=l,F=v.c,O=`${m(F,N)}: a shift of ${H(F.d)}`,W=_.slice(0,2).map(({c:$})=>`${$.label} ${$.higher?"higher":"lower"} on ${$.group} (${H($.d)})`),M=_.length-W.length,y=l.length,I=y===1?`${O}, each wafer one value (q ${re(v.q)})`:`${y} tests differ by ${N}. Largest: ${O}, each wafer one value (q ${re(v.q)}); next: ${W.join(", ")}${M>0?`, and ${M} more`:""}`,k=U({affected:g,measure:H(F.d),severity:v.q<.001?"unusual":"notable",text:I,reason:y===1?O:`${y} tests differ by ${N}. Largest: ${O}`,brief:y===1?`${N} ${F.group}: ${F.label} ${F.higher?"higher":"lower"}`:`${N}: ${y} tests differ`,subject:N,target:{kind:"test",testNumber:F.testNumber},testNumbers:l.map($=>$.c.testNumber),chart:{chart:"box",fields:{x:{meta:o},y:V(F.testNumber),color:{meta:o}}}});return y>1&&(k.chips=l.slice(0,Y).map(({c:$})=>({label:`${$.label} ${H($.d)}`,target:{kind:"test",testNumber:$.testNumber}})),y>Y&&(k.moreTests=y-Y)),k}),compared:p}}function at(e){return e.map(t=>U({affected:t.passingDies,measure:"",severity:"notable",text:`${t.label} ${t.plainVerb} on ${T(t.passingDies,"die")} binned as passing`,brief:`${t.label}: ${S(t.passingDies)} dies out of limits, binned passing`,subject:t.label,target:t.item.target,testNumbers:[t.testNumber],chart:t.item.chart}))}function rt(e,t){const s=t.passBins&&t.passBins.length>0?`; pass ${$e([t.passBins])}`:"";if(e.level==="wafer"){const n=e.stats.yieldPercent;return n==null?`${S(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${n.toFixed(1)}% (${S(e.stats.totalDies)} dies${s}).`}const i=e.lotYieldSeries.map(n=>n.yieldPercent).filter(n=>typeof n=="number");if(i.length===0)return`${T(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const d=i.reduce((n,u)=>n+u,0)/i.length,c=e.perWafer.reduce((n,u)=>n+u.summary.stats.totalDies,0),[r,h]=[ge(i).toFixed(1),me(i).toFixed(1)],f=r!==h?`, range ${r}\u2013${h}%`:"";return`Yield ${d.toFixed(1)}% (mean of ${T(i.length,"wafer")}, ${S(c)} dies${s})${f}.`}function ot(e,t,s=[]){const i=[],d=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.testsConsidered)).size,c=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.hardBinsConsidered)).size,r=e.stats.testValueAnalysis?.state;if(d>0&&r!=="off"&&i.push(T(d,"test")+(r==="skipped"?" (against their limits only)":"")),c>0&&i.push(T(c,"hard bin")),i.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const n=e.findings.filter(pe);i.push(n.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${T(n.length,"outlier wafer")})`),e.stats.waferCount>=we&&i.push("the yield trend across the wafers (input order)"),s.length&&i.push(`the tests between the groups of ${s.join(", ")} (each wafer one value)`)}const h=e.findings.filter(n=>!t.has(n.id)).length,f=h>0?` ${T(h,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${i.join(", ")}.${f}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}export function buildSynthesis(e,t={}){const s=synthesisSource(e),i=s.findings,d=s.level==="lot"?s.stats.waferCount:void 0,c=t.passBins,r=new Map(i.map(a=>[a.id,a])),h=(s.level==="wafer"?[s]:s.perWafer.map(a=>a.summary)).every(a=>(a.stats.hardBinsConsidered??[]).length===0),f=a=>c!==void 0&&te(a)&&be(a.variable.kind,a.variable.bin??NaN,c,!h),n={isPassRate:a=>a.variable.kind==="yield"||c?.length===1&&f(a),isFailBin:a=>c!==void 0&&te(a)&&!f(a)},u=i.filter(a=>ce.has(a.comparison.family)&&E(a)>0&&(n.isPassRate(a)&&a.effect.direction==="lower"||n.isFailBin(a)&&a.effect.direction==="higher")),p=u.some(a=>a.variable.kind==="hardBin")?u.filter(a=>a.variable.kind!=="softBin"):u,m=[],x=new Map,o=new Set;for(const a of Te(p)){const w=a.map(z=>p[z]),B=Ce(w,i,d,n);m.push(B);const j=B.target.kind==="finding"?B.target.id:void 0;x.set(B,ee(w.find(z=>z.id===j)??w[0]))}for(const a of i.filter(w=>w.variable.kind==="spatialPattern")){const w=new Set((a.relatedIds??[]).filter(q=>r.has(q))),B=m.find(q=>q.findingIds.some(Q=>w.has(Q)));if(!B)continue;const j=a.level==="lot"&&"waferIndices"in a.highlight?a.highlight.waferIndices?.length:void 0,z=j!==void 0&&d?` on ${j}/${d} wafers`:"";B.text=`${a.variable.label} pattern${z}. ${B.text}`,B.reason=`${a.variable.label} pattern${z}. ${B.reason}`,B.chips.unshift({label:`${a.variable.label} pattern`,target:P(a)}),B.findingIds.unshift(a.id,...[...w].filter(q=>!m.some(Q=>Q.findingIds.includes(q))))}const l=qe(s),g=new Set,N=Ue(s,g),v=[...m],_=Qe(N,v,x,l);s.level==="lot"&&m.push(...Ge(s)),m.push(..._.map(a=>a.item));const F=new Set(_.filter(a=>l>0&&a.item.diesLost/l>=K).map(a=>a.testNumber));m.push(...et(i,[...v,..._.map(a=>a.item)],x),...tt(i,l),...st(s,g,l),...at(N.filter(a=>a.passingDies>0&&!F.has(a.testNumber))));let O=[];if(s.level==="lot"){const a=nt(s,t.attributes);O=a.compared;for(const w of a.items){const B=w.testNumbers[0],j=w.testNumbers.length===1?m.find(z=>z.target.kind==="test"&&z.target.testNumber===B)??m.find(z=>z.testNumbers.includes(B)):void 0;j?j.text+=`. ${w.text}`:m.push(w)}}const W=Ke(s),M=m.filter(a=>l>0&&a.affected/l>=K);for(const a of M)a.shareOfDies=a.affected/l,a.impact=Pe(a.shareOfDies,a.kind==="loss"&&W>0?a.diesLost/W:0),a.measure||(a.measure=`${(a.shareOfDies*100).toFixed(1)}%`);const y=a=>`${String(a.testNumbers[0]??"").padStart(10,"0")}${a.findingIds[0]??""}`;M.sort((a,w)=>w.affected-a.affected||(y(a)<y(w)?-1:y(a)>y(w)?1:0));const I=M.slice(0,le),k=M.slice(le);for(const a of[...I,...k])for(const w of a.findingIds)o.add(w);const $=k.length>0?{items:k.slice(0,fe),more:Math.max(0,k.length-fe)}:void 0,L=s.level==="lot"?"region, fail bin or wafer":"region or fail bin",R=i.filter(a=>a.severity==="unusual"&&!o.has(a.id)).length,J=I.length===0?R>0?`No ${L} costs as much as ${A(K)} yield points, though ${T(R,"finding")} below ${R===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${L} costs as much as ${A(K)} yield points.`:void 0;return{headline:rt(s,t),items:I,...$?{also:$}:{},...J?{nothing:J}:{},checked:ot(s,o,O)}}export const synthesisKey=e=>e.target.kind==="finding"?`finding:${e.target.id}`:`test:${e.target.testNumber}`,SYNTHESIS_ALSO_HEADING=`Also, each affecting at least ${(K*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>e.measure,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((t,s)=>`${s+1}. ${t.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(t=>`${t.brief} (${synthesisRowShare(t)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],e.checked].join(`
2
2
  `)}
@@ -62,6 +62,11 @@ export declare function buildTestPassRateData(groups: {
62
62
  * (`classifySpec`, `getTestPassStatus`), for picking out the failing dies a pass-rate row counts.
63
63
  */
64
64
  export declare function dieFailsTest(die: Die, def: TestDef, kind: TestPassKind): boolean | undefined;
65
+ /**
66
+ * `dieFailsTest`'s judgement with the side a die failed on: judged by test limits, `failLow` or `failHigh`; by a
67
+ * recorded verdict, `fail`. Undefined where the die cannot be judged.
68
+ */
69
+ export declare function dieTestVerdict(die: Die, def: TestDef, kind: TestPassKind): 'pass' | 'fail' | 'failLow' | 'failHigh' | undefined;
65
70
  /**
66
71
  * True when this `kind` has something to show — used to decide which modes the
67
72
  * chart's selector offers.
@@ -70,6 +75,8 @@ export declare function dieFailsTest(die: Die, def: TestDef, kind: TestPassKind)
70
75
  * every parametric test *could* have one, so a definition-only check would offer
71
76
  * a mode that renders empty on the (common) data that has none.
72
77
  */
78
+ /** The tests a pass rate under `kind` covers: parametric tests with limits, parametric tests, or functional tests. */
79
+ export declare function testsForPassKind(testDefs: readonly TestDef[] | undefined, kind: TestPassKind): TestDef[];
73
80
  export declare function hasJudgeableTests(testDefs: TestDef[] | undefined, kind: TestPassKind, dies?: Die[]): boolean;
74
81
  /**
75
82
  * Pool per-wafer functional-test results into one lot-level set.
@@ -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 P}from"../core/dies.js";import{dieHasVerdicts as V,testValue as x,testValuesReader as M}from"../core/dieTable.js";import{isParametricTest as N,getTestPassStatus as I,testPassStatusReader as $}from"../renderer/buildWaferMap.js";import{classifySpec as S}from"../renderer/spec.js";import{testLabel as C,derivedFields as O}from"../renderer/testLabel.js";const K=(e,t)=>t===0?null:e/t*100;export function buildTestPassRateData(e,t,n){const s=e.map(o=>o.key),i={groups:s,rows:[],disagreementDies:null};if(!t?.length)return i;const l=t.filter(o=>o.testNumber!==void 0&&A(o,n));if(!l.length)return i;const p=()=>({pass:0,fail:0,failLow:0,failHigh:0}),u=new Map;for(const o of l){const c=o.testNumber;u.set(c,{label:C(o,c),overall:p(),perGroup:s.map(()=>p())})}const w=(o,c,b)=>{const d=u.get(o);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},a=n==="spec"||n==="testFlag";let r=0,g=0;e.forEach(function(c,b){for(const d of c.items){if(n==="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(n==="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,n);r+=m.comparable,g+=m.disagreements;for(let f=0;f<l.length;f++){const H=u.get(l[f].testNumber);for(const L of[H.overall,H.perGroup[b]])L.pass+=m.pass[f],L.fail+=m.fail[f],L.failLow+=m.failLow[f],L.failHigh+=m.failHigh[f]}}});const h=o=>({passDies:o.pass,failDies:o.fail,totalDies:o.pass+o.fail,passRatePercent:K(o.pass,o.pass+o.fail)}),D=[];for(const[o,c]of u)c.overall.pass+c.overall.fail!==0&&D.push({testNumber:o,label:c.label,overall:h(c.overall),byGroup:c.perGroup.map(h),...n==="spec"?{failLowDies:c.overall.failLow,failHighDies:c.overall.failHigh}:{}});return D.sort((o,c)=>(o.overall.passRatePercent??101)-(c.overall.passRatePercent??101)||o.testNumber-c.testNumber),{groups:s,rows:D,disagreementDies:a&&r>0?g:null}}const F=0,v=1,y=2,T=3,G=4,E=5,R=6,z=7,Y=new WeakMap,_=e=>`${e.testNumber},${e.limitLow},${e.limitHigh},${e.limitLowInclusive},${e.limitHighInclusive},${e.testType}`;function B(e,t,n){let s=Y.get(e);s||(s=new Map,Y.set(e,s));const i=t.map(_),l=t.filter((a,r)=>!s.has(i[r]));l.length&&J(e,l,s);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=n==="spec"||n==="testFlag";for(let a=0;a<p;a++){const r=s.get(i[a]);w&&(u.comparable+=r[E],u.disagreements+=r[R]),n==="spec"?(u.pass[a]=r[F],u.failLow[a]=r[v],u.failHigh[a]=r[y],u.fail[a]=r[v]+r[y]):(u.pass[a]=r[T],u.fail[a]=r[G])}return u}function J(e,t,n){const s=t.length,i=t.map(()=>new Int32Array(z)),l=M(t.map(a=>a.testNumber)),p=new Float64Array(s),u=$(t),w=new Int8Array(s);for(const a of e)if(P(a)){l(a,p),u(a,w);for(let r=0;r<s;r++){const g=i[r],h=S(p[r],t[r]),D=w[r];h!==null&&(h==="pass"?g[F]++:h==="failLow"?g[v]++:g[y]++),D!==-1&&(D===1?g[T]++:g[G]++,h!==null&&(g[E]++,h==="pass"!=(D===1)&&g[R]++))}}for(let a=0;a<s;a++)n.set(_(t[a]),i[a])}export function dieFailsTest(e,t,n){const s=dieTestVerdict(e,t,n);return s===void 0?void 0:s!=="pass"}export function dieTestVerdict(e,t,n){const s=t.testNumber;if(s===void 0||!P(e))return;if(n==="spec"){const l=x(e,s),p=l===void 0?null:S(l,t);return p===null?void 0:p}const i=I(e,s,t);return i===void 0?void 0:i?"pass":"fail"}function j(e){return(e.dies??[]).some(V)}function A(e,t){return t==="functional"?!N(e):N(e)?t==="spec"?e.limitLow!==void 0||e.limitHigh!==void 0:!0:!1}export function testsForPassKind(e,t){return(e??[]).filter(n=>n.testNumber!==void 0&&A(n,t))}export function hasJudgeableTests(e,t,n){if(!e?.length)return!1;const s=e.filter(i=>i.testNumber!==void 0&&A(i,t));return s.length?t!=="testFlag"?!0:(n??[]).some(i=>s.some(l=>I(i,l.testNumber,l)!==void 0)):!1}export function poolFunctionalYield(e){if(!e?.length||!e.every(s=>s.stats.functionalYield!==void 0))return;const t=new Map;for(const s of e)for(const i of s.stats.functionalYield??[]){const l=t.get(i.testNumber)??{label:i.label,...O(i),passDies:0,failDies:0,totalDies:0};l.passDies+=i.passDies,l.failDies+=i.failDies,l.totalDies+=i.totalDies,t.set(i.testNumber,l)}const n=[...t.entries()].map(([s,i])=>({testNumber:s,...i,passRatePercent:i.totalDies>0?i.passDies/i.totalDies*100:null}));return n.length?n: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
  /**
@@ -158,10 +170,13 @@ export interface StatsFinding {
158
170
  */
159
171
  highlight: HighlightTarget;
160
172
  /**
161
- * IDs of other findings that describe the same signal at a finer level of
162
- * detail. Note these do NOT all resolve to entries in `findings`: when a run
163
- * of per-region findings is merged into one (e.g. `Rings 3–4`), this is the
164
- * audit trail of the constituents it REPLACED, and those no longer exist.
173
+ * IDs of other findings that describe the same signal, which reading surfaces
174
+ * show under this one: on a spatial pattern, the ring, quadrant, sector, arc
175
+ * and cluster findings it explains; on a cluster of one hard bin, the rises in
176
+ * that bin in a ring, quadrant or sector that the cluster makes up. Note these
177
+ * do NOT all resolve to entries in `findings`: when a run of per-region
178
+ * findings is merged into one (e.g. `Rings 3–4`), this is the audit trail of
179
+ * the constituents it REPLACED, and those no longer exist.
165
180
  */
166
181
  relatedIds?: string[];
167
182
  /**
@@ -177,6 +192,27 @@ export interface StatsFinding {
177
192
  */
178
193
  absorbedIds?: string[];
179
194
  }
195
+ /**
196
+ * What became of the test-value analysis (`enableTestValueAnalysis`) and how big
197
+ * it is: the dies × parametric tests it covers. A surface that shows findings
198
+ * reads this to say when the test-value findings are missing and what running
199
+ * them would cost.
200
+ */
201
+ export interface TestValueAnalysisStatus {
202
+ /**
203
+ * `'done'`: it ran. `'skipped'`: `'auto'` and over the budget — limit-failure
204
+ * findings still ran. `'off'`: the host passed `false`.
205
+ */
206
+ state: 'done' | 'skipped' | 'off';
207
+ /** Parametric tests it covers (the most on any wafer, for a lot). */
208
+ tests: number;
209
+ /** Dies with test values (summed over the wafers, for a lot). */
210
+ dies: number;
211
+ /** Test values it reads: dies × tests, summed over the wafers for a lot. */
212
+ values: number;
213
+ /** Expected time in the slower browser engine (WebKit), in ms. An estimate, for the offer's "about 2 s". */
214
+ estimateMs: number;
215
+ }
180
216
  export interface StatsSummary {
181
217
  /** Discriminant — always `'wafer'`. Narrow on this to tell a wafer summary from a {@link LotStatsSummary}. */
182
218
  level: 'wafer';
@@ -195,6 +231,12 @@ export interface StatsSummary {
195
231
  findings: StatsFinding[];
196
232
  /** Free-form identity fields from waferConfig.metadata (lot, wafer ID, test date, etc.). */
197
233
  wafer?: Record<string, unknown>;
234
+ /**
235
+ * The options this summary was analysed with, as passed (`perWaferSummaries`
236
+ * aside). The renderers re-run the analysis with them when the reader asks for
237
+ * the skipped test-value analysis, so the re-run matches the host's choices.
238
+ */
239
+ analysisOptions?: AnalyzeWaferMapOptions;
198
240
  /** Engine-computed analysis stats for this wafer. */
199
241
  stats: {
200
242
  totalDies: number;
@@ -207,25 +249,32 @@ export interface StatsSummary {
207
249
  softBinsConsidered: number[];
208
250
  /**
209
251
  * Die counts per hard/soft bin, keyed by bin code, over the same
210
- * yield-eligible population `YieldSummary`/`buildBinParetoData` use
252
+ * yield-eligible population `YieldSummary` and the Insights bin pareto use
211
253
  * (`isYieldEligibleDie` — excludes `partial`/`edgeExcluded` dies).
212
254
  * Unlike `hardBinsConsidered`/`softBinsConsidered` (which list every bin
213
255
  * code that appears anywhere, eligible or not), these are the actual
214
256
  * counts a bin-breakdown display should show. Consumed by
215
- * `buildBinParetoData`/`buildBinClusterData` and the summary panel's bin
257
+ * the Insights bin pareto and the summary panel's bin
216
258
  * section when supplied, instead of each independently re-walking dies.
259
+ * Absent on a value stack (any `lotStack` method but `'mode'`), whose dies
260
+ * carry one wafer's bins rather than the stack's.
217
261
  */
218
262
  hardBinCounts?: Record<number, number>;
219
263
  softBinCounts?: Record<number, number>;
264
+ /**
265
+ * Whether the test-value analysis ran, and its size — see
266
+ * {@link TestValueAnalysisStatus}. Absent when the wafer has no parametric
267
+ * test values.
268
+ */
269
+ testValueAnalysis?: TestValueAnalysisStatus;
220
270
  /**
221
271
  * Structured advisories raised during analysis — the same `WaferWarning`
222
272
  * shape used by `WaferMapResult.warnings`, so a host has one warning
223
273
  * vocabulary to handle rather than two. Branch on `warning.code`.
224
274
  *
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".
275
+ * Raised today: `'analysis-option-corrected'`. A skipped test-value analysis
276
+ * is not a warning: it is recorded in `testValueAnalysis`, and the renderers
277
+ * offer to run it (`'test-count-capped'` is no longer raised).
229
278
  *
230
279
  * `renderWaferMap`/`renderWaferGallery` surface these automatically in the
231
280
  * toolbar's warning indicator; a host does not have to render them itself.
@@ -256,8 +305,8 @@ export interface StatsSummary {
256
305
  * `testSpecYield` counts in `failLowDies + failHighDies`), failing for a functional test
257
306
  * (`functionalYield`'s `failDies`). `dieKeys` are `getDieKey` strings; `lostDies` is how many of
258
307
  * them also fail the wafer's yield (not in a pass bin, or with no bin to judge by), so a test's
259
- * failures on dies binned as passing are told apart from the yield it costs. Only tests with a
260
- * failing die are present.
308
+ * failures on dies binned as passing are told apart from the yield it costs. On a value stack,
309
+ * which has no yield, every failing die counts. Only tests with a failing die are present.
261
310
  */
262
311
  testFailures?: Record<number, {
263
312
  dieKeys: string[];
@@ -450,9 +499,13 @@ export interface LotStatsSummary {
450
499
  * describing the whole batch.
451
500
  */
452
501
  mixedIdentityFields?: string[];
502
+ /** The options this lot was analysed with, as passed (`perWaferSummaries` aside). See `StatsSummary.analysisOptions`. */
503
+ analysisOptions?: AnalyzeWaferMapOptions;
453
504
  /** Engine-computed analysis stats for this lot. */
454
505
  stats: {
455
506
  waferCount: number;
507
+ /** The lot's test-value analysis: one decision for every wafer, sizes summed over them. */
508
+ testValueAnalysis?: TestValueAnalysisStatus;
456
509
  /**
457
510
  * Cp/Cpk/Pp/Ppk over the whole lot, each wafer as a subgroup — so `stdWithin`
458
511
  * is the pooled within-wafer stddev and Cp and Pp genuinely differ. Present
@@ -513,32 +566,39 @@ export interface AnalyzeWaferMapOptions {
513
566
  /**
514
567
  * Full parametric **spatial significance** analysis: Welch comparisons of each
515
568
  * 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.
569
+ * the rest of the wafer, with per-test statistics. It scales with dies × tests,
570
+ * the expensive part of analysis.
571
+ *
572
+ * - `'auto'` (default): run it when the dies × parametric tests analysed is
573
+ * within the test-value budget (1,500,000 values, about a second in the
574
+ * slower browser engine) — summed over the wafers for `analyzeWaferLot`, so a
575
+ * lot decides once. Over the budget it is skipped and the renderers' Findings
576
+ * section offers to run it (see `stats.testValueAnalysis`).
577
+ * - `true`: run it whatever the size.
578
+ * - `false`: do not run it, nor the spec-limit and functional pass-rate region
579
+ * findings that go with it.
519
580
  *
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.
581
+ * Limit-failure and functional pass-rate findings run unless this is `false`.
582
+ * For per-test statistics without the spatial comparisons, use
583
+ * {@link computePerTestStats}.
524
584
  */
525
- enableTestValueAnalysis?: boolean;
585
+ enableTestValueAnalysis?: boolean | 'auto';
526
586
  /**
527
587
  * Compute per-test descriptive statistics (`count`, `min`, `max`, `mean`,
528
588
  * `stddev`, `median`, `q1`, `q3`) into `StatsSummary.stats.perTestStats` —
529
589
  * the cheap quartile scan only, **without** the expensive regional Welch
530
590
  * comparisons of {@link enableTestValueAnalysis}. Use this for box-plot /
531
591
  * histogram panels that need distribution shape but not spatial findings.
532
- * Off by default. Implied by `enableTestValueAnalysis`.
592
+ * Off by default; produced whenever the test-value analysis runs. Not subject to
593
+ * the test-value budget: asking for it is choosing its cost.
533
594
  */
534
595
  computePerTestStats?: boolean;
535
596
  /** Number of angular sectors for sector analysis. Must be 4, 8 or 16. Default 8. */
536
597
  sectorCount?: number;
537
598
  /**
538
599
  * 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.
600
+ * When omitted, every parametric test with values. Naming fewer tests also
601
+ * shrinks the analysis, which can bring an `'auto'` run under its budget.
542
602
  * Example: `testNumbers: [1050, 1060, 1070]`
543
603
  */
544
604
  testNumbers?: number[];
@@ -52,17 +52,9 @@ export declare function yieldCounts(dies: readonly Die[], passBins: readonly num
52
52
  /** One bar per item. */
53
53
  export declare function buildYieldData(items: YieldItem[], sortBy?: YieldSortBy): ChartDatum[];
54
54
  /**
55
- * Combined yield: one bar per group, pooling the group's items. The pooled
56
- * yield is the yield-eligible-die-count-weighted mean of per-item yields —
57
- * exact for the standard pass/total definition (Σ pass / Σ total =
58
- * Σ(yield·dies)/Σ dies), *provided* `dies` is the same population the rate
59
- * was computed over. Weighting uses `yieldEligibleDieCount` (excludes
60
- * partial/edge-excluded dies), not raw `dies.length` — a per-item
61
- * `yieldPercent` (own or precomputed, e.g. from `analyzeWaferLot`) already
62
- * excludes those dies from its own numerator/denominator (`resolveYieldPercent`
63
- * → `isYieldEligibleDie`), so weighting by the raw count would let a wafer's
64
- * excluded dies (which count toward yield nowhere else) still skew this
65
- * combined bar.
55
+ * Combined yield: one row per group, pooling the group's items: each item's yield weighted by its judged dies
56
+ * (`yieldJudgedCount`), which is exactly Σ pass / Σ judged over the group, the rule the plot builder pools by. A die
57
+ * with no bin, or a partial or edge-excluded one, weighs nothing, as it counts toward no yield.
66
58
  */
67
59
  export declare function buildYieldDataCombined(groups: {
68
60
  key: string;
@@ -1 +1 @@
1
- import{requirePassBins as f}from"../core/passBins.js";import{isYieldEligibleDie as a,diePassStatus as p}from"../core/dies.js";import{compareNatural as b}from"../core/utils.js";export function yieldCounts(e,i){let n=0,t=0;const r=new Set(i);for(const o of e){if(!a(o))continue;const l=p(o,r);l!==void 0&&(t++,l&&n++)}return{pass:n,total:t}}function m(e,i){const{pass:n,total:t}=yieldCounts(e,i);return t>0?n/t*100:0}function c(e){return e.yieldPercent!==void 0?e.yieldPercent??0:m(e.dies??[],f(e,"yield"))}function y(e){let i=0;for(const n of e)a(n)&&i++;return i}function d(e,i){i==="yield"?e.sort((n,t)=>t.value-n.value):e.sort((n,t)=>b(n.label,t.label))}export function buildYieldData(e,i="label"){const n=e.map((t,r)=>{const o=c(t);return{label:t.label??`#${r}`,value:o,percent:o,itemCount:1,key:t.key}});return d(n,i),n}export function buildYieldDataCombined(e,i="label"){const n=e.map(t=>{let r=0,o=0;for(const s of t.items){const u=y(s.dies??[]);r+=c(s)*u,o+=u}const l=o>0?r/o:0;return{label:t.key,value:l,percent:l,itemCount:t.items.length}});return d(n,i),n}
1
+ import{requirePassBins as a}from"../core/passBins.js";import{isYieldEligibleDie as f,diePassStatus as p}from"../core/dies.js";import{compareNatural as m}from"../core/utils.js";export function yieldCounts(e,i){let n=0,t=0;const r=new Set(i);for(const o of e){if(!f(o))continue;const l=p(o,r);l!==void 0&&(t++,l&&n++)}return{pass:n,total:t}}function b(e,i){const{pass:n,total:t}=yieldCounts(e,i);return t>0?n/t*100:0}function d(e){return e.yieldPercent!==void 0?e.yieldPercent??0:b(e.dies??[],a(e,"yield"))}function y(e,i){return yieldCounts(e,i).total}function c(e,i){i==="yield"?e.sort((n,t)=>t.value-n.value):e.sort((n,t)=>m(n.label,t.label))}export function buildYieldData(e,i="label"){const n=e.map((t,r)=>{const o=d(t);return{label:t.label??`#${r}`,value:o,percent:o,itemCount:1,key:t.key}});return c(n,i),n}export function buildYieldDataCombined(e,i="label"){const n=e.map(t=>{let r=0,o=0;for(const s of t.items){const u=y(s.dies??[],a(s,"yield"));r+=d(s)*u,o+=u}const l=o>0?r/o:0;return{label:t.key,value:l,percent:l,itemCount:t.items.length}});return c(n,i),n}
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/) - 25 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/) - 27 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wafertools/wafermap",
3
- "version": "0.35.1",
3
+ "version": "0.37.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",
@@ -77,6 +77,7 @@
77
77
  "clean": "rm -rf dist",
78
78
  "check": "node scripts/build-user-guide.mjs && node scripts/sync-version.mjs && tsc --noEmit -p tsconfig.json && node scripts/check-examples-manifest.mjs && node scripts/build-agents-page.mjs --check && node scripts/check-agents-guide.mjs && node scripts/check-toolbar-docs.mjs && node scripts/check-doc-links.mjs && node scripts/check-quickstart-snippet.mjs && node scripts/check-overlay-conventions.mjs && node scripts/check-changelog.mjs && node scripts/help.mjs --check && node scripts/check-api-claims.mjs && node scripts/check-style-scales.mjs packages/canvas-adapter && node scripts/check-spread-limits.mjs && node scripts/check-pass-bin-defaults.mjs && node scripts/check-clones.mjs packages",
79
79
  "build:examples-index": "node scripts/build-examples-index.mjs",
80
+ "build:chart-index": "node scripts/build-chart-index.mjs",
80
81
  "check:drift": "node scripts/check-drift.mjs",
81
82
  "dev": "rm -rf docs/dist && cp -r dist docs/dist && ./.venv/bin/zensical serve --dev-addr localhost:8001",
82
83
  "test": "npm run build && node scripts/check-bundle-size.mjs && node --test tests/*.test.mjs",