@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 +1 @@
1
- import{sortBinsForDisplay as u}from"./binPareto.js";export function binCountsFrom(e,r,s){const o=new Map;if(s){for(const[n,i]of Object.entries(s))o.set(Number(n),i);return o}for(const n of e){if(n.partial||n.edgeExcluded)continue;const i=r==="hard"?n.hbin:n.sbin;i!=null&&o.set(i,(o.get(i)??0)+1)}return o}export function pooledBinCounts(e,r,s){const o=s==="hard"?"hardBinCounts":"softBinCounts";if(e?.length&&e.every(n=>n.stats[o]!==void 0)){const n=new Map;for(const i of e)for(const[t,a]of Object.entries(i.stats[o]))n.set(Number(t),(n.get(Number(t))??0)+a);return n}return binCountsFrom(r,s)}export function binBreakdownRows(e,r,s){const o=new Set(s),n=[...e.values()].reduce((t,a)=>t+a,0),i=r?new Map(r.map(t=>[t.bin,t.name])):void 0;return u(e.entries(),o).map(([t,a])=>{const c=i?.get(t);return{bin:t,...c?{name:c}:{},label:c?`Bin ${t} \xB7 ${c}`:`Bin ${t}`,count:a,percent:n?a/n*100:0,passing:o.has(t)}})}export const binBreakdownTitle=(e,r)=>`${e==="hard"?"Hard":"Soft"} Bin Breakdown \u2014 % of dies (N=${r.toLocaleString("en-GB")})`,totalOf=e=>[...e.values()].reduce((r,s)=>r+s,0);
1
+ import{isYieldEligibleDie as f}from"../core/dies.js";import{sortBinsForDisplay as u}from"./binPareto.js";export function binCountsFrom(e,r,s){const o=new Map;if(s){for(const[n,i]of Object.entries(s))o.set(Number(n),i);return o}for(const n of e){if(!f(n))continue;const i=r==="hard"?n.hbin:n.sbin;i!=null&&o.set(i,(o.get(i)??0)+1)}return o}export function pooledBinCounts(e,r,s){const o=s==="hard"?"hardBinCounts":"softBinCounts";if(e?.length&&e.every(n=>n.stats[o]!==void 0)){const n=new Map;for(const i of e)for(const[t,a]of Object.entries(i.stats[o]))n.set(Number(t),(n.get(Number(t))??0)+a);return n}return binCountsFrom(r,s)}export function binBreakdownRows(e,r,s){const o=new Set(s),n=[...e.values()].reduce((t,a)=>t+a,0),i=r?new Map(r.map(t=>[t.bin,t.name])):void 0;return u(e.entries(),o).map(([t,a])=>{const c=i?.get(t);return{bin:t,...c?{name:c}:{},label:c?`Bin ${t} \xB7 ${c}`:`Bin ${t}`,count:a,percent:n?a/n*100:0,passing:o.has(t)}})}export const binBreakdownTitle=(e,r)=>`${e==="hard"?"Hard":"Soft"} Bin Breakdown \u2014 % of dies (N=${r.toLocaleString("en-GB")})`,totalOf=e=>[...e.values()].reduce((r,s)=>r+s,0);
@@ -55,6 +55,15 @@ export interface CapabilityItem {
55
55
  /** One item's dies — typically one wafer, the natural short-term subgroup for Cp/Cpk. */
56
56
  dies?: Die[];
57
57
  }
58
+ /** The limits capability is judged against, and which kind they are. */
59
+ interface CapabilityLimits {
60
+ lsl: number;
61
+ usl: number;
62
+ basis: 'spec' | 'test';
63
+ }
64
+ /** Spec limits when both are given, else the test limits when both are, else none. The plot builder's
65
+ * normalisation to limits uses the same rule, so a plot and the capability chart place a test alike. */
66
+ export declare function capabilityLimits(def: TestDef): CapabilityLimits | undefined;
58
67
  /**
59
68
  * Process-capability data for every test in `testDefs` that has at least one
60
69
  * recorded value. Tests with both `limitLow` and `limitHigh` defined get the
@@ -134,4 +143,5 @@ export declare function buildCapabilityFigures(items: CapabilityItem[], testDefs
134
143
  * from the lot's merged `testDefs`, as they would for a direct computation.
135
144
  */
136
145
  export declare function poolCapabilityFigures(perWafer: readonly TestCapability[][], testDefs: TestDef[]): TestCapability[];
146
+ export {};
137
147
  //# sourceMappingURL=capability.d.ts.map
@@ -1 +1 @@
1
- import{isYieldEligibleDie as v}from"../core/dies.js";import{excludedCounts as H,testValuesReader as E}from"../core/dieTable.js";import{drain as C}from"../core/utils.js";import{isParametricTest as O}from"../renderer/buildWaferMap.js";import{countOutOfSpec as P,hasSpecLimits as V}from"../renderer/spec.js";import{testLabel as _,derivedFields as I}from"../renderer/testLabel.js";import{describeValues as z}from"./math.js";const R=25e4;function j(n){if(n.specLow!==void 0&&n.specHigh!==void 0&&n.specHigh>n.specLow)return{lsl:n.specLow,usl:n.specHigh,basis:"spec"};if(n.limitLow!==void 0&&n.limitHigh!==void 0&&n.limitHigh>n.limitLow)return{lsl:n.limitLow,usl:n.limitHigh,basis:"test"}}function A(n){const s=new Map,e=new Map;for(const l of n){const t=l.testNumber;if(t===void 0||!O(l))continue;e.set(t,l);const i=j(l);i&&s.set(t,i)}return{defByTestNumber:e,specByTest:s}}function*$(n,s,e){const l=[...s.keys()],t=l.length,i=new Float64Array(t),r=new Float64Array(t),o=new Float64Array(t),f=new Float64Array(t),p=new Float64Array(t),S=new Float64Array(t),y=new Float64Array(t),d=new Float64Array(t);let x=0;if(e)for(const m of n)x+=m.dies?.length??0;const g=e?Array.from({length:t},()=>new Float64Array(x)):[],u=E(l),b=new Float64Array(t),M=Math.max(500,Math.floor(R/Math.max(1,t)));let h=0;for(const m of n){S.fill(0),y.fill(0),d.fill(0);for(const c of m.dies??[])if(++h>=M&&(h=0,yield),!!v(c)){u(c,b);for(let a=0;a<t;a++){const w=b[a];Number.isFinite(w)&&(i[a]++,r[a]+=w,o[a]+=w*w,S[a]++,y[a]+=w,d[a]+=w*w,e&&(g[a][i[a]-1]=w))}}for(let c=0;c<t;c++){const a=S[c];if(a<2)continue;const w=y[c]/a,k=(d[c]-a*w*w)/(a-1);f[c]+=(a-1)*Math.max(0,k),p[c]+=a-1}}const N=new Map;for(let m=0;m<t;m++){if(i[m]===0)continue;const c=l[m];N.set(c,{n:i[m],sum:r[m],sumSq:o[m],withinNumerator:f[m],withinDenominator:p[m]}),e&&e.set(c,g[m].subarray(0,i[m]))}return N}function W(n,s,e){return C($(n,s,e))}function L(n,s,e,l){const{n:t,sum:i,sumSq:r,withinNumerator:o,withinDenominator:f}=l,p=i/t,S=t>=2?Math.max(0,(r-t*p*p)/(t-1)):0,y=Math.sqrt(S),d=f>0?Math.sqrt(o/f):NaN;let x=null,g=null,u=null,b=null;if(e){const{lsl:M,usl:h}=e,N=h-M;u=y>0?N/(6*y):null,b=y>0?Math.min((h-p)/(3*y),(p-M)/(3*y)):null,x=Number.isFinite(d)&&d>0?N/(6*d):null,g=Number.isFinite(d)&&d>0?Math.min((h-p)/(3*d),(p-M)/(3*d)):null}return{testNumber:n,label:_(s,n),unit:s.unit,...I(s),hasSpec:e!==void 0,lsl:e?.lsl,usl:e?.usl,...e?{limitBasis:e.basis}:{},mean:p,stdOverall:y,stdWithin:d,n:t,cp:x,cpk:g,pp:u,ppk:b}}function q(n){return n.sort((s,e)=>s.hasSpec!==e.hasSpec?s.hasSpec?-1:1:s.hasSpec?s.ppk===null&&e.ppk===null?0:s.ppk===null?1:e.ppk===null?-1:s.ppk-e.ppk:e.stdOverall-s.stdOverall)}export function buildCapabilityData(n,s){return C(buildCapabilityDataSteps(n,s))}export function*buildCapabilityDataSteps(n,s){return(yield*pooledTestStatsSteps(n,s)).capability.slice()}const F=new Map,Y=4,B=new WeakMap;let K=1;function U(n,s){const e=[];for(const t of n){const i=t.dies;if(!i){e.push(0);continue}let r=B.get(i);r===void 0&&(r=K++,B.set(i,r)),e.push(r)}const l=s.filter(t=>t.testNumber!==void 0&&O(t)).map(t=>`${t.testNumber}${t.testType??"P"}${t.limitLow??""}${t.limitHigh??""}${t.specLow??""}${t.specHigh??""}${t.name??""}${t.unit??""}`);return`${e.join(",")}${l.join("")}`}export function clearPooledTestStatsCache(){F.clear();for(const n of T.values())n.work.return(void 0);T.clear()}export function*pooledTestStatsSteps(n,s){const e=U(n,s),l=F.get(e);if(l)return F.delete(e),F.set(e,l),l;let t=T.get(e);t||(t={work:G(n,s,e),callers:0},T.set(e,t));const i=t;i.callers++;try{for(;;){if(i.result)return i.result;const r=i.work.next();if(r.done)return i.result=r.value,T.delete(e),r.value;yield}}finally{i.callers--,!i.result&&i.callers===0&&(i.work.return(void 0),T.get(e)===i&&T.delete(e))}}const T=new Map;function*G(n,s,e){const l={stats:new Map,specTally:new Map,capability:[]},{defByTestNumber:t,specByTest:i}=A(s);if(t.size===0)return l;const r=new Map,o=yield*$(n,t,r),f=new Map,p=new Map,S=[],y=new Map;let d;for(const g of n){const u=H((g.dies??[]).filter(b=>v(b)));if(u){d??=u.by;for(const[b,M]of u.counts)y.set(b,(y.get(b)??0)+M)}}for(const g of s){yield;const u=g.testNumber;if(u===void 0)continue;const b=o.get(u);if(!b||b.n===0||!t.has(u))continue;const M=r.get(u);r.delete(u),V(g)&&p.set(u,{n:M.length,fail:P(M,g)});const h=z(M);f.set(u,h);const N=i.get(u),m=L(u,g,N,b);let c;if(N){const w=N.usl-N.lsl;c=k=>(k-N.lsl)/w}else{const w=h.min,k=h.max-w;c=k>0?D=>(D-w)/k:()=>.5}const a=y.get(u);S.push({...m,...a&&d?{excluded:{count:a,limitSet:d}}:{},min:c(h.min),q1:c(h.q1),median:c(h.median),q3:c(h.q3),max:c(h.max)})}const x={stats:f,specTally:p,capability:q(S)};return F.set(e,x),F.size>Y&&F.delete(F.keys().next().value),x}export function buildCapabilityFigures(n,s){const{defByTestNumber:e,specByTest:l}=A(s);if(e.size===0)return[];const t=W(n,e,null),i=[];for(const[r,o]of t)o.n!==0&&i.push(L(r,e.get(r),l.get(r),o));return q(i)}export function poolCapabilityFigures(n,s){const{defByTestNumber:e,specByTest:l}=A(s),t=new Map;for(const r of n)for(const o of r){if(!e.has(o.testNumber)||o.n===0)continue;let f=t.get(o.testNumber);f||(f={n:0,sum:0,sumSq:0,withinNumerator:0,withinDenominator:0},t.set(o.testNumber,f));const p=o.stdOverall*o.stdOverall;f.n+=o.n,f.sum+=o.n*o.mean,f.sumSq+=(o.n-1)*p+o.n*o.mean*o.mean,o.n>=2&&(f.withinNumerator+=(o.n-1)*p,f.withinDenominator+=o.n-1)}const i=[];for(const[r,o]of t)i.push(L(r,e.get(r),l.get(r),o));return q(i)}
1
+ import{isYieldEligibleDie as v}from"../core/dies.js";import{excludedCounts as H,testValuesReader as E}from"../core/dieTable.js";import{drain as C}from"../core/utils.js";import{isParametricTest as O}from"../renderer/buildWaferMap.js";import{countOutOfSpec as P,hasSpecLimits as V}from"../renderer/spec.js";import{testLabel as _,derivedFields as I}from"../renderer/testLabel.js";import{describeValues as z}from"./math.js";const R=25e4;export function capabilityLimits(n){if(n.specLow!==void 0&&n.specHigh!==void 0&&n.specHigh>n.specLow)return{lsl:n.specLow,usl:n.specHigh,basis:"spec"};if(n.limitLow!==void 0&&n.limitHigh!==void 0&&n.limitHigh>n.limitLow)return{lsl:n.limitLow,usl:n.limitHigh,basis:"test"}}function A(n){const s=new Map,e=new Map;for(const l of n){const t=l.testNumber;if(t===void 0||!O(l))continue;e.set(t,l);const i=capabilityLimits(l);i&&s.set(t,i)}return{defByTestNumber:e,specByTest:s}}function*$(n,s,e){const l=[...s.keys()],t=l.length,i=new Float64Array(t),r=new Float64Array(t),o=new Float64Array(t),f=new Float64Array(t),p=new Float64Array(t),S=new Float64Array(t),y=new Float64Array(t),d=new Float64Array(t);let x=0;if(e)for(const m of n)x+=m.dies?.length??0;const g=e?Array.from({length:t},()=>new Float64Array(x)):[],u=E(l),b=new Float64Array(t),M=Math.max(500,Math.floor(R/Math.max(1,t)));let h=0;for(const m of n){S.fill(0),y.fill(0),d.fill(0);for(const c of m.dies??[])if(++h>=M&&(h=0,yield),!!v(c)){u(c,b);for(let a=0;a<t;a++){const w=b[a];Number.isFinite(w)&&(i[a]++,r[a]+=w,o[a]+=w*w,S[a]++,y[a]+=w,d[a]+=w*w,e&&(g[a][i[a]-1]=w))}}for(let c=0;c<t;c++){const a=S[c];if(a<2)continue;const w=y[c]/a,k=(d[c]-a*w*w)/(a-1);f[c]+=(a-1)*Math.max(0,k),p[c]+=a-1}}const N=new Map;for(let m=0;m<t;m++){if(i[m]===0)continue;const c=l[m];N.set(c,{n:i[m],sum:r[m],sumSq:o[m],withinNumerator:f[m],withinDenominator:p[m]}),e&&e.set(c,g[m].subarray(0,i[m]))}return N}function j(n,s,e){return C($(n,s,e))}function L(n,s,e,l){const{n:t,sum:i,sumSq:r,withinNumerator:o,withinDenominator:f}=l,p=i/t,S=t>=2?Math.max(0,(r-t*p*p)/(t-1)):0,y=Math.sqrt(S),d=f>0?Math.sqrt(o/f):NaN;let x=null,g=null,u=null,b=null;if(e){const{lsl:M,usl:h}=e,N=h-M;u=y>0?N/(6*y):null,b=y>0?Math.min((h-p)/(3*y),(p-M)/(3*y)):null,x=Number.isFinite(d)&&d>0?N/(6*d):null,g=Number.isFinite(d)&&d>0?Math.min((h-p)/(3*d),(p-M)/(3*d)):null}return{testNumber:n,label:_(s,n),unit:s.unit,...I(s),hasSpec:e!==void 0,lsl:e?.lsl,usl:e?.usl,...e?{limitBasis:e.basis}:{},mean:p,stdOverall:y,stdWithin:d,n:t,cp:x,cpk:g,pp:u,ppk:b}}function q(n){return n.sort((s,e)=>s.hasSpec!==e.hasSpec?s.hasSpec?-1:1:s.hasSpec?s.ppk===null&&e.ppk===null?0:s.ppk===null?1:e.ppk===null?-1:s.ppk-e.ppk:e.stdOverall-s.stdOverall)}export function buildCapabilityData(n,s){return C(buildCapabilityDataSteps(n,s))}export function*buildCapabilityDataSteps(n,s){return(yield*pooledTestStatsSteps(n,s)).capability.slice()}const F=new Map,W=4,B=new WeakMap;let Y=1;function K(n,s){const e=[];for(const t of n){const i=t.dies;if(!i){e.push(0);continue}let r=B.get(i);r===void 0&&(r=Y++,B.set(i,r)),e.push(r)}const l=s.filter(t=>t.testNumber!==void 0&&O(t)).map(t=>`${t.testNumber}${t.testType??"P"}${t.limitLow??""}${t.limitHigh??""}${t.specLow??""}${t.specHigh??""}${t.name??""}${t.unit??""}`);return`${e.join(",")}${l.join("")}`}export function clearPooledTestStatsCache(){F.clear();for(const n of T.values())n.work.return(void 0);T.clear()}export function*pooledTestStatsSteps(n,s){const e=K(n,s),l=F.get(e);if(l)return F.delete(e),F.set(e,l),l;let t=T.get(e);t||(t={work:U(n,s,e),callers:0},T.set(e,t));const i=t;i.callers++;try{for(;;){if(i.result)return i.result;const r=i.work.next();if(r.done)return i.result=r.value,T.delete(e),r.value;yield}}finally{i.callers--,!i.result&&i.callers===0&&(i.work.return(void 0),T.get(e)===i&&T.delete(e))}}const T=new Map;function*U(n,s,e){const l={stats:new Map,specTally:new Map,capability:[]},{defByTestNumber:t,specByTest:i}=A(s);if(t.size===0)return l;const r=new Map,o=yield*$(n,t,r),f=new Map,p=new Map,S=[],y=new Map;let d;for(const g of n){const u=H((g.dies??[]).filter(b=>v(b)));if(u){d??=u.by;for(const[b,M]of u.counts)y.set(b,(y.get(b)??0)+M)}}for(const g of s){yield;const u=g.testNumber;if(u===void 0)continue;const b=o.get(u);if(!b||b.n===0||!t.has(u))continue;const M=r.get(u);r.delete(u),V(g)&&p.set(u,{n:M.length,fail:P(M,g)});const h=z(M);f.set(u,h);const N=i.get(u),m=L(u,g,N,b);let c;if(N){const w=N.usl-N.lsl;c=k=>(k-N.lsl)/w}else{const w=h.min,k=h.max-w;c=k>0?D=>(D-w)/k:()=>.5}const a=y.get(u);S.push({...m,...a&&d?{excluded:{count:a,limitSet:d}}:{},min:c(h.min),q1:c(h.q1),median:c(h.median),q3:c(h.q3),max:c(h.max)})}const x={stats:f,specTally:p,capability:q(S)};return F.set(e,x),F.size>W&&F.delete(F.keys().next().value),x}export function buildCapabilityFigures(n,s){const{defByTestNumber:e,specByTest:l}=A(s);if(e.size===0)return[];const t=j(n,e,null),i=[];for(const[r,o]of t)o.n!==0&&i.push(L(r,e.get(r),l.get(r),o));return q(i)}export function poolCapabilityFigures(n,s){const{defByTestNumber:e,specByTest:l}=A(s),t=new Map;for(const r of n)for(const o of r){if(!e.has(o.testNumber)||o.n===0)continue;let f=t.get(o.testNumber);f||(f={n:0,sum:0,sumSq:0,withinNumerator:0,withinDenominator:0},t.set(o.testNumber,f));const p=o.stdOverall*o.stdOverall;f.n+=o.n,f.sum+=o.n*o.mean,f.sumSq+=(o.n-1)*p+o.n*o.mean*o.mean,o.n>=2&&(f.withinNumerator+=(o.n-1)*p,f.withinDenominator+=o.n-1)}const i=[];for(const[r,o]of t)i.push(L(r,e.get(r),l.get(r),o));return q(i)}
@@ -0,0 +1,53 @@
1
+ import type { PlotColor, PlotField, PlotSpec } from './plotSpec.js';
2
+ import type { TestDef } from '../renderer/buildWaferMap.js';
3
+ /**
4
+ * A field the tab supplies:
5
+ * - `test`: the section's chosen test.
6
+ * - `groupBy`: the tab's Group by field, or the wafer when Group by is off.
7
+ */
8
+ export type CardSlot = {
9
+ slot: 'test';
10
+ } | {
11
+ slot: 'groupBy';
12
+ };
13
+ export type CardField = PlotField | CardSlot;
14
+ export interface CardSpec extends Omit<PlotSpec, 'fields'> {
15
+ fields: {
16
+ x?: CardField | CardField[];
17
+ y?: CardField;
18
+ color?: PlotColor;
19
+ rows?: CardField;
20
+ facet?: CardField;
21
+ };
22
+ }
23
+ /** What the slots are filled with. */
24
+ export interface CardSlotValues {
25
+ /** The section's test. Absent = none chosen yet. */
26
+ test?: number;
27
+ /** The tab's Group by key. Absent = Group by is off. */
28
+ groupBy?: string;
29
+ testDefs?: readonly TestDef[];
30
+ }
31
+ export declare const isCardSlot: (f: unknown) => f is CardSlot;
32
+ /**
33
+ * The plot `card` draws with these slot values, or why it cannot be drawn yet (no test chosen, or one the lot does not
34
+ * hold). The colour is left as the card states it: a colour that follows Group by keeps following it.
35
+ */
36
+ export declare function fillCard(card: CardSpec, values: CardSlotValues): {
37
+ spec: PlotSpec;
38
+ } | {
39
+ issue: string;
40
+ };
41
+ /**
42
+ * The reader's own plot made from `card` as it is drawn now (Edit as plot): the slots filled, a colour that follows the
43
+ * tab replaced by the field it follows (the Group by field; the wafer when Group by is off and several wafers are in
44
+ * view; no colour otherwise), under a new id. It then draws the same thing on any lot and follows nothing.
45
+ */
46
+ export declare function freezeCard(card: CardSpec, values: CardSlotValues & {
47
+ waferCount: number;
48
+ }, id: string): {
49
+ spec: PlotSpec;
50
+ } | {
51
+ issue: string;
52
+ };
53
+ //# sourceMappingURL=cardSpec.d.ts.map
@@ -0,0 +1 @@
1
+ export const isCardSlot=r=>typeof r=="object"&&r!==null&&"slot"in r;export function fillCard(r,t){let f;const n=d=>{if(!isCardSlot(d))return d;if(d.slot==="groupBy")return t.groupBy?{meta:t.groupBy}:{builtin:"wafer"};const i=t.test,u=i===void 0?void 0:t.testDefs?.find(c=>c.testNumber===i);return i===void 0||t.testDefs&&!u?(f??=i===void 0?"Choose a test":`Test ${i} is not in this data`,{test:i??0}):u?.name?{test:i,name:u.name}:{test:i}},{fields:e,...s}=r,o={};return e.x!==void 0&&(o.x=Array.isArray(e.x)?e.x.map(n):n(e.x)),e.y!==void 0&&(o.y=n(e.y)),e.rows!==void 0&&(o.rows=n(e.rows)),e.facet!==void 0&&(o.facet=n(e.facet)),e.color!==void 0&&(o.color=e.color),f?{issue:f}:{spec:{...s,fields:o}}}export function freezeCard(r,t,f){const n=fillCard(r,t);if("issue"in n)return n;const e={...n.spec,id:f,fields:{...n.spec.fields}},s=e.fields.color;return(s===void 0||"follow"in s)&&(e.fields.color=t.groupBy?{meta:t.groupBy}:t.waferCount>1?{builtin:"wafer"}:{none:!0}),{spec:e}}
@@ -0,0 +1,37 @@
1
+ import type { PlotChart } from './plotSpec.js';
2
+ import { type GuideSection } from './guideSections.js';
3
+ /** The built-in cards that are not plots. */
4
+ export type CardKind = 'capability' | 'correlation' | 'ring-yield' | 'quadrant-yield' | 'reticle-yield' | 'comparison' | 'commonality' | 'pat' | 'difference-map';
5
+ /** Where a chart or table is found in Insights; `drilldown` is the menu opened on picked dies. */
6
+ export type CatalogueTab = 'overview' | 'distributions' | 'correlation' | 'data' | 'plots' | 'drilldown';
7
+ /** What an entry is: a way of colouring the map, a chart, a built-in card (a chart or a table), or a table of the Data tab. */
8
+ export type CatalogueKind = 'map' | 'chart' | 'table';
9
+ export interface CatalogueEntry {
10
+ /** The heading anchor on the reference page, which is the slug of `title` (Zensical takes an anchor from the heading text alone): lower-case words joined by hyphens. Never reused or renamed once published. */
11
+ id: string;
12
+ kind: CatalogueKind;
13
+ /** What the entry is called on the reference page and in the gallery. */
14
+ title: string;
15
+ /** One line: what it shows. The text of the card's "About this chart" ("About this table" on a table). */
16
+ about: string;
17
+ /** The ids of the built-in Insights cards that draw it (a plot card's id, or a card of the drilldown window). */
18
+ cards?: readonly string[];
19
+ /** The plot chart type it is, for a reader's own plot. */
20
+ chart?: PlotChart;
21
+ /** The built-in card that is not a plot. */
22
+ card?: CardKind;
23
+ /** The plot mode of the map it is (`PlotMode`), for a map entry. */
24
+ mode?: readonly string[];
25
+ /** The Insights tab that draws it, for a built-in card or table; `plots` is My plots, where a reader's own plot is built. */
26
+ tab?: CatalogueTab;
27
+ /** The example page (under `docs/examples/`) that shows it live, where it is not on an Insights tab. */
28
+ example?: string;
29
+ /** The user-guide sections that explain the statistics behind it. */
30
+ guide?: readonly GuideSection[];
31
+ /** The ids of related entries: the neighbour to reach for instead, or the one that completes it. */
32
+ see?: readonly string[];
33
+ }
34
+ export declare const CHART_CATALOGUE: readonly CatalogueEntry[];
35
+ /** An entry by id. */
36
+ export declare function catalogueEntry(id: string): CatalogueEntry | undefined;
37
+ //# sourceMappingURL=chartCatalogue.d.ts.map
@@ -0,0 +1 @@
1
+ import{GUIDE_SECTIONS as e}from"./guideSections.js";export const CHART_CATALOGUE=[{id:"bin-map",kind:"map",title:"Bin map",mode:["hardBin","softBin"],example:"display-control.html",about:"Each die coloured by its hard or soft bin, passing bins in greens and failing bins in other colours, to show where the failures are.",see:["test-value-map","bin-pareto"]},{id:"test-value-map",kind:"map",title:"Test value map",mode:["value"],example:"test-values.html",about:"Each die coloured by one test\u2019s value on a colour scale, with the test\u2019s limits on the colour bar, to show where on the wafer the value shifts.",see:["bin-map","limit-passfail-map","test-passfail-map","value-histogram"]},{id:"limit-passfail-map",kind:"map",title:"Limit pass/fail map",example:"test-values.html",about:"Each die coloured by whether its value for one test lies inside the test\u2019s limits, with the dies below the low limit and above the high limit marked apart, to show where a test fails its limits.",see:["test-value-map","test-passfail-map","pass-rate-by-test"]},{id:"test-passfail-map",kind:"map",title:"Test pass/fail map",example:"test-values.html",about:"Each die coloured by the pass or fail the tester recorded for one test, to show where a test failed, whether or not it has a measured value.",see:["limit-passfail-map","test-value-map","pass-rate-by-test"]},{id:"die-attribute-map",kind:"map",title:"Die attribute map",mode:["metadata"],example:"metadata-mode.html",about:"Each die coloured by an attribute the data carries (a test site, a probe step, a zone), to show whether a pattern follows it.",see:["bin-map"]},{id:"stacked-map",kind:"map",title:"Stacked map",mode:["stackedBins","stackedSoftBins","stackedValues"],example:"lot-stack-analysis.html",about:"The wafers of a lot laid over one another die by die: how often a bin occurs, or a value\u2019s mean, median or spread at each position, to show what repeats from wafer to wafer.",see:["difference-map","reticle-cell-yield"]},{id:"pat-verdict-map",kind:"map",title:"PAT verdict map",tab:"overview",about:"Each die coloured by its part average testing verdict (within the limits, an outlier or failing), one map per wafer, to show where the PAT outliers sit.",see:["part-average-testing-pat","bin-map","test-value-map"]},{id:"difference-map",kind:"map",title:"Difference map",card:"difference-map",tab:"distributions",about:"One group\u2019s wafer map less another\u2019s, die position by die position, to show where on the wafer they differ.",guide:[e.heatmap],see:["stacked-map","comparison-by-group"]},{id:"yield-by-wafer",kind:"chart",title:"Yield by wafer",cards:["card-yield"],tab:"overview",about:"Yield of each wafer or group: passing dies as a share of judged dies, with partial and edge-excluded dies left out. The line is the median bar.",see:["bin-pareto","what-divides-yield"]},{id:"bin-pareto",kind:"chart",title:"Bin pareto",cards:["card-bin-pareto"],tab:"overview",about:"Dies in each bin, largest first, so the bins that cost the most yield lead. Shown alone, the line is the running share of all dies.",see:["bin-map","pareto"]},{id:"pass-rate-by-test",kind:"chart",title:"Pass rate by test",cards:["card-pass-rate"],tab:"overview",about:"The share of judged dies that pass each test, lowest first, so the tests that fail the most dies lead.",see:["process-capability","bin-pareto"]},{id:"ring-yield",kind:"chart",title:"Ring yield",card:"ring-yield",tab:"overview",about:"Yield of each ring, from the wafer centre to its edge, to show a radial pattern.",see:["quadrant-yield","bin-map"]},{id:"quadrant-yield",kind:"chart",title:"Quadrant yield",card:"quadrant-yield",tab:"overview",about:"Yield of each quarter of the wafer, to show a one-sided pattern.",see:["ring-yield","bin-map"]},{id:"reticle-cell-yield",kind:"chart",title:"Reticle cell yield",card:"reticle-yield",tab:"overview",about:"Yield of each position in the reticle, pooled over every shot on every wafer. A cell low everywhere points at the mask rather than the wafer.",see:["stacked-map","ring-yield"]},{id:"test-value-distribution",kind:"chart",title:"Test value distribution",cards:["card-box"],tab:"distributions",about:"How one test\u2019s values spread on each wafer or group: the box holds the middle half of the dies, the line inside it is the median, and the whiskers reach the lowest and highest values.",see:["box-plot","value-histogram"]},{id:"value-histogram",kind:"chart",title:"Value histogram",cards:["card-histogram"],tab:"distributions",about:"How one test\u2019s values are distributed: the number of dies in each value range, with the test\u2019s limits marked.",see:["histogram","probability-plot","test-value-map"]},{id:"histogram-of-the-dies-picked",kind:"chart",title:"Histogram of the dies picked",cards:["drill-histogram"],tab:"drilldown",about:"How one test\u2019s values are distributed over the dies picked: the number of dies in each value range, with the test\u2019s limits marked.",see:["value-histogram"]},{id:"wafer-to-wafer-trend",kind:"chart",title:"Wafer-to-wafer trend",cards:["card-trend"],tab:"distributions",about:"Each wafer\u2019s mean of one test in wafer order, with a band of one standard deviation either side, to show drift through the lot.",guide:[e.bands],see:["control-chart","line-chart"]},{id:"test-scatter",kind:"chart",title:"Test scatter",cards:["card-scatter"],tab:"correlation",about:"One test against another, a point per die, to show whether the two move together. r is the correlation coefficient and n the number of dies.",guide:[e.fit],see:["test-correlation-matrix","scatter-plot"]},{id:"test-correlation-matrix",kind:"chart",title:"Test correlation matrix",card:"correlation",tab:"correlation",about:"The correlation of every pair of tests. A strong colour means two tests move together; click a cell to show the pair in the scatter.",see:["test-scatter","heatmap"]},{id:"process-capability",kind:"chart",title:"Process capability",card:"capability",tab:"distributions",about:"Every test with limits on one scale, the low limit at 0 and the high limit at 1, sorted lowest Ppk first, so the tests closest to their limits lead.",guide:[e.goal],see:["capability-goal-plot","pass-rate-by-test"]},{id:"comparison-by-group",kind:"table",title:"Comparison by group",card:"comparison",tab:"distributions",about:"Yield and each test compared between groups, counting each wafer once, with how likely a difference this large is by chance.",guide:[e.groups],see:["what-divides-yield","difference-map","box-plot"]},{id:"what-divides-yield",kind:"table",title:"What divides yield",card:"commonality",tab:"overview",about:"The wafer and lot fields ranked by how strongly they divide yield, as places to look for a cause.",guide:[e.dividesYield],see:["comparison-by-group","yield-by-wafer"]},{id:"part-average-testing-pat",kind:"table",title:"Part average testing (PAT)",card:"pat",tab:"overview",about:"Dies outside part average testing limits, set from each wafer\u2019s own spread of each test (the AEC-Q001 method), by wafer and by test.",guide:[e.pat],see:["pat-verdict-map","process-capability","scatter-plot"]},{id:"scatter-plot",kind:"chart",title:"Scatter plot",chart:"scatter",tab:"plots",about:"One field against another, a point per die or per wafer, to show whether they move together.",guide:[e.fit],see:["test-scatter","heatmap"]},{id:"histogram",kind:"chart",title:"Histogram",chart:"histogram",tab:"plots",about:"How a value is distributed: the number of dies or wafers in each value range.",see:["value-histogram","probability-plot","box-plot"]},{id:"box-plot",kind:"chart",title:"Box plot",chart:"box",tab:"plots",about:"How a value spreads in each category: the box holds the middle half, the line inside it is the median, and the whiskers reach the lowest and highest values.",guide:[e.groups],see:["test-value-distribution","nested-categories","probability-plot"]},{id:"bar-chart",kind:"chart",title:"Bar chart",chart:"bar",tab:"plots",about:"A count, a share or a summary value for each category, side by side.",see:["pareto","stacked-bars-and-shares","yield-by-wafer"]},{id:"line-chart",kind:"chart",title:"Line chart",chart:"line",tab:"plots",about:"A summary value in order along the X axis (wafer order, a test, a condition), to show a trend.",guide:[e.bands],see:["control-chart","sweep","wafer-to-wafer-trend"]},{id:"sweep",kind:"chart",title:"Sweep",chart:"sweep",tab:"plots",about:"A measured value against a swept condition, a curve per series, to show how the part responds across the range.",see:["line-chart"]},{id:"probability-plot",kind:"chart",title:"Probability plot",chart:"probability",tab:"plots",about:"The share of values at or below each value, a curve per colour, so whole distributions compare, tails included.",guide:[e.probability],see:["histogram","box-plot"]},{id:"control-chart",kind:"chart",title:"Control chart",chart:"control",tab:"plots",about:"One value per wafer in order against its centre line and control limits, with the points that break a Western Electric rule marked.",guide:[e.control],see:["wafer-to-wafer-trend","line-chart","capability-goal-plot"]},{id:"capability-goal-plot",kind:"chart",title:"Capability goal plot",chart:"goal",tab:"plots",about:"Each test with both limits placed by how far its mean is off centre and how wide its spread is, as shares of its limit window. A test outside the solid triangle is short of Ppk 1.33.",guide:[e.goal],see:["process-capability","control-chart"]},{id:"heatmap",kind:"chart",title:"Heatmap",chart:"heatmap",tab:"plots",about:"A value for every pair of two categories, as a colour, to show where the two interact.",guide:[e.heatmap],see:["test-correlation-matrix","difference-map","bar-chart"]},{id:"pareto",kind:"chart",title:"Pareto",tab:"plots",about:"Categories largest first with a line for their running share, to show which few account for most of the total.",see:["bin-pareto","bar-chart"]},{id:"stacked-bars-and-shares",kind:"chart",title:"Stacked bars and shares",tab:"plots",about:"Each bar split into its colours, as counts or as each colour\u2019s share of its own total, to show what a category is made of.",see:["bar-chart"]},{id:"nested-categories",kind:"chart",title:"Nested categories",tab:"plots",about:"A box or bar with categories inside categories, such as lots with their wafers, to show whether variation sits between or within the groups.",guide:[e.ranges],see:["box-plot","bar-chart"]},{id:"panels-small-multiples",kind:"chart",title:"Panels (small multiples)",tab:"plots",about:"One small chart per value of a field, on shared axes, to compare the same view across groups side by side.",guide:[e.ranges],see:["box-plot","scatter-plot","histogram"]},{id:"statistics-table",kind:"table",title:"Statistics table",tab:"data",about:"One row per test and group: the count, mean, spread, extremes, limits and capability, to read the numbers behind the charts.",see:["dies-table","process-capability"]},{id:"dies-table",kind:"table",title:"Dies table",tab:"data",about:"One row per die with its position, bin and values, to see exactly which dies a chart counts; it exports to CSV.",see:["wafers-table","statistics-table"]},{id:"wafers-table",kind:"table",title:"Wafers table",tab:"data",about:"One row per wafer with its attributes and its yield, to check what each wafer is and to compare them.",see:["dies-table","yield-by-wafer"]}];export function catalogueEntry(t){return CHART_CATALOGUE.find(a=>a.id===t)}
@@ -11,6 +11,15 @@ interface ClusterOptions {
11
11
  ringCount: number;
12
12
  /** Optional override for the failure predicate. Default: hard bin, then soft bin, not in passBins. */
13
13
  isFailingDie?: (die: Die) => boolean;
14
+ /**
15
+ * The hard bin `isFailingDie` selects, when the run is for one bin. Its groups are reported as that
16
+ * bin's clusters (a rise in the bin, not a fall in yield), and edge arcs are left to the run over
17
+ * every fail bin, which the edge patterns already account for.
18
+ */
19
+ bin?: {
20
+ bin: number;
21
+ label: string;
22
+ };
14
23
  }
15
24
  export declare function buildClusterFindings(dies: PositionedDie[], wafer: Wafer, options: ClusterOptions): StatsFinding[];
16
25
  export {};
@@ -1 +1 @@
1
- import{seededRandom as nt}from"./math.js";import{ringOf as it}from"../core/classify.js";import{compassBucket as st,sectorCompassNames as ot}from"./regions.js";import{getDieKey as rt,gridKey as L}from"../core/dies.js";import{findConnectedComponents as at,LargestComponentSizer as ct}from"./connectedComponents.js";function lt(t,e){return ot(16)[st(t,e,16)]}function ut(t){if(t.length<2)return 0;const e=[...t].sort((i,s)=>i-s);let n=e[0]+2*Math.PI-e[e.length-1];for(let i=1;i<e.length;i++)n=Math.max(n,e[i]-e[i-1]);return 2*Math.PI-n}function ft(t,e,n,i){const s=i!==void 0?Math.abs(i):0;return t<=.01&&(e>=.25||s>=2||n>=.1)?"unusual":t<=.05&&(e>=.15||s>=1||n>=.03)?"notable":"info"}const j=99,G=10;class ht{sizer;failCount;maxima=[];random;order;failing;constructor(e,n,i,s){this.sizer=e,this.failCount=i,this.random=nt(s),this.order=new Int32Array(n);for(let u=0;u<n;u++)this.order[u]=u;this.failing=new Uint8Array(n)}at(e){const{order:n,failing:i,failCount:s,random:u}=this,$=n.length;for(;this.maxima.length<=e;){for(let r=0;r<s;r++){const d=r+Math.floor(u()*($-r)),g=n[r];n[r]=n[d],n[d]=g,i[n[r]]=1}this.maxima.push(this.sizer.largest(i));for(let r=0;r<s;r++)i[n[r]]=0}return this.maxima[e]}pValue(e){let n=0;for(let i=0;i<j;i++)if(this.at(i)>=e&&++n===G)return G/(i+1);return(1+n)/(1+j)}}function mt(t){let e=0,n=0;for(let i=0;i<t.length;i++){let s=Math.imul(t[i].x|0,2654435761)^Math.imul(t[i].y|0,2246822507);s=Math.imul(s^s>>>16,2146121005),s=Math.imul(s^s>>>15,2221713035),e=e+(s^s>>>16)|0,n=n+Math.imul(s,668265263)+374761393|0}return`${t.length}:${e>>>0}:${n>>>0}`}function pt(t,e){return t<=20?t:Math.min(e,Math.ceil(20*1.05**Math.ceil(Math.log(t/20)/Math.log(1.05))))}const dt=new Map,gt=new Map;function _(t,e,n,i){let s=t.get(e);return s===void 0&&(s=i(),t.set(e,s),t.size>n&&t.delete(t.keys().next().value)),s}function yt(t,e,n){const i=t.length,s=mt(t),u=pt(e,i),$=_(gt,`${s}:${u}`,16,()=>{const r=_(dt,s,4,()=>new ct([...t].sort((E,v)=>E.y-v.y||E.x-v.x))),[,d,g]=s.split(":").map(Number);return new ht(r,i,u,(d^Math.imul(g,739982445)^Math.imul(u+1,2246822507))>>>0)});return n.map(r=>$.pValue(r))}export function buildClusterFindings(t,e,n){const{passBins:i,significanceLevel:s,minimumEffectSize:u,minimumRelativeEffect:$,minimumSampleSize:r,minimumClusterSize:d,ringCount:g}=n,E=new Set(i);if(t.length<r)return[];const v=o=>{const a=o.hbin??o.sbin;return a===void 0||!E.has(a)},Z=n.isFailingDie??v,P=t.filter(Z),z=P.length/t.length,D=t[0],V=D?D.width:10,A=D?D.height:10,R=Math.max(V,A)*1.5,X=new Map;for(const o of t)X.set(L(o.x,o.y),o);const K=Math.ceil(R/V),N=Math.ceil(R/A),q=at(P),O=[],C=[],Y=e.center.x,k=e.center.y,H=e.radius;for(const o of q){if(o.length<d)continue;const a=new Set(o.map(f=>L(f.x,f.y)));for(const f of o)for(let h=-N;h<=N;h++)for(let M=-K;M<=K;M++){const w=L(f.x+M,f.y+h);if(a.has(w))continue;const F=X.get(w);F&&Math.hypot(F.physX-f.physX,F.physY-f.physY)<=R&&a.add(w)}const l=[...a].map(f=>X.get(f)).filter(Boolean),m=o.length,y=l.length;if(y<r)continue;const x=m/y,b=x-z,p=z>0?b/z:void 0;(b>=u||p!==void 0&&p>=$)&&C.push({component:o,k:m,clusterRate:x,delta:b,relativeDelta:p})}if(!C.length)return[];const J=yt(t,P.length,C.map(o=>o.k));for(let o=0;o<C.length;o++){const{component:a,k:l,clusterRate:m,delta:y,relativeDelta:x}=C[o],b=J[o],p=b;if(p>s)continue;const B=a.reduce((c,S)=>c+S.physX,0)/l,f=a.reduce((c,S)=>c+S.physY,0)/l;let h=a[0],M=1/0;for(const c of a){const S=Math.hypot(c.physX-B,c.physY-f);S<M&&(M=S,h=c)}const w=ut(a.map(c=>Math.atan2(c.physY-k,c.physX-Y)))*180/Math.PI,I=a.filter(c=>it(c.physX-Y,c.physY-k,H,g)===g).length>l/2&&w<120,T=I?"edge-arc":"cluster",U=lt(B-Y,f-k),Q=I?`Edge arc ~${U}`:`Cluster at (${h.x}, ${h.y})`,W=l/t.length,tt=ft(p,y,W,x),et=a.map(c=>rt(c));O.push({id:`${T}:${h.x},${h.y}`,level:"wafer",severity:tt,variable:{kind:"yield",label:"Yield"},comparison:{family:T,left:Q,right:"Rest of wafer"},effect:{direction:"lower",absoluteDelta:-y,relativeDelta:x!==void 0?-x:void 0,effectSize:y},stats:{method:"permutation",pValue:b,adjustedPValue:p,sampleSizeLeft:l,sampleSizeRight:t.length-l},summary:I?`Edge arc near ${U}: ${l} contiguous failing dies (${(m*100).toFixed(0)}% vs ${(z*100).toFixed(0)}% background)`:`Failure cluster at (${h.x}, ${h.y}): ${l} contiguous failing dies (${(m*100).toFixed(0)}% vs ${(z*100).toFixed(0)}% background)`,highlight:{kind:"dies",dieKeys:et}})}return O.sort((o,a)=>{const l=o.stats.pValue??1,m=a.stats.pValue??1;return l!==m?l-m:Math.abs(a.effect.effectSize??0)-Math.abs(o.effect.effectSize??0)})}
1
+ import{seededRandom as nt}from"./math.js";import{ringOf as it}from"../core/classify.js";import{compassBucket as st,sectorCompassNames as ot}from"./regions.js";import{diePassStatus as j,getDieKey as rt,gridKey as L}from"../core/dies.js";import{findConnectedComponents as at,LargestComponentSizer as ct}from"./connectedComponents.js";function lt(t,i){return ot(16)[st(t,i,16)]}function ut(t){if(t.length<2)return 0;const i=[...t].sort((s,n)=>s-n);let e=i[0]+2*Math.PI-i[i.length-1];for(let s=1;s<i.length;s++)e=Math.max(e,i[s]-i[s-1]);return 2*Math.PI-e}function ft(t,i,e,s){const n=s!==void 0?Math.abs(s):0;return t<=.01&&(i>=.25||n>=2||e>=.1)?"unusual":t<=.05&&(i>=.15||n>=1||e>=.03)?"notable":"info"}const ht=99,mt=9999,G=10;class dt{sizer;failCount;maxima=[];random;order;failing;constructor(i,e,s,n){this.sizer=i,this.failCount=s,this.random=nt(n),this.order=new Int32Array(e);for(let h=0;h<e;h++)this.order[h]=h;this.failing=new Uint8Array(e)}at(i){const{order:e,failing:s,failCount:n,random:h}=this,g=e.length;for(;this.maxima.length<=i;){for(let r=0;r<n;r++){const S=r+Math.floor(h()*(g-r)),p=e[r];e[r]=e[S],e[S]=p,s[e[r]]=1}this.maxima.push(this.sizer.largest(s));for(let r=0;r<n;r++)s[e[r]]=0}return this.maxima[i]}pValue(i,e){let s=0;for(let n=0;n<e;n++)if(this.at(n)>=i&&++s===G)return G/(n+1);return(1+s)/(1+e)}}function gt(t){let i=0,e=0;for(let s=0;s<t.length;s++){let n=Math.imul(t[s].x|0,2654435761)^Math.imul(t[s].y|0,2246822507);n=Math.imul(n^n>>>16,2146121005),n=Math.imul(n^n>>>15,2221713035),i=i+(n^n>>>16)|0,e=e+Math.imul(n,668265263)+374761393|0}return`${t.length}:${i>>>0}:${e>>>0}`}function pt(t,i){return t<=20?t:Math.min(i,Math.ceil(20*1.05**Math.ceil(Math.log(t/20)/Math.log(1.05))))}const yt=new Map,bt=new Map;function Z(t,i,e,s){let n=t.get(i);return n===void 0&&(n=s(),t.set(i,n),t.size>e&&t.delete(t.keys().next().value)),n}function xt(t,i,e,s){const n=t.length,h=Math.min(mt,Math.max(ht,Math.ceil(1/s))),g=gt(t),r=pt(i,n),S=Z(bt,`${g}:${r}`,16,()=>{const p=Z(yt,g,4,()=>new ct([...t].sort((x,m)=>x.y-m.y||x.x-m.x))),[,F,R]=g.split(":").map(Number);return new dt(p,n,r,(F^Math.imul(R,739982445)^Math.imul(r+1,2246822507))>>>0)});return e.map(p=>S.pValue(p,h))}export function buildClusterFindings(t,i,e){const{passBins:s,significanceLevel:n,minimumEffectSize:h,minimumRelativeEffect:g,minimumSampleSize:r,minimumClusterSize:S,ringCount:p}=e,F=new Set(s);if(e.isFailingDie||(t=t.filter(o=>j(o,F)!==void 0)),t.length<r)return[];const R=e.isFailingDie??(o=>j(o,F)===!1),x=t.filter(R),m=x.length/t.length;if(x.length===0)return[];if(m===1&&h>0&&g>0)return[];const D=t[0],V=D?D.width:10,K=D?D.height:10,X=Math.max(V,K)*1.5,B=new Map;for(const o of t)B.set(L(o.x,o.y),o);const T=Math.ceil(X/V),O=Math.ceil(X/K),q=at(x),U=[],v=[],Y=i.center.x,I=i.center.y,H=i.radius;for(const o of q){if(o.length<S)continue;const l=new Set(o.map(f=>L(f.x,f.y)));for(const f of o)for(let a=-O;a<=O;a++)for(let C=-T;C<=T;C++){const w=L(f.x+C,f.y+a);if(l.has(w))continue;const P=B.get(w);P&&Math.hypot(P.physX-f.physX,P.physY-f.physY)<=X&&l.add(w)}const u=[...l].map(f=>B.get(f)).filter(Boolean),d=o.length,y=u.length;if(y<r)continue;const M=d/y,z=M-m,$=m>0?z/m:void 0;(z>=h||$!==void 0&&$>=g)&&v.push({component:o,k:d,clusterRate:M,delta:z,relativeDelta:$})}if(!v.length)return[];const J=xt(t,x.length,v.map(o=>o.k),n);for(let o=0;o<v.length;o++){const{component:l,k:u,clusterRate:d,delta:y,relativeDelta:M}=v[o],z=J[o],$=z;if($>n)continue;const A=l.reduce((c,E)=>c+E.physX,0)/u,f=l.reduce((c,E)=>c+E.physY,0)/u;let a=l[0],C=1/0;for(const c of l){const E=Math.hypot(c.physX-A,c.physY-f);E<C&&(C=E,a=c)}const w=ut(l.map(c=>Math.atan2(c.physY-I,c.physX-Y)))*180/Math.PI,k=l.filter(c=>it(c.physX-Y,c.physY-I,H,p)===p).length>u/2&&w<120;if(k&&e.bin)continue;const N=k?"edge-arc":"cluster",_=lt(A-Y,f-I),b=e.bin,Q=k?`Edge arc ~${_}`:`Cluster at (${a.x}, ${a.y})`,W=u/t.length,tt=ft($,y,W,M),et=l.map(c=>rt(c));U.push({id:b?`${N}:hardBin:${b.bin}:${a.x},${a.y}`:`${N}:${a.x},${a.y}`,level:"wafer",severity:tt,variable:b?{kind:"hardBin",bin:b.bin,label:b.label}:{kind:"yield",label:"Yield"},comparison:{family:N,left:Q,right:"Rest of wafer"},effect:b?{direction:"higher",absoluteDelta:y,relativeDelta:M,effectSize:y}:{direction:"lower",absoluteDelta:-y,relativeDelta:M!==void 0?-M:void 0,effectSize:y},stats:{method:"permutation",pValue:z,adjustedPValue:$,sampleSizeLeft:u,sampleSizeRight:t.length-u},summary:k?`Edge arc near ${_}: ${u} contiguous failing dies (${(d*100).toFixed(0)}% vs ${(m*100).toFixed(0)}% background)`:b?`${b.label} cluster at (${a.x}, ${a.y}): ${u} contiguous dies (${(d*100).toFixed(0)}% vs ${(m*100).toFixed(0)}% background)`:`Failure cluster at (${a.x}, ${a.y}): ${u} contiguous failing dies (${(d*100).toFixed(0)}% vs ${(m*100).toFixed(0)}% background)`,highlight:{kind:"dies",dieKeys:et}})}return U.sort((o,l)=>{const u=o.stats.pValue??1,d=l.stats.pValue??1;return u!==d?u-d:Math.abs(l.effect.effectSize??0)-Math.abs(o.effect.effectSize??0)})}
@@ -0,0 +1,62 @@
1
+ import type { Die } from '../core/dies.js';
2
+ import type { WaferMetadata } from '../core/metadata.js';
3
+ import { type GroupComparison } from './groupCompare.js';
4
+ import { type FacetCuration } from './facets.js';
5
+ export interface CommonalityWafer {
6
+ metadata?: WaferMetadata;
7
+ dies: readonly Die[];
8
+ passBins: readonly number[];
9
+ }
10
+ export interface CommonalityField {
11
+ key: string;
12
+ label: string;
13
+ }
14
+ /** What is compared across a field's groups: the wafers' yield, or their share of judged dies in one hard bin. */
15
+ export type CommonalityMeasure = {
16
+ kind: 'yield';
17
+ } | {
18
+ kind: 'bin';
19
+ bin: number;
20
+ };
21
+ export interface CommonalityRow {
22
+ field: CommonalityField;
23
+ measure: CommonalityMeasure;
24
+ comparison: GroupComparison;
25
+ /** The group with the lowest yield (or the highest bin rate), and its mean over its wafers, in percent. */
26
+ worst: {
27
+ key: string;
28
+ mean: number;
29
+ };
30
+ /** The group at the other end. */
31
+ best: {
32
+ key: string;
33
+ mean: number;
34
+ };
35
+ /** `worst` to `best` in percentage points, always positive. */
36
+ spread: number;
37
+ /** Benjamini–Hochberg q of Welch's p (Kruskal–Wallis's where Welch cannot be computed), over every row. */
38
+ pAdjusted: number;
39
+ }
40
+ export interface CommonalityResult {
41
+ rows: CommonalityRow[];
42
+ /** Fields with no two groups of two or more wafers: nothing to compare. */
43
+ untestable: CommonalityField[];
44
+ /** The fail bins compared, most dies first. */
45
+ bins: number[];
46
+ /**
47
+ * Pairs of fields that divide the wafers identically (every group of one is a group of the other): the wafers cannot
48
+ * say which of the two it is.
49
+ */
50
+ confounded: Array<[CommonalityField, CommonalityField]>;
51
+ }
52
+ /** How many of the most common fail bins are compared, besides yield. */
53
+ export declare const COMMONALITY_BINS = 5;
54
+ /**
55
+ * Every field of `fields` ranked by how clearly its groups differ in yield and in the rate of each of the
56
+ * `COMMONALITY_BINS` most common fail bins (failing by each wafer's own pass bins). A wafer with no value for a field
57
+ * is left out of that field's comparison.
58
+ */
59
+ export declare function rankCommonality(wafers: readonly CommonalityWafer[], fields: readonly CommonalityField[], curation?: Record<string, FacetCuration>): CommonalityResult;
60
+ /** A measure as the reader names it: "Yield", "Hard bin 2". */
61
+ export declare const measureLabel: (m: CommonalityMeasure, binName?: (bin: number) => string | undefined) => string;
62
+ //# sourceMappingURL=commonality.d.ts.map
@@ -0,0 +1 @@
1
+ import{diePassStatus as I,isYieldEligibleDie as B}from"../core/dies.js";import{benjaminiHochberg as Y}from"./math.js";import{compareGroups as $,comparisonP as C}from"./groupCompare.js";import{facetValueOf as z}from"./facets.js";import{yieldCounts as E}from"./yield.js";import{compareNatural as H}from"../core/utils.js";export const COMMONALITY_BINS=5;function L(s,f){let r=0,a=0;for(const c of s.dies)!B(c)||c.hbin===void 0||(a++,c.hbin===f&&r++);return a?r/a*100:NaN}export function rankCommonality(s,f,r){const a=s.map(e=>{const{pass:n,total:o}=E(e.dies,e.passBins);return o?n/o*100:NaN}),c=new Map;for(const e of s){const n=new Set(e.passBins);for(const o of e.dies)B(o)&&o.hbin!==void 0&&I(o,n)===!1&&c.set(o.hbin,(c.get(o.hbin)??0)+1)}const p=[...c].sort((e,n)=>n[1]-e[1]||e[0]-n[0]).slice(0,COMMONALITY_BINS).map(([e])=>e),t=new Map(p.map(e=>[e,s.map(n=>L(n,e))])),u=[],w=[],h=new Map;for(const e of f){const n=s.map(i=>z(i.metadata,e.key,r)),o=[...new Set(n.filter(i=>i!==void 0))].sort(H);if(o.filter(i=>n.filter(y=>y===i).length>=2).length<2){w.push(e);continue}h.set(e.key,n.map(i=>i===void 0?"":String(o.indexOf(i))).join("|"));const P=[[{kind:"yield"},a],...p.map(i=>[{kind:"bin",bin:i},t.get(i)])];for(const[i,y]of P){const b=$(o.map(d=>({key:d,values:y.filter((l,F)=>n[F]===d)}))),g=b.groups.filter(d=>!b.tooSmall.includes(d.key)&&Number.isFinite(d.mean));if(g.length<2)continue;const k=g.reduce((d,l)=>l.mean<d.mean?l:d),N=g.reduce((d,l)=>l.mean>d.mean?l:d),[x,A]=i.kind==="yield"?[k,N]:[N,k];u.push({field:e,measure:i,comparison:b,worst:{key:x.key,mean:x.mean},best:{key:A.key,mean:A.mean},spread:N.mean-k.mean,pAdjusted:NaN})}}const j=u.filter(e=>Number.isFinite(C(e.comparison))),O=Y(j.map(e=>C(e.comparison)));j.forEach((e,n)=>{e.pAdjusted=O[n]});const M=e=>Number.isFinite(e.pAdjusted)?e.pAdjusted:1/0;u.sort((e,n)=>M(e)-M(n)||n.spread-e.spread);const S=[],m=f.filter(e=>h.has(e.key));for(let e=0;e<m.length;e++)for(let n=e+1;n<m.length;n++)_(h.get(m[e].key),h.get(m[n].key))&&S.push([m[e],m[n]]);return{rows:u,untestable:w,bins:p,confounded:S}}function _(s,f){const r=s.split("|"),a=f.split("|"),c=new Map,p=new Map;for(let t=0;t<r.length;t++){if(c.has(r[t])&&c.get(r[t])!==a[t]||p.has(a[t])&&p.get(a[t])!==r[t])return!1;c.set(r[t],a[t]),p.set(a[t],r[t])}return!0}export const measureLabel=(s,f)=>s.kind==="yield"?"Yield":`Hard bin ${s.bin}${f?.(s.bin)?` (${f(s.bin)})`:""}`;
@@ -1 +1 @@
1
- import{gridKey as p}from"../core/dies.js";const d=[-1,0,1,-1,1,-1,0,1],m=[-1,-1,-1,0,0,1,1,1];export function findConnectedComponents(l){if(l.length===0)return[];const o=new Map;for(const n of l)o.set(p(n.x,n.y),n);const e=new Set,a=[];for(const n of l){const c=p(n.x,n.y);if(e.has(c))continue;const t=[],r=[n];for(e.add(c);r.length>0;){const s=r.pop();t.push(s);for(let i=0;i<8;i++){const h=p(s.x+d[i],s.y+m[i]);if(e.has(h))continue;const f=o.get(h);f&&(e.add(h),r.push(f))}}a.push(t)}return a}export class LargestComponentSizer{start;list;seen;stack;stamp=0;constructor(o){const e=o.length,a=new Map;for(let t=0;t<e;t++)a.set(p(o[t].x,o[t].y),t);const n=new Int32Array(e+1),c=[];for(let t=0;t<e;t++){n[t]=c.length;for(let r=0;r<8;r++){const s=a.get(p(o[t].x+d[r],o[t].y+m[r]));s!==void 0&&c.push(s)}}n[e]=c.length,this.start=n,this.list=Int32Array.from(c),this.seen=new Int32Array(e),this.stack=new Int32Array(e)}largest(o){const{start:e,list:a,seen:n,stack:c}=this,t=++this.stamp;let r=0;for(let s=0;s<o.length;s++){if(!o[s]||n[s]===t)continue;n[s]=t;let i=0;c[i++]=s;let h=0;for(;i>0;){const f=c[--i];h++;for(let y=e[f];y<e[f+1];y++){const u=a[y];o[u]&&n[u]!==t&&(n[u]=t,c[i++]=u)}}h>r&&(r=h)}return r}}
1
+ import{gridKey as m}from"../core/dies.js";const A=[-1,0,1,-1,1,-1,0,1],k=[-1,-1,-1,0,0,1,1,1];export function findConnectedComponents(h){if(h.length===0)return[];const o=S(h);if(o)return o;const s=new Map;for(const n of h)s.set(m(n.x,n.y),n);const u=new Set,c=[];for(const n of h){const t=m(n.x,n.y);if(u.has(t))continue;const r=[],i=[n];for(u.add(t);i.length>0;){const p=i.pop();r.push(p);for(let f=0;f<8;f++){const d=m(p.x+A[f],p.y+k[f]);if(u.has(d))continue;const y=s.get(d);y&&(u.add(d),i.push(y))}}c.push(r)}return c}function S(h){const o=h.length;let s=1/0,u=-1/0,c=1/0,n=-1/0;for(let e=0;e<o;e++){const{x:l,y:a}=h[e];if(!Number.isInteger(l)||!Number.isInteger(a))return;l<s&&(s=l),l>u&&(u=l),a<c&&(c=a),a>n&&(n=a)}const t=u-s+1,r=n-c+1;if(t*r>4*o+1024||t*r>1<<26)return;const i=(e,l)=>(e-s)*r+(l-c),p=new Int32Array(t*r);for(let e=0;e<o;e++)p[i(h[e].x,h[e].y)]=e+1;const f=new Uint8Array(t*r),d=[],y=[];for(let e=0;e<o;e++){const l=h[e],a=i(l.x,l.y);if(f[a])continue;f[a]=1;const C=[];for(y.push(l);y.length>0;){const I=y.pop();C.push(I);for(let x=0;x<8;x++){const b=I.x+A[x],g=I.y+k[x];if(b<s||b>u||g<c||g>n)continue;const w=i(b,g);f[w]||p[w]===0||(f[w]=1,y.push(h[p[w]-1]))}}d.push(C)}return d}export class LargestComponentSizer{start;list;seen;stack;stamp=0;constructor(o){const s=o.length,u=new Map;for(let t=0;t<s;t++)u.set(m(o[t].x,o[t].y),t);const c=new Int32Array(s+1),n=[];for(let t=0;t<s;t++){c[t]=n.length;for(let r=0;r<8;r++){const i=u.get(m(o[t].x+A[r],o[t].y+k[r]));i!==void 0&&n.push(i)}}c[s]=n.length,this.start=c,this.list=Int32Array.from(n),this.seen=new Int32Array(s),this.stack=new Int32Array(s)}largest(o){const{start:s,list:u,seen:c,stack:n}=this,t=++this.stamp;let r=0;for(let i=0;i<o.length;i++){if(!o[i]||c[i]===t)continue;c[i]=t;let p=0;n[p++]=i;let f=0;for(;p>0;){const d=n[--p];f++;for(let y=s[d];y<s[d+1];y++){const e=u[y];o[e]&&c[e]!==t&&(c[e]=t,n[p++]=e)}}f>r&&(r=f)}return r}}
@@ -0,0 +1,21 @@
1
+ /** d2 for subgroups of two: the expected range of two normal values in standard deviations. */
2
+ export declare const MR_D2 = 1.128;
3
+ export interface ControlLimits {
4
+ centre: number;
5
+ /** σ from the average moving range of the baseline. */
6
+ sigma: number;
7
+ ucl: number;
8
+ lcl: number;
9
+ /** Points the centre and σ were set from. */
10
+ baseline: number;
11
+ }
12
+ export interface ControlViolation {
13
+ index: number;
14
+ rules: number[];
15
+ }
16
+ export declare const CONTROL_RULE_TEXT: Readonly<Record<number, string>>;
17
+ /** The centre and ±3σ limits of `values` from its first `baseline` points (all when absent); undefined below three points. */
18
+ export declare function individualsLimits(values: readonly number[], baseline?: number): ControlLimits | undefined;
19
+ /** The points of `values` that complete a Western Electric rule against `lim`, each with the rules it completes. */
20
+ export declare function westernElectric(values: readonly number[], lim: ControlLimits): ControlViolation[];
21
+ //# sourceMappingURL=control.d.ts.map
@@ -0,0 +1 @@
1
+ export const MR_D2=1.128,CONTROL_RULE_TEXT={1:"beyond 3\u03C3",2:"2 of 3 beyond 2\u03C3 on one side",3:"4 of 5 beyond 1\u03C3 on one side",4:"8 in a row on one side"};export function individualsLimits(l,c){const n=l.slice(0,c&&c>=3?c:l.length).filter(Number.isFinite);if(n.length<3)return;const r=n.reduce((i,h)=>i+h,0)/n.length;let f=0;for(let i=1;i<n.length;i++)f+=Math.abs(n[i]-n[i-1]);const t=f/(n.length-1)/1.128;return{centre:r,sigma:t,ucl:r+3*t,lcl:r-3*t,baseline:n.length}}export function westernElectric(l,c){const{centre:n,sigma:r}=c,f=[];if(!(r>0))return f;const t=l.map(e=>(e-n)/r),i=e=>Math.sign(t[e]),h=(e,s,g,u)=>{if(e-s+1<0)return!1;for(const o of[1,-1]){let d=0;for(let a=e-s+1;a<=e;a++)Number.isFinite(t[a])&&o*t[a]>u&&d++;if(d>=g&&o*t[e]>u)return!0}return!1};for(let e=0;e<t.length;e++){if(!Number.isFinite(t[e]))continue;const s=[];if(Math.abs(t[e])>3&&s.push(1),h(e,3,2,2)&&s.push(2),h(e,5,4,1)&&s.push(3),e>=7){const g=i(e);let u=g!==0;for(let o=e-7;o<=e&&u;o++)(!Number.isFinite(t[o])||i(o)!==g)&&(u=!1);u&&s.push(4)}s.length&&f.push({index:e,rules:s})}return f}
@@ -57,6 +57,16 @@ export interface CorrelationMatrix {
57
57
  of: number;
58
58
  used: number;
59
59
  };
60
+ /**
61
+ * Present only when the matrix covers a selection of the tests — see
62
+ * `CORRELATION_TEST_BUDGET`. `of` is how many parametric tests there were, `used`
63
+ * how many entered the matrix. Same rule as `sample`: a surface showing the matrix
64
+ * says so (`correlationSampleNote`).
65
+ */
66
+ testSample?: {
67
+ of: number;
68
+ used: number;
69
+ };
60
70
  }
61
71
  /**
62
72
  * Dies read before `buildCorrelationMatrix` starts sampling.
@@ -72,11 +82,39 @@ export interface CorrelationMatrix {
72
82
  * already invisible at two decimal places.
73
83
  */
74
84
  export declare const CORRELATION_DIE_BUDGET = 25000;
75
- /** The sentence a panel puts next to a sampled matrix. */
76
- export declare function correlationSampleNote(sample: CorrelationMatrix['sample']): string | undefined;
77
85
  /**
78
- * Pearson correlation matrix for every test in `testDefs` across every die
79
- * in `dies`.
86
+ * Tests entering the pairwise pass of `buildCorrelationMatrix`.
87
+ *
88
+ * The pass is quadratic in tests: 6 accumulators per pair and one cell per ordered
89
+ * pair. A real test program reaches thousands of parametric tests: unbounded, 2,002
90
+ * tests take 38 s to pair, and 15,000 (112M pairs, ~5 GB of accumulators) do not
91
+ * finish. The panel shows at most 100 tests (20 by default), the strongest pairs
92
+ * first, so the candidates are chosen before pairing instead of after.
93
+ *
94
+ * 300 tests is 44,850 pairs: about a second and a half on a 3,000-die wafer.
95
+ */
96
+ export declare const CORRELATION_TEST_BUDGET = 300;
97
+ /**
98
+ * Pair updates (test pairs × dies) the pairwise pass may make. Within it the die
99
+ * sample is `CORRELATION_DIE_BUDGET`; past it the dies are thinned, evenly, to fit:
100
+ * 300 tests (44,850 pairs) read about 5,600 dies, where the standard error of r is
101
+ * ~0.013 — while 300 tests over the full 25,000-die budget was 1.1×10⁹ updates and
102
+ * 12 s in a browser.
103
+ */
104
+ export declare const CORRELATION_WORK_BUDGET = 250000000;
105
+ /**
106
+ * Test values (tests × dies) the choice of tests (`selectCorrelationTests`) reads, when there are more tests than
107
+ * `CORRELATION_TEST_BUDGET`. Past it the tests are scored on an even spread of the dies: 15,000 tests are scored on
108
+ * about 1,700 dies, enough to rank them by fails and spread, where every die of the sample would be 375M reads.
109
+ */
110
+ export declare const CORRELATION_SCORE_BUDGET = 25000000;
111
+ /** The sentence a panel puts next to a matrix built from a sample of the dies or the tests. */
112
+ export declare function correlationSampleNote(m: Pick<CorrelationMatrix, 'sample' | 'testSample'>): string | undefined;
113
+ /**
114
+ * Pearson correlation matrix for the parametric tests in `testDefs` across the
115
+ * dies in `dies` — every test up to `CORRELATION_TEST_BUDGET` (above it, the
116
+ * chosen ones: `testSample`), every die up to `CORRELATION_DIE_BUDGET` (above it,
117
+ * an even spread: `sample`).
80
118
  *
81
119
  * Running-accumulator algorithm: one die-walk, 6 Float64 accumulators per
82
120
  * upper-triangle pair (count, sumX, sumY, sumXX, sumYY, sumXY). No pair
@@ -1 +1 @@
1
- import{dieHasValues as X,testValue as Y}from"../core/dieTable.js";import{isParametricTest as v}from"../renderer/buildWaferMap.js";import{markedTestLabel as P,derivedFields as L}from"../renderer/testLabel.js";export function pearsonFromSums(e,r,a,i,c,d){if(e<3)return null;const m=r/e,f=a/e,s=d/e-m*f,h=i/e-m*m,w=c/e-f*f,I=Math.sqrt(h*w);return I===0?null:Math.max(-1,Math.min(1,s/I))}export function pearsonOfPairs(e){let r=0,a=0,i=0,c=0,d=0,m=0;for(let f=0;f<e.length;f++){const{x:s,y:h}=e[f];!Number.isFinite(s)||!Number.isFinite(h)||(r++,a+=s,i+=h,c+=s*s,d+=h*h,m+=s*h)}return{r:pearsonFromSums(r,a,i,c,d,m),n:r}}export const CORRELATION_DIE_BUDGET=25e3;function S(e,r){const a=[],i=e/r;for(let c=0;c<r;c++)a.push(Math.floor(c*i));return a}export function correlationSampleNote(e){if(e)return`From a ${e.used.toLocaleString()}-die sample of ${e.of.toLocaleString()}, spread evenly across the lot`}function z(e){return e.filter(r=>r.testNumber!==void 0&&v(r)).map(r=>({testNumber:r.testNumber,label:P(r,r.testNumber),unit:r.unit,...L(r)}))}export function buildCorrelationMatrix(e,r){const a=z(r);if(a.length<2)return{tests:a,cells:[]};const i=a.length,c=a.map(n=>n.testNumber),d=i*(i-1)/2,m=new Float64Array(d),f=new Float64Array(i),s=new Float64Array(d),h=new Float64Array(d),w=new Float64Array(d),I=new Float64Array(d),A=new Float64Array(d);function R(n,o){return n*i-(n*(n+1)>>1)+(o-n-1)}const g=e.filter(X),t=g.length>CORRELATION_DIE_BUDGET,l=t?S(g.length,CORRELATION_DIE_BUDGET).map(n=>g[n]):g,u=new Float64Array(i),x=new Uint8Array(i);for(const n of l){x.fill(0);for(let o=0;o<i;o++){const b=Y(n,c[o]);b!==void 0&&Number.isFinite(b)&&(u[o]=b,x[o]=1)}for(let o=0;o<i;o++){if(!x[o])continue;f[o]++;const b=u[o];for(let F=o+1;F<i;F++){if(!x[F])continue;const M=u[F],N=R(o,F);m[N]++,s[N]+=b,h[N]+=M,w[N]+=b*b,I[N]+=M*M,A[N]+=b*M}}}const y=n=>pearsonFromSums(m[n],s[n],h[n],w[n],I[n],A[n]),p=[];for(let n=0;n<i;n++)for(let o=0;o<i;o++){if(o===n){p.push({xIndex:o,yIndex:n,r:1,n:f[o]});continue}const b=Math.min(o,n),F=Math.max(o,n),M=R(b,F);p.push({xIndex:o,yIndex:n,r:y(M),n:m[M]})}return t?{tests:a,cells:p,sample:{of:g.length,used:l.length}}:{tests:a,cells:p}}export function filterCorrelationMatrix(e,{threshold:r=.3,minTests:a=6,maxTests:i=20}={}){const c=[];let d=0,m=0,f=null;for(const t of e.cells){if(t.xIndex>=t.yIndex||t.r===null)continue;const l=Math.abs(t.r);c.push({xi:t.xIndex,yi:t.yIndex,absR:l}),(f===null||l>Math.abs(f.r))&&(f={xLabel:e.tests[t.xIndex].label,yLabel:e.tests[t.yIndex].label,r:t.r})}c.sort((t,l)=>l.absR-t.absR);const s=new Set;for(const{xi:t,yi:l,absR:u}of c){const x=u<r;s.size>=i||x&&s.size>=a||(s.add(t),s.size<i&&s.add(l))}if(s.size<Math.min(a,e.tests.length))for(let t=0;t<e.tests.length&&s.size<Math.min(i,a,e.tests.length);t++)s.add(t);const h=(()=>{const t=Array.from(s),l=new Map,u=new Map;for(const{xi:y,yi:p,absR:n}of c)!s.has(y)||!s.has(p)||(l.set(y,(l.get(y)??0)+n),l.set(p,(l.get(p)??0)+n),u.set(y,(u.get(y)??0)+1),u.set(p,(u.get(p)??0)+1));const x=y=>(u.get(y)??0)>0?l.get(y)/u.get(y):0;return t.sort((y,p)=>x(p)-x(y))})(),w=h.map(t=>e.tests[t]),I=new Map(h.map((t,l)=>[t,l])),A=new Set(w.map(t=>t.testNumber)),R=e.cells.filter(t=>A.has(e.tests[t.xIndex].testNumber)&&A.has(e.tests[t.yIndex].testNumber)).map(t=>({xIndex:I.get(t.xIndex),yIndex:I.get(t.yIndex),r:t.r,n:t.n}));let g=0;for(const{xi:t,yi:l,absR:u}of c)s.has(t)&&s.has(l)?u>=.7?d++:u>=.4&&m++:u<r&&g++;return{matrix:{tests:w,cells:R},strongPairs:d,moderatePairs:m,hiddenWeakPairs:g,strongestPair:f}}
1
+ import{dieHasValues as Y,testValue as E}from"../core/dieTable.js";import{isParametricTest as v}from"../renderer/buildWaferMap.js";import{markedTestLabel as P,derivedFields as k}from"../renderer/testLabel.js";export function pearsonFromSums(e,o,i,d,m,c){if(e<3)return null;const g=o/e,u=i/e,a=c/e-g*u,p=d/e-g*g,b=m/e-u*u,M=Math.sqrt(p*b);return M===0?null:Math.max(-1,Math.min(1,a/M))}export function pearsonOfPairs(e){let o=0,i=0,d=0,m=0,c=0,g=0;for(let u=0;u<e.length;u++){const{x:a,y:p}=e[u];!Number.isFinite(a)||!Number.isFinite(p)||(o++,i+=a,d+=p,m+=a*a,c+=p*p,g+=a*p)}return{r:pearsonFromSums(o,i,d,m,c,g),n:o}}export const CORRELATION_DIE_BUDGET=25e3;function O(e,o){const i=[],d=e/o;for(let m=0;m<o;m++)i.push(Math.floor(m*d));return i}export const CORRELATION_TEST_BUDGET=300,CORRELATION_WORK_BUDGET=25e7,CORRELATION_SCORE_BUDGET=25e6;export function correlationSampleNote(e){const o=[];return e.testSample&&o.push(`Among the ${e.testSample.used.toLocaleString()} of ${e.testSample.of.toLocaleString()} tests with the most dies outside their limits, then the widest spread`),e.sample&&o.push(`${o.length?"from":"From"} a ${e.sample.used.toLocaleString()}-die sample of ${e.sample.of.toLocaleString()}, spread evenly across the lot`),o.length?o.join(", "):void 0}function D(e,o,i,d){const m=e.length,c=new Float64Array(m),g=new Float64Array(m),u=new Float64Array(m),a=new Float64Array(m),p=e.map(r=>o.get(r.testNumber)?.limitLow),b=e.map(r=>o.get(r.testNumber)?.limitHigh);for(const r of i)for(let n=0;n<m;n++){const t=E(r,e[n].testNumber);t===void 0||!Number.isFinite(t)||(c[n]++,g[n]+=t,u[n]+=t*t,(p[n]!==void 0&&t<p[n]||b[n]!==void 0&&t>b[n])&&a[n]++)}const M=r=>{if(c[r]<3)return-1;const n=g[r]/c[r],t=Math.sqrt(Math.max(0,u[r]/c[r]-n*n)),f=p[r]!==void 0&&b[r]!==void 0?b[r]-p[r]:Math.abs(n);return f>0?t/f:0},h=e.map((r,n)=>({i:n,fails:c[n]<3?-1:a[n],spread:M(n)}));return h.sort((r,n)=>n.fails-r.fails||n.spread-r.spread||r.i-n.i),h.slice(0,d).map(r=>r.i).sort((r,n)=>r-n).map(r=>e[r])}function z(e){return e.filter(o=>o.testNumber!==void 0&&v(o)).map(o=>({testNumber:o.testNumber,label:P(o,o.testNumber),unit:o.unit,...k(o)}))}export function buildCorrelationMatrix(e,o){const i=z(o);if(i.length<2)return{tests:i,cells:[]};const d=e.filter(Y),c=d.length>CORRELATION_DIE_BUDGET?O(d.length,CORRELATION_DIE_BUDGET).map(s=>d[s]):d,g=i.length>CORRELATION_TEST_BUDGET,u=g?D(i,new Map(o.flatMap(s=>s.testNumber===void 0?[]:[[s.testNumber,s]])),c.length*i.length>CORRELATION_SCORE_BUDGET?O(c.length,Math.max(1,Math.floor(CORRELATION_SCORE_BUDGET/i.length))).map(s=>c[s]):c,CORRELATION_TEST_BUDGET):i,a=u.length*(u.length-1)/2,p=Math.max(1,Math.floor(CORRELATION_WORK_BUDGET/Math.max(1,a))),b=c.length>p?O(c.length,p).map(s=>c[s]):c,M=b.length<d.length,h=u.length,r=u.map(s=>s.testNumber),n=h*(h-1)/2,t=new Float64Array(n),f=new Float64Array(h),x=new Float64Array(n),N=new Float64Array(n),y=new Float64Array(n),w=new Float64Array(n),S=new Float64Array(n);function C(s,l){return s*h-(s*(s+1)>>1)+(l-s-1)}const _=new Float64Array(h),T=new Uint8Array(h);for(const s of b){T.fill(0);for(let l=0;l<h;l++){const I=E(s,r[l]);I!==void 0&&Number.isFinite(I)&&(_[l]=I,T[l]=1)}for(let l=0;l<h;l++){if(!T[l])continue;f[l]++;const I=_[l];for(let F=l+1;F<h;F++){if(!T[F])continue;const A=_[F],R=C(l,F);t[R]++,x[R]+=I,N[R]+=A,y[R]+=I*I,w[R]+=A*A,S[R]+=I*A}}}const X=s=>pearsonFromSums(t[s],x[s],N[s],y[s],w[s],S[s]),L=[];for(let s=0;s<h;s++)for(let l=0;l<h;l++){if(l===s){L.push({xIndex:l,yIndex:s,r:1,n:f[l]});continue}const I=Math.min(l,s),F=Math.max(l,s),A=C(I,F);L.push({xIndex:l,yIndex:s,r:X(A),n:t[A]})}return{tests:u,cells:L,...M?{sample:{of:d.length,used:b.length}}:{},...g?{testSample:{of:i.length,used:u.length}}:{}}}export function filterCorrelationMatrix(e,{threshold:o=.3,minTests:i=6,maxTests:d=20}={}){const m=[];let c=0,g=0,u=null;for(const t of e.cells){if(t.xIndex>=t.yIndex||t.r===null)continue;const f=Math.abs(t.r);m.push({xi:t.xIndex,yi:t.yIndex,absR:f}),(u===null||f>Math.abs(u.r))&&(u={xLabel:e.tests[t.xIndex].label,yLabel:e.tests[t.yIndex].label,r:t.r})}m.sort((t,f)=>f.absR-t.absR);const a=new Set;for(const{xi:t,yi:f,absR:x}of m){const N=x<o;a.size>=d||N&&a.size>=i||(a.add(t),a.size<d&&a.add(f))}if(a.size<Math.min(i,e.tests.length))for(let t=0;t<e.tests.length&&a.size<Math.min(d,i,e.tests.length);t++)a.add(t);const p=(()=>{const t=Array.from(a),f=new Map,x=new Map;for(const{xi:y,yi:w,absR:S}of m)!a.has(y)||!a.has(w)||(f.set(y,(f.get(y)??0)+S),f.set(w,(f.get(w)??0)+S),x.set(y,(x.get(y)??0)+1),x.set(w,(x.get(w)??0)+1));const N=y=>(x.get(y)??0)>0?f.get(y)/x.get(y):0;return t.sort((y,w)=>N(w)-N(y))})(),b=p.map(t=>e.tests[t]),M=new Map(p.map((t,f)=>[t,f])),h=new Set(b.map(t=>t.testNumber)),r=e.cells.filter(t=>h.has(e.tests[t.xIndex].testNumber)&&h.has(e.tests[t.yIndex].testNumber)).map(t=>({xIndex:M.get(t.xIndex),yIndex:M.get(t.yIndex),r:t.r,n:t.n}));let n=0;for(const{xi:t,yi:f,absR:x}of m)a.has(t)&&a.has(f)?x>=.7?c++:x>=.4&&g++:x<o&&n++;return{matrix:{tests:b,cells:r},strongPairs:c,moderatePairs:g,hiddenWeakPairs:n,strongestPair:u}}
@@ -35,8 +35,11 @@ export interface DieRegionDef {
35
35
  /** Present when findings and region yield group dies by this region. */
36
36
  grouping?: RegionGrouping;
37
37
  }
38
+ /** A die's distance from the centre as a share of the wafer radius (ring 1 of 4 is 0–0.25), or undefined when it cannot be placed. */
39
+ export declare function dieRadialPosition(d: Die, ctx: {
40
+ wafer?: Wafer;
41
+ }): number | undefined;
38
42
  export declare const DIE_REGIONS: Record<DieRegionKey, DieRegionDef>;
39
43
  /** The regions this population offers, in the order they are listed. */
40
44
  export declare function availableRegions(ctx: RegionContext, anyPositioned: boolean): DieRegionDef[];
41
- export declare const isDieRegionKey: (k: string) => k is DieRegionKey;
42
45
  //# sourceMappingURL=dieRegions.d.ts.map
@@ -1 +1 @@
1
- import{classifyDie as c}from"../core/classify.js";import{getReticleCell as f,getReticleShot as d}from"../core/reticle.js";import{requireRingCount as g}from"../core/ringCount.js";import{hasPosition as l}from"../core/dies.js";import{getRingLabel as s}from"../core/classify.js";export const DIE_REGION_KEYS=["ring","quadrant","reticleCell","reticleShot"];function p(e,r){return!!r.wafer&&l(e)&&e.physX!==void 0&&e.physY!==void 0}function i(e,r,n){if(p(e,r))return c(e,r.wafer,{ringCount:g(r,n)})}const t=new Map([["quadrant:NE",0],["quadrant:NW",1],["quadrant:SE",2],["quadrant:SW",3]]);function a(e,r){const n=r.reticle??r.wafer?.reticle;return n&&l(e)?f(e,n):void 0}export const DIE_REGIONS={ring:{key:"ring",label:"Ring",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?`Ring ${n.ring}`:void 0},rawOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?String(n.ring):void 0},grouping:{family:"ring",place:(e,r)=>{const n=i(e,r,"a ring");return n?{key:`ring:${n.ring}`,label:s(n.ring,r.ringCount)}:void 0},order:(e,r)=>e.localeCompare(r)}},quadrant:{key:"quadrant",label:"Quadrant",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>i(e,r,"a quadrant of a plot")?.quadrant,grouping:{family:"quadrant",place:(e,r)=>{const n=i(e,r,"a quadrant");return n?{key:`quadrant:${n.quadrant}`,label:n.quadrant}:void 0},order:(e,r)=>(t.get(e)??4)-(t.get(r)??4)}},reticleCell:{key:"reticleCell",label:"Reticle cell",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=a(e,r);return n?`Reticle cell (${n.column}, ${n.row})`:void 0},grouping:{family:"reticle-position",place:(e,r)=>{const n=a(e,r);return n?{key:`reticle-position:cell:${n.column},${n.row}`,label:`Reticle cell (${n.column}, ${n.row})`}:void 0},order:(e,r)=>e.localeCompare(r,void 0,{numeric:!0})}},reticleShot:{key:"reticleShot",label:"Reticle shot",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=r.reticle??r.wafer?.reticle;if(!n||!l(e))return;const{column:o,row:u}=d(e,n);return`Reticle shot (${o}, ${u})`}}};export function availableRegions(e,r){return DIE_REGION_KEYS.map(n=>DIE_REGIONS[n]).filter(n=>n.available(e,r))}export const isDieRegionKey=e=>DIE_REGION_KEYS.includes(e);
1
+ import{classifyDie as c}from"../core/classify.js";import{getReticleCell as f,getReticleShot as d}from"../core/reticle.js";import{requireRingCount as g}from"../core/ringCount.js";import{hasPosition as a}from"../core/dies.js";import{getRingLabel as s,radialPosition as p}from"../core/classify.js";export const DIE_REGION_KEYS=["ring","quadrant","reticleCell","reticleShot"];function m(e,r){return!!r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0}export function dieRadialPosition(e,r){return r.wafer&&a(e)&&e.physX!==void 0&&e.physY!==void 0?p(e,r.wafer):void 0}function i(e,r,n){if(m(e,r))return c(e,r.wafer,{ringCount:g(r,n)})}const l=new Map([["quadrant:NE",0],["quadrant:NW",1],["quadrant:SE",2],["quadrant:SW",3]]);function t(e,r){const n=r.reticle??r.wafer?.reticle;return n&&a(e)?f(e,n):void 0}export const DIE_REGIONS={ring:{key:"ring",label:"Ring",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?`Ring ${n.ring}`:void 0},rawOf:(e,r)=>{const n=i(e,r,"a ring of a plot");return n?String(n.ring):void 0},grouping:{family:"ring",place:(e,r)=>{const n=i(e,r,"a ring");return n?{key:`ring:${n.ring}`,label:s(n.ring,r.ringCount)}:void 0},order:(e,r)=>e.localeCompare(r)}},quadrant:{key:"quadrant",label:"Quadrant",available:(e,r)=>!!e.wafer&&r,valueOf:(e,r)=>i(e,r,"a quadrant of a plot")?.quadrant,grouping:{family:"quadrant",place:(e,r)=>{const n=i(e,r,"a quadrant");return n?{key:`quadrant:${n.quadrant}`,label:n.quadrant}:void 0},order:(e,r)=>(l.get(e)??4)-(l.get(r)??4)}},reticleCell:{key:"reticleCell",label:"Reticle cell",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=t(e,r);return n?`Reticle cell (${n.column}, ${n.row})`:void 0},grouping:{family:"reticle-position",place:(e,r)=>{const n=t(e,r);return n?{key:`reticle-position:cell:${n.column},${n.row}`,label:`Reticle cell (${n.column}, ${n.row})`}:void 0},order:(e,r)=>e.localeCompare(r,void 0,{numeric:!0})}},reticleShot:{key:"reticleShot",label:"Reticle shot",available:(e,r)=>!!(e.reticle??e.wafer?.reticle)&&r,valueOf:(e,r)=>{const n=r.reticle??r.wafer?.reticle;if(!n||!a(e))return;const{column:o,row:u}=d(e,n);return`Reticle shot (${o}, ${u})`}}};export function availableRegions(e,r){return DIE_REGION_KEYS.map(n=>DIE_REGIONS[n]).filter(n=>n.available(e,r))}
@@ -0,0 +1,22 @@
1
+ import type { Die } from '../core/dies.js';
2
+ /** A wafer of a group: its dies, and its own pass bins (for a yield difference). */
3
+ export interface DifferenceWafer {
4
+ dies: readonly Die[];
5
+ passBins: readonly number[];
6
+ }
7
+ /** What is compared at each position: a measured test, or the yield (the share of the group's wafers passing there). */
8
+ export type DifferenceMeasure = {
9
+ test: number;
10
+ } | {
11
+ yield: true;
12
+ };
13
+ export interface DifferenceResult {
14
+ /** One die per position either group has, `testValues[0]` the difference where both have a value. */
15
+ dies: Die[];
16
+ /** Positions with a difference, and the largest difference either way (for a colour range centred on zero). */
17
+ compared: number;
18
+ maxAbs: number;
19
+ }
20
+ /** Group A's mean minus group B's at every position; see the module comment for the rule. */
21
+ export declare function differenceMap(a: readonly DifferenceWafer[], b: readonly DifferenceWafer[], m: DifferenceMeasure): DifferenceResult;
22
+ //# sourceMappingURL=differenceMap.d.ts.map
@@ -0,0 +1 @@
1
+ import{diePassStatus as v,hasPosition as x,isYieldEligibleDie as B,positionKey as d}from"../core/dies.js";import{copyDie as o,testValue as p}from"../core/dieTable.js";import{aggregateValues as h}from"../core/aggregates.js";function M(u,a){return u.map(s=>{const f=new Set(s.passBins);return s.dies.filter(x).map(n=>{let t;if("test"in a)t=p(n,a.test);else if(B(n)){const i=v(n,f);t=i===void 0?void 0:i?100:0}return o(n,{testValues:t===void 0||!Number.isFinite(t)?void 0:{0:t},testPass:void 0})})})}export function differenceMap(u,a,s){const f=h(M(u,s),"mean",0),n=h(M(a,s),"mean",0),t=new Map(n.map(e=>[d(e),p(e,0)]));let i=0,r=0;const c=new Set,m=f.map(e=>{const l=d(e);c.add(l);const V=p(e,0),b=t.get(l);if(V===void 0||b===void 0)return o(e,{testValues:void 0});const g=V-b;return i++,r=Math.max(r,Math.abs(g)),o(e,{testValues:{0:g}})});for(const e of n)c.has(d(e))||m.push(o(e,{testValues:void 0}));return{dies:m,compared:i,maxAbs:r}}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Which tests and lot field the Plot tab's example plots are drawn from, chosen from the data in view rather than
3
+ * from the order the tests are listed in: the examples then show what this lot has to say. Pure and bounded: it reads a
4
+ * sample of the dies and at most `MAX_TESTS` tests, so choosing costs about the same on a lot of a million dies.
5
+ */
6
+ import type { FacetCuration } from './facets.js';
7
+ import type { PlotItem } from './plotData.js';
8
+ export interface ExamplePicks {
9
+ /** The tests, most telling first (between wafers, or against position for one wafer); tests never scored are last, in their own order. */
10
+ ranked: number[];
11
+ /** The test that best tracks the lead test over the sampled dies, when one does. */
12
+ partner?: number;
13
+ /** The lot field whose values best separate the wafers' means of the lead test. */
14
+ splitKey?: string;
15
+ }
16
+ /**
17
+ * `tests` in order of how much each has to show: the share of its variation that lies between wafers (a shift, a drift,
18
+ * a split effect); for a single wafer, how strongly it follows distance from the centre (edge roll-off). A test with too
19
+ * few values scores nothing. The partner and split field are read against the lead test.
20
+ */
21
+ export declare function pickExamples(items: readonly PlotItem[], tests: readonly number[], metaKeys: readonly string[], curation?: Record<string, FacetCuration>): ExamplePicks;
22
+ //# sourceMappingURL=examplePicks.d.ts.map
@@ -0,0 +1 @@
1
+ import{testValuesReader as K}from"../core/dieTable.js";import{facetValueOf as L}from"./facets.js";import{dieRadialPosition as U}from"./dieRegions.js";import{pearsonOfPairs as W}from"./correlation.js";import{sampleVariance as j}from"./math.js";const v=4e3,O=60,z=20,I=c=>Math.sqrt(j(c));function P(c,f){const u=Math.min(c.length,f.length);return u<z?0:W(Array.from({length:u},(E,a)=>({x:c[a],y:f[a]}))).r??0}export function pickExamples(c,f,u,E){const a=f.slice(0,O),N=c.reduce((n,e)=>n+e.dies.length,0);if(a.length===0||N===0)return{ranked:[...f]};const T=Math.max(1,Math.ceil(N/v)),X=K(a),_=new Float64Array(a.length),i=a.map(()=>[]),b=[],x=[],A=c.map(()=>[]);let q=0;c.forEach((n,e)=>{for(const o of n.dies){if(q++%T)continue;X(o,_);const t=b.length;b.push(e),A[e].push(t),x.push(U(o,{wafer:n.wafer})??NaN);for(let r=0;r<a.length;r++)i[r].push(_[r])}});const k=n=>i[n].reduce((e,o,t)=>(Number.isFinite(o)&&e.push(t),e),[]),F=n=>A.map(e=>{const o=e.map(t=>i[n][t]).filter(Number.isFinite);return o.length>=3?o.reduce((t,r)=>t+r,0)/o.length:void 0}),p=a.map((n,e)=>{const o=k(e);if(o.length<z)return 0;if(c.length===1)return Math.abs(P(o.map(s=>i[e][s]),o.map(s=>x[s]))||0);const t=I(o.map(s=>i[e][s])),r=F(e).filter(s=>s!==void 0);return t>0&&r.length>=2?Math.min(1,I(r)/t):0}),m=a.map((n,e)=>e).sort((n,e)=>p[e]-p[n]||n-e),B=[...m.map(n=>a[n]),...f.slice(O)],d=m[0];if(p[d]<=0)return{ranked:[...f]};let g,R=.3;const D=k(d);for(const n of m.slice(1)){const e=D.filter(t=>Number.isFinite(i[n][t])),o=Math.abs(P(e.map(t=>i[d][t]),e.map(t=>i[n][t])));o>R&&(R=o,g=a[n])}let M,w=0;const S=F(d),l=S.filter(n=>n!==void 0),V=l.length?l.reduce((n,e)=>n+e,0)/l.length:0,y=l.reduce((n,e)=>n+(e-V)**2,0);if(y>0)for(const n of u){const e=new Map;if(c.forEach((t,r)=>{const s=L(t.metadata,n,E),h=S[r];s!==void 0&&h!==void 0&&e.set(s,[...e.get(s)??[],h])}),e.size<2||e.size>Math.max(2,Math.floor(l.length/2)))continue;const o=[...e.values()].reduce((t,r)=>t+r.length*(r.reduce((s,h)=>s+h,0)/r.length-V)**2,0);o/y>w&&(w=o/y,M=n)}return{ranked:B,...g!==void 0?{partner:g}:{},...M&&w>.05?{splitKey:M}:{}}}
@@ -0,0 +1,41 @@
1
+ import { type PlotCondition } from './plotSpec.js';
2
+ export declare const FILTERS_FORMAT = "wafermap-filters";
3
+ export declare const FILTERS_VERSION = 1;
4
+ /** A named filter. `id` tells it apart from its copies; `name` is what the picker lists. */
5
+ export interface SavedFilter {
6
+ id: string;
7
+ name: string;
8
+ conditions: PlotCondition[];
9
+ }
10
+ export interface ReadFiltersResult {
11
+ filters: SavedFilter[];
12
+ /** Problems that dropped a filter, a condition or a setting, each naming where. */
13
+ warnings: string[];
14
+ /** Set when nothing could be read at all: the file as a whole is rejected. */
15
+ error?: string;
16
+ }
17
+ /**
18
+ * The filters in a list the host or a file gave: lenient, so a filter that can be read is kept and each problem named.
19
+ * A filter written as a bare `{ field, values }` is a list of one condition; a missing name becomes "Filter N"; a repeated
20
+ * id is given a new one.
21
+ */
22
+ export declare function readSavedFilters(list: readonly unknown[], where?: string): {
23
+ filters: SavedFilter[];
24
+ warnings: string[];
25
+ };
26
+ /**
27
+ * Reads a filters file. Lenient like the plots file: every filter that can be read is kept and each problem is named;
28
+ * only a file with nothing usable is an error. A bare array of filters is accepted as well as the wrapped form.
29
+ */
30
+ export declare function readFiltersFile(text: string): ReadFiltersResult;
31
+ /** The file for `filters`: wrapped, versioned, with every setting (including ones this build does not know). */
32
+ export declare function writeFiltersFile(filters: readonly SavedFilter[]): string;
33
+ /**
34
+ * Adds `incoming` to `existing`, never replacing: an import must not overwrite a filter the reader has edited since.
35
+ * One whose id is already in use is added as a copy under a new id, and the names of those are returned.
36
+ */
37
+ export declare function addSavedFilters(existing: readonly SavedFilter[], incoming: readonly SavedFilter[]): {
38
+ filters: SavedFilter[];
39
+ copies: string[];
40
+ };
41
+ //# sourceMappingURL=filterFile.d.ts.map
@@ -0,0 +1,2 @@
1
+ import{addIdentified as m,readFilter as p,readIdentified as F,unwrapListFile as g}from"./plotSpec.js";import{newFilterId as l}from"./plotId.js";export const FILTERS_FORMAT="wafermap-filters",FILTERS_VERSION=1;const a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);export function readSavedFilters(e,r="filters"){const n=[];return{filters:F(e,n,{labelOf:(t,o)=>`"${u(t,o)}"`,read:(t,o,f)=>{const s=e.indexOf(t);if(!a(t)){f.push(`${r}[${s}]: not a filter, left out`);return}const d=p(t,`${r}[${s}] ${o}`,f);if(!d){f.push(`${r}[${s}] ${o}: has no condition that can be read, left out`);return}const{off:$,...c}=d;return{...c,id:typeof t.id=="string"&&t.id?t.id:l(),name:u(t,s)}},newId:l}),warnings:n}}const u=(e,r)=>a(e)&&typeof e.name=="string"&&e.name.trim()?e.name.trim():`Filter ${r+1}`;export function readFiltersFile(e){const r=g(e,{format:FILTERS_FORMAT,noun:"filters",key:"filters",version:FILTERS_VERSION});if("error"in r)return{filters:[],warnings:[],error:r.error};const{list:n,warnings:i}=r,t=readSavedFilters(n);return t.filters.length===0&&n.length>0?{filters:[],warnings:[...i,...t.warnings],error:"No filter in the file could be read"}:{filters:t.filters,warnings:[...i,...t.warnings]}}export function writeFiltersFile(e){return JSON.stringify({format:FILTERS_FORMAT,version:FILTERS_VERSION,filters:e},null,2)+`
2
+ `}export function addSavedFilters(e,r){const{items:n,copies:i}=m(e,r,t=>t.name,l);return{filters:n,copies:i}}