@wafertools/wafermap 0.33.0 → 0.35.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.
- package/AGENTS.md +6 -6
- package/CHANGELOG.md +271 -0
- package/README.md +5 -5
- package/dist/packages/canvas-adapter/chartPopulation.d.ts +15 -10
- package/dist/packages/canvas-adapter/chartPopulation.js +1 -1
- package/dist/packages/canvas-adapter/charts/barPanel.d.ts +8 -1
- package/dist/packages/canvas-adapter/charts/barPanel.js +1 -1
- package/dist/packages/canvas-adapter/charts/binCluster.d.ts +7 -1
- package/dist/packages/canvas-adapter/charts/binCluster.js +1 -1
- package/dist/packages/canvas-adapter/charts/boxplot.js +1 -1
- package/dist/packages/canvas-adapter/charts/capability.js +1 -1
- package/dist/packages/canvas-adapter/charts/chartShell.d.ts +72 -5
- package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
- package/dist/packages/canvas-adapter/charts/correlation.js +1 -2
- package/dist/packages/canvas-adapter/charts/groupedBarPlot.d.ts +2 -0
- package/dist/packages/canvas-adapter/charts/groupedBarPlot.js +1 -1
- package/dist/packages/canvas-adapter/charts/histogram.d.ts +16 -0
- package/dist/packages/canvas-adapter/charts/histogram.js +1 -1
- package/dist/packages/canvas-adapter/charts/palette.d.ts +2 -0
- package/dist/packages/canvas-adapter/charts/palette.js +1 -1
- package/dist/packages/canvas-adapter/charts/plotChart.d.ts +27 -0
- package/dist/packages/canvas-adapter/charts/plotChart.js +1 -0
- package/dist/packages/canvas-adapter/charts/pointInteractions.d.ts +45 -0
- package/dist/packages/canvas-adapter/charts/pointInteractions.js +1 -0
- package/dist/packages/canvas-adapter/charts/regionYieldDiagram.d.ts +8 -1
- package/dist/packages/canvas-adapter/charts/regionYieldDiagram.js +1 -1
- package/dist/packages/canvas-adapter/charts/scatter.d.ts +19 -0
- package/dist/packages/canvas-adapter/charts/scatter.js +1 -1
- package/dist/packages/canvas-adapter/charts/sweep.d.ts +12 -0
- package/dist/packages/canvas-adapter/charts/sweep.js +1 -1
- package/dist/packages/canvas-adapter/charts/testPassRate.d.ts +7 -0
- package/dist/packages/canvas-adapter/charts/testPassRate.js +1 -1
- package/dist/packages/canvas-adapter/charts/trend.d.ts +11 -0
- package/dist/packages/canvas-adapter/charts/trend.js +1 -1
- package/dist/packages/canvas-adapter/confirmDialog.d.ts +13 -0
- package/dist/packages/canvas-adapter/confirmDialog.js +1 -0
- package/dist/packages/canvas-adapter/dataTab.d.ts +137 -0
- package/dist/packages/canvas-adapter/dataTab.js +1 -0
- package/dist/packages/canvas-adapter/dieList.d.ts +39 -4
- package/dist/packages/canvas-adapter/dieList.js +6 -7
- package/dist/packages/canvas-adapter/drilldown.d.ts +23 -3
- package/dist/packages/canvas-adapter/drilldown.js +1 -1
- package/dist/packages/canvas-adapter/guideWindow.d.ts +96 -0
- package/dist/packages/canvas-adapter/guideWindow.js +1 -0
- package/dist/packages/canvas-adapter/identityHeader.d.ts +19 -0
- package/dist/packages/canvas-adapter/identityHeader.js +1 -1
- package/dist/packages/canvas-adapter/index.d.ts +3 -3
- package/dist/packages/canvas-adapter/index.js +1 -1
- package/dist/packages/canvas-adapter/insightsTab.d.ts +75 -54
- package/dist/packages/canvas-adapter/insightsTab.js +1 -1
- package/dist/packages/canvas-adapter/maplessSummary.d.ts +2 -2
- package/dist/packages/canvas-adapter/plotEditor.d.ts +29 -0
- package/dist/packages/canvas-adapter/plotEditor.js +1 -0
- package/dist/packages/canvas-adapter/plotItems.d.ts +32 -0
- package/dist/packages/canvas-adapter/plotItems.js +1 -0
- package/dist/packages/canvas-adapter/plotModal.d.ts +30 -0
- package/dist/packages/canvas-adapter/plotModal.js +1 -0
- package/dist/packages/canvas-adapter/plotStore.d.ts +52 -0
- package/dist/packages/canvas-adapter/plotStore.js +1 -0
- package/dist/packages/canvas-adapter/plotTab.d.ts +33 -0
- package/dist/packages/canvas-adapter/plotTab.js +1 -0
- package/dist/packages/canvas-adapter/renderWaferGallery.d.ts +11 -2
- package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
- package/dist/packages/canvas-adapter/renderWaferMap.d.ts +29 -2
- package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
- package/dist/packages/canvas-adapter/summaryPanel.d.ts +34 -10
- package/dist/packages/canvas-adapter/summaryPanel.js +2 -4
- package/dist/packages/canvas-adapter/summaryRail.d.ts +7 -0
- package/dist/packages/canvas-adapter/summaryRail.js +1 -0
- package/dist/packages/canvas-adapter/sweepEditor.d.ts +17 -0
- package/dist/packages/canvas-adapter/sweepEditor.js +1 -0
- package/dist/packages/canvas-adapter/tableExport.d.ts +22 -0
- package/dist/packages/canvas-adapter/tableExport.js +3 -0
- package/dist/packages/canvas-adapter/toolbar.d.ts +25 -97
- package/dist/packages/canvas-adapter/toolbar.js +2 -2
- package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
- package/dist/packages/canvas-adapter/userGuideHtml.js +354 -45
- package/dist/packages/canvas-adapter/version.d.ts +2 -2
- package/dist/packages/canvas-adapter/version.js +1 -1
- package/dist/packages/canvas-adapter/viewSwitch.d.ts +13 -0
- package/dist/packages/canvas-adapter/viewSwitch.js +1 -0
- package/dist/packages/canvas-adapter/virtualTable.d.ts +44 -0
- package/dist/packages/canvas-adapter/virtualTable.js +1 -0
- package/dist/packages/core/classify.d.ts +3 -2
- package/dist/packages/core/classify.js +1 -1
- package/dist/packages/core/index.d.ts +1 -1
- package/dist/packages/core/index.js +1 -1
- package/dist/packages/core/passBins.d.ts +17 -4
- package/dist/packages/core/passBins.js +1 -1
- package/dist/packages/core/reticle.d.ts +20 -0
- package/dist/packages/core/reticle.js +1 -1
- package/dist/packages/core/ringCount.d.ts +22 -0
- package/dist/packages/core/ringCount.js +1 -0
- package/dist/packages/core/tableCsv.d.ts +43 -0
- package/dist/packages/core/tableCsv.js +3 -0
- package/dist/packages/core/wafer.d.ts +15 -0
- package/dist/packages/core/wafer.js +1 -1
- package/dist/packages/renderer/binColors.d.ts +6 -6
- package/dist/packages/renderer/binColors.js +1 -1
- package/dist/packages/renderer/buildView.d.ts +1 -1
- package/dist/packages/renderer/buildView.js +1 -1
- package/dist/packages/renderer/buildWaferMap.js +1 -1
- package/dist/packages/renderer/derivedTests/apply.js +1 -1
- package/dist/packages/renderer/derivedTests/evaluate.d.ts +3 -1
- package/dist/packages/renderer/derivedTests/evaluate.js +1 -1
- package/dist/packages/renderer/derivedTests/parser.d.ts +7 -0
- package/dist/packages/renderer/derivedTests/parser.js +2 -2
- package/dist/packages/stats/analyzeWaferLot.js +1 -1
- package/dist/packages/stats/analyzeWaferMap.js +1 -1
- package/dist/packages/stats/binPareto.d.ts +1 -1
- package/dist/packages/stats/binPareto.js +1 -1
- package/dist/packages/stats/dieRegions.d.ts +42 -0
- package/dist/packages/stats/dieRegions.js +1 -0
- package/dist/packages/stats/facets.d.ts +8 -0
- package/dist/packages/stats/facets.js +1 -1
- package/dist/packages/stats/histogram.d.ts +27 -0
- package/dist/packages/stats/histogram.js +1 -1
- package/dist/packages/stats/index.d.ts +4 -1
- package/dist/packages/stats/index.js +1 -1
- package/dist/packages/stats/lotDrift.js +1 -1
- package/dist/packages/stats/lotPattern.js +1 -1
- package/dist/packages/stats/math.d.ts +9 -6
- package/dist/packages/stats/math.js +1 -1
- package/dist/packages/stats/metadataColumns.js +1 -1
- package/dist/packages/stats/patternClassification.d.ts +1 -1
- package/dist/packages/stats/patternClassification.js +1 -1
- package/dist/packages/stats/plotData.d.ts +258 -0
- package/dist/packages/stats/plotData.js +1 -0
- package/dist/packages/stats/plotId.d.ts +3 -0
- package/dist/packages/stats/plotId.js +1 -0
- package/dist/packages/stats/plotSpec.d.ts +119 -0
- package/dist/packages/stats/plotSpec.js +4 -0
- package/dist/packages/stats/presentation.d.ts +2 -0
- package/dist/packages/stats/presentation.js +1 -1
- package/dist/packages/stats/regions.d.ts +15 -0
- package/dist/packages/stats/regions.js +1 -1
- package/dist/packages/stats/renderSummaryReport.d.ts +8 -3
- package/dist/packages/stats/renderSummaryReport.js +15 -15
- package/dist/packages/stats/reportHtml.d.ts +1 -1
- package/dist/packages/stats/reportHtml.js +36 -29
- package/dist/packages/stats/scatter.d.ts +6 -0
- package/dist/packages/stats/scatter.js +1 -1
- package/dist/packages/stats/sweep.d.ts +37 -1
- package/dist/packages/stats/sweep.js +1 -1
- package/dist/packages/stats/sweepText.d.ts +14 -0
- package/dist/packages/stats/sweepText.js +1 -0
- package/dist/packages/stats/sweepXFromName.d.ts +14 -0
- package/dist/packages/stats/sweepXFromName.js +1 -1
- package/dist/packages/stats/synthesis.d.ts +14 -4
- package/dist/packages/stats/synthesis.js +1 -1
- package/dist/packages/stats/testPassRate.d.ts +6 -0
- package/dist/packages/stats/testPassRate.js +1 -1
- package/dist/packages/stats/trend.js +1 -1
- package/dist/packages/stats/types.d.ts +1 -1
- package/dist/packages/stats/yield.d.ts +15 -6
- package/dist/packages/stats/yield.js +1 -1
- package/llms.txt +15 -3
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasPosition as he}from"../core/dies.js";import{DIE_REGIONS as G,DIE_REGION_KEYS as Re}from"./dieRegions.js";import{testValue as Ge,testsPresent as be}from"../core/dieTable.js";import{compareNatural as Se,minOf as Le,maxOf as Te}from"../core/utils.js";import{isParametricTest as ne,getTestPassStatus as He}from"../renderer/buildWaferMap.js";import{facetValueOf as Ve,buildFacetTable as Xe,FACET_NONE_VALUE as Oe}from"./facets.js";import{yieldCounts as De}from"./yield.js";import{sameTestName as ze}from"./sweep.js";import{sameField as pe,plotIssue as qe,isField as ye}from"./plotSpec.js";function Ke(e){if(!e)return;const i={};for(const n of["limitLow","limitHigh","specLow","specHigh"])Number.isFinite(e[n])&&(i[n]=e[n]);return Object.keys(i).length?i:void 0}function Ze(e){let i=0;for(const l of e)i+=l.dies.length;const n=new Array(i),o=new Uint32Array(i);let s=0;return e.forEach((l,u)=>{for(const a of l.dies)n[s]=a,o[s++]=u}),{dies:n,item:o}}const J={wafer:"Wafer",x:"Die X",y:"Die Y",ring:G.ring.label,quadrant:G.quadrant.label,reticleCell:G.reticleCell.label,reticleShot:G.reticleShot.label,hbin:"Hard bin",sbin:"Soft bin",site:"Site",yield:"Yield",dieCount:"Dies",waferOrder:"Wafer order"};export function fieldLabel(e,i){if("test"in e){const n=i?.find(s=>s.testNumber===e.test),o=n?.name||e.name||`Test ${e.test}`;return n!==void 0&&!ne(n)?`${o} (pass/fail)`:o}return"builtin"in e?J[e.builtin]??String(e.builtin):ie(e.meta)}function ie(e){const i=e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim();return i?i[0].toUpperCase()+i.slice(1):e}const Je=/^[+-]?(?:\d+\.?\d*|\.\d+)$/;function H(e,i){const{items:n,rows:o,ctx:s}=i,l=fieldLabel(e,s.testDefs),u={field:e,label:l},a=o.dies.length,$=n.length;if("test"in e){const c=s.testDefs?.find(h=>h.testNumber===e.test);if(c===void 0){if(i.present??=new Set(o.dies.length?be(o.dies,"values"):[]),!i.present.has(e.test))return{...u,level:"die",kind:"numeric",issue:`Needs test ${e.test}${e.name?` (${e.name})`:""}, which is not in these dies`}}else if(e.name&&c.name&&!ze(e.name,c.name))return{...u,level:"die",kind:"numeric",unit:c.unit,issue:`Test ${e.test} is "${e.name}" in this plot and "${c.name}" here`};if(c!==void 0&&!ne(c)){const h=o.dies.map(m=>{const t=He(m,e.test,c);return t===void 0?void 0:t?"Pass":"Fail"});return{...u,level:"die",kind:"categorical",cat:h}}const y=new Float64Array(a);for(let h=0;h<a;h++)y[h]=Ge(o.dies[h],e.test)??NaN;return{...u,level:"die",kind:"numeric",unit:c?.unit,num:y,limits:Ke(c)}}if("meta"in e){const c=n.map(m=>Ve(m.metadata,e.meta,s.curation));if(c.every(m=>m===void 0))return{...u,level:"wafer",kind:"categorical",cat:c,issue:`No wafer has a "${ie(e.meta)}" value`};const y=c.map(m=>m===void 0||!Je.test(m.trim())?NaN:Number(m)),h=c.every((m,t)=>m===void 0||Number.isFinite(y[t]));return{...u,level:"wafer",kind:h?"numeric":"categorical",cat:c,num:h?Float64Array.from(y):void 0}}switch(e.builtin){case"wafer":return{...u,level:"wafer",kind:"categorical",cat:n.map(c=>c.label)};case"waferOrder":return{...u,level:"wafer",kind:"numeric",num:Float64Array.from(n,(c,y)=>y+1)};case"dieCount":return{...u,level:"wafer",kind:"numeric",num:Float64Array.from(n,c=>c.dies.length)};case"yield":{const c=new Float64Array($),y=new Float64Array($);return n.forEach((h,m)=>{const{pass:t,total:b}=De(h.dies,h.passBins);c[m]=b>0?t/b*100:NaN,y[m]=b}),{...u,level:"wafer",kind:"numeric",unit:"%",num:c,weights:y}}case"x":case"y":{const c=new Float64Array(a);for(let y=0;y<a;y++){const h=o.dies[y];c[y]=he(h)?e.builtin==="x"?h.x:h.y:NaN}return{...u,level:"die",kind:"numeric",num:c}}case"hbin":case"sbin":{const c=o.dies.map(y=>{const h=e.builtin==="hbin"?y.hbin:y.sbin;return h===void 0?void 0:`Bin ${h}`});return{...u,level:"die",kind:"categorical",cat:c}}case"site":return{...u,level:"die",kind:"categorical",cat:o.dies.map(c=>c.siteNum===void 0?void 0:`Site ${c.siteNum}`)};case"ring":case"quadrant":case"reticleCell":case"reticleShot":{const c=G[e.builtin],y=o.dies.map((h,m)=>{const t=n[o.item[m]];return c.valueOf(h,{wafer:t.wafer,ringCount:t.ringCount})});return{...u,level:"die",kind:"categorical",cat:y}}default:return{...u,level:"die",kind:"categorical",issue:"Needs a newer version of this tool"}}}function Qe(e,i){const n=e.rows.dies.length,o=new Float64Array(n),s=new Float64Array(n);for(let l=0;l<n;l++){const u=e.items[e.rows.item[l]],{pass:a,total:$}=De([e.rows.dies[l]],u.passBins);o[l]=$>0?a*100:NaN,s[l]=$}return{...i,level:"die",num:o,weights:s,perDie:!0}}export function combine(e,i){const n=e.filter(Number.isFinite);if(i==="count")return n.length;if(n.length===0)return NaN;switch(i){case"sum":return n.reduce((o,s)=>o+s,0);case"min":return Le(n);case"max":return Te(n);case"median":{const o=[...n].sort((l,u)=>l-u),s=o.length>>1;return o.length%2?o[s]:(o[s-1]+o[s])/2}default:return n.reduce((o,s)=>o+s,0)/n.length}}const re={mean:"Mean",median:"Median",min:"Min",max:"Max",sum:"Sum",count:"Count",yield:"Pooled yield"};function W(e,i,n,o,s,l){const u=o.axes?.[e]??{};let a=u.scale??"linear";if(a==="log"){for(const $ of s)if(Number.isFinite($)&&$<=0){a="linear",l.push(`The ${e.toUpperCase()} axis stays linear: a log axis needs every value above zero`);break}}return{label:u.label??i,unit:n,scale:a,min:u.min,max:u.max,reverse:u.reverse}}function et(e,i){const{chart:n}=e,o=e.fields??{},s=o.x?fieldLabel(o.x,i.testDefs):n==="box"||n==="bar"?"Wafer":void 0,l=o.y?fieldLabel(o.y,i.testDefs):void 0;switch(n){case"scatter":return s&&l?`${l} vs ${s}`:"Scatter";case"histogram":return l??(o.x?fieldLabel(o.x,i.testDefs):void 0)??"Histogram";case"line":return s&&l?`${l} over ${s}`:"Line";case"box":return l&&s?`${l} by ${s}`:"Box";case"bar":return s?l?`${l} by ${s}`:`Dies by ${s}`:"Bar";default:return""}}function Ee(e,i,n,o={}){return{spec:e,issues:n,notes:[],level:"die",autoTitle:et(e,o),groups:[""],population:{wafers:i.length,dies:i.reduce((s,l)=>s+l.dies.length,0)},plotted:0,omitted:[]}}export function combinationIssue(e,i,n={}){const o=[i.x,n.continuousColor?void 0:i.color].filter($=>!!$&&$.level==="die"),s=!!i.y&&i.y.yield&&i.y.level==="wafer",l=(e==="bar"||e==="line")&&(n.aggregate===void 0||n.aggregate==="yield"||n.aggregate==="mean");if(s&&o.length&&!l)return{long:`${i.y.label} is one figure per wafer, and ${o[0].label} belongs to dies, so a ${e} of it cannot be split by ${o[0].label}. A bar chart of yield can (pooled yield per ${o[0].label.toLowerCase()}), or plot a measured value instead`,short:`${i.y.label} is per wafer: use a bar or line chart`};const u=[i.x,i.y].filter($=>!!$);let a=n.level??(u.some($=>$.level==="die")?"die":"wafer");if(e==="bar"&&!i.y&&o.length&&(a="die"),i.color?.level==="die"&&a==="wafer"&&!n.continuousColor&&!(s&&(e==="bar"||e==="line")))return{long:`${i.color.label} is per die, so it cannot colour a plot with one mark per wafer. Plot a measured value (one mark per die), or make a bar chart of yield, which can be split by ${i.color.label.toLowerCase()}`,short:`${i.color.label} is per die: this plot has one mark per wafer`}}export function resolvePlot(e,i,n={}){const o=qe(e);if(o)return Ee(e,i,[o],n);const s=(...r)=>Ee(e,i,r,n);if(e.chart==="sweep")return s("A sweep is drawn by the sweep panel");const l=Ze(i),u={items:i,rows:l,ctx:n},a=e.chart,$=e.fields??{},c=$.x??(a==="box"||a==="bar"?{builtin:"wafer"}:void 0),y=$.y,h=a==="histogram"?y??c:y;if(a==="scatter"||a==="line"){if(!c)return s("Choose a field for X");if(!y)return s("Choose a field for Y")}if(a==="box"&&!y)return s("Choose a field for Y");if(a==="histogram"&&!h)return s("Choose a field to count");const m=a==="histogram"?void 0:c?H(c,u):void 0;let t=h?H(h,u):void 0;const b=a==="scatter"||a==="line"?[["X",m],["Y",t]]:a==="histogram"?[["to count",t]]:a==="box"||a==="bar"?[["Y",t]]:[];for(const[r,f]of b)if(f&&!f.issue&&f.kind==="categorical"&&!f.num)return s(`${f.label} is a category, not a number, so it cannot be ${r==="to count"?"the field a histogram counts":`the ${r} of a ${a}`}. Use it as the X of a bar or box chart (one bar per ${f.label.toLowerCase()}), or as the colour`);const S=$.color;let w,xe=!1,oe;S===void 0||"follow"in S?n.groupBy?oe=n.groupBy:i.length>1&&(xe=!0):"none"in S||(w=H(S,u)),oe&&(w=H({meta:oe},u)),xe&&(w=H({builtin:"wafer"},u)),w?.issue&&(S===void 0||"follow"in S)&&(w=void 0);const se=[m?.issue,t?.issue,w?.issue].filter(r=>!!r),Q=!!w&&w.kind==="numeric"&&!("meta"in w.field);if(Q&&a!=="scatter"&&se.push(`${w.label} is continuous, so it can colour a scatter but not a ${a}: colour by a category such as wafer, split or bin`),se.length)return s(...se);const Be=[m,t].filter(r=>!!r);let F=e.level??(Be.some(r=>r.level==="die")?"die":"wafer");const ae=[m,Q?void 0:w].filter(r=>!!r&&r.level==="die"),le=r=>r&&{label:r.label,level:r.level,kind:r.kind,yield:!!r.weights},ve=combinationIssue(a,{x:le(m),y:le(t),color:le(w)},{aggregate:e.aggregate,level:e.level,continuousColor:Q});if(ve)return s(ve.long);a==="bar"&&!t&&ae.length&&(F="die"),t&&t.level==="wafer"&&t.weights&&ae.length&&(t=Qe(u,t),F="die"),F==="die"&&t?.weights&&!t.perDie&&!ae.length&&(F="wafer");const T=F==="die"?l.dies.length:i.length,ee=r=>F==="die"?l.item[r]:r,ue=r=>({item:ee(r),die:F==="die"?l.dies[r]:void 0}),Ne=e.aggregate&&e.aggregate!=="yield"?e.aggregate:"mean",D=r=>{if(!r.num)throw new Error("numeric field expected");if(r.level===F)return r.num;if(r.level==="wafer"){const g=new Float64Array(T);for(let d=0;d<T;d++)g[d]=r.num[ee(d)];return g}const f=i.map(()=>[]);for(let g=0;g<r.num.length;g++)f[l.item[g]].push(r.num[g]);return Float64Array.from(f,g=>combine(g,Ne))},Ce=r=>{if(!r.cat)throw new Error("category field expected");if(r.level===F)return r.cat;if(r.level==="wafer")return Array.from({length:T},(f,g)=>r.cat[ee(g)]);throw new Error("a per-die category cannot be used at wafer level")},Ue=r=>r.weights&&r.level===F?r.weights:void 0;let ce=[""],E=new Int32Array(T),V,I;if(w&&Q)V=w.label,I=D(w);else if(w){V=w.label;const r=Ce(w),f=new Map,g=[];for(let x=0;x<T;x++){const v=r[x]??Oe;f.has(v)||(f.set(v,0),g.push(v))}const k="builtin"in w.field&&w.field.builtin==="wafer"?g:w.num&&"meta"in w.field?[...g].sort((x,v)=>(Number(x)||0)-(Number(v)||0)):[...g].sort(Se);k.forEach((x,v)=>f.set(x,v)),ce=k;for(let x=0;x<T;x++)E[x]=f.get(r[x]??Oe)}const fe=new Map,M=r=>fe.set(r,(fe.get(r)??0)+1),_=[],Pe=F==="die"?"dies":"wafers";let X,O,B,Y,Ae,z=0;const U=ce.length,te=r=>r.level==="die"&&F==="wafer"?`${re[Ne].toLowerCase()} of ${r.label} per wafer`:void 0;if(a==="scatter"){const r=D(m),f=D(t),g=[];for(let d=0;d<T;d++){if(!Number.isFinite(r[d])){M(m.label);continue}if(!Number.isFinite(f[d])){M(t.label);continue}if(I&&!Number.isFinite(I[d])){M(w.label);continue}g.push({x:r[d],y:f[d],group:E[d],item:ee(d),die:F==="die"?l.dies[d]:void 0,...I?{value:I[d]}:{}})}if(z=g.length,I&&g.length){const d=g.map(k=>k.value);Ae={label:w.label,unit:w.unit,lo:Le(d),hi:Te(d)}}X={type:"scatter",points:g},O=W("x",m.label,m.unit,e,g.map(d=>d.x),_),B=W("y",t.label,t.unit,e,g.map(d=>d.y),_),Y=[te(m),te(t)].filter(Boolean).join("; ")||void 0}else if(a==="histogram"){const r=D(t),f=Array.from({length:U},()=>[]),g=Array.from({length:U},()=>[]);for(let d=0;d<T;d++){if(!Number.isFinite(r[d])){M(t.label);continue}f[E[d]].push(r[d]),g[E[d]].push(d),z++}X={type:"histogram",values:f,units:g,unit:ue},O=W("x",t.label,t.unit,e,f.flat(),_),B={label:"Count",scale:"linear",...e.axes?.y?.label?{label:e.axes.y.label}:{}},Y=te(t)}else if(a==="line"){const r=D(m),f=D(t),g=new Set,d=new Map,k=new Map;for(let N=0;N<T;N++){if(!Number.isFinite(r[N])){M(m.label);continue}if(!Number.isFinite(f[N])){M(t.label);continue}g.add(r[N]);const A=`${E[N]}|${r[N]}`;(d.get(A)??d.set(A,[]).get(A)).push(f[N]),z++,(k.get(A)??k.set(A,[]).get(A)).push(N)}const x=[...g].sort((N,A)=>N-A),v=e.aggregate??"mean",j=Array.from({length:U},(N,A)=>x.map(P=>{const K=d.get(`${A}|${P}`);return K?combine(K,v==="yield"?"mean":v):NaN})),L=Array.from({length:U},(N,A)=>x.map(P=>d.get(`${A}|${P}`)?.length??0)),R=Array.from({length:U},(N,A)=>x.map(P=>k.get(`${A}|${P}`)??[]));X={type:"line",xs:x,values:j,counts:L,cellUnits:R,unit:ue},O=W("x",m.label,m.unit,e,x,_);const q=v==="yield"?"mean":v;B=W("y",t.perDie?t.label:`${re[q]} ${t.label}`,t.unit,e,j.flat(),_),Y=t.perDie?`passing dies over judged dies, per ${m.label.toLowerCase()}`:`${re[q].toLowerCase()} of ${t.label} per ${m.label}`}else{const r=m,f="builtin"in r.field&&(r.field.builtin==="x"||r.field.builtin==="y");if(r.kind==="numeric"&&r.level==="die"&&!f)return s(`${r.label} is continuous, so a ${a} cannot have one ${a==="bar"?"bar":"box"} per value; use a scatter or line, or choose a categorical X such as wafer, ring or bin`);const g=r.cat?Ce(r):Array.from(D(r),p=>Number.isFinite(p)?String(p):void 0),d=new Map,k=[];for(let p=0;p<T;p++){const C=g[p];C!==void 0&&!d.has(C)&&(d.set(C,0),k.push(C))}const x="builtin"in r.field&&r.field.builtin==="wafer",v=x?k:r.kind==="numeric"?[...k].sort((p,C)=>Number(p)-Number(C)):[...k].sort(Se);v.forEach((p,C)=>d.set(p,C));const j=a==="bar"&&!t,L=e.aggregate??(j?"count":t?.weights?"yield":"mean");if(L==="yield"&&!t?.weights)return s("Pooled yield needs Yield as the Y field");if(a==="box"&&L==="count")return s("A box plot needs a measured field for Y");const R=t?D(t):void 0,q=t?Ue(t):void 0,N=Array.from({length:U},()=>v.map(()=>[])),A=Array.from({length:U},()=>v.map(()=>[])),P=Array.from({length:U},()=>v.map(()=>[]));for(let p=0;p<T;p++){const C=g[p]===void 0?void 0:d.get(g[p]);if(C===void 0){M(r.label);continue}if(R&&!Number.isFinite(R[p])){M(t.label);continue}N[E[p]][C].push(R?R[p]:1),A[E[p]][C].push(p),q&&P[E[p]][C].push(q[p]),z++}const K=N.map((p,C)=>p.map((Z,Ye)=>{if(Z.length===0)return NaN;if(L==="yield"){const Fe=P[C][Ye],ke=Fe.reduce((me,ge)=>me+ge,0);return ke>0?Z.reduce((me,ge,je)=>me+ge*Fe[je],0)/ke:NaN}return combine(Z,L)})),Ie=x?v.map(p=>g.findIndex((C,Z)=>C===p&&Z>=0)):void 0;if(X={type:a==="box"?"box":"bar",categories:v,cells:N,cellUnits:A,unit:ue,values:K,categoryItems:Ie?.map(p=>F==="die"?l.item[p]:p)},O={label:e.axes?.x?.label??r.label,scale:"linear"},a==="bar"){const p=L==="count"?"Count":re[L],C=j?`Count of ${Pe}`:L==="yield"?"Pooled yield":`${p} ${t.label}`;B=W("y",C,L==="yield"?"%":L==="count"?void 0:t?.unit,e,K.flat(),_),Y=j?void 0:L==="yield"?`passing dies over judged dies, pooled per ${r.label.toLowerCase()}`:`${p.toLowerCase()} of ${t.label}${t.level==="die"&&F==="wafer"?" per wafer":""} per ${r.label.toLowerCase()}`}else B=W("y",t.label,t.unit,e,N.flat(2),_),Y=te(t)}const de=(r,f)=>r&&!r.perDie&&(f===void 0||f==="mean"||f==="median"||f==="min"||f==="max")?r.limits:void 0,We=e.aggregate??"mean";return O&&(a==="scatter"||a==="line")&&(O.limits=de(m)),B&&a!=="histogram"&&(B.limits=de(t,a==="scatter"||a==="box"?void 0:We)),a==="histogram"&&O&&(O.limits=de(t)),{spec:e,issues:[],notes:_,marks:X,level:F,autoTitle:(()=>{const r=m?.label,f=t?.label,g=a==="scatter"?`${f} vs ${r}`:a==="histogram"?`${f}`:a==="line"?`${f} over ${r}`:a==="box"?`${f} by ${r}`:f?`${f} by ${r}`:`Dies by ${r}`;return V&&w&&!pe(w.field,c)?`${g} \xB7 by ${V}`:g})(),x:O,y:B,groups:ce,colorScale:Ae,colorLabel:V,aggregation:Y,population:{wafers:i.length,dies:l.dies.length},plotted:z,omitted:[...fe].map(([r,f])=>({field:r,count:f}))}}export function plotTitle(e){return e.spec.title?.trim()?e.spec.title:e.autoTitle}export function plotFootnote(e){const{wafers:i,dies:n}=e.population,o=[`${i.toLocaleString("en-GB")} wafer${i===1?"":"s"} \xB7 ${n.toLocaleString("en-GB")} dies`];e.aggregation&&o.push(e.aggregation);for(const s of e.omitted)o.push(`${s.count.toLocaleString("en-GB")} ${e.level==="die"?"dies":"wafers"} without ${s.field} not plotted`);return o.join(" \xB7 ")}export function fieldKey(e){return"test"in e?`test:${e.test}`:"builtin"in e?`builtin:${e.builtin}`:`meta:${e.meta}`}export function fieldCatalogue(e,i={}){const n=[],o=e.flatMap(t=>t.dies),s=new Set(o.length?be(o,"values"):[]),l=i.testDefs??[],u=new Map;for(const t of l)t.testType!=="F"&&(s.has(t.testNumber)||!o.length)&&u.set(t.testNumber,t.name);for(const t of s)!u.has(t)&&!l.some(b=>b.testNumber===t&&b.testType==="F")&&u.set(t,void 0);for(const[t,b]of[...u].sort((S,w)=>S[0]-w[0]))n.push({field:{test:t,...b?{name:b}:{}},label:b?`${b} \xB7 ${t}`:`Test ${t}`,name:b||`Test ${t}`,group:"Tests",kind:"numeric",level:"die",categorical:!1});const a=new Set(o.length?be(o,"all"):[]);for(const t of l){if(ne(t)||!(a.has(t.testNumber)||!o.length))continue;const b=t.name||`Test ${t.testNumber}`;n.push({field:{test:t.testNumber,...t.name?{name:t.name}:{}},label:`${b} \xB7 ${t.testNumber} (pass/fail)`,name:b,group:"Verdicts",kind:"categorical",level:"die",categorical:!0})}const $=t=>o.some(t),c=(t,b,S)=>n.push({field:{builtin:t},label:J[t],name:J[t],group:"Die",kind:b,level:"die",categorical:S});$(t=>he(t))&&(c("x","numeric",!1),c("y","numeric",!1));const y=$(t=>he(t));for(const t of Re)e.some(b=>G[t].available({wafer:b.wafer,ringCount:b.ringCount},y))&&c(t,"categorical",!0);$(t=>t.hbin!==void 0)&&c("hbin","categorical",!0),$(t=>t.sbin!==void 0)&&c("sbin","categorical",!0),$(t=>t.siteNum!==void 0)&&c("site","categorical",!0);const h=(t,b,S)=>n.push({field:{builtin:t},label:J[t],name:J[t],group:"Wafer",kind:b,level:"wafer",categorical:S});h("wafer","categorical",!0),e.length>1&&h("waferOrder","numeric",!1),h("yield","numeric",!1),h("dieCount","numeric",!1);const m={items:e,rows:{dies:[],item:new Uint32Array(0)},ctx:i};for(const t of Xe(e.map(b=>({metadata:b.metadata,dieCount:b.dies.length})),{facetableOnly:!0,curation:i.curation})){if(t.values.length===0)continue;const b=H({meta:t.key},m);n.push({field:{meta:t.key},label:t.label||ie(t.key),name:t.label||ie(t.key),group:"Wafer",kind:b.kind,level:"wafer",categorical:!0,distinct:t.values.length})}return n}export function fieldsForRole(e,i,n){const o=n==="y"||n==="x"&&(i==="scatter"||i==="line"||i==="histogram");return n==="color"?e.filter(s=>s.categorical||i==="scatter"&&s.kind==="numeric"):o?e.filter(s=>s.kind==="numeric"):e.filter(s=>s.categorical)}export function defaultPlot(e,i){const n=e.filter(o=>o.group==="Tests");return n.length>=2?{id:i,chart:"scatter",fields:{x:n[0].field,y:n[1].field}}:n.length===1?{id:i,chart:"histogram",fields:{y:n[0].field}}:{id:i,chart:"scatter",fields:{x:{builtin:"waferOrder"},y:{builtin:"yield"}}}}const we=new Set(["wafer","dies","die x","die y","wafer order"]),tt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$e=(e,i)=>i.length>=3&&new RegExp(`(^|[^A-Za-z0-9_])${tt(i)}($|[^A-Za-z0-9_])`,"i").test(e);export function titleDrift(e,i){const n=e.title?.trim(),o={names:[],omits:[]};if(!n)return o;const s=e.fields?.color,l=[e.fields?.x,e.fields?.y,s].filter(t=>ye(t)),u=t=>l.some(b=>pe(b,t)),a=i.filter(t=>!we.has(t.name.toLowerCase())&&!("meta"in t.field)&&!u(t.field)&&$e(n,t.name)).map(t=>t.name),$=[e.fields?.x,e.fields?.y].filter(t=>ye(t)),c=t=>i.find(b=>pe(b.field,t))?.name??fieldLabel(t),y=$.filter(t=>!we.has(c(t).toLowerCase())&&$e(n,c(t))),h=$.filter(t=>!we.has(c(t).toLowerCase())&&!$e(n,c(t))),m=y.length>0||a.length>0?h.map(c):[];return{names:a,omits:m}}const Me=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;export function describeTitleDrift(e){const i=[];return e.names.length&&i.push(`The title names ${Me(e.names)}, which this plot does not show.`),e.omits.length&&i.push(`It does not name ${Me(e.omits)}, which this plot shows.`),i.length?i.join(" "):null}export function examplePlots(e,i,n){const o=e.filter(u=>u.group==="Tests").map(u=>u.field),s=[],l=i>1;if(o.length>=2&&s.push({id:n(),chart:"scatter",fields:{x:o[0],y:o[1]}}),o.length>=1&&s.push({id:n(),chart:"histogram",fields:{y:o[0],color:{none:!0}}}),o.length>=1&&l&&s.push({id:n(),chart:"box",fields:{x:{builtin:"wafer"},y:o[0],color:{none:!0}}}),l){const u=e.find(a=>"meta"in a.field&&a.distinct!==void 0&&a.distinct>=2&&a.distinct<=Math.max(2,Math.floor(i/2)));s.push({id:n(),chart:"bar",fields:{x:u?u.field:{builtin:"wafer"},y:{builtin:"yield"},color:{none:!0}}})}return o.length>=1&&l&&s.push({id:n(),chart:"line",fields:{x:{builtin:"waferOrder"},y:o[0],color:{none:!0}},aggregate:"mean"}),o.length>=2&&s.push({..._e(o.flatMap(u=>"test"in u?[u]:[]),n()),title:"Example sweep"}),s}export function plotTestNumber(e){const{x:i,y:n,color:o}=e.fields??{},s=e.chart==="scatter"?[i,n,o]:e.chart==="histogram"?[n,i]:[n];for(const l of s)if(ye(l)&&"test"in l)return l.test}export function defaultSweep(e,i){return _e(e.filter(ne).map(n=>({test:n.testNumber,name:n.name})),i)}function _e(e,i){const n=[...e].sort((s,l)=>s.test-l.test).slice(0,5),o=Object.fromEntries(n.flatMap(s=>s.name?[[String(s.test),s.name]]:[]));return{id:i,chart:"sweep",sweep:{series:[{label:"Series 1",tests:n.map(s=>s.test),...Object.keys(o).length?{testNames:o}:{}}]}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let o=0;export function newPlotId(){const t=Math.floor(Math.random()*4294967296).toString(36).padStart(7,"0");return`plot-${Date.now().toString(36)}-${t}-${(o++).toString(36)}`}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { newPlotId } from './plotId.js';
|
|
2
|
+
import type { SweepSpec } from './sweep.js';
|
|
3
|
+
export { newPlotId };
|
|
4
|
+
export declare const PLOTS_FORMAT = "wafermap-plots";
|
|
5
|
+
export declare const PLOTS_VERSION = 1;
|
|
6
|
+
/** The marker of the sweeps file tsmap wrote before sweeps became plots. A plots file reader accepts it. */
|
|
7
|
+
export declare const SWEEPS_FORMAT = "tsmap-sweeps";
|
|
8
|
+
/** A sweep's own definition: a `SweepSpec` without the `id` and `title` the plot already carries. */
|
|
9
|
+
export type SweepPayload = Omit<SweepSpec, 'id' | 'title'>;
|
|
10
|
+
export declare const PLOT_CHARTS: readonly ["scatter", "histogram", "box", "bar", "line", "sweep"];
|
|
11
|
+
export type PlotChart = (typeof PLOT_CHARTS)[number];
|
|
12
|
+
export declare const PLOT_BUILTINS: readonly ["wafer", "x", "y", "ring", "quadrant", "reticleCell", "reticleShot", "hbin", "sbin", "site", "yield", "dieCount", "waferOrder"];
|
|
13
|
+
export type PlotBuiltin = (typeof PLOT_BUILTINS)[number];
|
|
14
|
+
/** A series a plot can put on an axis or use for colour. */
|
|
15
|
+
export type PlotField =
|
|
16
|
+
/** A measured test. The number is the key; the name is a check, so a plot saved against another test program is
|
|
17
|
+
* reported rather than drawn against the wrong measurement. */
|
|
18
|
+
{
|
|
19
|
+
test: number;
|
|
20
|
+
name?: string;
|
|
21
|
+
} | {
|
|
22
|
+
builtin: PlotBuiltin;
|
|
23
|
+
}
|
|
24
|
+
/** A wafer or lot metadata key (split, slot, temperature…). */
|
|
25
|
+
| {
|
|
26
|
+
meta: string;
|
|
27
|
+
};
|
|
28
|
+
export interface PlotAxis {
|
|
29
|
+
/** Replaces the automatic axis title. Absent = automatic. */
|
|
30
|
+
label?: string;
|
|
31
|
+
scale?: 'linear' | 'log';
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
reverse?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const PLOT_AGGREGATES: readonly ["mean", "median", "min", "max", "sum", "count", "yield"];
|
|
37
|
+
export type PlotAggregate = (typeof PLOT_AGGREGATES)[number];
|
|
38
|
+
export declare const PLOT_LIMITS: readonly ["both", "test", "spec", "none"];
|
|
39
|
+
export type PlotLimits = (typeof PLOT_LIMITS)[number];
|
|
40
|
+
export type PlotColor = PlotField | {
|
|
41
|
+
follow: 'groupBy';
|
|
42
|
+
} | {
|
|
43
|
+
none: true;
|
|
44
|
+
};
|
|
45
|
+
export interface PlotSpec {
|
|
46
|
+
/** Stable, generated once, never reused; survives rename and reorder. */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Set only when the user typed one; absent = the automatic title. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** The kind of chart that draws the plot. */
|
|
51
|
+
chart: PlotChart;
|
|
52
|
+
/** Which field stands for each role. Absent for a sweep, which names runs of tests instead. */
|
|
53
|
+
fields?: {
|
|
54
|
+
x?: PlotField;
|
|
55
|
+
y?: PlotField;
|
|
56
|
+
/** Absent = follow the tab's Group by. */
|
|
57
|
+
color?: PlotColor;
|
|
58
|
+
};
|
|
59
|
+
/** The unit one mark stands for. Absent = the finest level the X and Y fields allow. */
|
|
60
|
+
level?: 'die' | 'wafer';
|
|
61
|
+
/** How die-level values are combined into one mark. Absent = a mean (a count when there is no Y). */
|
|
62
|
+
aggregate?: PlotAggregate;
|
|
63
|
+
axes?: {
|
|
64
|
+
x?: PlotAxis;
|
|
65
|
+
y?: PlotAxis;
|
|
66
|
+
};
|
|
67
|
+
/** Histogram bin count. Absent = automatic. */
|
|
68
|
+
bins?: number;
|
|
69
|
+
/** Which of a plotted test's limits are drawn: `test` limits, `spec` limits (LSL/USL), `both` or `none`. Absent = both. */
|
|
70
|
+
limits?: PlotLimits;
|
|
71
|
+
/** The definition of a `sweep` chart: ordered runs of tests read as curves. Such a plot has no `fields`. */
|
|
72
|
+
sweep?: SweepPayload;
|
|
73
|
+
}
|
|
74
|
+
export interface ReadPlotsResult {
|
|
75
|
+
plots: PlotSpec[];
|
|
76
|
+
/** Problems that dropped a plot or a setting, each naming where. */
|
|
77
|
+
warnings: string[];
|
|
78
|
+
/** Set when nothing could be read at all: the file as a whole is rejected. */
|
|
79
|
+
error?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Two fields name the same series. */
|
|
82
|
+
export declare function sameField(a: PlotField | undefined, b: PlotField | undefined): boolean;
|
|
83
|
+
export declare function isField(v: unknown): v is PlotField;
|
|
84
|
+
/**
|
|
85
|
+
* A sweep's definition from parsed JSON. Lenient like the rest of the file: a series that cannot be read is named and
|
|
86
|
+
* left out, a setting that is wrong is dropped, and settings this build does not know are kept.
|
|
87
|
+
*/
|
|
88
|
+
export declare function readSweepPayload(raw: unknown, where: string, warnings: string[]): SweepPayload;
|
|
89
|
+
/** The plot a sweep becomes: its id and title go on the envelope, the rest is the payload. */
|
|
90
|
+
export declare function sweepToPlot(spec: SweepSpec): PlotSpec;
|
|
91
|
+
/** The sweep a `sweep` plot defines, in the shape the sweep maths reads; `undefined` for any other chart. */
|
|
92
|
+
export declare function plotToSweep(plot: PlotSpec): SweepSpec | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* One plot from parsed JSON, or `null` when it cannot be a plot at all (no chart). Unknown keys survive; a
|
|
95
|
+
* setting that is wrong is dropped with a warning and the rest of the plot is kept.
|
|
96
|
+
*/
|
|
97
|
+
export declare function readPlot(raw: unknown, where: string, warnings: string[]): PlotSpec | null;
|
|
98
|
+
/**
|
|
99
|
+
* Reads a plots file. Lenient: every plot that can be read is kept and each problem is named, because a file a
|
|
100
|
+
* user spent time on must not be refused for one bad setting. Only a file with nothing usable is an error.
|
|
101
|
+
* A bare array of plots is accepted as well as the wrapped form.
|
|
102
|
+
*/
|
|
103
|
+
export declare function readPlotsFile(text: string): ReadPlotsResult;
|
|
104
|
+
/** The file for `plots`: wrapped, versioned, with every setting (including ones this build does not know). */
|
|
105
|
+
export declare function writePlotsFile(plots: readonly PlotSpec[]): string;
|
|
106
|
+
/**
|
|
107
|
+
* Adds `incoming` to `existing` as copies where an id is already in use, never replacing: an import must not
|
|
108
|
+
* overwrite a plot the user has edited since. Returns the merged list and the titles that became copies.
|
|
109
|
+
*/
|
|
110
|
+
export declare function addPlots(existing: readonly PlotSpec[], incoming: readonly PlotSpec[]): {
|
|
111
|
+
plots: PlotSpec[];
|
|
112
|
+
copies: string[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Why this build cannot draw `plot`, or `undefined` when it can: a chart or field kind from a newer version.
|
|
116
|
+
* (A test that is missing from the open lot is a data question, answered by the resolver, not a version one.)
|
|
117
|
+
*/
|
|
118
|
+
export declare function plotIssue(plot: PlotSpec): string | undefined;
|
|
119
|
+
//# sourceMappingURL=plotSpec.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{newPlotId as p}from"./plotId.js";export{p as newPlotId};export const PLOTS_FORMAT="wafermap-plots",PLOTS_VERSION=1,SWEEPS_FORMAT="tsmap-sweeps",PLOT_CHARTS=["scatter","histogram","box","bar","line","sweep"],PLOT_BUILTINS=["wafer","x","y","ring","quadrant","reticleCell","reticleShot","hbin","sbin","site","yield","dieCount","waferOrder"],PLOT_AGGREGATES=["mean","median","min","max","sum","count","yield"],PLOT_LIMITS=["both","test","spec","none"];const u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),c=e=>typeof e=="number"&&Number.isFinite(e);export function sameField(e,t){return!e||!t?e===t:"test"in e?"test"in t&&e.test===t.test:"builtin"in e?"builtin"in t&&e.builtin===t.builtin:"meta"in t&&e.meta===t.meta}export function isField(e){return u(e)?"test"in e?Number.isInteger(e.test):"builtin"in e?PLOT_BUILTINS.includes(e.builtin):"meta"in e?typeof e.meta=="string"&&e.meta!=="":!1:!1}function a(e,t,i){if(e!==void 0){if(!u(e)){i.push(`${t}: not a field, left out`);return}if("test"in e){if(!Number.isInteger(e.test)){i.push(`${t}: test number ${JSON.stringify(e.test)} is not an integer, left out`);return}const s={...e,test:e.test};return typeof e.name=="string"&&e.name!==""?s.name=e.name:delete s.name,s}if("builtin"in e)return PLOT_BUILTINS.includes(e.builtin)?{...e,builtin:e.builtin}:e;if("meta"in e){if(typeof e.meta!="string"||e.meta===""){i.push(`${t}: metadata key is empty, left out`);return}return{...e,meta:e.meta}}return e}}function y(e,t,i){if(e===void 0)return;if(!u(e)){i.push(`${t}: not an object, left out`);return}const s={...e};"label"in e&&typeof e.label!="string"&&(i.push(`${t}.label: not text, left out`),delete s.label),"scale"in e&&e.scale!=="linear"&&e.scale!=="log"&&(i.push(`${t}.scale: "${String(e.scale)}" is not linear or log, left out`),delete s.scale);for(const o of["min","max"])o in e&&!c(e[o])&&(i.push(`${t}.${o}: not a number, left out`),delete s[o]);return"reverse"in e&&typeof e.reverse!="boolean"&&(i.push(`${t}.reverse: not true or false, left out`),delete s.reverse),s}const x=/^\s*\d+\s*(\.\.\s*\d+\s*)?$/,$=e=>typeof e=="number"&&Number.isInteger(e)||typeof e=="string"&&x.test(e);export function readSweepPayload(e,t,i){if(!u(e))return i.push(`${t}: no sweep definition, left empty`),{series:[]};const s={...e};delete s.id,delete s.title;const o=Array.isArray(e.series)?e.series:[];Array.isArray(e.series)||i.push(`${t}.series: not a list, left empty`);const l=[];o.forEach((n,r)=>{const f=`${t}.series ${r+1}`;if(!u(n)){i.push(`${f}: not an object, skipped`);return}const d={...n};if((typeof n.label!="string"||n.label.trim()==="")&&(d.label=`Series ${r+1}`),!Array.isArray(n.tests)||!n.tests.every($)){i.push(`${f}: its tests must be test numbers or ranges such as "1010..1030", skipped`);return}"xValues"in n&&!(Array.isArray(n.xValues)&&n.xValues.every(c))&&(i.push(`${f}.xValues: not a list of numbers, left out`),delete d.xValues),"xFromName"in n&&typeof n.xFromName!="string"&&(i.push(`${f}.xFromName: not text, left out`),delete d.xFromName),"color"in n&&typeof n.color!="string"&&delete d.color,"testNames"in n&&!(u(n.testNames)&&Object.values(n.testNames).every(m=>typeof m=="string"))&&(i.push(`${f}.testNames: not a list of names, left out`),delete d.testNames),l.push(d)}),s.series=l;for(const n of["xLabel","xUnit","yLabel"])n in e&&typeof e[n]!="string"&&(i.push(`${t}.${n}: not text, left out`),delete s[n]);return"xScale"in e&&e.xScale!=="linear"&&e.xScale!=="log"&&(i.push(`${t}.xScale: "${String(e.xScale)}" is not linear or log, left out`),delete s.xScale),"crossing"in e&&typeof e.crossing!="boolean"&&(i.push(`${t}.crossing: not true or false, left out`),delete s.crossing),"separationAt"in e&&!(Array.isArray(e.separationAt)&&e.separationAt.every(c))&&(i.push(`${t}.separationAt: not a list of numbers, left out`),delete s.separationAt),s}export function sweepToPlot(e){const{id:t,title:i,...s}=e;return{id:t,...i?{title:i}:{},chart:"sweep",sweep:s}}export function plotToSweep(e){if(e.chart==="sweep")return{...e.sweep??{series:[]},id:e.id,title:e.title??"Sweep"}}export function readPlot(e,t,i){if(!u(e))return i.push(`${t}: not an object, skipped`),null;const s=e.chart;if(typeof s!="string"||s==="")return i.push(`${t}: no chart, skipped`),null;const o={...e};(typeof e.id!="string"||e.id==="")&&(o.id=p(),i.push(`${t}: no id, given a new one`)),"title"in e&&typeof e.title!="string"?(i.push(`${t}.title: not text, left out`),delete o.title):typeof e.title=="string"&&e.title.trim()===""&&delete o.title;const l=u(e.fields)?e.fields:{};e.fields!==void 0&&!u(e.fields)&&i.push(`${t}.fields: not an object, left empty`);const n={...l};for(const r of["x","y"]){const f=a(l[r],`${t}.fields.${r}`,i);f?n[r]=f:delete n[r]}if(l.color!==void 0){const r=l.color;if(u(r)&&"follow"in r)r.follow==="groupBy"?n.color={follow:"groupBy"}:n.color=r;else if(u(r)&&"none"in r)n.color={none:!0};else{const f=a(r,`${t}.fields.color`,i);f?n.color=f:delete n.color}}if(s==="sweep"&&Object.keys(n).length===0?delete o.fields:o.fields=n,"level"in e&&e.level!=="die"&&e.level!=="wafer"&&(i.push(`${t}.level: "${String(e.level)}" is not die or wafer, left out`),delete o.level),"aggregate"in e&&!PLOT_AGGREGATES.includes(e.aggregate)&&(i.push(`${t}.aggregate: "${String(e.aggregate)}" is not known to this version, left out`),delete o.aggregate),"limits"in e&&!PLOT_LIMITS.includes(e.limits)&&(i.push(`${t}.limits: "${String(e.limits)}" is not both, test, spec or none, left out`),delete o.limits),"bins"in e&&!(Number.isInteger(e.bins)&&e.bins>=1)&&(i.push(`${t}.bins: not a whole number of at least 1, left out`),delete o.bins),s==="sweep"&&(o.sweep=readSweepPayload(e.sweep,`${t}.sweep`,i)),e.axes!==void 0)if(!u(e.axes))i.push(`${t}.axes: not an object, left out`),delete o.axes;else{const r={...e.axes};for(const f of["x","y"]){const d=y(e.axes[f],`${t}.axes.${f}`,i);d?r[f]=d:delete r[f]}o.axes=r}return o}function b(e,t){const i=/position (\d+)/.exec(t);if(!i)return t;const s=Math.min(Number(i[1]),e.length),o=e.slice(0,s),l=o.split(`
|
|
2
|
+
`).length,n=s-(o.lastIndexOf(`
|
|
3
|
+
`)+1)+1;return`${t} (line ${l}, column ${n})`}export function readPlotsFile(e){let t;try{t=JSON.parse(e)}catch(n){return{plots:[],warnings:[],error:`Not valid JSON: ${b(e,n instanceof Error?n.message:String(n))}`}}let i;if(Array.isArray(t))i=t;else if(u(t))if(t.format===SWEEPS_FORMAT){if(!Array.isArray(t.sweeps))return{plots:[],warnings:[],error:'The file has no "sweeps" list'};i=t.sweeps.map(n=>u(n)?{id:n.id,title:n.title,chart:"sweep",sweep:n}:n)}else{if(t.format!==PLOTS_FORMAT)return{plots:[],warnings:[],error:`This is not a plots file (expected "format": "${PLOTS_FORMAT}")`};i=t.plots}else return{plots:[],warnings:[],error:"This is not a plots file"};if(!Array.isArray(i))return{plots:[],warnings:[],error:'The file has no "plots" list'};const s=[];u(t)&&c(t.version)&&t.version>PLOTS_VERSION&&s.push(`Written by a newer version (${t.version}); settings this version does not know are kept but not used`);const o=[],l=new Set;return i.forEach((n,r)=>{const f=u(n)&&typeof n.title=="string"&&n.title?`"${n.title}"`:`plot ${r+1}`,d=readPlot(n,f,s);d&&(l.has(d.id)&&(d.id=p(),s.push(`${f}: its id was already used, given a new one`)),l.add(d.id),o.push(d))}),o.length===0&&i.length>0?{plots:o,warnings:s,error:"No plot in the file could be read"}:{plots:o,warnings:s}}export function writePlotsFile(e){return JSON.stringify({format:PLOTS_FORMAT,version:PLOTS_VERSION,plots:e},null,2)+`
|
|
4
|
+
`}export function addPlots(e,t){const i=new Set(e.map(l=>l.id)),s=[],o=t.map(l=>{if(!i.has(l.id))return i.add(l.id),l;const n=p();return i.add(n),s.push(l.title??l.id),{...l,id:n}});return{plots:[...e,...o],copies:s}}export function plotIssue(e){if(!PLOT_CHARTS.includes(e.chart))return"Needs a newer version of this tool";const t=e.fields??{};for(const i of[t.x,t.y,t.color])if(!(i===void 0||u(i)&&("follow"in i||"none"in i))&&!isField(i))return"Needs a newer version of this tool"}
|
|
@@ -12,6 +12,8 @@ export declare const SEVERITY_MARK: Readonly<Record<StatsSeverity, {
|
|
|
12
12
|
}>>;
|
|
13
13
|
/** An item's impact (share of dies lost) as the word it is shown by. */
|
|
14
14
|
export declare const impactWord: (tier: MeterTier) => string;
|
|
15
|
+
/** The same tier as one word, for a compact list row where "impact" is already the heading's subject. */
|
|
16
|
+
export declare const impactShortWord: (tier: MeterTier) => string;
|
|
15
17
|
/**
|
|
16
18
|
* How strongly a yield difference is tinted: 0 for none, 1–3 light to strong. Only a shortfall of a
|
|
17
19
|
* point or more is tinted — a lot with nothing wrong has no tint at all, which is how a good lot is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const METER_DOTS=3,filledDots=t=>t==="high"?3:t==="medium"?2:1,SEVERITY_MARK={unusual:{tier:"high",word:"Unusual"},notable:{tier:"medium",word:"Notable"},info:{tier:"low",word:"Minor"}},impactWord=t=>`${t==="medium"?"Moderate":t==="high"?"High":"Low"} impact
|
|
1
|
+
export const METER_DOTS=3,filledDots=t=>t==="high"?3:t==="medium"?2:1,SEVERITY_MARK={unusual:{tier:"high",word:"Unusual"},notable:{tier:"medium",word:"Notable"},info:{tier:"low",word:"Minor"}},impactWord=t=>`${t==="medium"?"Moderate":t==="high"?"High":"Low"} impact`,impactShortWord=t=>t==="medium"?"Moderate":t==="high"?"High":"Low";const e=[{points:4,step:3},{points:2,step:2},{points:1,step:1}];export function shortfallStep(t){return e.find(o=>-t>=o.points)?.step??0}export const SHORTFALL_RGB="190, 60, 60",SHORTFALL_ALPHA={1:.1,2:.2,3:.32},shortfallColor=t=>`rgba(${SHORTFALL_RGB}, ${SHORTFALL_ALPHA[t]})`;export function formatPoints(t){return`${t>0?"+":t<0?"\u2212":""}${Math.abs(t).toFixed(1)}`}export const barPercent=t=>Math.max(0,Math.min(100,t)),shortfallLegend=t=>`Bars run 0\u2013100%. A figure is tinted when it is 1, 2 or 4 or more points below ${t}; nothing above it is.`,MEAN_WAFER_YIELD_LABEL="Mean per-wafer yield";
|
|
@@ -38,6 +38,12 @@ export interface RegionYieldDatum {
|
|
|
38
38
|
* yield itself uses.
|
|
39
39
|
*/
|
|
40
40
|
export declare function buildRegionYieldData(diesByWafer: Die[][], allWafers: Wafer[], ringCount: number, passBins: readonly number[] | ((waferIndex: number) => readonly number[]), regionBuilder: (dies: PositionedDie[], wafer: Wafer, ringCount: number) => StatsRegion[]): RegionYieldDatum[];
|
|
41
|
+
/**
|
|
42
|
+
* The dies behind one region of `buildRegionYieldData`'s output, on one wafer: the same dies its `n` counts (positioned,
|
|
43
|
+
* not partial or edge-excluded, with a bin recorded), found by the same region builder. For picking out what a click on a
|
|
44
|
+
* ring or quadrant of the yield diagram stands for.
|
|
45
|
+
*/
|
|
46
|
+
export declare function diesInRegion(dies: readonly Die[], wafer: Wafer, ringCount: number, key: string, regionBuilder: (dies: PositionedDie[], wafer: Wafer, ringCount: number) => StatsRegion[]): Die[];
|
|
41
47
|
/** Compass bearing names for a given sector count, ordered CCW from East. */
|
|
42
48
|
export declare function sectorCompassNames(sectorCount: number): string[];
|
|
43
49
|
/** Quadrants going round the wafer, counter-clockwise from the north-east. */
|
|
@@ -61,6 +67,15 @@ export interface ParsedRegionKey {
|
|
|
61
67
|
* Parse a region key (e.g. `ring:2`, `quadrant:NE`, `sector:NNE`) into its
|
|
62
68
|
* structured parts. Always parse identity from the key, never from the label.
|
|
63
69
|
*/
|
|
70
|
+
/**
|
|
71
|
+
* A reticle cell's position within its field, from its region key: `reticle-position:cell:2,1` is column 2, row 1.
|
|
72
|
+
* Separate from `parseRegionKey`, which leaves a reticle key `unknown` on purpose: only ring, quadrant and sector findings
|
|
73
|
+
* merge, and the merge logic reads `unknown` as "leave alone".
|
|
74
|
+
*/
|
|
75
|
+
export declare function parseReticleCellKey(key: string): {
|
|
76
|
+
column: number;
|
|
77
|
+
row: number;
|
|
78
|
+
} | undefined;
|
|
64
79
|
export declare function parseRegionKey(key: string): ParsedRegionKey;
|
|
65
80
|
export declare function buildRingRegions(dies: PositionedDie[], wafer: Wafer, ringCount: number): StatsRegion[];
|
|
66
81
|
export declare function buildQuadrantRegions(dies: PositionedDie[], wafer: Wafer, ringCount: number): StatsRegion[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DIE_REGIONS as W}from"./dieRegions.js";import{isPositionedDie as b,diePassStatus as R,getDieKey as M}from"../core/dies.js";function m(e){return M(e)}export function buildRegionYieldData(e,n,o,i,s){const r=new Map,t=[];for(let c=0;c<n.length;c++){const u=e[c];if(!u?.length)continue;const l=new Set(typeof i=="function"?i(c):i),d=s(u.filter(b),n[c],o);for(const a of d){t.includes(a.key)||t.push(a.key);const g=r.get(a.key)??{label:a.label,pass:0,total:0};for(const p of a.dies){if(p.partial||p.edgeExcluded)continue;const S=R(p,l);S!==void 0&&(g.total++,S&&g.pass++)}r.set(a.key,g)}}return t.map(c=>{const u=r.get(c);return u.total===0?null:{key:c,label:u.label,n:u.total,passDies:u.pass,yieldPercent:u.pass/u.total*100}}).filter(c=>c!==null)}export function diesInRegion(e,n,o,i,s){const r=s(e.filter(b),n,o).find(t=>t.key===i);return r?r.dies.filter(t=>!t.partial&&!t.edgeExcluded&&(t.hbin??t.sbin)!==void 0):[]}const I=["E","ENE","NE","NNE","N","NNW","NW","WNW","W","WSW","SW","SSW","S","SSE","SE","ESE"],k=["E","NE","N","NW","W","SW","S","SE"],A=["E","N","W","S"];export function sectorCompassNames(e){const n=[4,8,16].includes(e)?e:16;return n===4?A:n===8?k:I}export const QUADRANT_CYCLE=["NE","NW","SW","SE"];const P={NE:["NW","SE"],NW:["NE","SW"],SE:["NE","SW"],SW:["NW","SE"]};export function areQuadrantsAdjacent(e,n){return P[e]?.includes(n)??!1}const f=1440;export function regionAngleBins(e,n){const o=parseRegionKey(e);let i,s;if(o.family==="quadrant"){const t=QUADRANT_CYCLE.indexOf(o.quadrant);if(t<0)return;i=t*f/4,s=f/4}else if(o.family==="sector"){const t=[4,8,16].includes(n)?n:void 0,c=t?sectorCompassNames(t).indexOf(o.sector??""):-1;if(!t||c<0)return;s=f/t,i=c*s-s/2}else return;const r=new Set;for(let t=0;t<s;t++)r.add(((i+t)%f+f)%f);return r}export function parseReticleCellKey(e){const n=/^reticle-position:cell:(-?\d+),(-?\d+)$/.exec(e);return n?{column:Number(n[1]),row:Number(n[2])}:void 0}export function parseRegionKey(e){return e.startsWith("ring:")?{family:"ring",ring:Number(e.slice(5))}:e.startsWith("quadrant:")?{family:"quadrant",quadrant:e.slice(9)}:e.startsWith("sector:")?{family:"sector",sector:e.slice(7)}:{family:"unknown"}}function E(e,n,o){const i=W[n].grouping,s=new Map;for(const r of e){const t=i.place(r,o);if(!t)continue;const c=s.get(t.key)??{family:i.family,key:t.key,label:t.label,dieKeys:[],dies:[]};c.dieKeys.push(m(r)),c.dies.push(r),s.set(t.key,c)}return[...s.values()].sort((r,t)=>i.order(r.key,t.key))}export function buildRingRegions(e,n,o){return E(e,"ring",{wafer:n,ringCount:o})}export function buildQuadrantRegions(e,n,o){return E(e,"quadrant",{wafer:n,ringCount:o})}export function buildReticlePositionRegions(e,n){return n?E(e,"reticleCell",{ringCount:0,reticle:n}):[]}const D=3;export function buildTestSiteRegions(e,n=!1){const o=new Map;for(const i of e){if(i.siteNum===void 0)continue;const s=o.get(i.siteNum)??[];s.push(i),o.set(i.siteNum,s)}if(!n){let i=0;for(const s of o.values())s.length>=D&&i++;if(i<2)return[]}return[...o.entries()].sort(([i],[s])=>i-s).map(([i,s])=>({family:"test-site",key:`test-site:${i}`,label:`Site ${i}`,dieKeys:s.map(m),dies:s}))}export function buildSectorRegions(e,n,o){const i=[4,8,16].includes(o)?o:16,s=sectorCompassNames(i),r=new Map,t=n.center.x,c=n.center.y,u=n.radius;for(const l of e){const d=l.physX-t,a=l.physY-c;if(Math.hypot(d,a)/u<.2)continue;const p=Math.PI/i,S=(Math.atan2(a,d)+2*Math.PI+p)%(2*Math.PI),x=Math.floor(S/(2*Math.PI)*i)%i,h=s[x],y=`sector:${h}`,N=r.get(y)??{family:"sector",key:y,label:`Sector ${h}`,dieKeys:[],dies:[]};N.dieKeys.push(m(l)),N.dies.push(l),r.set(y,N)}return[...r.values()].sort((l,d)=>l.key.localeCompare(d.key))}
|
|
@@ -18,8 +18,10 @@ export interface SummaryReportParams {
|
|
|
18
18
|
sbinDefs?: BinDef[];
|
|
19
19
|
testDefs?: TestDef[];
|
|
20
20
|
statsSummary?: StatsSummary;
|
|
21
|
-
passBins
|
|
22
|
-
|
|
21
|
+
/** The map's own pass bins (`WaferMapResult.passBins`): required, there is no default to judge by instead. */
|
|
22
|
+
passBins: number[];
|
|
23
|
+
/** The map's own ring count (`WaferMapResult.ringCount`): required, there is no default. */
|
|
24
|
+
ringCount: number;
|
|
23
25
|
/** @internal The map's own bin colours, so a bar here is the colour of that bin on the map. Resolved with the default palette when omitted. */
|
|
24
26
|
binColors?: BinColors;
|
|
25
27
|
/** @internal Shown inside the app: a click on a finding's row selects it on the map (see `LIVE_FINDINGS_SCRIPT`). */
|
|
@@ -39,6 +41,8 @@ export interface LotSummaryReportParams {
|
|
|
39
41
|
dies?: Die[];
|
|
40
42
|
/** This wafer's own pass bins (`WaferMapResult.passBins`). Omitted ⇒ the top-level `passBins`. */
|
|
41
43
|
passBins?: number[];
|
|
44
|
+
/** This wafer's own ring count (`WaferMapResult.ringCount`). Omitted ⇒ the top-level `ringCount`. */
|
|
45
|
+
ringCount?: number;
|
|
42
46
|
/** Reused directly as `analyzeWaferLot`'s `perWaferSummaries` — the expensive
|
|
43
47
|
* per-wafer pass (`analyzeWaferMap`) is never re-run here. */
|
|
44
48
|
statsSummary?: StatsSummary;
|
|
@@ -54,8 +58,9 @@ export interface LotSummaryReportParams {
|
|
|
54
58
|
hbinDefs?: BinDef[];
|
|
55
59
|
sbinDefs?: BinDef[];
|
|
56
60
|
testDefs?: TestDef[];
|
|
57
|
-
/**
|
|
61
|
+
/** For items that carry no `passBins` of their own (a hand-built map). No default: an item with neither is refused. */
|
|
58
62
|
passBins?: number[];
|
|
63
|
+
/** For items that carry no `ringCount` of their own (a hand-built map); none ⇒ the first item's. No default. */
|
|
59
64
|
ringCount?: number;
|
|
60
65
|
/** Passthrough to the internal per-group `analyzeWaferLot` call, e.g. `{ enableTestValueAnalysis: true }`. */
|
|
61
66
|
analyzeOptions?: AnalyzeWaferMapOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{waferDisplayLabel as
|
|
2
|
-
`)}function
|
|
3
|
-
`)),m?
|
|
1
|
+
import{waferDisplayLabel as _}from"../core/waferLabel.js";import{binPassSets as Re,binPassSetsByWafer as We,mergeBinDefs as Q,resolveBinColors as Ne,resolveBinColorsByWafer as Ie}from"../renderer/binColors.js";import{commonPassBins as Me,itemPassBins as M,passBinsLabel as Le}from"../core/passBins.js";import{itemRingCount as Ee}from"../core/ringCount.js";import{isParametricTest as ke,isBuiltMap as V}from"../renderer/buildWaferMap.js";import{buildRingRegions as U,buildQuadrantRegions as K,buildRegionYieldData as He}from"./regions.js";import{openHtmlReport as je}from"./renderFindingsReport.js";import{analyzeWaferLot as Ae}from"./analyzeWaferLot.js";import{computeFunctionalYield as qe,analyzeWaferMap as ze}from"./analyzeWaferMap.js";import{mergeTestDefs as Ge}from"./mergeTestDefs.js";import{buildFacetTable as Oe,facetValueOf as _e,FACET_NONE_VALUE as Qe}from"./facets.js";import{visibleFindings as L}from"./filterFindings.js";import{buildYieldDataCombined as Ve}from"./yield.js";import{describeWaferPopulation as J,populationLabel as Ue}from"./population.js";import{buildTestPassRateData as Ke,hasJudgeableTests as Je,poolFunctionalYield as Xe}from"./testPassRate.js";import{buildCapabilityData as Ze}from"./capability.js";import{buildSynthesis as et}from"./synthesis.js";import{binBreakdownRows as tt,binBreakdownTitle as nt,binCountsFrom as st,pooledBinCounts as at,totalOf as it}from"./binRows.js";import{MEAN_WAFER_YIELD_LABEL as ot,shortfallLegend as E}from"./presentation.js";import{regionYieldRows as X,waferYieldRows as rt}from"./yieldRows.js";import{describeValues as lt}from"./math.js";import{fmt as C}from"../renderer/fmt.js";import{getDieKey as ct,isPositionedDie as dt,diePassStatus as Z}from"../core/dies.js";import{testValue as ut}from"../core/dieTable.js";import{findingsTableHtml as ee,synthesisSectionHtml as ft,LIVE_FINDINGS_SCRIPT as k,barCell as R,deltaCell as H,withSectionNav as te,renderMetadataSection as ne,renderMetricGrid as se,renderSection as D,renderTable as P,reportStyles as j}from"./reportHtml.js";import{escHtml as S}from"../core/utils.js";function ae(t,a){return a===0?"\u2014":`${(t/a*100).toFixed(1)}%`}function mt(t){if(!t)return"";const a=t.lot??t.lotId,i=t.wafer??t.waferId,n=[a,i].filter(Boolean).map(String);return n.length?` \u2014 ${n.map(S).join(" \xB7 ")}`:""}function ie(t,a,i,n,r){if(!t.size)return"";const e=tt(t,a,n).map(c=>{const s=c.passing?"muted-row":"",d=m=>({html:S(m),className:s});return[d(String(c.bin)),d(c.name??"\u2014"),d(String(c.count)),R(c.percent,`${c.percent.toFixed(1)}%`,s,r?.get(c.bin))]});return D(nt(i,it(t)),P(["Bin","Name","Dies","Share"],e,{className:"compact"}))}function pt(t,a,i,n,r,e){const c=Re(t,r);return["hard","soft"].map(s=>ie(st(t,s,s==="hard"?n.hard:n.soft),s==="hard"?a:i,s,c[s],e[s])).join(`
|
|
2
|
+
`)}function oe(t,a,i,n){const r=new Set(n),e=new Map(i.map(o=>[ct(o),o]));if(!i.some(o=>o.hbin!=null||o.sbin!=null)||!a.length)return"";const s=[];for(const o of a){let p=0,g=0;for(const b of o.dieKeys){const w=e.get(b);if(!w||w.partial||w.edgeExcluded)continue;const y=Z(w,r);y!==void 0&&(g++,y&&p++)}g&&s.push({label:o.label,pass:p,total:g})}if(!s.length)return"";const{rows:d}=X(s.map(o=>({key:o.label,label:o.label,n:o.total,passDies:o.pass,yieldPercent:o.pass/o.total*100}))),m=d.map(o=>[S(o.label),String(o.passDies),String(o.n),R(o.yieldPercent,ae(o.passDies,o.n)),H(o.delta)]);return D(t,P(["Region","Pass","Total","Yield","vs wafer"],m,{className:"compact"})+`<p class="report-legend">${E("the wafer")}</p>`)}function gt(t,a){const i=new Float64Array(t.length);let n=0;for(const g of t){const b=ut(g,a);b!==void 0&&Number.isFinite(b)&&(i[n++]=b)}if(n===0)return;const{count:r,min:e,mean:c,max:s,q1:d,median:m,q3:o,stddev:p}=lt(i.subarray(0,n));return{testNumber:a,count:r,min:e,mean:c,max:s,q1:d,median:m,q3:o,stddev:p}}function re(t,a,i,n,r){if(!a.length)return"";const e=t.filter(l=>!l.partial&&!l.edgeExcluded),c=new Map((i??[]).map(l=>[l.testNumber,l])),s=new Map((n??[]).map(l=>[l.testNumber,l.yieldPercent])),d=[];for(const l of a.filter(ke)){const u=c.get(l.testNumber)??gt(e,l.testNumber);u&&d.push({name:l.name,unit:l.unit||void 0,stats:u,limitYield:s.get(l.testNumber)})}if(!d.length)return"";const m=l=>d.every(u=>u.stats[l]!==void 0),o=m("q1")&&m("median")&&m("q3"),p=m("stddev"),g=d.some(l=>l.limitYield!==void 0&&l.limitYield!==null),b=(l,u)=>l===void 0?"\u2014":C(l,u),w=["Test","N","Min",...o?["Q1","Median"]:[],"Mean",...o?["Q3"]:[],"Max",...p?["StdDev"]:[],...g?["Limit yield"]:[]],y=d.map(({name:l,unit:u,stats:h,limitYield:$})=>[S(l),{html:String(h.count),className:"numeric"},b(h.min,u),...o?[b(h.q1,u),b(h.median,u)]:[],b(h.mean,u),...o?[b(h.q3,u)]:[],b(h.max,u),...p?[b(h.stddev,u)]:[],...g?[$==null?"\u2014":`${$.toFixed(1)}%`]:[]]);return D("Test Values",P(w,y,{className:"compact"})+`<p class="report-legend">${p?"StdDev is the sample standard deviation (n\u22121). ":""}${r??""}</p>`)}function le(t,a,i){const n=i??qe(t,a);if(!n?.length)return"";const r=n.map(e=>[S(e.label),String(e.totalDies),String(e.passDies),String(e.failDies),e.passRatePercent!==null?`${e.passRatePercent.toFixed(1)}%`:"\u2014"]);return D("Functional Tests",P(["Test","N","Pass","Fail","Pass Rate"],r,{className:"compact"}))}function ce(t,a){const i=Ze(t,a);if(!i.length)return"";const n=e=>e===null?"\u2014":e.toFixed(2),r=i.map(e=>[S(e.label),e.hasSpec?e.limitBasis==="spec"?`LSL ${C(e.lsl,e.unit)} \u2013 USL ${C(e.usl,e.unit)}`:`Lo limit ${C(e.lsl,e.unit)} \u2013 Hi limit ${C(e.usl,e.unit)}`:"\u2014",C(e.mean,e.unit),n(e.cp),n(e.cpk),n(e.pp),n(e.ppk)]);return D("Process Capability",P(["Test","Limits","Mean","Cp","Cpk","Pp","Ppk"],r,{className:"compact"}))}function de(t,a,i="",n=!1){const r=L(t);return r.length?D("Findings",ee(r,a,i,n)):""}function ue(t,a,i=""){const n=new Set(L(t.findings).map(r=>r.id));return ft(et(t,{passBins:a?[...a]:void 0}),n,i)}export function renderSummaryReportHtml(t,a={}){const{wafer:i,dies:n,yieldSummary:r,dataCoverage:e,hbinDefs:c,sbinDefs:s,testDefs:d=[],statsSummary:m,passBins:o,ringCount:p}=t,g=t.binColors??Ne(n,{passBins:o,hbinDefs:c,sbinDefs:s}),b=i.metadata,w=mt(b),y=a.title??`Wafer Summary${w}`,l=new Date().toLocaleString(),u=n.filter(dt),h=U(u,i,p),$=K(u,i,p),v=[{label:"Total dies",value:String(r.totalDies)},{label:"Filled dies",value:String(e.filledDies),hint:`${ae(e.filledDies,e.totalDies)} fill`},{label:"Pass dies",value:String(r.passDies)},{label:"Fail dies",value:String(r.failDies)},...r.partialDies>0?[{label:"Partial",value:String(r.partialDies)}]:[],...r.yieldPercent!==null?[{label:`Yield (pass: ${Le([o])})`,value:`${r.yieldPercent.toFixed(1)}%`}]:[],...r.edgeExcludedDies>0?[{label:"Edge excluded (outer zone)",value:String(r.edgeExcludedDies)}]:[]],x=[ne([{metadata:i.metadata}]),D("Summary",[se(v)].filter(Boolean).join(`
|
|
3
|
+
`)),m?ue(m,o):"",pt(n,c,s,{hard:m?.stats.hardBinCounts,soft:m?.stats.softBinCounts},o,g),oe("Ring Yield",h,n,o),oe("Quadrant Yield",$,n,o),re(n,d,m?.stats.perTestStats,m?.stats.testSpecYield),le(n,d,m?.stats.functionalYield),ce([{dies:n}],d),m?de(m.findings,void 0,"",t.live):""].filter(Boolean).join(`
|
|
4
4
|
`);return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
@@ -16,37 +16,37 @@ ${j()}
|
|
|
16
16
|
<h1>${S(y)}</h1>
|
|
17
17
|
<p class="report-subtitle">Generated ${S(l)}</p>
|
|
18
18
|
</header>
|
|
19
|
-
${
|
|
19
|
+
${te(x)}
|
|
20
20
|
<p class="footer">Generated ${S(l)}</p>
|
|
21
21
|
</main>
|
|
22
22
|
${t.live?k:""}
|
|
23
23
|
</body>
|
|
24
|
-
</html>`}function
|
|
25
|
-
`))}const
|
|
24
|
+
</html>`}function ht(t,a){const i=t.perWafer.flatMap(e=>{const c=e.summary.stats.yieldPercent;return c===null?[]:[{waferIndex:e.waferIndex,yieldPercent:c}]}),n=new Map(rt(i).rows.map(e=>[e.waferIndex,e])),r=t.perWafer.map(e=>{const c=S(_(a[e.waferIndex],e.waferIndex)),s=n.get(e.waferIndex);return s?[s.outlier?`${c} \xB7 ${s.outlier} outlier`:c,R(s.yieldPercent,`${s.yieldPercent.toFixed(1)}%`),H(s.delta)]:[c,"N/A",""]});return P(["Wafer","Yield","vs lot median"],r,{className:"compact"})+`<p class="report-legend">${E("the lot median")}</p>`}function bt(t){const a=[];for(const e of t.perWafer){const c=L(e.summary.findings);if(!c.length)continue;const s=e.summary.wafer?.waferId??`Wafer ${e.waferIndex+1}`;a.push(`<h3 class="report-subheading">${S(s)}</h3>`+ee(c))}if(!a.length)return"";const i=a.length,n=t.perWafer.length,r=`<p class="report-note">${i} of ${n} wafer${n===1?"":"s"} have per-wafer findings; the rest had none.</p>`;return D("Findings by Wafer",r+a.join(`
|
|
25
|
+
`))}const yt=3;function St(t,a,i){const n=t.map(d=>({metadata:d.wafer?.metadata})),r=Oe(n,{facetableOnly:!0}).filter(d=>d.splittable);if(!r.length)return"";const e=r.slice(0,yt),c=[];for(const d of e){const m=new Map;t.forEach((l,u)=>{const h=_e(l.wafer?.metadata,d.key)??Qe;(m.get(h)??m.set(h,[]).get(h)).push(u)});const o=[...m.entries()].map(([l,u])=>({key:l,items:u.map(h=>t[h])}));if(o.length<2)continue;const p=o.map(l=>[S(l.key),S(l.items.map(u=>u.label).join(", "))]),g=Ve(o.map(l=>({key:l.key,items:l.items.map(u=>({label:u.label,dies:u.dies,passBins:M(u,i)}))}))).map(l=>[S(l.label),String(l.itemCount),`${l.percent.toFixed(1)}%`]),b=[P([d.label,"Wafers"],p,{className:"compact"}),P([d.label,"Wafers","Yield"],g,{className:"compact"})],w=t.flatMap(l=>l.dies??[]);let y=0;for(const l of["spec","testFlag","functional"]){if(!Je(a,l,w))continue;const u=Ke(o.map(v=>({key:v.key,items:v.items.map(x=>({dies:x.dies,testSpecYield:x.statsSummary?.stats.testSpecYield,functionalYield:x.statsSummary?.stats.functionalYield}))})),a,l);if(!u.rows.length)continue;const h=u.rows.map(v=>[S(v.label),...v.byGroup.map(x=>x.passRatePercent===null?"\u2014":`${x.passRatePercent.toFixed(1)}%`),v.overall.passRatePercent===null?"\u2014":`${v.overall.passRatePercent.toFixed(1)}%`]),$=l==="spec"?"Pass rate \xB7 test limits":l==="testFlag"?"Pass rate \xB7 tester flag":"Pass rate \xB7 functional";u.disagreementDies&&(y=u.disagreementDies),b.push(`<h4 class="report-subheading">${S($)}</h4>`+P(["Test",...u.groups,"All"],h,{className:"compact"}))}y&&b.push(`<p class="report-note">${y.toLocaleString()} dies judged differently by limits and tester flag.</p>`),c.push(`<h3 class="report-subheading">${S(d.label)}</h3>${b.join(`
|
|
26
26
|
`)}`)}if(!c.length)return"";const s=r.length>e.length?`<p class="report-note">${r.length-e.length} further splittable field(s) not shown.</p>`:"";return D("Split Comparison",c.join(`
|
|
27
|
-
`)+s)}function
|
|
28
|
-
`)}function
|
|
29
|
-
`);return{lotSummary:o,sections:
|
|
27
|
+
`)+s)}function wt(t,a,i,n,r,e){const c=We(r);return["hard","soft"].map(s=>ie(at(n,t,s),s==="hard"?a:i,s,c[s],e[s])).join(`
|
|
28
|
+
`)}function fe(t,a,i,n,r,e){const c=He(i,n,r,d=>e[d],a);if(!c.length)return"";const s=X(c).rows.map(d=>[S(d.label),R(d.yieldPercent,`${d.yieldPercent.toFixed(1)}%`),H(d.delta)]);return D(t,P(["Region","Yield","vs lot"],s,{className:"compact"})+`<p class="report-legend">${E("the lot")}</p>`)}function $t(t,a,i,n){let r;if(i?.length&&i.every(e=>e.stats.perTestStats!==void 0)){const e=new Map;for(const c of i)for(const s of c.stats.perTestStats??[]){const d=e.get(s.testNumber)??{n:0,sum:0,min:1/0,max:-1/0,parts:[]};d.n+=s.count,d.sum+=s.mean*s.count,d.min=Math.min(d.min,s.min),d.max=Math.max(d.max,s.max),d.parts.push({n:s.count,mean:s.mean,sd:s.stddev}),e.set(s.testNumber,d)}r=[...e.entries()].map(([c,s])=>{const d=s.sum/s.n,m=s.parts.every(p=>p.sd!==void 0),o=m&&s.n>1?s.parts.reduce((p,g)=>p+Math.max(0,g.n-1)*g.sd**2+g.n*(g.mean-d)**2,0)/(s.n-1):m?0:void 0;return{testNumber:c,count:s.n,min:s.min,max:s.max,mean:d,...o!==void 0?{stddev:Math.sqrt(o)}:{}}})}return re(t,a,r,n,r?"Quartiles are not shown for a lot: they cannot be combined from each wafer\u2019s own.":void 0)}function vt(t,a,i){const n=Xe(i);return le(t,a,n)}const A=["lot","product","testProgram","temperature"];function xt(t){const a=new Map(A.map(e=>[e,new Set]));for(const e of t)for(const c of A){const s=e.wafer?.metadata?.[c];s!=null&&s!==""&&a.get(c).add(String(s))}const i=A.filter(e=>a.get(e).size>1);if(i.length===0)return[{label:"",items:t,varying:i}];const n=new Map,r=[];for(const e of t){const c=i.map(s=>String(e.wafer?.metadata?.[s]??"(none)")).join(" \xB7 ");n.has(c)||(n.set(c,[]),r.push(c)),n.get(c).push(e)}return r.map(e=>({label:e,items:n.get(e),varying:i}))}function me(t,a,i,n,r,e,c,s,d="",m=!1){const o=Ae(t.map(f=>f.source??f),{perWaferSummaries:t.map(f=>f.statsSummary),...c}),p=[],g=[],b=[],w=[];for(const f of t){const T=f.dies??[];f.wafer&&(p.push(f.wafer),b.push(T),w.push(M(f,r)));for(const F of T)g.push(F)}const y=t.map(f=>({dies:f.dies??[],passBins:M(f,r)})),l=s??Ie(y,{hbinDefs:a,sbinDefs:i}).colors,u=g.some(f=>f.hbin!=null),h=g.some(f=>f.sbin!=null),$=u||h,v=o.perWafer.map(f=>f.summary.stats.yieldPercent).filter(f=>f!==null),x=v.length?v.reduce((f,T)=>f+T,0)/v.length:null;let q=0,B=0,Y=0,W=0,N=0;for(const f of y){const T=new Set(f.passBins);for(const F of f.dies){if(q++,F.edgeExcluded&&W++,F.partial&&N++,F.partial||F.edgeExcluded)continue;const O=Z(F,T);O!==void 0&&(B++,O&&Y++)}}const ge=B-Y,z=B>0?Y/B*100:null,he=[{label:"Wafers",value:String(o.stats.waferCount)},{label:"Total dies",value:String(q)},...$?[{label:"Good dies",value:String(Y)},{label:"Bad dies",value:String(ge)}]:[],...W>0?[{label:"Edge excluded",value:String(W)}]:[],...N>0?[{label:"Partial dies",value:String(N)}]:[],...x!==null?[{label:ot,value:`${x.toFixed(1)}%`}]:[],...z!==null?[{label:"Total yield",value:`${z.toFixed(1)}%`}]:[]],be=J(o.perWafer.map(f=>f.summary.wafer)),ye=D(be.lotId!==void 0?"Lot Summary":"Summary",se(he)),Se=ne(t.map(f=>({metadata:f.wafer?.metadata}))),we=D("Per-Wafer Yield",ht(o,t)),G=e??Ee(t[0]),$e=St(t,n,r),I=o.perWafer.map(f=>f.summary),ve=$?wt(g,a,i,I,y,l):"",xe=$&&p.length?fe("Ring Yield (All Wafers)",U,b,p,G,w):"",De=$&&p.length?fe("Quadrant Yield (All Wafers)",K,b,p,G,w):"",Pe=n.length?$t(g,n,I,o.stats.testSpecYield):"",Fe=n.length?vt(g,n,I):"",Te=n.length?ce(t,n):"",Ce=o.findings.length?de(o.findings,o.stats.waferCount,d,m):"",Be=bt(o),Ye=[ye,ue(o,Me(y.map(f=>f.passBins)),d),Se,we,$e,ve,xe,De,Pe,Fe,Te,Ce,Be].filter(Boolean).join(`
|
|
29
|
+
`);return{lotSummary:o,sections:Ye}}function pe(t,a,i,n=""){return`<main class="report">
|
|
30
30
|
<header class="report-header">
|
|
31
31
|
<h1>${S(t)}</h1>
|
|
32
32
|
<p class="report-subtitle">Generated ${S(i)}</p>
|
|
33
33
|
</header>
|
|
34
|
-
${
|
|
34
|
+
${te(a,n)}
|
|
35
35
|
<p class="footer">Generated ${S(i)}</p>
|
|
36
|
-
</main>`}export function renderLotSummaryReportHtml(t,a={}){const{items:i,hbinDefs:n,sbinDefs:r,testDefs:e=[],passBins:c
|
|
36
|
+
</main>`}export function renderLotSummaryReportHtml(t,a={}){const{items:i,hbinDefs:n,sbinDefs:r,testDefs:e=[],passBins:c,ringCount:s,analyzeOptions:d}=t,m=new Date().toLocaleString(),o=xt(i);if(o.length===1){const{lotSummary:y,sections:l}=me(o[0].items,n,r,e,c,s,d,t.binColors,"",t.live),u=J(y.perWafer.map($=>$.summary.wafer)),h=a.title??(u.lotId!==void 0?`Lot Summary \u2014 ${u.lotId}`:`Summary \u2014 ${Ue(u)}`);return`<!DOCTYPE html>
|
|
37
37
|
<html lang="en">
|
|
38
38
|
<head>
|
|
39
39
|
<meta charset="UTF-8">
|
|
40
|
-
<title>${S(
|
|
40
|
+
<title>${S(h)}</title>
|
|
41
41
|
<style>
|
|
42
42
|
${j()}
|
|
43
43
|
</style>
|
|
44
44
|
</head>
|
|
45
45
|
<body>
|
|
46
|
-
${
|
|
46
|
+
${pe(h,l,m)}
|
|
47
47
|
${t.live?k:""}
|
|
48
48
|
</body>
|
|
49
|
-
</html>`}const p=a.title??"Summary",
|
|
49
|
+
</html>`}const p=a.title??"Summary",g=o.map((y,l)=>{const u=`g${l+1}-`,{lotSummary:h,sections:$}=me(y.items,n,r,e,c,s,d,t.binColors,u,t.live),v=y.varying.includes("lot")?void 0:h.lot?.lot??h.lot?.lotId,x=v?`${y.label} \xB7 Lot ${String(v)}`:y.label;return pe(`${p} \u2014 ${x}`,$,m,u)}),b=`<p style="max-width:1080px;margin:0 auto 8px;padding:8px 12px;background:var(--report-surface);border:1px solid var(--report-line);border-radius:4px;font-size:12px;color:var(--report-muted);">This load spans ${o.length} groups by identity \u2014 shown separately below so stats are never pooled across them.</p>`,w=g.map((y,l)=>`${l===0?"":'<hr style="max-width:1080px;margin:32px auto 0;border:none;border-top:3px solid var(--report-line-strong);">'}
|
|
50
50
|
${y}`).join(`
|
|
51
51
|
`);return`<!DOCTYPE html>
|
|
52
52
|
<html lang="en">
|
|
@@ -64,4 +64,4 @@ ${b}
|
|
|
64
64
|
${w}
|
|
65
65
|
${t.live?k:""}
|
|
66
66
|
</body>
|
|
67
|
-
</html>`}export{
|
|
67
|
+
</html>`}export{je as openHtmlReport};export function renderWaferReportHtml(t,a,i={}){return renderSummaryReportHtml({wafer:t.wafer,dies:t.dies,yieldSummary:t.yield,dataCoverage:t.dataCoverage,hbinDefs:t.hbinDefs,sbinDefs:t.sbinDefs,testDefs:t.testDefs,statsSummary:a??t.statsSummary??(V(t)?ze(t):void 0),passBins:[...t.passBins],ringCount:t.ringCount,binColors:i.binColors,live:i.live},i)}export function renderLotReportHtml(t,a={}){const i=Q(t.map(e=>e.hbinDefs)),n=Q(t.map(e=>e.sbinDefs)),r=t.some(e=>e.testDefs?.length)?Ge([...t]).defs:void 0;return renderLotSummaryReportHtml({items:t.map((e,c)=>({label:_(e,c),wafer:e.wafer,dies:e.dies,passBins:[...e.passBins],statsSummary:e.statsSummary,source:V(e)?e:void 0})),hbinDefs:i.length?i:void 0,sbinDefs:n.length?n:void 0,testDefs:r,ringCount:t[0]?.ringCount,analyzeOptions:a.analyzeOptions,binColors:a.binColors,live:a.live},{title:a.title})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StatsFinding, StatsSeverity } from './types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Synthesis } from './synthesis.js';
|
|
3
3
|
import { type MeterTier } from './presentation.js';
|
|
4
4
|
export type { MeterTier };
|
|
5
5
|
import { type FacetItem } from './facets.js';
|