@wafertools/wafermap 0.40.1 → 0.41.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 (214) hide show
  1. package/AGENTS.md +20 -21
  2. package/CHANGELOG.md +140 -0
  3. package/README.md +6 -6
  4. package/dist/packages/canvas-adapter/canvasTheme.d.ts +12 -0
  5. package/dist/packages/canvas-adapter/canvasTheme.js +1 -1
  6. package/dist/packages/canvas-adapter/cellShade.d.ts +2 -2
  7. package/dist/packages/canvas-adapter/cellShade.js +1 -1
  8. package/dist/packages/canvas-adapter/chartPopulation.d.ts +3 -0
  9. package/dist/packages/canvas-adapter/chartPopulation.js +1 -1
  10. package/dist/packages/canvas-adapter/charts/capability.d.ts +3 -0
  11. package/dist/packages/canvas-adapter/charts/capability.js +1 -1
  12. package/dist/packages/canvas-adapter/charts/cardAbout.d.ts +2 -1
  13. package/dist/packages/canvas-adapter/charts/cardAbout.js +1 -1
  14. package/dist/packages/canvas-adapter/charts/chartShell.d.ts +47 -27
  15. package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
  16. package/dist/packages/canvas-adapter/charts/commonality.js +4 -4
  17. package/dist/packages/canvas-adapter/charts/correlation.d.ts +6 -12
  18. package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
  19. package/dist/packages/canvas-adapter/charts/divergingScale.d.ts +45 -15
  20. package/dist/packages/canvas-adapter/charts/divergingScale.js +1 -1
  21. package/dist/packages/canvas-adapter/charts/groupComparison.js +1 -1
  22. package/dist/packages/canvas-adapter/charts/palette.d.ts +16 -30
  23. package/dist/packages/canvas-adapter/charts/palette.js +1 -1
  24. package/dist/packages/canvas-adapter/charts/patCard.js +1 -1
  25. package/dist/packages/canvas-adapter/charts/plotChart.d.ts +24 -1
  26. package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
  27. package/dist/packages/canvas-adapter/charts/regionYieldDiagram.d.ts +3 -0
  28. package/dist/packages/canvas-adapter/charts/regionYieldDiagram.js +1 -1
  29. package/dist/packages/canvas-adapter/charts/sweep.d.ts +3 -0
  30. package/dist/packages/canvas-adapter/charts/sweep.js +1 -1
  31. package/dist/packages/canvas-adapter/chromeRow.d.ts +68 -0
  32. package/dist/packages/canvas-adapter/chromeRow.js +1 -0
  33. package/dist/packages/canvas-adapter/chunked.d.ts +6 -0
  34. package/dist/packages/canvas-adapter/chunked.js +1 -1
  35. package/dist/packages/canvas-adapter/columnFilterPopup.d.ts +25 -0
  36. package/dist/packages/canvas-adapter/columnFilterPopup.js +1 -0
  37. package/dist/packages/canvas-adapter/composePng.d.ts +37 -0
  38. package/dist/packages/canvas-adapter/composePng.js +1 -0
  39. package/dist/packages/canvas-adapter/dataTab.d.ts +27 -0
  40. package/dist/packages/canvas-adapter/dataTab.js +1 -1
  41. package/dist/packages/canvas-adapter/dieList.js +1 -1
  42. package/dist/packages/canvas-adapter/differenceMapPanel.d.ts +3 -1
  43. package/dist/packages/canvas-adapter/differenceMapPanel.js +1 -1
  44. package/dist/packages/canvas-adapter/drilldown.d.ts +19 -0
  45. package/dist/packages/canvas-adapter/drilldown.js +1 -1
  46. package/dist/packages/canvas-adapter/filterEditor.d.ts +5 -0
  47. package/dist/packages/canvas-adapter/filterEditor.js +1 -1
  48. package/dist/packages/canvas-adapter/guideWindow.js +1 -1
  49. package/dist/packages/canvas-adapter/icons.js +1 -1
  50. package/dist/packages/canvas-adapter/identityHeader.d.ts +5 -0
  51. package/dist/packages/canvas-adapter/identityHeader.js +1 -1
  52. package/dist/packages/canvas-adapter/index.d.ts +7 -0
  53. package/dist/packages/canvas-adapter/index.js +1 -1
  54. package/dist/packages/canvas-adapter/insightsTab.d.ts +23 -5
  55. package/dist/packages/canvas-adapter/insightsTab.js +1 -1
  56. package/dist/packages/canvas-adapter/maplessSummary.d.ts +4 -2
  57. package/dist/packages/canvas-adapter/maplessSummary.js +1 -1
  58. package/dist/packages/canvas-adapter/openWaferMode.js +1 -1
  59. package/dist/packages/canvas-adapter/panelChart.d.ts +7 -0
  60. package/dist/packages/canvas-adapter/panelChart.js +1 -0
  61. package/dist/packages/canvas-adapter/panelTable.d.ts +50 -0
  62. package/dist/packages/canvas-adapter/panelTable.js +1 -0
  63. package/dist/packages/canvas-adapter/plotCard.js +1 -1
  64. package/dist/packages/canvas-adapter/plotEditor.d.ts +12 -0
  65. package/dist/packages/canvas-adapter/plotEditor.js +10 -10
  66. package/dist/packages/canvas-adapter/plotItems.d.ts +9 -4
  67. package/dist/packages/canvas-adapter/plotItems.js +1 -1
  68. package/dist/packages/canvas-adapter/plotJsonComplete.js +1 -1
  69. package/dist/packages/canvas-adapter/plotModal.d.ts +7 -0
  70. package/dist/packages/canvas-adapter/plotModal.js +1 -1
  71. package/dist/packages/canvas-adapter/plotStore.js +1 -1
  72. package/dist/packages/canvas-adapter/plotTab.d.ts +59 -1
  73. package/dist/packages/canvas-adapter/plotTab.js +1 -1
  74. package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +7 -0
  75. package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
  76. package/dist/packages/canvas-adapter/renderWaferMap.d.ts +41 -9
  77. package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
  78. package/dist/packages/canvas-adapter/reportCharts.d.ts +41 -0
  79. package/dist/packages/canvas-adapter/reportCharts.js +1 -0
  80. package/dist/packages/canvas-adapter/reportExport.d.ts +91 -0
  81. package/dist/packages/canvas-adapter/reportExport.js +1 -0
  82. package/dist/packages/canvas-adapter/reportFigures.d.ts +29 -0
  83. package/dist/packages/canvas-adapter/reportFigures.js +1 -0
  84. package/dist/packages/canvas-adapter/reportRun.d.ts +9 -0
  85. package/dist/packages/canvas-adapter/reportRun.js +1 -0
  86. package/dist/packages/canvas-adapter/selectionOverlay.d.ts +12 -0
  87. package/dist/packages/canvas-adapter/selectionOverlay.js +1 -0
  88. package/dist/packages/canvas-adapter/summaryPanel.d.ts +150 -109
  89. package/dist/packages/canvas-adapter/summaryPanel.js +7 -4
  90. package/dist/packages/canvas-adapter/summaryToggle.js +1 -1
  91. package/dist/packages/canvas-adapter/tableDrilldown.d.ts +48 -0
  92. package/dist/packages/canvas-adapter/tableDrilldown.js +1 -0
  93. package/dist/packages/canvas-adapter/tableFilter.d.ts +42 -0
  94. package/dist/packages/canvas-adapter/tableFilter.js +1 -0
  95. package/dist/packages/canvas-adapter/tablePlots.d.ts +85 -0
  96. package/dist/packages/canvas-adapter/tablePlots.js +1 -0
  97. package/dist/packages/canvas-adapter/themeWatch.d.ts +7 -0
  98. package/dist/packages/canvas-adapter/themeWatch.js +1 -0
  99. package/dist/packages/canvas-adapter/toCanvas.d.ts +3 -0
  100. package/dist/packages/canvas-adapter/toCanvas.js +1 -1
  101. package/dist/packages/canvas-adapter/toolbar.d.ts +125 -36
  102. package/dist/packages/canvas-adapter/toolbar.js +2 -2
  103. package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
  104. package/dist/packages/canvas-adapter/userGuideHtml.js +521 -412
  105. package/dist/packages/canvas-adapter/version.d.ts +2 -2
  106. package/dist/packages/canvas-adapter/version.js +1 -1
  107. package/dist/packages/canvas-adapter/viewSwitch.js +1 -1
  108. package/dist/packages/canvas-adapter/virtualTable.d.ts +35 -6
  109. package/dist/packages/canvas-adapter/virtualTable.js +1 -1
  110. package/dist/packages/core/aggregates.d.ts +14 -0
  111. package/dist/packages/core/aggregates.js +1 -1
  112. package/dist/packages/core/dies.d.ts +7 -0
  113. package/dist/packages/core/dies.js +1 -1
  114. package/dist/packages/core/utils.d.ts +2 -0
  115. package/dist/packages/core/utils.js +1 -1
  116. package/dist/packages/experimental/charts.d.ts +4 -0
  117. package/dist/packages/experimental/charts.js +1 -0
  118. package/dist/packages/renderer/binColors.d.ts +6 -2
  119. package/dist/packages/renderer/binColors.js +1 -1
  120. package/dist/packages/renderer/buildView.d.ts +36 -14
  121. package/dist/packages/renderer/buildView.js +1 -1
  122. package/dist/packages/renderer/buildWaferMap.d.ts +8 -0
  123. package/dist/packages/renderer/buildWaferMap.js +1 -1
  124. package/dist/packages/renderer/categoryColors.d.ts +3 -0
  125. package/dist/packages/renderer/categoryColors.js +1 -0
  126. package/dist/packages/renderer/colorMap.d.ts +15 -16
  127. package/dist/packages/renderer/colorMap.js +1 -1
  128. package/dist/packages/renderer/colorSchemes.d.ts +34 -30
  129. package/dist/packages/renderer/colorSchemes.js +1 -1
  130. package/dist/packages/renderer/dataColors.d.ts +126 -0
  131. package/dist/packages/renderer/dataColors.js +1 -0
  132. package/dist/packages/renderer/deprecate.js +1 -1
  133. package/dist/packages/renderer/fmt.d.ts +14 -0
  134. package/dist/packages/renderer/fmt.js +1 -1
  135. package/dist/packages/renderer/index.d.ts +2 -0
  136. package/dist/packages/renderer/index.js +1 -1
  137. package/dist/packages/renderer/spec.d.ts +5 -0
  138. package/dist/packages/renderer/spec.js +1 -1
  139. package/dist/packages/renderer/stacks.d.ts +21 -0
  140. package/dist/packages/renderer/stacks.js +1 -0
  141. package/dist/packages/renderer/timeAxis.d.ts +19 -0
  142. package/dist/packages/renderer/timeAxis.js +1 -0
  143. package/dist/packages/stats/analyzeWaferLot.js +1 -1
  144. package/dist/packages/stats/analyzeWaferMap.d.ts +2 -4
  145. package/dist/packages/stats/analyzeWaferMap.js +1 -1
  146. package/dist/packages/stats/binRows.js +1 -1
  147. package/dist/packages/stats/binShifts.d.ts +59 -0
  148. package/dist/packages/stats/binShifts.js +1 -0
  149. package/dist/packages/stats/capability.d.ts +6 -1
  150. package/dist/packages/stats/capability.js +1 -1
  151. package/dist/packages/stats/chartCatalogue.d.ts +3 -0
  152. package/dist/packages/stats/chartCatalogue.js +1 -1
  153. package/dist/packages/stats/clusterDetection.js +1 -1
  154. package/dist/packages/stats/columnPlot.d.ts +38 -0
  155. package/dist/packages/stats/columnPlot.js +1 -0
  156. package/dist/packages/stats/commonality.d.ts +7 -0
  157. package/dist/packages/stats/commonality.js +1 -1
  158. package/dist/packages/stats/correlation.d.ts +7 -2
  159. package/dist/packages/stats/correlation.js +1 -1
  160. package/dist/packages/stats/dataTable.d.ts +44 -0
  161. package/dist/packages/stats/dataTable.js +1 -0
  162. package/dist/packages/stats/dieRegions.js +1 -1
  163. package/dist/packages/stats/facets.d.ts +11 -0
  164. package/dist/packages/stats/facets.js +1 -1
  165. package/dist/packages/stats/filterFindings.d.ts +21 -0
  166. package/dist/packages/stats/filterFindings.js +1 -1
  167. package/dist/packages/stats/math.d.ts +2 -0
  168. package/dist/packages/stats/math.js +1 -1
  169. package/dist/packages/stats/overview.d.ts +114 -0
  170. package/dist/packages/stats/overview.js +1 -0
  171. package/dist/packages/stats/pat.d.ts +0 -2
  172. package/dist/packages/stats/pat.js +1 -1
  173. package/dist/packages/stats/patternClassification.d.ts +20 -3
  174. package/dist/packages/stats/patternClassification.js +1 -1
  175. package/dist/packages/stats/permutationNull.d.ts +16 -0
  176. package/dist/packages/stats/permutationNull.js +1 -0
  177. package/dist/packages/stats/plotData.d.ts +131 -10
  178. package/dist/packages/stats/plotData.js +1 -1
  179. package/dist/packages/stats/plotSpec.d.ts +10 -1
  180. package/dist/packages/stats/plotSpec.js +3 -3
  181. package/dist/packages/stats/plotTable.js +1 -1
  182. package/dist/packages/stats/plotWords.d.ts +52 -0
  183. package/dist/packages/stats/plotWords.js +1 -0
  184. package/dist/packages/stats/presentation.d.ts +63 -14
  185. package/dist/packages/stats/presentation.js +1 -1
  186. package/dist/packages/stats/presentationPresets.d.ts +35 -0
  187. package/dist/packages/stats/presentationPresets.js +1 -0
  188. package/dist/packages/stats/presentationSections.d.ts +83 -0
  189. package/dist/packages/stats/presentationSections.js +1 -0
  190. package/dist/packages/stats/renderSummaryReport.d.ts +80 -2
  191. package/dist/packages/stats/renderSummaryReport.js +1 -67
  192. package/dist/packages/stats/reportBlocks.d.ts +249 -0
  193. package/dist/packages/stats/reportBlocks.js +1 -0
  194. package/dist/packages/stats/reportContents.d.ts +22 -0
  195. package/dist/packages/stats/reportContents.js +1 -0
  196. package/dist/packages/stats/reportDeck.d.ts +245 -0
  197. package/dist/packages/stats/reportDeck.js +212 -0
  198. package/dist/packages/stats/reportHtml.d.ts +44 -43
  199. package/dist/packages/stats/reportHtml.js +82 -46
  200. package/dist/packages/stats/reportMaps.d.ts +67 -0
  201. package/dist/packages/stats/reportMaps.js +1 -0
  202. package/dist/packages/stats/reportSections.d.ts +55 -0
  203. package/dist/packages/stats/reportSections.js +1 -0
  204. package/dist/packages/stats/sweep.d.ts +14 -6
  205. package/dist/packages/stats/sweep.js +1 -1
  206. package/dist/packages/stats/synthesis.d.ts +79 -9
  207. package/dist/packages/stats/synthesis.js +1 -1
  208. package/dist/packages/stats/types.d.ts +22 -0
  209. package/dist/packages/stats/worthItems.d.ts +15 -0
  210. package/dist/packages/stats/worthItems.js +1 -0
  211. package/dist/packages/stats/yield.d.ts +13 -0
  212. package/dist/packages/stats/yield.js +1 -1
  213. package/llms.txt +1 -1
  214. package/package.json +6 -1
@@ -0,0 +1,114 @@
1
+ import { type Die } from '../core/dies.js';
2
+ import { type TestDef } from '../renderer/buildWaferMap.js';
3
+ import type { TestShiftsByBin } from './binShifts.js';
4
+ import { type TestPassKind } from './testPassRate.js';
5
+ import type { SynthesisCategory, SynthesisItem } from './synthesis.js';
6
+ /** The Overview's groups, in its order. */
7
+ export type OverviewGroup = 'yield' | 'bins' | 'tests' | 'where' | 'why';
8
+ export declare const OVERVIEW_GROUPS: readonly OverviewGroup[];
9
+ export declare const OVERVIEW_GROUP_LABELS: Readonly<Record<OverviewGroup, string>>;
10
+ /** The group a Worth a look item belongs to: a wafer's to Yield, a pattern's and a site's to Where, a test's to Tests, a group's to Why. */
11
+ export declare const ITEM_GROUP: Readonly<Record<SynthesisCategory, OverviewGroup>>;
12
+ /** One wafer's dies and pass bins, as the tables count them. */
13
+ export interface WaferDies {
14
+ dies: readonly Die[];
15
+ passBins: readonly number[];
16
+ }
17
+ /** A sentence a group opens with, and the level of the item it is, when it is one. */
18
+ export interface OverviewSentence {
19
+ text: string;
20
+ level?: 'high' | 'medium' | 'low';
21
+ }
22
+ /** "Yield runs from 66.4% (W04) to 93.1% (W14).": the group's leading item when it has one, else the wafers' range. */
23
+ export declare function yieldSentence(items: readonly SynthesisItem[], wafers: ReadonlyArray<{
24
+ label: string;
25
+ yieldPercent: number;
26
+ }>): OverviewSentence | null;
27
+ /** "Hard bin 4 holds 56.0% of the 1,824 failing dies.": the largest fail bin's share, each die judged by its wafer's pass bins. */
28
+ export declare function binsSentence(wafers: readonly WaferDies[]): OverviewSentence | null;
29
+ /** "3 parametric tests put dies outside limits; most, iddq_uA on 460 dies (3.1%).", from the analysis's limit yields. */
30
+ export declare function testsSentence(specYield: ReadonlyArray<{
31
+ label: string;
32
+ failLowDies: number;
33
+ failHighDies: number;
34
+ totalDies: number;
35
+ }> | undefined): OverviewSentence | null;
36
+ /** A cell of Test shifts in each fail bin: "+2.8σ", "−2.7σ", "0.0σ". */
37
+ export declare function shiftText(shift: number): string;
38
+ /** Tests' sentence when no test can be judged: "Hard bin 3 dies read iddq 2.8σ above passing dies." */
39
+ export declare function binShiftSentence(shifts: Pick<TestShiftsByBin, 'field' | 'lead'>): OverviewSentence;
40
+ /** Where's sentence: its leading item, else that nothing stands out (when it has anything to show). */
41
+ export declare function whereSentence(items: readonly SynthesisItem[], hasCharts: boolean): OverviewSentence | null;
42
+ /** Why's sentence: its leading item, else that no wafer field divides yield clearly. */
43
+ export declare function whySentence(items: readonly SynthesisItem[]): OverviewSentence;
44
+ /** A test the tables judge, and how: by its limits (a parametric test with a limit), or by its recorded verdict (functional). */
45
+ export interface JudgedTest {
46
+ def: TestDef;
47
+ kind: TestPassKind;
48
+ }
49
+ /** The tests the Overview's tables judge: parametric tests with a limit, and functional tests. */
50
+ export declare function judgedTests(defs: readonly TestDef[]): JudgedTest[];
51
+ /**
52
+ * The dies each table counts, as one rule per cell, so a click on a count opens exactly the dies it counts. `pass` is the
53
+ * die's own wafer's pass bins. Every table counts yield-eligible dies only (no partial, edge-excluded or filtered-out die);
54
+ * `dieTestVerdict` already leaves the others out.
55
+ */
56
+ export type TableDieRule = (d: Die, pass: ReadonlySet<number>) => boolean;
57
+ /** @internal A die of a fail bin, as the bin tables count it: eligible, binned, and failing under its wafer's pass bins. */
58
+ export declare const inFailBin: (d: Die, pass: ReadonlySet<number>, field: "hbin" | "sbin") => boolean;
59
+ /** Tests behind each bin: the dies of one cell (`bin`), or of the row's Dies total (no `bin`: every fail bin). */
60
+ export declare function behindBinsRule(field: 'hbin' | 'sbin', test: JudgedTest, bin?: number): TableDieRule;
61
+ /** Parametric tests outside limits: the dies of a row, below or above the test's limits. */
62
+ export declare function outsideLimitsRule(def: TestDef): TableDieRule;
63
+ /** A die a test site's yield counts, in Test fail rate by site and the Summary panel: eligible, with a pass/fail verdict. */
64
+ export declare const siteJudged: (d: Die, pass: ReadonlySet<number>) => boolean;
65
+ /** Test fail rate by site: the dies of a site's yield (no `test`), or those failing `test` there. */
66
+ export declare function siteRule(site: number, test?: JudgedTest): TableDieRule;
67
+ /** Tests behind each bin: for the largest fail bins, how many of each bin's dies fail each test (a die under each it fails). */
68
+ export interface TestsBehindBins {
69
+ /** The bins counted: hard, or soft when the dies carry no hard bin. */
70
+ field: 'hbin' | 'sbin';
71
+ /** The largest fail bins, largest first. */
72
+ bins: number[];
73
+ /** The tests that fail dies in them, the most first: each bin's count, in `bins` order, and the total. */
74
+ rows: Array<{
75
+ test: JudgedTest;
76
+ counts: number[];
77
+ total: number;
78
+ }>;
79
+ /** Further tests that fail dies, not listed. */
80
+ more: number;
81
+ }
82
+ export declare function testsBehindBins(wafers: readonly WaferDies[], defs: readonly TestDef[], limits?: {
83
+ bins: number;
84
+ tests: number;
85
+ }): TestsBehindBins | null;
86
+ /** Parametric tests outside their limits: the dies below the low limit and above the high, and Ppk, the most first. */
87
+ export declare function testsOutsideLimits(wafers: readonly WaferDies[], defs: readonly TestDef[]): Array<{
88
+ def: TestDef;
89
+ low: number;
90
+ high: number;
91
+ ppk?: number;
92
+ }>;
93
+ /** A site failing a test at more than this many times the other sites' median rate, and at least `SITE_FLAG_POINTS` above it. */
94
+ export declare const SITE_FLAG_RATIO = 2.5;
95
+ export declare const SITE_FLAG_POINTS = 2;
96
+ /** Test fail rate by site: each site's yield, and each test's fail rate there, a site flagged where it fails a test far more. */
97
+ export interface SiteFailRates {
98
+ sites: number[];
99
+ /** Each site's yield, in per cent, in `sites` order. */
100
+ yields: number[];
101
+ /** The tests that fail dies, flagged ones first, then the most failing: each site's rate in per cent, and which are flagged. */
102
+ rows: Array<{
103
+ test: JudgedTest;
104
+ rates: number[];
105
+ flagged: boolean[];
106
+ total: number;
107
+ }>;
108
+ }
109
+ export declare function siteFailRates(wafers: readonly WaferDies[], defs: readonly TestDef[], limit?: number): SiteFailRates | null;
110
+ /** The largest count in a table of counts, for shading its cells against. */
111
+ export declare const largestCount: (rows: ReadonlyArray<{
112
+ counts: readonly number[];
113
+ }>) => number;
114
+ //# sourceMappingURL=overview.d.ts.map
@@ -0,0 +1 @@
1
+ import{diePassStatus as w,isYieldEligibleDie as N}from"../core/dies.js";import{maxOf as P}from"../core/utils.js";import{binFieldOf as M,isParametricTest as D}from"../renderer/buildWaferMap.js";import{plainBinTerms as y}from"../renderer/fmt.js";import{testLabel as T}from"../renderer/testLabel.js";import{buildCapabilityFigures as F}from"./capability.js";import{dieTestVerdict as S}from"./testPassRate.js";export const OVERVIEW_GROUPS=["yield","bins","tests","where","why"],OVERVIEW_GROUP_LABELS={yield:"Yield",bins:"Bins",tests:"Tests",where:"Where",why:"Why"},ITEM_GROUP={wafers:"yield",groups:"why",patterns:"where",sites:"where",tests:"tests"};const b=e=>`${e.toFixed(1)}%`,$=e=>Math.round(e).toLocaleString("en-GB");function L(e,t){const n=e.find(i=>ITEM_GROUP[i.category]===t);return n?{text:y(n.reason),level:n.impact}:null}export function yieldSentence(e,t){const n=L(e,"yield");if(n)return n;const i=t.filter(s=>Number.isFinite(s.yieldPercent)).sort((s,r)=>s.yieldPercent-r.yieldPercent);return i.length>1?{text:`Yield runs from ${b(i[0].yieldPercent)} (${i[0].label}) to ${b(i[i.length-1].yieldPercent)} (${i[i.length-1].label}).`}:null}export function binsSentence(e){const t=M(e.map(r=>r.dies)),n=new Map;let i=0;for(const r of e){const u=new Set(r.passBins);for(const c of r.dies){const d=c[t];N(c)&&d!==void 0&&w(c,u)===!1&&(n.set(d,(n.get(d)??0)+1),i++)}}const s=[...n].sort((r,u)=>u[1]-r[1])[0];return s&&i?{text:`${t==="sbin"?"Soft":"Hard"} bin ${s[0]} holds ${b(100*s[1]/i)} of the ${$(i)} failing dies.`}:null}export function testsSentence(e){const t=e??[],n=[...t].sort((s,r)=>r.failLowDies+r.failHighDies-(s.failLowDies+s.failHighDies))[0],i=t.filter(s=>s.failLowDies+s.failHighDies>0).length;return n&&n.failLowDies+n.failHighDies>0?{text:`${i} parametric test${i===1?"":"s"} put dies outside limits; most, ${y(n.label)} on ${$(n.failLowDies+n.failHighDies)} dies (${b(100*(n.failLowDies+n.failHighDies)/n.totalDies)}).`}:null}const B=e=>Math.abs(e)>=9.95?$(Math.abs(e)):Math.abs(e).toFixed(1);export function shiftText(e){const t=B(e);return`${t==="0.0"?"":e>0?"+":"\u2212"}${t}\u03C3`}export function binShiftSentence(e){const t=e.lead;return{text:t?`${e.field==="sbin"?"Soft":"Hard"} bin ${t.bin} dies read ${y(T(t.def,t.def.testNumber))} ${B(t.cell.shift)}\u03C3 ${t.cell.shift>0?"above":"below"} passing dies.`:"No fail bin differs clearly from the passing dies on any test."}}export function whereSentence(e,t){return L(e,"where")??(t?{text:"No region, pattern or test site stands out."}:null)}export function whySentence(e){return L(e,"why")??{text:"No wafer field divides yield clearly."}}export function judgedTests(e){return e.flatMap(t=>D(t)?t.limitLow!==void 0||t.limitHigh!==void 0?[{def:t,kind:"spec"}]:[]:[{def:t,kind:"functional"}])}const x=(e,t)=>{const n=S(e,t.def,t.kind);return n!==void 0&&n!=="pass"};export const inFailBin=(e,t,n)=>N(e)&&e[n]!==void 0&&w(e,t)===!1;export function behindBinsRule(e,t,n){return(i,s)=>inFailBin(i,s,e)&&(n===void 0||i[e]===n)&&x(i,t)}export function outsideLimitsRule(e){return t=>{const n=S(t,e,"spec");return n==="failLow"||n==="failHigh"}}export const siteJudged=(e,t)=>e.siteNum!==void 0&&N(e)&&w(e,t)!==void 0;export function siteRule(e,t){return(n,i)=>n.siteNum===e&&siteJudged(n,i)&&(!t||x(n,t))}export function testsBehindBins(e,t,n={bins:6,tests:10}){const i=judgedTests(t);if(!i.length)return null;const s=M(e.map(f=>f.dies)),r=new Map,u=new Map;for(const f of e){const o=new Set(f.passBins);for(const l of f.dies){if(!inFailBin(l,o,s))continue;const a=l[s];r.set(a,(r.get(a)??0)+1);for(const p of i){if(!x(l,p))continue;const m=u.get(p.def.testNumber)??u.set(p.def.testNumber,new Map).get(p.def.testNumber);m.set(a,(m.get(a)??0)+1)}}}const c=[...r].sort((f,o)=>o[1]-f[1]).slice(0,n.bins).map(([f])=>f),d=i.map(f=>({test:f,total:[...u.get(f.def.testNumber)?.values()??[]].reduce((o,l)=>o+l,0)})).filter(f=>f.total>0).sort((f,o)=>o.total-f.total);if(!c.length||!d.length)return null;const h=d.slice(0,n.tests).map(f=>({...f,counts:c.map(o=>u.get(f.test.def.testNumber)?.get(o)??0)}));return{field:s,bins:c,rows:h,more:d.length-h.length}}export function testsOutsideLimits(e,t){const n=t.filter(s=>D(s)&&(s.limitLow!==void 0||s.limitHigh!==void 0));if(!n.length)return[];const i=new Map(F(e.map(s=>({dies:[...s.dies]})),n).map(s=>[s.testNumber,s.ppk??void 0]));return n.map(s=>{let r=0,u=0;for(const d of e)for(const h of d.dies){const f=S(h,s,"spec");f==="failLow"?r++:f==="failHigh"&&u++}const c=i.get(s.testNumber);return{def:s,low:r,high:u,...c!==void 0&&Number.isFinite(c)?{ppk:c}:{}}}).filter(s=>s.low+s.high>0).sort((s,r)=>r.low+r.high-(s.low+s.high))}export const SITE_FLAG_RATIO=2.5,SITE_FLAG_POINTS=2;export function siteFailRates(e,t,n=10){const i=[...new Set(e.flatMap(o=>o.dies.map(l=>l.siteNum)).filter(o=>o!==void 0))].sort((o,l)=>o-l);if(i.length<2)return null;const s=judgedTests(t),r=new Map,u=new Map,c=new Map;for(const o of e){const l=new Set(o.passBins);for(const a of o.dies){if(!siteJudged(a,l))continue;const p=w(a,l);r.set(a.siteNum,(r.get(a.siteNum)??0)+1),p&&u.set(a.siteNum,(u.get(a.siteNum)??0)+1);for(const m of s){if(!x(a,m))continue;const g=c.get(m.def.testNumber)??c.set(m.def.testNumber,new Map).get(m.def.testNumber);g.set(a.siteNum,(g.get(a.siteNum)??0)+1)}}}const d=(o,l)=>100*(c.get(o)?.get(l)??0)/(r.get(l)||1),h=(o,l)=>{const a=i.filter(g=>g!==l).map(g=>d(o,g)).sort((g,H)=>g-H),p=a[Math.floor(a.length/2)]??0,m=d(o,l);return m>SITE_FLAG_RATIO*p&&m-p>=SITE_FLAG_POINTS},f=s.filter(o=>c.has(o.def.testNumber)).map(o=>{const l=o.def.testNumber;return{test:o,rates:i.map(a=>d(l,a)),flagged:i.map(a=>h(l,a)),total:[...c.get(l).values()].reduce((a,p)=>a+p,0)}}).sort((o,l)=>Number(l.flagged.some(Boolean))-Number(o.flagged.some(Boolean))||l.total-o.total).slice(0,n);return{sites:i,yields:i.map(o=>100*(u.get(o)??0)/(r.get(o)||1)),rows:f}}export const largestCount=e=>P(e.flatMap(t=>t.counts));
@@ -2,8 +2,6 @@ import type { Die } from '../core/dies.js';
2
2
  import { type TestDef } from '../renderer/buildWaferMap.js';
3
3
  /** Robust sigmas each side of the median. */
4
4
  export declare const PAT_K = 6;
5
- /** The interquartile range of a normal distribution in standard deviations. */
6
- export declare const PAT_IQR_SIGMA = 1.35;
7
5
  /** Passing values a wafer needs on a test before its PAT limits mean anything. */
8
6
  export declare const PAT_MIN_DIES = 30;
9
7
  /**
@@ -1 +1 @@
1
- import{diePassStatus as g}from"../core/dies.js";import{testValuesReader as y}from"../core/dieTable.js";import{isParametricTest as F}from"../renderer/buildWaferMap.js";import{fiveNumberSummary as I}from"./math.js";import{capabilityLimits as x}from"./capability.js";export const PAT_K=6,PAT_IQR_SIGMA=1.35,PAT_MIN_DIES=30,PAT_SKEW_WARN=.2,PAT_VERDICT_LABEL={within:"Within PAT limits",outlier:"PAT outlier",fails:"Fails (bin or limits)"},PAT_VERDICT_ORDER=[PAT_VERDICT_LABEL.within,PAT_VERDICT_LABEL.outlier,PAT_VERDICT_LABEL.fails];export function patTests(r){return r.filter(i=>F(i)&&x(i)!==void 0)}const E=new WeakMap;function q(r,i,m){const A=[...m].sort((t,e)=>t-e).join(","),d=E.get(r);if(d&&d.defs===i&&d.passKey===A)return d;const a=patTests(i),p=a.map(t=>x(t)),P=y(a.map(t=>t.testNumber)),T=new Set(m),b=new Float64Array(a.length),v=a.map(()=>[]);for(const t of r)if(g(t,T)===!0){P(t,b);for(let e=0;e<a.length;e++){const n=b[e];Number.isFinite(n)&&n>=p[e].lsl&&n<=p[e].usl&&v[e].push(n)}}const N=new Map,w=[];a.forEach((t,e)=>{const{lsl:n,usl:f,basis:h}=p[e],c=v[e];if(c.length<PAT_MIN_DIES){w.push({testNumber:t.testNumber,reason:"few-values"});return}const s=I(Float64Array.from(c)),o=(s.q3-s.q1)/PAT_IQR_SIGMA;if(!(o>0)){w.push({testNumber:t.testNumber,reason:"no-spread"});return}const l=s.median-PAT_K*o,u=s.median+PAT_K*o;N.set(t.testNumber,{testNumber:t.testNumber,lo:Math.max(l,n),hi:Math.min(u,f),median:s.median,robustSigma:o,n:c.length,basis:h,clippedLo:l<n,clippedHi:u>f,skew:(s.q3+s.q1-2*s.median)/(s.q3-s.q1)})});const R=a.map(t=>N.get(t.testNumber)),S=r.map(t=>{const e=g(t,T)===!1,n=P(t,b);let f=!1;const h=[],c=[];return a.forEach((s,o)=>{const l=R[o],u=n[o];!l||!Number.isFinite(u)||(f=!0,u<p[o].lsl||u>p[o].usl?h.push(s.testNumber):(u<l.lo||u>l.hi)&&c.push(s.testNumber))}),f?h.length||e?{verdict:"fails",tests:h}:c.length?{verdict:"outlier",tests:c}:{verdict:"within",tests:[]}:e?{verdict:"fails",tests:[]}:{tests:[]}}),_={defs:i,passKey:A,pat:{limits:N,skipped:w},verdicts:S};return E.set(r,_),_}export function waferPatLimits(r,i,m){return q(r,i,m).pat}export function waferPatVerdicts(r,i,m){return q(r,i,m).verdicts}
1
+ import{diePassStatus as _}from"../core/dies.js";import{testValuesReader as y}from"../core/dieTable.js";import{isParametricTest as F}from"../renderer/buildWaferMap.js";import{fiveNumberSummary as I,IQR_SIGMA as L}from"./math.js";import{capabilityLimits as x}from"./capability.js";export const PAT_K=6,PAT_MIN_DIES=30,PAT_SKEW_WARN=.2,PAT_VERDICT_LABEL={within:"Within PAT limits",outlier:"PAT outlier",fails:"Fails (bin or limits)"},PAT_VERDICT_ORDER=[PAT_VERDICT_LABEL.within,PAT_VERDICT_LABEL.outlier,PAT_VERDICT_LABEL.fails];export function patTests(r){return r.filter(i=>F(i)&&x(i)!==void 0)}const E=new WeakMap;function q(r,i,m){const A=[...m].sort((t,e)=>t-e).join(","),d=E.get(r);if(d&&d.defs===i&&d.passKey===A)return d;const a=patTests(i),p=a.map(t=>x(t)),v=y(a.map(t=>t.testNumber)),P=new Set(m),b=new Float64Array(a.length),T=a.map(()=>[]);for(const t of r)if(_(t,P)===!0){v(t,b);for(let e=0;e<a.length;e++){const n=b[e];Number.isFinite(n)&&n>=p[e].lsl&&n<=p[e].usl&&T[e].push(n)}}const N=new Map,w=[];a.forEach((t,e)=>{const{lsl:n,usl:f,basis:h}=p[e],c=T[e];if(c.length<PAT_MIN_DIES){w.push({testNumber:t.testNumber,reason:"few-values"});return}const s=I(Float64Array.from(c)),o=(s.q3-s.q1)/L;if(!(o>0)){w.push({testNumber:t.testNumber,reason:"no-spread"});return}const l=s.median-PAT_K*o,u=s.median+PAT_K*o;N.set(t.testNumber,{testNumber:t.testNumber,lo:Math.max(l,n),hi:Math.min(u,f),median:s.median,robustSigma:o,n:c.length,basis:h,clippedLo:l<n,clippedHi:u>f,skew:(s.q3+s.q1-2*s.median)/(s.q3-s.q1)})});const R=a.map(t=>N.get(t.testNumber)),S=r.map(t=>{const e=_(t,P)===!1,n=v(t,b);let f=!1;const h=[],c=[];return a.forEach((s,o)=>{const l=R[o],u=n[o];!l||!Number.isFinite(u)||(f=!0,u<p[o].lsl||u>p[o].usl?h.push(s.testNumber):(u<l.lo||u>l.hi)&&c.push(s.testNumber))}),f?h.length||e?{verdict:"fails",tests:h}:c.length?{verdict:"outlier",tests:c}:{verdict:"within",tests:[]}:e?{verdict:"fails",tests:[]}:{tests:[]}}),g={defs:i,passKey:A,pat:{limits:N,skipped:w},verdicts:S};return E.set(r,g),g}export function waferPatLimits(r,i,m){return q(r,i,m).pat}export function waferPatVerdicts(r,i,m){return q(r,i,m).verdicts}
@@ -67,6 +67,18 @@ export interface PatternClassification {
67
67
  features: PatternFeatures;
68
68
  /** Human-readable note about classification uncertainty, when applicable. */
69
69
  note?: string;
70
+ /**
71
+ * How often the same number of fails scattered at random over the same dies shows this pattern at least as strongly
72
+ * (a permutation p-value, on the measure the classifier's rule for the shape rests on), when it was tested against chance. Absent for `random`, `none` and `near-full`
73
+ * (a fail rate, not a shape), and when no significance level was given. It is the chance of that shape's own measure; it
74
+ * does not allow for the classifier having chosen this shape among the others, so it is a little generous.
75
+ */
76
+ pValue?: number;
77
+ /**
78
+ * The shape the failing dies resemble when random placement gives it too often to report (`pValue` at or above the
79
+ * significance level): `pattern` is then `random`. Small wafers at a moderate fail rate take a shape by chance often.
80
+ */
81
+ resembles?: PatternLabel;
70
82
  }
71
83
  export interface PatternThresholds {
72
84
  nearFullGlobalRdd: number;
@@ -105,8 +117,9 @@ export interface PatternThresholds {
105
117
  * Default thresholds for the spatial pattern classifier.
106
118
  *
107
119
  * Calibrated against WM-811K — 25,519 labelled real-world wafers from TSMC
108
- * 300mm fabrication (Wu et al. 2015). Benchmark results on that dataset
109
- * (`scripts/run-benchmark-npz.mjs`, 2026-10-09):
120
+ * 300mm fabrication (Wu et al. 2015). Benchmark results of these rules alone on that dataset
121
+ * (`scripts/run-benchmark-npz.mjs --no-null`, 2026-10-09; with each shape tested against
122
+ * chance, 2026-11-10, see docs/detection-analysis.md):
110
123
  *
111
124
  * | Pattern | Recall | Precision |
112
125
  * |------------|--------|-----------|
@@ -156,10 +169,14 @@ export declare function patternExplains(pattern: PatternLabel, family: string, r
156
169
  export declare function classifyPattern(dies: PositionedDie[], wafer: Wafer, options: {
157
170
  passBins: number[];
158
171
  ringCount: number;
172
+ /** Test the shape against chance at this level; see {@link classifyFailingDies}. */
173
+ significanceLevel?: number;
159
174
  }): PatternClassification | null;
160
175
  /**
161
176
  * {@link classifyPattern} over a failing set already chosen — a wafer's failing
162
177
  * dies, or the positions at which a lot's failures recur (`findLotPattern`).
163
178
  */
164
- export declare function classifyFailingDies(failing: PositionedDie[], dies: PositionedDie[], wafer: Wafer, ringCount: number): PatternClassification | null;
179
+ export declare function classifyFailingDies(failing: PositionedDie[], dies: PositionedDie[], wafer: Wafer, ringCount: number,
180
+ /** Test the shape against chance at this level (see {@link patternPValue}); omitted, the shape is taken as found. */
181
+ significanceLevel?: number): PatternClassification | null;
165
182
  //# sourceMappingURL=patternClassification.d.ts.map
@@ -1 +1 @@
1
- import{diePassStatus as fn}from"../core/dies.js";import{findConnectedComponents as pn}from"./connectedComponents.js";import{clamp01 as mn}from"../core/utils.js";import{ringOf as yn}from"../core/classify.js";export const DEFAULT_PATTERN_THRESHOLDS={nearFullGlobalRdd:.6,edgeRingEdgeRdd:.18,edgeRingEdgeRddHigh:.3,edgeRingRadialSpread:.45,edgeRingAngularSpread:.6,edgeLocalEdgeRdd:.1,edgeLocalCentroidDist:.76,centerCentroidDist:.22,centerCentroidDistHigh:.1,centerEdgeRdd:.35,scratchMaxLineWidth:.8,scratchMinLineLength:8,scratchMinLineLengthRadius:.3,scratchMinReach:.35,scratchMaxInnerDist:.7,donutHole:.15,donutRim:.15,donutPeak:.15,minimumFailingDies:5};function B(n,t,o){return yn(n.physX-t.center.x,n.physY-t.center.y,t.radius,o)===o}function Mn(n,t,o){if(n.length<3)return 0;let s=0,a=0,c=0;for(const M of n){const u=M.physX-t,g=M.physY-o;s+=u*u,a+=g*g,c+=u*g}s/=n.length,a/=n.length,c/=n.length;const d=s+a,i=s*a-c*c,p=Math.max(0,(d/2)**2-i),f=d/2+Math.sqrt(p),y=d/2-Math.sqrt(p);if(f<=0)return 0;const R=mn(y/f);return Math.sqrt(1-R)}function xn(n,t){if(t===0)return 0;const o=new Map,s=new Map,a=new Map,c=new Map;for(const i of n)o.set(i.y,(o.get(i.y)??0)+1),s.set(i.x,(s.get(i.x)??0)+1),a.set(i.x-i.y,(a.get(i.x-i.y)??0)+1),c.set(i.x+i.y,(c.get(i.x+i.y)??0)+1);let d=0;for(const i of o.values())i>d&&(d=i);for(const i of s.values())i>d&&(d=i);for(const i of a.values())i>d&&(d=i);for(const i of c.values())i>d&&(d=i);return d/t}function Rn(n,t,o,s){if(n.length<2)return{width:0,length:0};let a=0,c=0,d=0;for(const u of n){const g=u.physX-t,x=u.physY-o;a+=g*g,c+=x*x,d+=g*x}const i=.5*Math.atan2(2*d,a-c),p=Math.cos(i),f=Math.sin(i);let y=1/0,R=-1/0,M=0;for(const u of n){const g=u.physX-t,x=u.physY-o,D=g*p+x*f,m=x*p-g*f;M+=m*m,D<y&&(y=D),D>R&&(R=D)}return{width:Math.sqrt(M/n.length)/s,length:(R-y)/s}}function K(n){let t=0,o=0;for(const s of n)t+=s.physX,o+=s.physY;return[t/n.length,o/n.length]}const Dn=1.5,Sn=3;function Ln(n,t,o){const s=[...n];if(n.length<2)return s;const a=t.filter(c=>c.length>0);for(;;){const[c,d]=K(s);let i=0,p=0,f=0;for(const l of s){const h=l.physX-c,S=l.physY-d;i+=h*h,p+=S*S,f+=h*S}const y=.5*Math.atan2(2*f,i-p),R=Math.cos(y),M=Math.sin(y),u=l=>(l.physX-c)*R+(l.physY-d)*M;let g=1/0,x=-1/0;for(const l of s){const h=u(l);h<g&&(g=h),h>x&&(x=h)}let D=-1,m=1/0;for(let l=0;l<a.length;l++){let h=1/0,S=-1/0,I=!1;for(const E of a[l]){if(Math.abs((E.physY-d)*R-(E.physX-c)*M)>Dn*o){I=!0;break}const b=u(E);b<h&&(h=b),b>S&&(S=b)}if(I)continue;const L=Math.max(h-x,g-S,0);L<=Sn*o&&L<m&&(D=l,m=L)}if(D<0)return s;s.push(...a[D]),a.splice(D,1)}}function En(n,t,o,s){const a=t.length,c=n.length,d=a>0?c/a:0,i=t.filter(e=>B(e,o,s)),p=n.filter(e=>B(e,o,s)),f=i.length>0?p.length/i.length:0,y=pn(n),R=e=>{let r=1/0,A=1/0,_=0,v=0;for(const N of e)_+=N.physX,v+=N.physY,(N.y<r||N.y===r&&N.x<A)&&(r=N.y,A=N.x);const un=Math.hypot(_/e.length-o.center.x,v/e.length-o.center.y);return[Math.round(un*1e6),r,A]},M=y.length>0?y.map(e=>({c:e,k:R(e)})).sort((e,r)=>r.c.length-e.c.length||e.k[0]-r.k[0]||e.k[1]-r.k[1]||e.k[2]-r.k[2]).map(({c:e})=>e):[n],u=M[0],g=M.slice(0,5).flat(),x=u.length,D=c>0?x/c:0,m=o.center.x,l=o.center.y,h=o.radius;let S=0,I=0,L=1/0,E=0;for(const e of u){S+=e.physX,I+=e.physY;const r=Math.sqrt((e.physX-m)**2+(e.physY-l)**2);r<L&&(L=r),r>E&&(E=r)}const b=S/u.length,U=I/u.length,V=Math.sqrt((b-m)**2+(U-l)**2)/h,j=L===1/0?0:L/h,J=Math.min(E/h,1),k=n.map(e=>Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h).sort((e,r)=>e-r),Q=k[Math.floor(k.length*.25)]??0,P=t.filter(e=>Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h<.5).length,H=t.filter(e=>Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h>=.5).length,Z=n.filter(e=>Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h<.5).length,$=n.filter(e=>Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h>=.5).length,O=P>0?Z/P:0,w=H>0?$/H:0,nn=w>0?O/w:O>0?2:1,tn=g.reduce((e,r)=>e+r.physX,0)/g.length,en=g.reduce((e,r)=>e+r.physY,0)/g.length,on=Mn(g,tn,en),sn=xn(g,g.length),F=16,G=new Set;for(const e of p){const r=(Math.atan2(e.physY-l,e.physX-m)+2*Math.PI)%(2*Math.PI);G.add(Math.floor(r/(2*Math.PI)*F)%F)}const rn=p.length>0?G.size/F:0,T=Math.max(u[0]?.width??1,u[0]?.height??1),X=Ln(u,M.slice(1,12),T),{width:cn,length:dn}=Rn(X,...K(X),T);let Y=1/0,q=0;for(const e of X){const r=Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h;r<Y&&(Y=r),r>q&&(q=r)}const an=Y===1/0?0:Y,ln=Math.min(q,1),C=5,W=new Array(C).fill(0),z=new Array(C).fill(0),hn=new Set(n);for(const e of t){const r=Math.min(C-1,Math.floor(Math.sqrt((e.physX-m)**2+(e.physY-l)**2)/h*C));W[r]++,hn.has(e)&&z[r]++}const gn=W.map((e,r)=>e>0?z[r]/e:0);return{globalRdd:d,edgeRdd:f,centroidDistNorm:V,minDistNorm:j,maxDistNorm:J,p25DistNorm:Q,eccentricity:on,linearScore:sn,salienceSize:x,salienceFraction:D,edgeAngularSpread:rn,innerOuterRatio:nn,lineWidth:cn,lineLength:dn,lineSize:X.length,lineMinDistNorm:an,lineMaxDistNorm:ln,radialFailRates:gn}}function Nn(n,t,o){const s=Math.max(5,Math.round(o*.003)),a=n.salienceSize>=s;if(n.globalRdd<t.nearFullGlobalRdd&&n.p25DistNorm>=t.edgeLocalCentroidDist&&n.edgeAngularSpread>=t.edgeRingAngularSpread&&n.edgeRdd>=t.edgeLocalEdgeRdd)return{pattern:"edge-ring",confidence:n.edgeRdd>=t.edgeRingEdgeRddHigh?"high":"medium"};const[c,d,i,,p]=n.radialFailRates,f=Math.max(d,i);if(n.globalRdd<t.nearFullGlobalRdd&&f>=t.donutPeak&&f-c>=t.donutHole&&f-p>=t.donutRim)return{pattern:"donut",confidence:f-c>=2*t.donutHole?"high":"medium"};if(n.globalRdd<t.nearFullGlobalRdd&&n.lineSize>=s&&n.lineWidth<=t.scratchMaxLineWidth&&n.lineLength>=t.scratchMinLineLength&&n.lineLength>=t.scratchMinLineLengthRadius*Math.sqrt(o/Math.PI)&&n.lineMaxDistNorm>=t.scratchMinReach&&n.lineMinDistNorm<t.scratchMaxInnerDist)return{pattern:"scratch",confidence:n.lineWidth<=t.scratchMaxLineWidth/2?"high":"medium"};if(n.globalRdd<t.nearFullGlobalRdd&&n.salienceFraction<.1)return{pattern:"random",confidence:"low"};if(n.globalRdd>=t.nearFullGlobalRdd)return{pattern:"near-full",confidence:n.globalRdd>=.8?"high":"medium"};const y=a&&n.edgeRdd>=t.edgeLocalEdgeRdd&&n.maxDistNorm>=.7;return y&&n.p25DistNorm>=t.edgeLocalCentroidDist&&n.maxDistNorm-n.minDistNorm<=t.edgeRingRadialSpread?{pattern:"edge-ring",confidence:n.edgeRdd>=t.edgeRingEdgeRddHigh?"high":"medium"}:y&&n.p25DistNorm>=.55&&n.p25DistNorm<t.edgeLocalCentroidDist?{pattern:"edge-local",confidence:n.edgeRdd>=t.edgeRingEdgeRdd?"medium":"low"}:a&&n.centroidDistNorm<=t.centerCentroidDist&&n.edgeRdd<=t.centerEdgeRdd?{pattern:"center",confidence:n.centroidDistNorm<=t.centerCentroidDistHigh?"high":"medium"}:{pattern:"random",confidence:"low"}}export const PATTERN_LABELS={center:"Center cluster",donut:"Donut","edge-ring":"Edge-ring","edge-local":"Edge-local",scratch:"Scratch","near-full":"Near-full",random:"Random",none:"None"};export function patternFailVerdict(n,t){const o=fn(n,t);return o===void 0?void 0:!o}export function patternExplains(n,t,o,s){if(!{"edge-ring":["ring","edge-arc"],"edge-local":["edge-arc","sector","quadrant"],center:["ring","cluster"],donut:["ring"],scratch:["cluster","sector","quadrant"],"near-full":["ring"]}[n]?.includes(t))return!1;if(t==="cluster")return n!=="center"||o.length===0||o.includes(1);if(t!=="ring"||o.length===0)return!0;const c=o.includes(s),d=o.includes(1);return n==="edge-ring"||n==="edge-local"?c:n==="center"?d:n==="donut"?!c&&!d:!0}export function classifyPattern(n,t,o){const s=new Set(o.passBins),a=n.filter(c=>patternFailVerdict(c,s)===!0);return classifyFailingDies(a,n,t,o.ringCount)}export function classifyFailingDies(n,t,o,s){const a={...DEFAULT_PATTERN_THRESHOLDS},c=Math.max(a.minimumFailingDies,Math.round(t.length*.003));if(n.length<c)return null;const d=En(n,t,o,s),{pattern:i,confidence:p,note:f}=Nn(d,a,t.length);return{pattern:i,confidence:p,features:d,...f?{note:f}:{}}}
1
+ import{diePassStatus as ft}from"../core/dies.js";import{findConnectedComponents as mt}from"./connectedComponents.js";import{clamp01 as pt}from"../core/utils.js";import{ringOf as yt}from"../core/classify.js";import{seededRandom as Mt}from"./math.js";import{failBand as xt,layoutKey as Rt,remember as Dt}from"./permutationNull.js";export const DEFAULT_PATTERN_THRESHOLDS={nearFullGlobalRdd:.6,edgeRingEdgeRdd:.18,edgeRingEdgeRddHigh:.3,edgeRingRadialSpread:.45,edgeRingAngularSpread:.6,edgeLocalEdgeRdd:.1,edgeLocalCentroidDist:.76,centerCentroidDist:.22,centerCentroidDistHigh:.1,centerEdgeRdd:.35,scratchMaxLineWidth:.8,scratchMinLineLength:8,scratchMinLineLengthRadius:.3,scratchMinReach:.35,scratchMaxInnerDist:.7,donutHole:.15,donutRim:.15,donutPeak:.15,minimumFailingDies:5};function $(t,n,e){return yt(t.physX-n.center.x,t.physY-n.center.y,n.radius,e)===e}function Lt(t,n,e){if(t.length<3)return 0;let s=0,c=0,o=0;for(const p of t){const g=p.physX-n,y=p.physY-e;s+=g*g,c+=y*y,o+=g*y}s/=t.length,c/=t.length,o/=t.length;const a=s+c,r=s*c-o*o,h=Math.max(0,(a/2)**2-r),l=a/2+Math.sqrt(h),u=a/2-Math.sqrt(h);if(l<=0)return 0;const M=pt(u/l);return Math.sqrt(1-M)}function Nt(t,n){if(n===0)return 0;const e=new Map,s=new Map,c=new Map,o=new Map;for(const r of t)e.set(r.y,(e.get(r.y)??0)+1),s.set(r.x,(s.get(r.x)??0)+1),c.set(r.x-r.y,(c.get(r.x-r.y)??0)+1),o.set(r.x+r.y,(o.get(r.x+r.y)??0)+1);let a=0;for(const r of e.values())r>a&&(a=r);for(const r of s.values())r>a&&(a=r);for(const r of c.values())r>a&&(a=r);for(const r of o.values())r>a&&(a=r);return a/n}function bt(t,n,e,s){if(t.length<2)return{width:0,length:0};let c=0,o=0,a=0;for(const g of t){const y=g.physX-n,x=g.physY-e;c+=y*y,o+=x*x,a+=y*x}const r=.5*Math.atan2(2*a,c-o),h=Math.cos(r),l=Math.sin(r);let u=1/0,M=-1/0,p=0;for(const g of t){const y=g.physX-n,x=g.physY-e,f=y*h+x*l,D=x*h-y*l;p+=D*D,f<u&&(u=f),f>M&&(M=f)}return{width:Math.sqrt(p/t.length)/s,length:(M-u)/s}}function z(t){let n=0,e=0;for(const s of t)n+=s.physX,e+=s.physY;return[n/t.length,e/t.length]}const St=1.5,Et=3;function Ct(t,n,e){const s=[...t];if(t.length<2)return s;const c=n.filter(o=>o.length>0);for(;;){const[o,a]=z(s);let r=0,h=0,l=0;for(const m of s){const R=m.physX-o,L=m.physY-a;r+=R*R,h+=L*L,l+=R*L}const u=.5*Math.atan2(2*l,r-h),M=Math.cos(u),p=Math.sin(u),g=m=>(m.physX-o)*M+(m.physY-a)*p;let y=1/0,x=-1/0;for(const m of s){const R=g(m);R<y&&(y=R),R>x&&(x=R)}let f=-1,D=1/0;for(let m=0;m<c.length;m++){let R=1/0,L=-1/0,N=!1;for(const I of c[m]){if(Math.abs((I.physY-a)*M-(I.physX-o)*p)>St*e){N=!0;break}const E=g(I);E<R&&(R=E),E>L&&(L=E)}if(N)continue;const b=Math.max(R-x,y-L,0);b<=Et*e&&b<D&&(f=m,D=b)}if(f<0)return s;s.push(...c[f]),c.splice(f,1)}}const C=5;function B(t,n,e){const s=n.center.x,c=n.center.y,o=n.radius;let a=0,r=0;const h=new Array(C).fill(0);for(const l of t){$(l,n,e)&&a++;const u=Math.sqrt((l.physX-s)**2+(l.physY-c)**2)/o;u<.5&&r++,h[Math.min(C-1,Math.floor(u*C))]++}return{n:t.length,edgeCount:a,innerCount:r,outerCount:t.length-r,bandN:h}}function V(t,n,e,s){const c=n.n,o=t.length,a=c>0?o/c:0,r=t.filter(i=>$(i,e,s)),h=n.edgeCount>0?r.length/n.edgeCount:0,l=mt(t),u=i=>{let d=1/0,P=1/0,U=0,W=0;for(const S of i)U+=S.physX,W+=S.physY,(S.y<d||S.y===d&&S.x<P)&&(d=S.y,P=S.x);const gt=Math.hypot(U/i.length-e.center.x,W/i.length-e.center.y);return[Math.round(gt*1e6),d,P]},M=l.length>0?l.map(i=>({c:i,k:u(i)})).sort((i,d)=>d.c.length-i.c.length||i.k[0]-d.k[0]||i.k[1]-d.k[1]||i.k[2]-d.k[2]).map(({c:i})=>i):[t],p=M[0],g=M.slice(0,5).flat(),y=p.length,x=o>0?y/o:0,f=e.center.x,D=e.center.y,m=e.radius;let R=0,L=0,N=1/0,b=0;for(const i of p){R+=i.physX,L+=i.physY;const d=Math.sqrt((i.physX-f)**2+(i.physY-D)**2);d<N&&(N=d),d>b&&(b=d)}const I=R/p.length,E=L/p.length,j=Math.sqrt((I-f)**2+(E-D)**2)/m,J=N===1/0?0:N/m,Q=Math.min(b/m,1),T=t.map(i=>Math.sqrt((i.physX-f)**2+(i.physY-D)**2)/m).sort((i,d)=>i-d),Z=T[Math.floor(T.length*.25)]??0,k=n.innerCount,q=n.outerCount,tt=t.filter(i=>Math.sqrt((i.physX-f)**2+(i.physY-D)**2)/m<.5).length,nt=t.filter(i=>Math.sqrt((i.physX-f)**2+(i.physY-D)**2)/m>=.5).length,O=k>0?tt/k:0,_=q>0?nt/q:0,et=_>0?O/_:O>0?2:1,ot=g.reduce((i,d)=>i+d.physX,0)/g.length,rt=g.reduce((i,d)=>i+d.physY,0)/g.length,st=Lt(g,ot,rt),it=Nt(g,g.length),A=16,H=new Set;for(const i of r){const d=(Math.atan2(i.physY-D,i.physX-f)+2*Math.PI)%(2*Math.PI);H.add(Math.floor(d/(2*Math.PI)*A)%A)}const ct=r.length>0?H.size/A:0,w=Math.max(p[0]?.width??1,p[0]?.height??1),X=Ct(p,M.slice(1,12),w),{width:at,length:dt}=bt(X,...z(X),w);let Y=1/0,F=0;for(const i of X){const d=Math.sqrt((i.physX-f)**2+(i.physY-D)**2)/m;d<Y&&(Y=d),d>F&&(F=d)}const lt=Y===1/0?0:Y,ht=Math.min(F,1),G=new Array(C).fill(0);for(const i of t)G[Math.min(C-1,Math.floor(Math.sqrt((i.physX-f)**2+(i.physY-D)**2)/m*C))]++;const ut=n.bandN.map((i,d)=>i>0?G[d]/i:0);return{globalRdd:a,edgeRdd:h,centroidDistNorm:j,minDistNorm:J,maxDistNorm:Q,p25DistNorm:Z,eccentricity:st,linearScore:it,salienceSize:y,salienceFraction:x,edgeAngularSpread:ct,innerOuterRatio:et,lineWidth:at,lineLength:dt,lineSize:X.length,lineMinDistNorm:lt,lineMaxDistNorm:ht,radialFailRates:ut}}function It(t,n,e){const s=Math.max(5,Math.round(e*.003)),c=t.salienceSize>=s;if(t.globalRdd<n.nearFullGlobalRdd&&t.p25DistNorm>=n.edgeLocalCentroidDist&&t.edgeAngularSpread>=n.edgeRingAngularSpread&&t.edgeRdd>=n.edgeLocalEdgeRdd)return{pattern:"edge-ring",confidence:t.edgeRdd>=n.edgeRingEdgeRddHigh?"high":"medium"};const[o,a,r,,h]=t.radialFailRates,l=Math.max(a,r);if(t.globalRdd<n.nearFullGlobalRdd&&l>=n.donutPeak&&l-o>=n.donutHole&&l-h>=n.donutRim)return{pattern:"donut",confidence:l-o>=2*n.donutHole?"high":"medium"};if(t.globalRdd<n.nearFullGlobalRdd&&t.lineSize>=s&&t.lineWidth<=n.scratchMaxLineWidth&&t.lineLength>=n.scratchMinLineLength&&t.lineLength>=n.scratchMinLineLengthRadius*Math.sqrt(e/Math.PI)&&t.lineMaxDistNorm>=n.scratchMinReach&&t.lineMinDistNorm<n.scratchMaxInnerDist)return{pattern:"scratch",confidence:t.lineWidth<=n.scratchMaxLineWidth/2?"high":"medium"};if(t.globalRdd<n.nearFullGlobalRdd&&t.salienceFraction<.1)return{pattern:"random",confidence:"low"};if(t.globalRdd>=n.nearFullGlobalRdd)return{pattern:"near-full",confidence:t.globalRdd>=.8?"high":"medium"};const u=c&&t.edgeRdd>=n.edgeLocalEdgeRdd&&t.maxDistNorm>=.7;return u&&t.p25DistNorm>=n.edgeLocalCentroidDist&&t.maxDistNorm-t.minDistNorm<=n.edgeRingRadialSpread?{pattern:"edge-ring",confidence:t.edgeRdd>=n.edgeRingEdgeRddHigh?"high":"medium"}:u&&t.p25DistNorm>=.55&&t.p25DistNorm<n.edgeLocalCentroidDist?{pattern:"edge-local",confidence:t.edgeRdd>=n.edgeRingEdgeRdd?"medium":"low"}:c&&t.centroidDistNorm<=n.centerCentroidDist&&t.edgeRdd<=n.centerEdgeRdd?{pattern:"center",confidence:t.centroidDistNorm<=n.centerCentroidDistHigh?"high":"medium"}:{pattern:"random",confidence:"low"}}export const PATTERN_LABELS={center:"Center cluster",donut:"Donut","edge-ring":"Edge-ring","edge-local":"Edge-local",scratch:"Scratch","near-full":"Near-full",random:"Random",none:"None"};export function patternFailVerdict(t,n){const e=ft(t,n);return e===void 0?void 0:!e}export function patternExplains(t,n,e,s){if(!{"edge-ring":["ring","edge-arc"],"edge-local":["edge-arc","sector","quadrant"],center:["ring","cluster"],donut:["ring"],scratch:["cluster","sector","quadrant"],"near-full":["ring"]}[t]?.includes(n))return!1;if(n==="cluster")return t!=="center"||e.length===0||e.includes(1);if(n!=="ring"||e.length===0)return!0;const o=e.includes(s),a=e.includes(1);return t==="edge-ring"||t==="edge-local"?o:t==="center"?a:t==="donut"?!o&&!a:!0}export function classifyPattern(t,n,e){const s=new Set(e.passBins),c=t.filter(o=>patternFailVerdict(o,s)===!0);return classifyFailingDies(c,t,n,e.ringCount,e.significanceLevel)}const Xt=99,Yt=999,v=10;function K(t,n){const[e,s,c,,o]=t.radialFailRates;switch(n){case"center":return e-t.globalRdd;case"donut":return Math.max(s,c)-Math.max(e,o);case"edge-ring":case"edge-local":return t.edgeRdd-t.globalRdd;case"scratch":return t.lineLength;default:return 0}}class At{dies;wafer;ringCount;failCount;features=[];order;random;layout;constructor(n,e,s,c,o){this.dies=n,this.wafer=e,this.ringCount=s,this.failCount=c,this.order=n.map((a,r)=>r),this.random=Mt(o),this.layout=B(n,e,s)}at(n){const e=this.dies.length,s=this.failCount;for(;this.features.length<=n;){for(let o=0;o<s;o++){const a=o+Math.floor(this.random()*(e-o)),r=this.order[o];this.order[o]=this.order[a],this.order[a]=r}const c=[];for(let o=0;o<s;o++)c.push(this.dies[this.order[o]]);this.features.push(V(c,this.layout,this.wafer,this.ringCount))}return this.features[n]}pValue(n,e,s){let c=0;for(let o=0;o<s;o++)if(K(this.at(o),n)>=e&&++c===v)return v/(o+1);return(1+c)/(1+s)}}const Ft=new Map;function Pt(t,n,e,s,c,o,a){const r=Math.min(Yt,Math.max(Xt,Math.ceil(1/a))),h=Rt(t),l=xt(s,t.length),u=`${h}:${n.center.x},${n.center.y},${n.radius}:${e}:${l}`;return Dt(Ft,u,32,()=>{const[,p,g]=h.split(":").map(Number),y=[...t].sort((x,f)=>x.y-f.y||x.x-f.x);return new At(y,n,e,l,(p^Math.imul(g,739982445)^Math.imul(l+7,2654435761))>>>0)}).pValue(o,K(c,o),r)}export function classifyFailingDies(t,n,e,s,c){const o={...DEFAULT_PATTERN_THRESHOLDS},a=Math.max(o.minimumFailingDies,Math.round(n.length*.003));if(t.length<a)return null;const r=V(t,B(n,e,s),e,s),{pattern:h,confidence:l,note:u}=It(r,o,n.length);if(c!==void 0&&h!=="random"&&h!=="none"&&h!=="near-full"){const M=Pt(n,e,s,t.length,r,h,c);return M>=c?{pattern:"random",confidence:"low",features:r,resembles:h,pValue:M}:{pattern:h,confidence:l,features:r,pValue:M,...u?{note:u}:{}}}return{pattern:h,confidence:l,features:r,...u?{note:u}:{}}}
@@ -0,0 +1,16 @@
1
+ import type { PositionedDie } from '../core/dies.js';
2
+ /**
3
+ * A die layout's identity, independent of the order its dies arrive in: two 32-bit sums of a hash of
4
+ * each die's grid position, with the count. Wafers of one lot share it.
5
+ */
6
+ export declare function layoutKey(dies: readonly PositionedDie[]): string;
7
+ /** A value from a bounded cache, made and kept if absent; the oldest entry goes once there are more than `limit`. */
8
+ export declare function remember<T>(cache: Map<string, T>, key: string, limit: number, make: () => T): T;
9
+ /**
10
+ * Fail counts are taken up to the top of a band 5% wide, so the wafers of a lot share a few null
11
+ * distributions instead of drawing one each. For the cluster null rounding up only makes the test stricter
12
+ * (more fails scattered make larger groups by chance); for the pattern classifier's it is a close
13
+ * approximation, since the chance of a shape changes smoothly with the fail rate.
14
+ */
15
+ export declare function failBand(failCount: number, n: number): number;
16
+ //# sourceMappingURL=permutationNull.d.ts.map
@@ -0,0 +1 @@
1
+ export function layoutKey(t){let l=0,r=0;for(let n=0;n<t.length;n++){let e=Math.imul(t[n].x|0,2654435761)^Math.imul(t[n].y|0,2246822507);e=Math.imul(e^e>>>16,2146121005),e=Math.imul(e^e>>>15,2221713035),l=l+(e^e>>>16)|0,r=r+Math.imul(e,668265263)+374761393|0}return`${t.length}:${l>>>0}:${r>>>0}`}export function remember(t,l,r,n){let e=t.get(l);return e===void 0&&(e=n(),t.set(l,e),t.size>r&&t.delete(t.keys().next().value)),e}export function failBand(t,l){return t<=20?t:Math.min(l,Math.ceil(20*1.05**Math.ceil(Math.log(t/20)/Math.log(1.05))))}
@@ -5,6 +5,7 @@ import type { WaferMetadata } from '../core/metadata.js';
5
5
  import { type TestDef } from '../renderer/buildWaferMap.js';
6
6
  import type { FacetCuration } from './facets.js';
7
7
  import type { PlotSpec, PlotCondition, PlotField, PlotValueReference, PlotAggregate, PlotTestSet, PlotJudge } from './plotSpec.js';
8
+ import { type PlotWords } from './plotWords.js';
8
9
  import { type GroupComparison } from './groupCompare.js';
9
10
  import { type TestPassKind } from './testPassRate.js';
10
11
  import { type ControlLimits, type ControlViolation } from './control.js';
@@ -24,6 +25,10 @@ export interface PlotItem {
24
25
  allDies?: readonly Die[];
25
26
  }
26
27
  export interface PlotContext {
28
+ /** @internal Say it in plain words, for a reader building charts from a table of wafers: a yield is the dies that passed out of all those tested. */
29
+ plain?: boolean;
30
+ /** The words the plot says its data in (`stats/plotWords.ts`): what a row is, what it counts, what an outcome is called. Default: wafers, dies, bins and yield. */
31
+ words?: PlotWords;
27
32
  /** The population's reconciled test list (`mergeTestDefs`). */
28
33
  testDefs?: readonly TestDef[];
29
34
  /** The Insights tab's Group by key, which "follow Group by" resolves to. Absent outside the tab. */
@@ -38,6 +43,14 @@ export interface PlotContext {
38
43
  scaleDies?: readonly Die[];
39
44
  /** @internal The panels divide a set of tests by test, so neither X nor the colour has to. */
40
45
  facetByTest?: boolean;
46
+ /**
47
+ * The values of a wafer field over the whole loaded lot, in the order every surface lists them (`orderFieldValues`). A
48
+ * group is coloured by its place in this list, not in the chart's own, so a split keeps its colour in a chart that lacks
49
+ * one of the others. Absent, a group takes its place among the values the chart shows.
50
+ */
51
+ lotValues?: (key: string) => readonly string[] | undefined;
52
+ /** The colour a host gave a value of a wafer field (its definition's `color`), which wins over the palette, as on the map. */
53
+ valueColor?: (key: string, value: string) => string | undefined;
41
54
  /** @internal Partial and edge-excluded dies are already left out (`resolveEligible`). */
42
55
  eligibleOnly?: boolean;
43
56
  /** @internal The plot's `where` is already applied: these are the dies it keeps. */
@@ -87,6 +100,10 @@ export interface FieldColumn {
87
100
  limits?: TestLimits;
88
101
  /** Set on a yield taken per die (100 for a passing die, 0 for a failing one): its mean over any set of dies is their yield. */
89
102
  perDie?: true;
103
+ /** A count of dies (passing, failing): wafers combine by adding it, unless the chart says otherwise. */
104
+ sums?: true;
105
+ /** A count of dies taken per die: a die with no value is one the count leaves out, not a missing reading. */
106
+ counted?: true;
90
107
  /** For a pass rate judged by test limits: per die, −1 failed below the low limit, 1 above the high, 0 otherwise. */
91
108
  failSide?: Int8Array;
92
109
  /** Why this field cannot be used on this population. */
@@ -94,6 +111,8 @@ export interface FieldColumn {
94
111
  /** For a field put in ranges: the middle of each row's range, in the measured field's own unit, so a line can run along them. */
95
112
  mid?: Float64Array;
96
113
  midUnit?: string;
114
+ /** `num` is a date, as days since 1970-01-01 (UTC): a wafer field whose every value is an ISO date or date-time. `cat` keeps the text. */
115
+ time?: true;
97
116
  /** For a set of tests: the test each row's value belongs to, by name, so a missing value is reported against its test. */
98
117
  labelOf?: (row: number) => string;
99
118
  }
@@ -128,12 +147,19 @@ export interface PlotPoint {
128
147
  group: number;
129
148
  item: number;
130
149
  die?: Die; /** The colour field's value, when it is continuous. */
131
- value?: number;
150
+ value?: number; /** For a mark of a whole wafer: the dies of that wafer its value is made from (see `PlotUnit.dies`). */
151
+ dies?: readonly Die[];
132
152
  }
133
153
  /** What one mark stands for: the wafer it is on, and the die when it is one die (not a wafer's aggregate). */
134
154
  export interface PlotUnit {
135
155
  item: number;
136
156
  die?: Die;
157
+ /**
158
+ * For a unit of a whole wafer: the dies of that wafer its value is made from, after the plot's filter. A yield counts
159
+ * the tested dies, a test's mean the dies with a reading, Passing dies the passing ones; a die count, a wafer field or a
160
+ * count of wafers all of them. A drilldown from the mark opens on exactly these, so it shows the numbers the mark did.
161
+ */
162
+ dies?: readonly Die[];
137
163
  }
138
164
  /**
139
165
  * A bar of die pass rates or a yield per die: its cells' values are 100 (pass) and 0 (fail), and, judged by test limits,
@@ -173,7 +199,8 @@ export type PlotMarks =
173
199
  type: 'box' | 'bar';
174
200
  categories: string[];
175
201
  cells: number[][][];
176
- cellUnits: number[][][];
202
+ cellUnits: number[][][]; /** The dies each cell stands for, when its units stand for more than one each (a wafer table's rows); absent otherwise. */
203
+ cellCount?: number[][];
177
204
  values: number[][];
178
205
  categoryItems?: number[];
179
206
  nest?: {
@@ -233,6 +260,12 @@ export interface ResolvedAxis {
233
260
  min?: number;
234
261
  max?: number;
235
262
  reverse?: boolean;
263
+ /** The values are dates, as days since 1970-01-01 (UTC, the time of day a fraction): the axis ticks on days, weeks, months or years and labels them as dates. */
264
+ time?: true;
265
+ /** The values are a count or a sum of something that has no unit (orders, revenue, dies): written with thousands separators, never as an exponent. */
266
+ plainNumbers?: true;
267
+ /** The values are counts of things, so no tick falls between two whole numbers. */
268
+ whole?: true;
236
269
  /** The limits of the test this axis measures, when it measures one: the chart draws them as lines. */
237
270
  limits?: TestLimits;
238
271
  /** A panel of a faceted plot: the data range of every panel, so each panel's axis spans the same range. */
@@ -245,6 +278,8 @@ export interface ResolvedAxis {
245
278
  hi: number;
246
279
  outside: number;
247
280
  };
281
+ /** An axis of wafer order: the wafer at each position, `names[k]` at value k + 1, so the ticks read wafer IDs. */
282
+ names?: string[];
248
283
  }
249
284
  export interface ResolvedPlot {
250
285
  spec: PlotSpec;
@@ -260,7 +295,12 @@ export interface ResolvedPlot {
260
295
  y?: ResolvedAxis;
261
296
  /** Colour groups in legend order; `['']` when there is no colour (or the colour is continuous, see `colorScale`). */
262
297
  groups: string[];
263
- /** Set when a scatter is coloured by a continuous field: the range its colourbar covers. */
298
+ /**
299
+ * The yield of every bar together, when the bars are coloured by their shortfall from it (`colorBars: 'shortfall'`): a
300
+ * bar 1, 2, or 4 or more points below takes the attention colour's three strengths.
301
+ */
302
+ shortfallFrom?: number;
303
+ /** Set when a scatter is coloured by a continuous field, or bars by their value (`colorBars`): the range its colourbar covers. */
264
304
  colorScale?: {
265
305
  label: string;
266
306
  unit?: string;
@@ -272,12 +312,25 @@ export interface ResolvedPlot {
272
312
  diverging?: true;
273
313
  /** The values are a rating (a yield, a pass rate): the key runs from bad to good, not from low to high. */
274
314
  rating?: true;
315
+ /** The values are counts of dies: the key runs from none (the quiet colour) up, in the warm counts gradient. */
316
+ counts?: true;
317
+ /** The values are positions in the limits (0 the low limit, 1 the high): the key is labelled Low limit, Centre and High limit. */
318
+ limits?: true;
275
319
  };
276
320
  colorLabel?: string;
277
321
  /** Set when the colour is a hard or soft bin: each group takes that bin's colour on the maps (`BinColors`). */
278
322
  colorBins?: 'hard' | 'soft';
279
- /** Set when the colour is one of the X fields: the axis already names every colour, so no legend is needed. */
323
+ /** Set when the colour is one of the X fields (bins aside): the axis already names every value. */
280
324
  colorRepeatsX?: true;
325
+ /** Set when the colour is one of the X fields, bins included: a table of the plot needs no column for it. */
326
+ colorIsX?: true;
327
+ /**
328
+ * Which colour of the Group by palette each group takes, when that is not its place in `groups`: its place in the whole
329
+ * lot's values (a split, a lot) or the wafer's place in the set loaded. Absent: its place in `groups`.
330
+ */
331
+ groupColorIndex?: number[];
332
+ /** A group's own colour, where a host defined one for its value (`PlotContext.valueColor`): it wins over the palette. */
333
+ groupColorOwn?: Array<string | undefined>;
281
334
  /** How values were combined, in words ("mean of Vth per wafer"), when they were. */
282
335
  aggregation?: string;
283
336
  /** How the values were rescaled, in words, when they were (`PlotSpec.normalize`). */
@@ -335,6 +388,8 @@ export interface ResolvedPlot {
335
388
  wafers: number;
336
389
  dies: number;
337
390
  };
391
+ /** The words this plot was resolved in, which its footnote, tooltips and menus say it in. Absent: the wafer words. */
392
+ words?: PlotWords;
338
393
  /** From `PlotContext.populationLabel`: replaces the wafer count in the footnote. */
339
394
  populationLabel?: string;
340
395
  /** Marks drawn. */
@@ -356,16 +411,30 @@ export interface ResolvedPlot {
356
411
  }>;
357
412
  };
358
413
  }
414
+ /** The two values of the Pass / fail field, and their order: Pass first. */
415
+ export declare const PASS_FAIL_LABEL: {
416
+ readonly pass: "Pass";
417
+ readonly fail: "Fail";
418
+ };
419
+ /**
420
+ * A die's Pass / fail value by its wafer's pass bins, the rule the yield uses (`diePassStatus`): the share of Pass is the
421
+ * yield. A die the yield leaves out (no bin, edge-excluded) has none. The chart field and the Dies table both read it.
422
+ */
423
+ export declare function passFailOf(die: Die, passBins: ReadonlySet<number>): string | undefined;
424
+ /** The words a plot is said in: the host's, or the wafer words. */
425
+ export declare const wordsOf: (ctx: {
426
+ words?: PlotWords;
427
+ } | undefined) => PlotWords;
359
428
  /** The reader's name for a field, whether or not the population has it. */
360
- export declare function fieldLabel(field: PlotField, testDefs?: readonly TestDef[], curation?: Record<string, FacetCuration>): string;
429
+ export declare function fieldLabel(field: PlotField, testDefs?: readonly TestDef[], curation?: Record<string, FacetCuration>, words?: PlotWords): string;
361
430
  /**
362
431
  * The order a wafer field's values (a split, a lot) are listed in: by number when every value is one, else naturally
363
432
  * (W2 before W10). A plot places and colours them in this order, and Insights' Group by lists its groups in it, so a
364
433
  * group has one colour on every card.
365
434
  */
366
435
  export declare function orderFieldValues(values: readonly string[]): string[];
367
- /** The bin a category or colour named by `binLabel` stands for; `undefined` for any other label. */
368
- export declare function binOfLabel(label: string): number | undefined;
436
+ /** The bin a category or colour named by `binLabel` stands for (by name, or "Bin 3"); `undefined` for any other label. */
437
+ export declare function binOfLabel(label: string, words?: PlotWords): number | undefined;
369
438
  /**
370
439
  * How a pass rate judges a die of `def`: a functional test by its recorded verdict, a parametric one by its test limits
371
440
  * or (`judge: 'flag'`) by the tester's recorded flag. The Overview pass-rate card's three modes, as one rule.
@@ -403,13 +472,24 @@ export declare function binEdges(values: ArrayLike<number>, bins: number, by: 'c
403
472
  export declare const probabilityPosition: (k: number, n: number) => number;
404
473
  /** One value for a set of numbers. `count` ignores missing values; the rest of an empty set is NaN. */
405
474
  export declare function combine(values: readonly number[], how: PlotAggregate): number;
475
+ /**
476
+ * Whether a bar chart's bars add up (a count or a sum), so stacking, shares of a total and a cumulative line mean
477
+ * something. With no combine chosen, a bar with no Y field counts, one of a count of dies (passing, failing) sums, and
478
+ * any other takes its mean or its yield, which do not add up. The one rule the chart and the editor both use.
479
+ */
480
+ export declare const barsAddUp: (aggregate: PlotAggregate | undefined, y: PlotField | undefined, splitByDie?: boolean) => boolean;
406
481
  /** What the cross-field rules need to know of a field: its level, whether it is a number, and whether it is a yield. */
407
482
  export interface FieldFacts {
408
483
  label: string;
409
484
  level: 'die' | 'wafer';
410
485
  kind: FieldKind;
411
486
  yield: boolean;
487
+ dieCount?: boolean;
412
488
  }
489
+ /** The wafer figures that are counts of dies, which split by a die field are counted die by die. */
490
+ declare const DIE_COUNTS: readonly ["passDies", "failDies", "dieCount"];
491
+ /** Which count of dies a field is, if it is one. */
492
+ export declare const dieCountOf: (field: PlotField | undefined) => (typeof DIE_COUNTS)[number] | undefined;
413
493
  /**
414
494
  * Whether the chosen fields can be drawn together, as the reason in two lengths: `long` for the chart card, `short` for the
415
495
  * editor's field list, where a choice that would break the plot is greyed with it. ONE function, so the list and the chart
@@ -427,10 +507,20 @@ export declare function combinationIssue(mark: PlotSpec['chart'], f: {
427
507
  aggregate?: PlotAggregate;
428
508
  level?: 'die' | 'wafer';
429
509
  continuousColor?: boolean;
510
+ words?: PlotWords;
430
511
  }): {
431
512
  long: string;
432
513
  short: string;
433
514
  } | undefined;
515
+ /**
516
+ * Why a saved chart cannot be drawn here when none of the tests it names is in this lot — a chart saved with another
517
+ * test program, kept in the reader's charts after a different lot was opened — or `null` when at least one of them is.
518
+ * A test is in this lot when the lot's program declares that number, or its dies hold values for it, and, where the
519
+ * chart recorded the test's name, the name still matches. Every kind of chart, a sweep included, and every place one is
520
+ * listed (My charts, the charts menu) reads this one rule, so the reason is the same wherever the chart is offered.
521
+ * A chart that names no test (yield by split, bins by site) is never caught by it.
522
+ */
523
+ export declare function testsNotInLot(spec: PlotSpec, testDefs: readonly TestDef[], present?: () => ReadonlySet<number>): string | null;
434
524
  /** The values a resolved plot draws along one axis (`markValues`): what a host compares its limits against. */
435
525
  export declare const axisValues: (r: ResolvedPlot, role: "x" | "y") => number[];
436
526
  /** The unit a condition's numbers are in, for stating its range: a test's own, or a percentage. */
@@ -439,7 +529,7 @@ export declare function conditionUnit(field: PlotField, testDefs?: readonly Test
439
529
  * One condition in words, as the card footnote, the filter band and the editor's summary state it: "Ring is Edge or
440
530
  * Middle", "Hard bin is not Bin 1", "Vth from 0.4 V to 0.6 V", "Yield below 90%".
441
531
  */
442
- export declare function conditionText(c: PlotCondition, testDefs?: readonly TestDef[], curation?: Record<string, FacetCuration>): string;
532
+ export declare function conditionText(c: PlotCondition, testDefs?: readonly TestDef[], curation?: Record<string, FacetCuration>, words?: PlotWords): string;
443
533
  /** What `applyConditions` kept: the items (each with only its kept dies), their places in the input, and counts. */
444
534
  export interface ConditionsApplied {
445
535
  items: PlotItem[];
@@ -467,6 +557,12 @@ export interface ConditionsApplied {
467
557
  * verdict or a whole-wafer figure is still judged on all of it.
468
558
  */
469
559
  export declare function applyConditions(conditions: readonly PlotCondition[], items: readonly PlotItem[], ctx?: PlotContext): ConditionsApplied;
560
+ /**
561
+ * A title in sentence case: after its first word, a plain word with a capital ("Yield by Split", "Mean Pass rate") is
562
+ * written small ("Yield by split", "Mean pass rate"). A name in `keep` (a test's: Fmax, IDS) and a word with capitals of
563
+ * its own (PartType, PAT) keep theirs.
564
+ */
565
+ export declare function sentenceTitle(title: string, keep: readonly string[]): string;
470
566
  /** Resolves `spec` over `items`. Never throws for a plot that cannot be drawn: it returns the reasons. */
471
567
  export declare function resolvePlot(spec: PlotSpec, items: readonly PlotItem[], ctx?: PlotContext): ResolvedPlot;
472
568
  /** The plot's title: the one the user typed, else the automatic one. */
@@ -491,6 +587,8 @@ export interface FieldOption {
491
587
  /** For a lot field: how many different values the wafers in view carry. */
492
588
  distinct?: number;
493
589
  group: FieldGroup;
590
+ /** The heading the field's group shows under, in the host's words, when it is not the group's own name. */
591
+ groupLabel?: string;
494
592
  kind: FieldKind;
495
593
  level: 'die' | 'wafer';
496
594
  /** Can divide the data into series or categories (a colour, a bar's X). */
@@ -543,6 +641,27 @@ export interface TitleDrift {
543
641
  export declare function titleDrift(spec: PlotSpec, catalogue: readonly FieldOption[]): TitleDrift;
544
642
  /** `titleDrift` in a sentence for the reader, or null when the title is fine. */
545
643
  export declare function describeTitleDrift(d: TitleDrift): string | null;
644
+ /** One starter plot: the plot, and one line on what it is for. */
645
+ export interface ExamplePlot {
646
+ spec: PlotSpec;
647
+ purpose: string;
648
+ }
649
+ /** The Examples' groups, each a question a test engineer or analyst asks, in the order they ask them. */
650
+ export declare const EXAMPLE_GROUPS: readonly ["Yield and bins", "Limits and capability", "On the wafer", "Tester", "Relationships", "Sweep"];
651
+ export type ExampleGroup = typeof EXAMPLE_GROUPS[number];
652
+ /**
653
+ * The starter plots, grouped by the question each answers and built on this lot's own tests and fields: the tests that
654
+ * have most to show (or fail their limits most) and the field that divides the wafers. About a dozen, none of them a
655
+ * chart the Overview or Distributions already draws. Each has a plain title and one line on what it is for.
656
+ */
657
+ export declare function exampleGroups(catalogue: readonly FieldOption[], waferCount: number, newId: () => string, data?: {
658
+ items: readonly PlotItem[];
659
+ ctx?: PlotContext;
660
+ }): Array<{
661
+ group: ExampleGroup;
662
+ examples: ExamplePlot[];
663
+ }>;
664
+ /** Every starter plot, in group order (see {@link exampleGroups}). */
546
665
  export declare function examplePlots(catalogue: readonly FieldOption[], waferCount: number, newId: () => string, data?: {
547
666
  items: readonly PlotItem[];
548
667
  ctx?: PlotContext;
@@ -560,8 +679,10 @@ export declare function plotOpensBins(spec: PlotSpec): boolean;
560
679
  */
561
680
  export declare function plotTestNumber(spec: PlotSpec): number | undefined;
562
681
  /**
563
- * A new sweep to start from: one series of the lot's first few parametric tests, in test order, on the ordinal axis
564
- * (no X scale is claimed). Never an empty editor; the reader edits the tests and adds the series they meant.
682
+ * A new sweep to start from: the program's longest sweep run (its tests in swept order, the x axis read from their
683
+ * names), else the first five parametric tests that share the first one's unit, in test order on the ordinal axis.
684
+ * Never tests of different units, and never an empty editor; the reader edits the tests and adds the series they meant.
565
685
  */
566
686
  export declare function defaultSweep(testDefs: readonly TestDef[], id: string): PlotSpec;
687
+ export {};
567
688
  //# sourceMappingURL=plotData.d.ts.map