@wafertools/wafermap 0.38.0 → 0.40.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/CHANGELOG.md +79 -3
- package/README.md +4 -3
- package/dist/packages/canvas-adapter/cellShade.d.ts +21 -0
- package/dist/packages/canvas-adapter/cellShade.js +1 -0
- package/dist/packages/canvas-adapter/charts/chartShell.d.ts +19 -3
- package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
- package/dist/packages/canvas-adapter/charts/commonality.js +4 -1
- package/dist/packages/canvas-adapter/charts/correlation.d.ts +11 -0
- package/dist/packages/canvas-adapter/charts/correlation.js +1 -1
- package/dist/packages/canvas-adapter/charts/divergingScale.d.ts +23 -0
- package/dist/packages/canvas-adapter/charts/divergingScale.js +1 -0
- package/dist/packages/canvas-adapter/charts/groupComparison.js +1 -1
- package/dist/packages/canvas-adapter/charts/palette.d.ts +10 -3
- package/dist/packages/canvas-adapter/charts/palette.js +1 -1
- package/dist/packages/canvas-adapter/charts/plotChart.d.ts +8 -0
- package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
- package/dist/packages/canvas-adapter/charts/regionYieldDiagram.js +1 -1
- package/dist/packages/canvas-adapter/charts/sweep.js +1 -1
- package/dist/packages/canvas-adapter/dataTab.js +1 -1
- package/dist/packages/canvas-adapter/differenceMapPanel.d.ts +1 -0
- package/dist/packages/canvas-adapter/differenceMapPanel.js +1 -1
- package/dist/packages/canvas-adapter/filterJson.d.ts +25 -0
- package/dist/packages/canvas-adapter/filterJson.js +5 -0
- package/dist/packages/canvas-adapter/insightsTab.js +1 -1
- package/dist/packages/canvas-adapter/pageFilter.js +2 -2
- package/dist/packages/canvas-adapter/plotEditor.js +10 -1
- package/dist/packages/canvas-adapter/plotJsonComplete.d.ts +46 -0
- package/dist/packages/canvas-adapter/plotJsonComplete.js +4 -0
- package/dist/packages/canvas-adapter/plotJsonHistory.d.ts +12 -0
- package/dist/packages/canvas-adapter/plotJsonHistory.js +1 -0
- package/dist/packages/canvas-adapter/plotJsonSuggest.d.ts +16 -0
- package/dist/packages/canvas-adapter/plotJsonSuggest.js +1 -0
- package/dist/packages/canvas-adapter/plotModal.js +1 -1
- package/dist/packages/canvas-adapter/plotTab.js +1 -1
- package/dist/packages/canvas-adapter/renderWaferGallery.js +1 -1
- package/dist/packages/canvas-adapter/renderWaferMap.js +1 -1
- package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
- package/dist/packages/canvas-adapter/sweepEditor.js +1 -1
- package/dist/packages/canvas-adapter/toCanvas.d.ts +1 -0
- package/dist/packages/canvas-adapter/toCanvas.js +1 -1
- package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
- package/dist/packages/canvas-adapter/userGuideHtml.js +81 -43
- package/dist/packages/canvas-adapter/version.d.ts +2 -2
- package/dist/packages/canvas-adapter/version.js +1 -1
- package/dist/packages/canvas-adapter/virtualTable.d.ts +2 -0
- package/dist/packages/canvas-adapter/virtualTable.js +1 -1
- package/dist/packages/core/compact.js +2 -2
- package/dist/packages/core/dieTable.js +1 -1
- package/dist/packages/core/utils.d.ts +6 -0
- package/dist/packages/core/utils.js +1 -1
- package/dist/packages/renderer/fmt.js +1 -1
- package/dist/packages/stats/chartCatalogue.js +1 -1
- package/dist/packages/stats/coFailure.d.ts +11 -0
- package/dist/packages/stats/coFailure.js +1 -0
- package/dist/packages/stats/commonality.d.ts +37 -4
- package/dist/packages/stats/commonality.js +1 -1
- package/dist/packages/stats/correlation.d.ts +7 -0
- package/dist/packages/stats/correlation.js +1 -1
- package/dist/packages/stats/dieRegions.d.ts +2 -0
- package/dist/packages/stats/dieRegions.js +1 -1
- package/dist/packages/stats/differenceMap.d.ts +2 -0
- package/dist/packages/stats/differenceMap.js +1 -1
- package/dist/packages/stats/examplePicks.d.ts +6 -0
- package/dist/packages/stats/examplePicks.js +1 -1
- package/dist/packages/stats/groupEffects.d.ts +66 -0
- package/dist/packages/stats/groupEffects.js +1 -0
- package/dist/packages/stats/plotData.d.ts +11 -2
- package/dist/packages/stats/plotData.js +1 -1
- package/dist/packages/stats/plotSpec.d.ts +31 -2
- package/dist/packages/stats/plotSpec.js +4 -4
- package/dist/packages/stats/plotTable.d.ts +18 -0
- package/dist/packages/stats/plotTable.js +1 -0
- package/dist/packages/stats/renderFindingsReport.js +1 -1
- package/dist/packages/stats/renderSummaryReport.js +7 -7
- package/dist/packages/stats/reportHtml.js +18 -13
- package/dist/packages/stats/sweep.d.ts +3 -3
- package/dist/packages/stats/sweepXFromName.js +1 -1
- package/dist/packages/stats/synthesis.d.ts +19 -0
- package/dist/packages/stats/synthesis.js +1 -1
- package/dist/packages/stats/testsByWafer.d.ts +11 -0
- package/dist/packages/stats/testsByWafer.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export function openHtmlReport(e){if(typeof window.__openHtmlReport=="function"){window.__openHtmlReport(e);return}const o=URL.createObjectURL(new Blob([e],{type:"text/html"})),n=window.open(o,"_blank");setTimeout(()=>URL.revokeObjectURL(o),3e4),n||console.warn("
|
|
1
|
+
export function openHtmlReport(e){if(typeof window.__openHtmlReport=="function"){window.__openHtmlReport(e);return}const o=URL.createObjectURL(new Blob([e],{type:"text/html"})),n=window.open(o,"_blank");setTimeout(()=>URL.revokeObjectURL(o),3e4),n||console.warn("window.open() returned null, so the report could not be shown. If this host cannot use window.open (e.g. Tauri, or popups are blocked), call setReportOpener() to supply your own opener.")}export function setReportOpener(e){window.__openHtmlReport=e}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{waferDisplayLabel as
|
|
2
|
-
`)}function fe(e,i,o,s){const r=new Set(s),t=new Map(o.map(n=>[gt(n),n]));if(!o.some(n=>n.hbin!=null||n.sbin!=null)||!i.length)return"";const l=[];for(const n of i){let m=0,y=0;for(const v of n.dieKeys){const S=t.get(v);if(!S||!j(S))continue;const p=oe(S,r);p!==void 0&&(y++,p&&m++)}y&&l.push({label:n.label,pass:m,total:y})}if(!l.length)return"";const{rows:c}=ie(l.map(n=>({key:n.label,label:n.label,n:n.total,passDies:n.pass,yieldPercent:n.pass/n.total*100}))),u=c.map(n=>[w(n.label),String(n.passDies),String(n.n),M(n.yieldPercent,O(n.passDies,n.n)),q(n.delta)]);return x(e,P(["Region","Pass","Total","Yield","vs wafer"],u,{className:"compact"})+`<p class="report-legend">${A("the wafer")}</p>`)}function Pt(e,i){const o=new Float64Array(e.length);let s=0;for(const y of e){const v=yt(y,i);v!==void 0&&Number.isFinite(v)&&(o[s++]=v)}if(s===0)return;const{count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:m}=pt(o.subarray(0,s));return{testNumber:i,count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:m}}function me(e,i,o,s,r,t){if(!i.length)return"";const a=e.filter(d=>j(d)),l=new Map((o??[]).map(d=>[d.testNumber,d])),c=new Map((s??[]).map(d=>[d.testNumber,d.yieldPercent])),u=[];for(const d of i.filter(E)){const f=l.get(d.testNumber)??Pt(a,d.testNumber);f&&u.push({name:d.name,unit:d.unit||void 0,stats:f,limitYield:c.get(d.testNumber)})}if(!u.length)return"";const n=d=>u.every(f=>f.stats[d]!==void 0),m=n("q1")&&n("median")&&n("q3"),y=n("stddev"),v=u.some(d=>d.limitYield!==void 0&&d.limitYield!==null),S=(d,f)=>d===void 0?"\u2014":N(d,f),p=bt(a),g=p?`${[...p.counts.values()].reduce((d,f)=>d+f,0).toLocaleString("en-GB")} values outside the ${St(p.by)} are excluded (not in N): `+[...p.counts].map(([d,f])=>`${w(i.find($=>$.testNumber===d)?.name??`test ${d}`)} ${f.toLocaleString("en-GB")}`).join(", ")+". ":"",b=["Test","N","Min",...m?["Q1","Median"]:[],"Mean",...m?["Q3"]:[],"Max",...y?["StdDev"]:[],...v?["Limit yield"]:[]],D=u.map(({name:d,unit:f,stats:$,limitYield:F})=>[w(d),{html:String($.count),className:"numeric"},S($.min,f),...m?[S($.q1,f),S($.median,f)]:[],S($.mean,f),...m?[S($.q3,f)]:[],S($.max,f),...y?[S($.stddev,f)]:[],...v?[F==null?"\u2014":`${F.toFixed(1)}%`]:[]]);return x("Test Values",P(b,D,{className:"compact"})+`<p class="report-legend">${y?"StdDev is the sample standard deviation (n\u22121). ":""}${g}${r??""}</p>`,"",t)}function pe(e,i,o,s){const r=o??Qe(e,i);if(!r?.length)return"";const t=r.map(a=>[w(a.label),String(a.totalDies),String(a.passDies),String(a.failDies),a.passRatePercent!==null?`${a.passRatePercent.toFixed(1)}%`:"\u2014"]);return x("Functional Tests",P(["Test","N","Pass","Fail","Pass Rate"],t,{className:"compact"}),"",s)}function ge(e,i){const o=at(e,i);if(!o.length)return"";const s=t=>t===null?"\u2014":t.toFixed(2),r=o.map(t=>[w(t.label),t.hasSpec?t.limitBasis==="spec"?`LSL ${N(t.lsl,t.unit)} \u2013 USL ${N(t.usl,t.unit)}`:`Lo limit ${N(t.lsl,t.unit)} \u2013 Hi limit ${N(t.usl,t.unit)}`:"\u2014",N(t.mean,t.unit),s(t.cp),s(t.cpk),s(t.pp),s(t.ppk)]);return x("Process Capability",P(["Test","Limits","Mean","Cp","Cpk","Pp","Ppk"],r,{className:"compact"}))}function he(e,i,o="",s=!1){const r=H(e);return r.length?x("Findings",re(r,i,o,s)):""}const _=e=>`report-tests-${e}`,Q=e=>`report-functional-${e}`;function be(e,i,o,s){const r=new Set(H(e.findings).map(a=>a.id)),t=a=>a.kind==="finding"?r.has(a.id)?wt(a.id,o):void 0:s.get(a.testNumber);return $t(ot(e,{passBins:i?[...i]:void 0}),t)}function ye(e,i,o,s){const r=new Map;for(const t of e)(E(t)?o:s)&&r.set(t.testNumber,E(t)?_(i):Q(i));return r}export function renderSummaryReportHtml(e,i={}){const{wafer:o,dies:s,yieldSummary:r,dataCoverage:t,hbinDefs:a,sbinDefs:l,testDefs:c=[],statsSummary:u,passBins:n,ringCount:m}=e,y=e.binColors??Ee(s,{passBins:n,hbinDefs:a,sbinDefs:l}),v=o.metadata,S=Dt(v),p=i.title??`Wafer Summary${S}`,g=new Date().toLocaleString(),b=s.filter(ht),D=ne(b,o,m),d=se(b,o,m),f=qe(u?.stats.isLotStack,u?.stats.aggregationMethod),$=f?[{label:"Total dies",value:String(r.totalDies)},{label:"Filled dies",value:String(t.filledDies),hint:`${O(t.filledDies,t.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: ${je([n])})`,value:`${r.yieldPercent.toFixed(1)}%`}]:[],...r.edgeExcludedDies>0?[{label:"Edge excluded (outer zone)",value:String(r.edgeExcludedDies)}]:[]]:[{label:"Dies",value:String(s.length)},{label:"Filled dies",value:String(t.filledDies),hint:`${O(t.filledDies,t.totalDies)} fill`}],F=me(s,c,u?.stats.perTestStats,u?.stats.testSpecYield,void 0,_("")),B=pe(s,c,u?.stats.functionalYield,Q("")),C=[ce([{metadata:o.metadata}]),x("Summary",[de($)].filter(Boolean).join(`
|
|
1
|
+
import{waferDisplayLabel as k}from"../core/waferLabel.js";import{binPassSets as ke,binPassSetsByWafer as Ie,mergeBinDefs as ee,resolveBinColors as Ee,resolveBinColorsByWafer as He}from"../renderer/binColors.js";import{commonPassBins as Ae,itemPassBins as I,passBinsLabel as je}from"../core/passBins.js";import{itemRingCount as Ge}from"../core/ringCount.js";import{stackBinsAreData as qe}from"../core/aggregates.js";import{isParametricTest as E,isBuiltMap as te}from"../renderer/buildWaferMap.js";import{buildRingRegions as ne,buildQuadrantRegions as se,buildRegionYieldData as ze}from"./regions.js";import{openHtmlReport as Oe}from"./renderFindingsReport.js";import{analyzeWaferLot as _e}from"./analyzeWaferLot.js";import{computeFunctionalYield as Qe,analyzeWaferMap as Ve}from"./analyzeWaferMap.js";import{mergeTestDefs as Ue}from"./mergeTestDefs.js";import{buildFacetTable as Ke,facetValueOf as Je,FACET_NONE_VALUE as Xe}from"./facets.js";import{visibleFindings as H}from"./filterFindings.js";import{buildYieldDataCombined as Ze}from"./yield.js";import{describeWaferPopulation as ae,populationLabel as et}from"./population.js";import{buildTestPassRateData as tt,hasJudgeableTests as nt,poolFunctionalYield as st}from"./testPassRate.js";import{buildCapabilityData as at,pooledTestStatsSteps as it}from"./capability.js";import{buildSynthesis as ot}from"./synthesis.js";import{binBreakdownRows as rt,binBreakdownTitle as lt,binCountsFrom as ct,pooledBinCounts as dt,totalOf as ut}from"./binRows.js";import{MEAN_WAFER_YIELD_LABEL as ft,shortfallLegend as A}from"./presentation.js";import{regionYieldRows as ie,waferYieldRows as mt}from"./yieldRows.js";import{describeValues as pt}from"./math.js";import{fmt as N}from"../renderer/fmt.js";import{isYieldEligibleDie as j,getDieKey as gt,isPositionedDie as ht,diePassStatus as oe}from"../core/dies.js";import{excludedCounts as bt,testValue as yt}from"../core/dieTable.js";import{limitSetName as St}from"../renderer/valueFilter.js";import{findingsTableHtml as re,findingAnchor as wt,synthesisSectionHtml as $t,reportScripts as G,barCell as M,deltaCell as q,withSectionNav as le,renderMetadataSection as ce,renderMetricGrid as de,renderSection as x,renderTable as P,reportStyles as z}from"./reportHtml.js";import{escHtml as w,drain as vt}from"../core/utils.js";function O(e,i){return i===0?"\u2014":`${(e/i*100).toFixed(1)}%`}function Dt(e){if(!e)return"";const i=e.lot??e.lotId,o=e.wafer??e.waferId,s=[i,o].filter(Boolean).map(String);return s.length?` \u2014 ${s.map(w).join(" \xB7 ")}`:""}function ue(e,i,o,s,r){if(!e.size)return"";const t=rt(e,i,s).map(a=>{const l=a.passing?"muted-row":"",c=u=>({html:w(u),className:l});return[c(String(a.bin)),c(a.name??"\u2014"),c(String(a.count)),M(a.percent,`${a.percent.toFixed(1)}%`,l,r?.get(a.bin))]});return x(lt(o,ut(e)),P(["Bin","Name","Dies","Share"],t,{className:"compact"}))}function xt(e,i,o,s,r,t){const a=ke(e,r);return["hard","soft"].map(l=>ue(ct(e,l,l==="hard"?s.hard:s.soft),l==="hard"?i:o,l,a[l],t[l])).join(`
|
|
2
|
+
`)}function fe(e,i,o,s){const r=new Set(s),t=new Map(o.map(n=>[gt(n),n]));if(!o.some(n=>n.hbin!=null||n.sbin!=null)||!i.length)return"";const l=[];for(const n of i){let m=0,y=0;for(const v of n.dieKeys){const S=t.get(v);if(!S||!j(S))continue;const p=oe(S,r);p!==void 0&&(y++,p&&m++)}y&&l.push({label:n.label,pass:m,total:y})}if(!l.length)return"";const{rows:c}=ie(l.map(n=>({key:n.label,label:n.label,n:n.total,passDies:n.pass,yieldPercent:n.pass/n.total*100}))),u=c.map(n=>[w(n.label),String(n.passDies),String(n.n),M(n.yieldPercent,O(n.passDies,n.n)),q(n.delta)]);return x(e,P(["Region","Pass","Total","Yield","vs wafer"],u,{className:"compact"})+`<p class="report-legend">${A("the wafer")}</p>`)}function Pt(e,i){const o=new Float64Array(e.length);let s=0;for(const y of e){const v=yt(y,i);v!==void 0&&Number.isFinite(v)&&(o[s++]=v)}if(s===0)return;const{count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:m}=pt(o.subarray(0,s));return{testNumber:i,count:r,min:t,mean:a,max:l,q1:c,median:u,q3:n,stddev:m}}function me(e,i,o,s,r,t){if(!i.length)return"";const a=e.filter(d=>j(d)),l=new Map((o??[]).map(d=>[d.testNumber,d])),c=new Map((s??[]).map(d=>[d.testNumber,d.yieldPercent])),u=[];for(const d of i.filter(E)){const f=l.get(d.testNumber)??Pt(a,d.testNumber);f&&u.push({name:d.name,unit:d.unit||void 0,stats:f,limitYield:c.get(d.testNumber)})}if(!u.length)return"";const n=d=>u.every(f=>f.stats[d]!==void 0),m=n("q1")&&n("median")&&n("q3"),y=n("stddev"),v=u.some(d=>d.limitYield!==void 0&&d.limitYield!==null),S=(d,f)=>d===void 0?"\u2014":N(d,f),p=bt(a),g=p?`${[...p.counts.values()].reduce((d,f)=>d+f,0).toLocaleString("en-GB")} values outside the ${St(p.by)} are excluded (not in N): `+[...p.counts].map(([d,f])=>`${w(i.find($=>$.testNumber===d)?.name??`test ${d}`)} ${f.toLocaleString("en-GB")}`).join(", ")+". ":"",b=["Test","N","Min",...m?["Q1","Median"]:[],"Mean",...m?["Q3"]:[],"Max",...y?["StdDev"]:[],...v?["Limit yield"]:[]],D=u.map(({name:d,unit:f,stats:$,limitYield:F})=>[w(d),{html:String($.count),className:"numeric"},S($.min,f),...m?[S($.q1,f),S($.median,f)]:[],S($.mean,f),...m?[S($.q3,f)]:[],S($.max,f),...y?[S($.stddev,f)]:[],...v?[F==null?"\u2014":`${F.toFixed(1)}%`]:[]]);return x("Test Values",P(b,D,{className:"compact"})+`<p class="report-legend">${y?"StdDev is the sample standard deviation (n\u22121). ":""}${g}${r??""}</p>`,"",t)}function pe(e,i,o,s){const r=o??Qe(e,i);if(!r?.length)return"";const t=r.map(a=>[w(a.label),String(a.totalDies),String(a.passDies),String(a.failDies),a.passRatePercent!==null?`${a.passRatePercent.toFixed(1)}%`:"\u2014"]);return x("Functional Tests",P(["Test","N","Pass","Fail","Pass Rate"],t,{className:"compact"}),"",s)}function ge(e,i){const o=at(e,i);if(!o.length)return"";const s=t=>t===null?"\u2014":t.toFixed(2),r=o.map(t=>[w(t.label),t.hasSpec?t.limitBasis==="spec"?`LSL ${N(t.lsl,t.unit)} \u2013 USL ${N(t.usl,t.unit)}`:`Lo limit ${N(t.lsl,t.unit)} \u2013 Hi limit ${N(t.usl,t.unit)}`:"\u2014",N(t.mean,t.unit),s(t.cp),s(t.cpk),s(t.pp),s(t.ppk)]);return x("Process Capability",P(["Test","Limits","Mean","Cp","Cpk","Pp","Ppk"],r,{className:"compact"}))}function he(e,i,o="",s=!1){const r=H(e);return r.length?x("Findings",re(r,i,o,s)):""}const _=e=>`report-tests-${e}`,Q=e=>`report-functional-${e}`;function be(e,i,o,s){const r=new Set(H(e.findings).map(a=>a.id)),t=a=>a.kind==="finding"?r.has(a.id)?wt(a.id,o):void 0:a.kind==="test"?s.get(a.testNumber):void 0;return $t(ot(e,{passBins:i?[...i]:void 0}),t)}function ye(e,i,o,s){const r=new Map;for(const t of e)(E(t)?o:s)&&r.set(t.testNumber,E(t)?_(i):Q(i));return r}export function renderSummaryReportHtml(e,i={}){const{wafer:o,dies:s,yieldSummary:r,dataCoverage:t,hbinDefs:a,sbinDefs:l,testDefs:c=[],statsSummary:u,passBins:n,ringCount:m}=e,y=e.binColors??Ee(s,{passBins:n,hbinDefs:a,sbinDefs:l}),v=o.metadata,S=Dt(v),p=i.title??`Wafer Summary${S}`,g=new Date().toLocaleString(),b=s.filter(ht),D=ne(b,o,m),d=se(b,o,m),f=qe(u?.stats.isLotStack,u?.stats.aggregationMethod),$=f?[{label:"Total dies",value:String(r.totalDies)},{label:"Filled dies",value:String(t.filledDies),hint:`${O(t.filledDies,t.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: ${je([n])})`,value:`${r.yieldPercent.toFixed(1)}%`}]:[],...r.edgeExcludedDies>0?[{label:"Edge excluded (outer zone)",value:String(r.edgeExcludedDies)}]:[]]:[{label:"Dies",value:String(s.length)},{label:"Filled dies",value:String(t.filledDies),hint:`${O(t.filledDies,t.totalDies)} fill`}],F=me(s,c,u?.stats.perTestStats,u?.stats.testSpecYield,void 0,_("")),B=pe(s,c,u?.stats.functionalYield,Q("")),C=[ce([{metadata:o.metadata}]),x("Summary",[de($)].filter(Boolean).join(`
|
|
3
3
|
`)),u?be(u,n,"",ye(c,"",!!F,!!B)):"",f?xt(s,a,l,{hard:u?.stats.hardBinCounts,soft:u?.stats.softBinCounts},n,y):"",f?fe("Ring Yield",D,s,n):"",f?fe("Quadrant Yield",d,s,n):"",F,B,ge([{dies:s}],c),u?he(u.findings,void 0,"",e.live):""].filter(Boolean).join(`
|
|
4
4
|
`);return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
@@ -21,11 +21,11 @@ ${z()}
|
|
|
21
21
|
</main>
|
|
22
22
|
${G(e.live)}
|
|
23
23
|
</body>
|
|
24
|
-
</html>`}function Ft(e,i){const o=e.perWafer.flatMap(t=>{const a=t.summary.stats.yieldPercent;return a===null?[]:[{waferIndex:t.waferIndex,yieldPercent:a}]}),s=new Map(mt(o).rows.map(t=>[t.waferIndex,t])),r=e.perWafer.map(t=>{const a=w(
|
|
25
|
-
`))}const Ct=3;function Tt(e,i,o){const s=e.map(c=>({metadata:c.wafer?.metadata})),r=Ke(s,{facetableOnly:!0}).filter(c=>c.splittable);if(!r.length)return"";const t=r.slice(0,Ct),a=[];for(const c of t){const u=new Map;e.forEach((g,b)=>{const D=Je(g.wafer?.metadata,c.key)??Xe;(u.get(D)??u.set(D,[]).get(D)).push(b)});const n=[...u.entries()].map(([g,b])=>({key:g,items:b.map(D=>e[D])}));if(n.length<2)continue;const m=n.map(g=>[w(g.key),w(g.items.map(b=>b.label).join(", "))]),y=Ze(n.map(g=>({key:g.key,items:g.items.map(b=>({label:b.label,dies:b.dies,passBins:
|
|
24
|
+
</html>`}function Ft(e,i){const o=e.perWafer.flatMap(t=>{const a=t.summary.stats.yieldPercent;return a===null?[]:[{waferIndex:t.waferIndex,yieldPercent:a}]}),s=new Map(mt(o).rows.map(t=>[t.waferIndex,t])),r=e.perWafer.map(t=>{const a=w(k(i[t.waferIndex],t.waferIndex)),l=s.get(t.waferIndex);return l?[l.outlier?`${a} \xB7 ${l.outlier} outlier`:a,M(l.yieldPercent,`${l.yieldPercent.toFixed(1)}%`),q(l.delta)]:[a,"N/A",""]});return P(["Wafer","Yield","vs lot median"],r,{className:"compact"})+`<p class="report-legend">${A("the lot median")}</p>`}function Bt(e){const i=[];for(const t of e.perWafer){const a=H(t.summary.findings);if(!a.length)continue;const l=k({wafer:{metadata:t.summary.wafer}},t.waferIndex);i.push(`<h3 class="report-subheading">${w(l)}</h3>`+re(a))}if(!i.length)return"";const o=i.length,s=e.perWafer.length,r=`<p class="report-note">${o} of ${s} wafer${s===1?"":"s"} have per-wafer findings; the rest had none.</p>`;return x("Findings by Wafer",r+i.join(`
|
|
25
|
+
`))}const Ct=3;function Tt(e,i,o){const s=e.map(c=>({metadata:c.wafer?.metadata})),r=Ke(s,{facetableOnly:!0}).filter(c=>c.splittable);if(!r.length)return"";const t=r.slice(0,Ct),a=[];for(const c of t){const u=new Map;e.forEach((g,b)=>{const D=Je(g.wafer?.metadata,c.key)??Xe;(u.get(D)??u.set(D,[]).get(D)).push(b)});const n=[...u.entries()].map(([g,b])=>({key:g,items:b.map(D=>e[D])}));if(n.length<2)continue;const m=n.map(g=>[w(g.key),w(g.items.map(b=>b.label).join(", "))]),y=Ze(n.map(g=>({key:g.key,items:g.items.map(b=>({label:b.label,dies:b.dies,passBins:I(b,o)}))}))).map(g=>[w(g.label),String(g.itemCount),`${g.percent.toFixed(1)}%`]),v=[P([c.label,"Wafers"],m,{className:"compact"}),P([c.label,"Wafers","Yield"],y,{className:"compact"})],S=e.flatMap(g=>g.dies??[]);let p=0;for(const g of["spec","testFlag","functional"]){if(!nt(i,g,S))continue;const b=tt(n.map(f=>({key:f.key,items:f.items.map($=>({dies:$.dies,testSpecYield:$.statsSummary?.stats.testSpecYield,functionalYield:$.statsSummary?.stats.functionalYield}))})),i,g);if(!b.rows.length)continue;const D=b.rows.map(f=>[w(f.label),...f.byGroup.map($=>$.passRatePercent===null?"\u2014":`${$.passRatePercent.toFixed(1)}%`),f.overall.passRatePercent===null?"\u2014":`${f.overall.passRatePercent.toFixed(1)}%`]),d=g==="spec"?"Pass rate \xB7 test limits":g==="testFlag"?"Pass rate \xB7 tester flag":"Pass rate \xB7 functional";b.disagreementDies&&(p=b.disagreementDies),v.push(`<h4 class="report-subheading">${w(d)}</h4>`+P(["Test",...b.groups,"All"],D,{className:"compact"}))}p&&v.push(`<p class="report-note">${p.toLocaleString()} dies judged differently by limits and tester flag.</p>`),a.push(`<h3 class="report-subheading">${w(c.label)}</h3>${v.join(`
|
|
26
26
|
`)}`)}if(!a.length)return"";const l=r.length>t.length?`<p class="report-note">${r.length-t.length} further wafer field(s) not shown.</p>`:"";return x("Group Comparison",a.join(`
|
|
27
|
-
`)+l)}function Yt(e,i,o,s,r,t){const a=
|
|
28
|
-
`)}function Se(e,i,o,s,r,t){const a=ze(o,s,r,c=>t[c],i);if(!a.length)return"";const l=ie(a).rows.map(c=>[w(c.label),M(c.yieldPercent,`${c.yieldPercent.toFixed(1)}%`),q(c.delta)]);return x(e,P(["Region","Yield","vs lot"],l,{className:"compact"})+`<p class="report-legend">${A("the lot")}</p>`)}function Nt(e,i,o,s,r,t){let a;if(s?.length&&s.every(c=>c.stats.perTestStats!==void 0)){const c=new Map;for(const u of s)for(const n of u.stats.perTestStats??[]){const m=c.get(n.testNumber)??{n:0,sum:0,min:1/0,max:-1/0,parts:[]};m.n+=n.count,m.sum+=n.mean*n.count,m.min=Math.min(m.min,n.min),m.max=Math.max(m.max,n.max),m.parts.push({n:n.count,mean:n.mean,sd:n.stddev}),c.set(n.testNumber,m)}a=[...c.entries()].map(([u,n])=>{const m=n.sum/n.n,y=n.parts.every(S=>S.sd!==void 0),v=y&&n.n>1?n.parts.reduce((S,p)=>S+Math.max(0,p.n-1)*p.sd**2+p.n*(p.mean-m)**2,0)/(n.n-1):y?0:void 0;return{testNumber:u,count:n.n,min:n.min,max:n.max,mean:m,...v!==void 0?{stddev:Math.sqrt(v)}:{}}})}const l=a?void 0:[...vt(it(e,o)).stats].map(([c,u])=>({testNumber:c,...u}));return me(i,o,a??l,r,a?"Quartiles are not shown for a lot: they cannot be combined from each wafer\u2019s own.":void 0,t)}function Mt(e,i,o,s){const r=st(o);return pe(e,i,r,s)}const V=["lot","product","testProgram","temperature"];function Rt(e){const i=new Map(V.map(t=>[t,new Set]));for(const t of e)for(const a of V){const l=t.wafer?.metadata?.[a];l!=null&&l!==""&&i.get(a).add(String(l))}const o=V.filter(t=>i.get(t).size>1);if(o.length===0)return[{label:"",items:e,varying:o}];const s=new Map,r=[];for(const t of e){const a=o.map(l=>String(t.wafer?.metadata?.[l]??"(none)")).join(" \xB7 ");s.has(a)||(s.set(a,[]),r.push(a)),s.get(a).push(t)}return r.map(t=>({label:t,items:s.get(t),varying:o}))}function we(e,i,o,s,r,t,a,l,c="",u=!1){const n=_e(e.map(h=>h.source??h),{perWaferSummaries:e.map(h=>h.statsSummary),...a}),m=[],y=[],v=[],S=[];for(const h of e){const T=h.dies??[];h.wafer&&(m.push(h.wafer),v.push(T),S.push(
|
|
27
|
+
`)+l)}function Yt(e,i,o,s,r,t){const a=Ie(r);return["hard","soft"].map(l=>ue(dt(s,e,l),l==="hard"?i:o,l,a[l],t[l])).join(`
|
|
28
|
+
`)}function Se(e,i,o,s,r,t){const a=ze(o,s,r,c=>t[c],i);if(!a.length)return"";const l=ie(a).rows.map(c=>[w(c.label),M(c.yieldPercent,`${c.yieldPercent.toFixed(1)}%`),q(c.delta)]);return x(e,P(["Region","Yield","vs lot"],l,{className:"compact"})+`<p class="report-legend">${A("the lot")}</p>`)}function Nt(e,i,o,s,r,t){let a;if(s?.length&&s.every(c=>c.stats.perTestStats!==void 0)){const c=new Map;for(const u of s)for(const n of u.stats.perTestStats??[]){const m=c.get(n.testNumber)??{n:0,sum:0,min:1/0,max:-1/0,parts:[]};m.n+=n.count,m.sum+=n.mean*n.count,m.min=Math.min(m.min,n.min),m.max=Math.max(m.max,n.max),m.parts.push({n:n.count,mean:n.mean,sd:n.stddev}),c.set(n.testNumber,m)}a=[...c.entries()].map(([u,n])=>{const m=n.sum/n.n,y=n.parts.every(S=>S.sd!==void 0),v=y&&n.n>1?n.parts.reduce((S,p)=>S+Math.max(0,p.n-1)*p.sd**2+p.n*(p.mean-m)**2,0)/(n.n-1):y?0:void 0;return{testNumber:u,count:n.n,min:n.min,max:n.max,mean:m,...v!==void 0?{stddev:Math.sqrt(v)}:{}}})}const l=a?void 0:[...vt(it(e,o)).stats].map(([c,u])=>({testNumber:c,...u}));return me(i,o,a??l,r,a?"Quartiles are not shown for a lot: they cannot be combined from each wafer\u2019s own.":void 0,t)}function Mt(e,i,o,s){const r=st(o);return pe(e,i,r,s)}const V=["lot","product","testProgram","temperature"];function Rt(e){const i=new Map(V.map(t=>[t,new Set]));for(const t of e)for(const a of V){const l=t.wafer?.metadata?.[a];l!=null&&l!==""&&i.get(a).add(String(l))}const o=V.filter(t=>i.get(t).size>1);if(o.length===0)return[{label:"",items:e,varying:o}];const s=new Map,r=[];for(const t of e){const a=o.map(l=>String(t.wafer?.metadata?.[l]??"(none)")).join(" \xB7 ");s.has(a)||(s.set(a,[]),r.push(a)),s.get(a).push(t)}return r.map(t=>({label:t,items:s.get(t),varying:o}))}function we(e,i,o,s,r,t,a,l,c="",u=!1){const n=_e(e.map(h=>h.source??h),{perWaferSummaries:e.map(h=>h.statsSummary),...a}),m=[],y=[],v=[],S=[];for(const h of e){const T=h.dies??[];h.wafer&&(m.push(h.wafer),v.push(T),S.push(I(h,r)));for(const Y of T)y.push(Y)}const p=e.map(h=>({dies:h.dies??[],passBins:I(h,r)})),g=l??He(p,{hbinDefs:i,sbinDefs:o}).colors,b=y.some(h=>h.hbin!=null),D=y.some(h=>h.sbin!=null),d=b||D,f=n.perWafer.map(h=>h.summary.stats.yieldPercent).filter(h=>h!==null),$=f.length?f.reduce((h,T)=>h+T,0)/f.length:null;let F=0,B=0,C=0,R=0,W=0;for(const h of p){const T=new Set(h.passBins);for(const Y of h.dies){if(F++,Y.edgeExcluded&&R++,Y.partial&&W++,!j(Y))continue;const Z=oe(Y,T);Z!==void 0&&(B++,Z&&C++)}}const ve=B-C,U=B>0?C/B*100:null,De=[{label:"Wafers",value:String(n.stats.waferCount)},{label:"Total dies",value:String(F)},...d?[{label:"Good dies",value:String(C)},{label:"Bad dies",value:String(ve)}]:[],...R>0?[{label:"Edge excluded",value:String(R)}]:[],...W>0?[{label:"Partial dies",value:String(W)}]:[],...$!==null?[{label:ft,value:`${$.toFixed(1)}%`}]:[],...U!==null?[{label:"Total yield",value:`${U.toFixed(1)}%`}]:[]],xe=ae(n.perWafer.map(h=>h.summary.wafer)),Pe=x(xe.lotId!==void 0?"Lot Summary":"Summary",de(De)),Fe=ce(e.map(h=>({metadata:h.wafer?.metadata}))),Be=x("Per-Wafer Yield",Ft(n,e)),K=t??Ge(e[0]),Ce=Tt(e,s,r),L=n.perWafer.map(h=>h.summary),Te=d?Yt(y,i,o,L,p,g):"",Ye=d&&m.length?Se("Ring Yield (All Wafers)",ne,v,m,K,S):"",Ne=d&&m.length?Se("Quadrant Yield (All Wafers)",se,v,m,K,S):"",J=s.length?Nt(e,y,s,L,n.stats.testSpecYield,_(c)):"",X=s.length?Mt(y,s,L,Q(c)):"",Me=s.length?ge(e,s):"",Re=n.findings.length?he(n.findings,n.stats.waferCount,c,u):"",We=Bt(n),Le=[Pe,be(n,Ae(p.map(h=>h.passBins)),c,ye(s,c,!!J,!!X)),Fe,Be,Ce,Te,Ye,Ne,J,X,Me,Re,We].filter(Boolean).join(`
|
|
29
29
|
`);return{lotSummary:n,sections:Le}}function $e(e,i,o,s=""){return`<main class="report">
|
|
30
30
|
<header class="report-header">
|
|
31
31
|
<h1>${w(e)}</h1>
|
|
@@ -64,4 +64,4 @@ ${v}
|
|
|
64
64
|
${S}
|
|
65
65
|
${G(e.live)}
|
|
66
66
|
</body>
|
|
67
|
-
</html>`}export{Oe as openHtmlReport};export function renderWaferReportHtml(e,i,o={}){return renderSummaryReportHtml({wafer:e.wafer,dies:e.dies,yieldSummary:e.yield,dataCoverage:e.dataCoverage,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,statsSummary:i??e.statsSummary??(te(e)?Ve(e):void 0),passBins:[...e.passBins],ringCount:e.ringCount,binColors:o.binColors,live:o.live},o)}export function renderLotReportHtml(e,i={}){const o=ee(e.map(t=>t.hbinDefs)),s=ee(e.map(t=>t.sbinDefs)),r=e.some(t=>t.testDefs?.length)?Ue([...e]).defs:void 0;return renderLotSummaryReportHtml({items:e.map((t,a)=>({label:
|
|
67
|
+
</html>`}export{Oe as openHtmlReport};export function renderWaferReportHtml(e,i,o={}){return renderSummaryReportHtml({wafer:e.wafer,dies:e.dies,yieldSummary:e.yield,dataCoverage:e.dataCoverage,hbinDefs:e.hbinDefs,sbinDefs:e.sbinDefs,testDefs:e.testDefs,statsSummary:i??e.statsSummary??(te(e)?Ve(e):void 0),passBins:[...e.passBins],ringCount:e.ringCount,binColors:o.binColors,live:o.live},o)}export function renderLotReportHtml(e,i={}){const o=ee(e.map(t=>t.hbinDefs)),s=ee(e.map(t=>t.sbinDefs)),r=e.some(t=>t.testDefs?.length)?Ue([...e]).defs:void 0;return renderLotSummaryReportHtml({items:e.map((t,a)=>({label:k(t,a),wafer:t.wafer,dies:t.dies,passBins:[...t.passBins],statsSummary:t.statsSummary,source:te(t)?t:void 0})),hbinDefs:o.length?o:void 0,sbinDefs:s.length?s:void 0,testDefs:r,ringCount:e[0]?.ringCount,analyzeOptions:i.analyzeOptions,binColors:i.binColors,live:i.live},{title:i.title})}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{SYNTHESIS_ALSO_HEADING as
|
|
1
|
+
import{SYNTHESIS_ALSO_HEADING as w,SYNTHESIS_POSSIBLE_HEADING as $,synthesisMoreTests as y,synthesisRowShare as k}from"./synthesis.js";import{formatFindingTooltip as S,findingMetricLabel as z,isProportionFinding as j}from"./findingText.js";import{arrangeFindings as T}from"./filterFindings.js";import{SEVERITY_MARK as b,METER_DOTS as N,filledDots as I,impactWord as E,impactShortWord as M,shortfallColor as u,shortfallStep as A,formatPoints as F,barPercent as L}from"./presentation.js";import{fmt as f,plainBinTerms as D}from"../renderer/fmt.js";import{buildFacetTable as _,attributeLabel as B}from"./facets.js";import{escHtml as a}from"../core/utils.js";import{derivedKeyText as R,derivedFields as C}from"../renderer/testLabel.js";export function renderSection(e,r,t="",o){return`<section class="${["report-section",t].filter(Boolean).join(" ")}"${o?` id="${a(o)}"`:""}>
|
|
2
2
|
<h2>${a(e)}</h2>
|
|
3
3
|
${r}
|
|
4
4
|
</section>`}export function renderDefinitionList(e,r="meta-list"){if(!e.length)return"";const t=e.map(o=>`<div class="definition-item"><dt>${a(o.label)}</dt><dd>${a(o.value)}</dd></div>`).join(`
|
|
5
5
|
`);return`<dl class="${r}">
|
|
6
6
|
${t}
|
|
7
|
-
</dl>`}export function buildMetadataRows(e){return
|
|
7
|
+
</dl>`}export function buildMetadataRows(e){return _(e,{facetableOnly:e.length>1}).map(t=>({label:B(t.key),value:t.values.map(o=>o.value).join(", ")}))}export function renderMetadataSection(e){const r=buildMetadataRows(e);return r.length?renderSection("Wafer Info",renderDefinitionList(r)):""}export function renderMetricGrid(e){return e.length?`<dl class="metric-grid">
|
|
8
8
|
${e.map(t=>`<div class="metric">
|
|
9
9
|
<dt>${a(t.label)}</dt>
|
|
10
10
|
<dd>${a(t.value)}</dd>
|
|
11
11
|
${t.hint?`<span class="metric-hint">${a(t.hint)}</span>`:""}
|
|
12
12
|
</div>`).join(`
|
|
13
13
|
`)}
|
|
14
|
-
</dl>`:""}export function renderTable(e,r,t={}){if(!r.length)return`<p class="no-data">${a(t.emptyMessage??"No data")}</p>`;const o=["report-table",t.className].filter(Boolean).join(" "),p=e.map(
|
|
14
|
+
</dl>`:""}export function renderTable(e,r,t={}){if(!r.length)return`<p class="no-data">${a(t.emptyMessage??"No data")}</p>`;const o=["report-table",t.className].filter(Boolean).join(" "),p=e.map(s=>`<th>${a(s)}</th>`).join(""),c=s=>typeof s=="string"?`<td>${s}</td>`:`<td${s.className?` class="${s.className}"`:""}>${s.html}</td>`,l=r.map(s=>`<tr>${s.map(c).join("")}</tr>`).join(`
|
|
15
15
|
`);return`<table class="${o}">
|
|
16
16
|
<thead><tr>${p}</tr></thead>
|
|
17
17
|
<tbody>${l}</tbody>
|
|
18
|
-
</table>`}export function renderMeter(e,r){const t=
|
|
19
|
-
${p}`}export function formatFindingDelta(e){if(e.variable.kind==="spatialPattern")return"\u2014";const r=e.effect.absoluteDelta??0,t=r>0?"+":r<0?"\u2212":"";if(
|
|
18
|
+
</table>`}export function renderMeter(e,r){const t=I(e);return`<span class="meter"><span class="meter-dots" aria-hidden="true">${"\u25CF".repeat(t)}${"\u25CB".repeat(N-t)}</span><span class="meter-word">${a(r)}</span></span>`}export function renderSeverityMeter(e){const{tier:r,word:t}=b[e];return renderMeter(r,t)}export const severityTier=e=>b[e].tier;export function barCell(e,r,t="",o){const p=o?`;background:${a(o)}`:"";return{html:`<span class="cellbar"><span class="cellbar-value">${a(r)}</span><span class="cellbar-track" aria-hidden="true"><i style="width:${L(e).toFixed(1)}%${p}"></i></span></span>`,className:["barcell",t].filter(Boolean).join(" ")}}export function deltaCell(e){const r=A(e);return{html:a(F(e)),className:["numeric",r?`low-${r}`:""].filter(Boolean).join(" ")}}export function withSectionNav(e,r=""){const t=[];let o=0;const p=e.replace(/<section class="(report-section[^"]*)"(?: id="([^"]*)")?>(\s*<h2>)(.*?)(<\/h2>)/g,(l,s,n,d,m,g)=>{++o;const i=n??`sec-${r}${o}`;return t.push({id:i,title:m}),`<section class="${s}" id="${i}">${d}${m}${g}`});return t.length<4?e:`<nav class="report-toc" aria-label="Sections">${t.map(l=>`<a href="#${l.id}">${l.title}</a>`).join("")}</nav>
|
|
19
|
+
${p}`}export function formatFindingDelta(e){if(e.variable.kind==="spatialPattern")return"\u2014";const r=e.effect.absoluteDelta??0,t=r>0?"+":r<0?"\u2212":"";if(j(e))return`${t}${Math.abs(r*100).toFixed(1)} pp`;if(e.variable.kind==="test"){if(e.effect.relativeDelta!==void 0&&Number.isFinite(e.effect.relativeDelta)){const o=Math.abs(e.effect.relativeDelta*100).toFixed(1);return`${t}${o}%`}return`${t}${f(Math.abs(r),e.variable.unit)}`}return`${t}${f(Math.abs(r),e.variable.unit)}`}export function derivedFindingsKeyHtml(e){const r=R(e.map(t=>({label:t.variable.label,...C(t.variable)})));return r?`<p class="report-note">${a(r)}</p>`:""}export function findingAnchor(e,r=""){return`finding-${r}`+e.replace(/[^A-Za-z0-9]/g,t=>`_${t.charCodeAt(0).toString(16)}_`)}const H="Indented rows are the findings a pattern explains, most severe first. The other findings follow, grouped by region, most severe first.";export function findingsTableHtml(e,r,t,o=!1){const p=T(e),c=[...p.patterns.flatMap(n=>[{f:n.finding,nested:!1},...n.children.map(d=>({f:d,nested:!0}))]),...p.groups.flatMap(n=>n.findings.map(d=>({f:d,nested:!1})))],l=c.length?c.map(({f:n,nested:d})=>`<tr class="tier-${severityTier(n.severity)}${d?" nested":""}${o?" live":""}"${t!==void 0?` id="${findingAnchor(n.id,t)}"`:""}${o?` data-finding="${a(n.id)}"`:""} title="${a(S(n))}${o?`
|
|
20
20
|
Click to show it on the map`:""}">
|
|
21
21
|
<td class="tight">${renderSeverityMeter(n.severity)}</td>
|
|
22
22
|
<td class="tight">${a(n.comparison.left)}</td>
|
|
23
|
-
<td>${a(
|
|
23
|
+
<td>${a(D(z(n)))}</td>
|
|
24
24
|
<td class="numeric">${a(formatFindingDelta(n))}</td>
|
|
25
25
|
<td class="numeric">${a(formatFindingCoverage(n,r))}</td>
|
|
26
26
|
</tr>`).join(`
|
|
@@ -37,16 +37,21 @@ Click to show it on the map`:""}">
|
|
|
37
37
|
<tbody>
|
|
38
38
|
${l}
|
|
39
39
|
</tbody>
|
|
40
|
-
</table>${p.patterns.length?`<p class="report-note">${a(
|
|
41
|
-
<li class="tier-${o.impact}">${renderMeter(o.impact,
|
|
42
|
-
</ol>`:`<p class="synthesis-none">${a(e.nothing??"Nothing stands out.")}</p>`,m=c.length?`<p class="synthesis-smaller">${a(
|
|
40
|
+
</table>${p.patterns.length?`<p class="report-note">${a(H)}</p>`:""}${derivedFindingsKeyHtml(e)}`}export function synthesisSectionHtml(e,r){const t=(i,v)=>{const h=r(v);return h?`<a href="#${a(h)}">${a(i)}</a>`:a(i)},[o,...p]=e.items,c=[...p,...e.also?.items??[]],l=e.also?.more??0,s=o?[t(o.subject,o.target),...o.chips.map(i=>t(i.label,i.target))]:[],n=o&&y(o);n&&s.push(a(n));const d=o?`<ol class="synthesis-items">
|
|
41
|
+
<li class="tier-${o.impact}">${renderMeter(o.impact,E(o.impact))}<span>${a(o.text)}<span class="synthesis-see">See: ${s.join(" \xB7 ")}</span></span></li>
|
|
42
|
+
</ol>`:`<p class="synthesis-none">${a(e.nothing??"Nothing stands out.")}</p>`,m=c.length?`<p class="synthesis-smaller">${a(w)}</p>
|
|
43
43
|
<ul class="synthesis-more">
|
|
44
|
-
${c.map(
|
|
44
|
+
${c.map(i=>`<li>${renderMeter(i.impact,M(i.impact))}<span>${t(i.brief,i.target)}</span><span class="synthesis-share">${a(k(i))}</span></li>`).join(`
|
|
45
45
|
`)}${l?`
|
|
46
46
|
<li class="synthesis-rest"><span></span><span>and ${l} more</span><span></span></li>`:""}
|
|
47
|
+
</ul>`:"",g=e.possible?.length?`<p class="synthesis-smaller">${a($)}</p>
|
|
48
|
+
<ul class="synthesis-more">
|
|
49
|
+
${e.possible.map(i=>`<li><span>${a(i.text)}</span></li>`).join(`
|
|
50
|
+
`)}
|
|
47
51
|
</ul>`:"";return renderSection("What stands out",`<p class="synthesis-headline">${a(e.headline)}</p>
|
|
48
52
|
${d}
|
|
49
53
|
${m}
|
|
54
|
+
${g}
|
|
50
55
|
<p class="synthesis-checked">${a(e.checked)}</p>`,"synthesis")}const x=`<script>
|
|
51
56
|
(function () {
|
|
52
57
|
var embedded = location.href === 'about:srcdoc';
|
|
@@ -116,9 +121,9 @@ document.addEventListener('click', function (e) {
|
|
|
116
121
|
--report-tier-medium-edge: #a8741a;
|
|
117
122
|
--report-tier-low-bg: #edf2f7;
|
|
118
123
|
--report-tier-low-edge: #5f7f9f;
|
|
119
|
-
--report-low-1: ${
|
|
120
|
-
--report-low-2: ${
|
|
121
|
-
--report-low-3: ${
|
|
124
|
+
--report-low-1: ${u(1)};
|
|
125
|
+
--report-low-2: ${u(2)};
|
|
126
|
+
--report-low-3: ${u(3)};
|
|
122
127
|
--report-bar: #9db8d3;
|
|
123
128
|
}
|
|
124
129
|
|
|
@@ -34,13 +34,13 @@ export interface SweepSeriesSpec {
|
|
|
34
34
|
* Read each test's x value from its NAME instead — for programs that record
|
|
35
35
|
* the swept quantity only in the test text. A placeholder pattern, not a
|
|
36
36
|
* regular expression: `{x}` reads a number, `*` matches any run of
|
|
37
|
-
* characters, `?` matches exactly one character, everything else is literal. `"
|
|
38
|
-
* a test named `"
|
|
37
|
+
* characters, `?` matches exactly one character, everything else is literal. `"LEVEL_{x}"` reads 12,000 from
|
|
38
|
+
* a test named `"Cum_share= LEVEL_12K / …"`.
|
|
39
39
|
*
|
|
40
40
|
* - The pattern is found ANYWHERE in the name; no leading or trailing `*`.
|
|
41
41
|
* - Literal text matches case-insensitively; the value's SI prefix does not
|
|
42
42
|
* (`m` is milli, `M` mega). `{x}` reads the prefix, and `K` is accepted as
|
|
43
|
-
* kilo. Put the prefix in the pattern instead (`"
|
|
43
|
+
* kilo. Put the prefix in the pattern instead (`"LEVEL_{x}K"`) to keep
|
|
44
44
|
* the numbers as the name shows them (12 rather than 12,000).
|
|
45
45
|
* - Each x stays attached to its own test, so a test missing from the data
|
|
46
46
|
* loses one point instead of shifting every later x the way a positional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SI_PREFIX_SCALE as
|
|
1
|
+
import{SI_PREFIX_SCALE as b,KNOWN_BASE_UNITS as p}from"../renderer/fmt.js";const c=Object.fromEntries(Object.entries({...b,K:1e3}).map(([e,t])=>[e,Math.round(Math.log10(t))])),m=e=>e!==void 0&&/\p{L}/u.test(e),g=[...new Set(p.map(e=>e.toLowerCase()))];function E(e,t){const n=e[t];if(n===void 0||!m(n))return null;const o=t+1;if(!m(e[o]))return c[n]??null;const a=e.slice(o),s=g.find(r=>a.toLowerCase().startsWith(r)&&!m(a[r.length]));if(s===void 0)return null;const l=a.slice(0,s.length);return!p.includes(l)||!/\p{Ll}/u.test(e)?n.toLowerCase()==="m"?"ambiguous":c[n]??c[n.toLowerCase()]??c[n.toUpperCase()]??null:c[n]??null}export const NAME_PATTERN_EXAMPLES=[{name:"Fmax @ 0.55 V",pattern:"@ {x}",reads:.55,note:"the text before the number picks it out; the unit after it is ignored"},{name:"1234-5",pattern:"-{x}",reads:5,note:"the number after the dash"},{name:"1234-5",pattern:"{x}",reads:1234,note:"with nothing around it, {x} takes the first number"},{name:"A-1-5",pattern:"A-1-{x}",reads:5,note:"a pattern fits the first place it can, so add more of the name"},{name:"VDD=1.2V_IDS",pattern:"VDD={x}",reads:1.2},{name:"Idsat Vg=0.8 Vd=1.0",pattern:"Vd={x}",reads:1,note:"the second of two levels"},{name:"Tj-40C_Vth",pattern:"Tj{x}C",reads:-40,note:"a minus sign belongs to the number"},{name:"Step 03 of 12",pattern:"Step {x}",reads:3},{name:"PAT_7_RUN2",pattern:"PAT_{x}_",reads:7,note:"text after {x} must follow it, so RUN2 is not read"},{name:"LEVEL_12K",pattern:"LEVEL_{x}",reads:12e3,note:"{x} reads the K as kilo"},{name:"LEVEL_12K",pattern:"LEVEL_{x}K",reads:12,note:"write the K in the pattern to keep the number as the name shows it"},{name:"Fmax_25C_0.55V",pattern:"C_{x}",reads:.55,note:"the text just before the number, here the end of the temperature"},{name:"VCC_1.8V_TEMP_125",pattern:"TEMP_{x}",reads:125,note:"other numbers in the name are ignored"},{name:"RUN3_LEVEL_12K",pattern:"RUN*LEVEL_{x}",reads:12e3,note:"* skips any length of text between the two parts"},{name:"fmax @ 0.55 v",pattern:"FMAX @ {x}",reads:.55,note:"text matches in any case"},{name:"Vth @ 50mV",pattern:"@ {x}",reads:.05,note:"the m of mV is read as milli, so 50 mV is 0.05"},{name:"Delay 5ns @ 25C",pattern:"Delay {x}",reads:5e-9,note:"a unit with a prefix is scaled to its base unit"},{name:"Leak I=1e-6A",pattern:"I={x}",reads:1e-6,note:"exponent notation is read"},{name:"12314",pattern:"123?{x}",reads:4,note:"? is any one character, so names of one shape can be read by position: here the digit after 123 and one more"},{name:"12336",pattern:"123?{x}",reads:6,note:"the same pattern on the next name"}],NAME_PATTERN_LIMIT="A pattern reads a whole number or nothing: it cannot take part of a number, so reading the last digit of 12314 needs the characters before it spelled out or skipped with ? (123?{x}), which suits names of one length. It cannot count back from the end of a name. For names of uneven length, choose Values and type the X values instead.";export function compileXNamePattern(e){const t=[];let n="",o=0;const a=()=>{n&&(t.push({kind:"lit",text:n.toLowerCase()}),n="")};for(let s=0;s<e.length;s++){if(e.startsWith("{x}",s)){a(),t.push({kind:"x"}),o++,s+=2;continue}if(e[s]==="*"){a(),t.at(-1)?.kind!=="star"&&t.push({kind:"star"});continue}if(e[s]==="?"){a(),t.push({kind:"any"});continue}n+=e[s]}return a(),o!==1?{error:`the pattern must contain {x} exactly once (it has ${o})`}:{source:e,parts:t}}const _=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/;function L(e,t){const n=_.exec(e.slice(t));if(!n)return[];const o=n[0],a=t+o.length,s=E(e,a);if(s==="ambiguous"){const u=e.slice(t,a+1+(/^\p{L}+/u.exec(e.slice(a+1))?.[0].length??0));return[{value:Number(o),end:a,literalMustFollow:u}]}const l=[];if(s!==null){const[u,r="0"]=o.split(/[eE]/);l.push({value:+`${u}e${Number(r)+s}`,end:a+1})}return l.push({value:Number(o),end:a}),l}export function readXFromName(e,t){const{parts:n}=e;let o;const a=t.toLowerCase(),s=new Set,l=(r,i)=>r*(t.length+1)+i;function u(r,i){if(r===n.length)return NaN;if(s.has(l(r,i)))return;const h=n[r];let f;if(h.kind==="lit")a.startsWith(h.text,i)&&(f=u(r+1,i+h.text.length));else if(h.kind==="any")i<t.length&&(f=u(r+1,i+(t.codePointAt(i)>65535?2:1)));else if(h.kind==="star")for(let d=i;d<=t.length&&f===void 0;d++)f=u(r+1,d);else for(const d of L(t,i)){if(d.literalMustFollow!==void 0){const x=n[r+1];if(x?.kind!=="lit"||!a.startsWith(x.text,d.end)){o??=d.literalMustFollow;continue}}if(u(r+1,d.end)!==void 0){f=d.value;break}}return f===void 0&&s.add(l(r,i)),f}for(let r=0;r<=t.length;r++){const i=u(0,r);if(i!==void 0)return Number.isFinite(i)?i:null}return o!==void 0?{ambiguous:o}:null}
|
|
@@ -12,6 +12,12 @@ export type SynthesisTarget = {
|
|
|
12
12
|
} | {
|
|
13
13
|
kind: 'test';
|
|
14
14
|
testNumber: number;
|
|
15
|
+
}
|
|
16
|
+
/** The wafers' groups on a field (Group by's key): an item about yield, which has no finding or test to show on the map. */
|
|
17
|
+
| {
|
|
18
|
+
kind: 'group';
|
|
19
|
+
field: string; /** Every field that gives the same groups, `field` first. */
|
|
20
|
+
fields: string[];
|
|
15
21
|
};
|
|
16
22
|
/** One part of an item that can be shown on its own: a fail bin in its region, the pattern, a test on the same dies. */
|
|
17
23
|
export interface SynthesisChip {
|
|
@@ -90,6 +96,11 @@ export interface Synthesis {
|
|
|
90
96
|
items: SynthesisItem[];
|
|
91
97
|
more: number;
|
|
92
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Groups of wafers that differ on two or more measures with no overlap, which the sample is too small to confirm. Kept apart
|
|
101
|
+
* from `items` and not counted as what stands out. Absent when there are none.
|
|
102
|
+
*/
|
|
103
|
+
possible?: SynthesisItem[];
|
|
93
104
|
/** Said instead of the items when none is material, so a good lot reads as one rather than as an empty list. */
|
|
94
105
|
nothing?: string;
|
|
95
106
|
/** What was compared and not repeated above. Required: a short synthesis must not read as "not analysed". */
|
|
@@ -108,6 +119,12 @@ export interface SynthesisContext {
|
|
|
108
119
|
*/
|
|
109
120
|
attributes?: Record<string, FacetCuration>;
|
|
110
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* A bar of wafers drawn with Group by on takes the group's colours, and the wafers sit under their group on a second level
|
|
124
|
+
* of the X axis: a pattern that belongs to a group (both low wafers are SS) shows as a colour, and the legend switches
|
|
125
|
+
* groups on and off. With no grouping, or any other chart, it is returned as specified.
|
|
126
|
+
*/
|
|
127
|
+
export declare function groupColouredChart(chart: Omit<PlotSpec, 'id'>, grouped: boolean): Omit<PlotSpec, 'id'>;
|
|
111
128
|
/**
|
|
112
129
|
* The summary a synthesis is written from. A lot of one wafer is that wafer: the lot's own findings need
|
|
113
130
|
* a signal to recur on two wafers, so on one they are always empty and the lot would read as clean while
|
|
@@ -124,6 +141,8 @@ export declare function buildSynthesis(input: StatsSummary | LotStatsSummary, ct
|
|
|
124
141
|
* card and a card's Show on map finds its row.
|
|
125
142
|
*/
|
|
126
143
|
export declare const synthesisKey: (it: Pick<SynthesisItem, "target">) => string;
|
|
144
|
+
/** The heading over groups that differ with no overlap but that the sample is too small to confirm. */
|
|
145
|
+
export declare const SYNTHESIS_POSSIBLE_HEADING = "Possible, not confirmed";
|
|
127
146
|
/** The heading over the compact list of further items: the floor is the same one that admits an item at all. */
|
|
128
147
|
export declare const SYNTHESIS_ALSO_HEADING: string;
|
|
129
148
|
/** A compact-list row: the item in a few words, then its size (`2.4%` of the dies, `1.3σ`, `Ppk 0.62`). Plain text. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{maxOf as ge,minOf as be}from"../core/utils.js";import{isPassBin as $e,passBinsLabel as we}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as ye}from"./lotDrift.js";import{isOneBinCluster as ve}from"./filterFindings.js";import{plainBinTerms as Se}from"../renderer/fmt.js";import{benjaminiHochberg as Ne,normalUpperTail as Ie}from"./math.js";import{compareGroups as ke,formatP as re}from"./groupCompare.js";import{attributeLabel as oe,buildFacetTable as xe,facetValueOf as Me}from"./facets.js";const De=1,Be=2,_e=.5,le=3,fe=5,K=.01,Fe=.02,Oe=.04,ze=.15,Le=.4,X=.5,Ee=.1,Te=2,ce=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function ee(e){const t=e.highlight;return"dieKeysByWafer"in t&&t.dieKeysByWafer?Object.values(t.dieKeysByWafer).reduce((s,i)=>s+i.length,0):"dieKeys"in t&&t.dieKeys&&t.dieKeys.length>0?t.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function te(e){const t=e.highlight,s=new Set;if("dieKeysByWafer"in t&&t.dieKeysByWafer)for(const[i,d]of Object.entries(t.dieKeysByWafer))for(const c of d)s.add(`${i}:${c}`);else if("dieKeys"in t&&t.dieKeys)for(const i of t.dieKeys)s.add(i);return s}const D=e=>Math.abs(e.effect.absoluteDelta??0),A=e=>D(e)*(ee(e)??0),E=e=>(e*100).toFixed(1),G=e=>{const t=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return Se(t)},S=e=>Math.round(e).toLocaleString("en-GB"),T=(e,t,s=`${t}s`)=>`${S(e)} ${e===1?t:s}`;function C(e){const t=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(t)?`${t} quadrant`:t}const de=ve;function Ae(e){const t=e.map((f,a)=>a),s=f=>t[f]===f?f:t[f]=s(t[f]),i=e.map(te),d=(f,a)=>{const u=i[f].size<=i[a].size?i[f]:i[a],b=u===i[f]?i[a]:i[f];let m=0;for(const p of u)b.has(p)&&m++;return m},c=e.map((f,a)=>a).filter(f=>de(e[f])),n=e.map((f,a)=>a).filter(f=>!de(e[f]));for(let f=0;f<n.length;f++)for(let a=f+1;a<n.length;a++){const u=Math.min(i[n[f]].size,i[n[a]].size);u>0&&d(n[f],n[a])>=X*u&&(t[s(n[f])]=s(n[a]))}for(const f of c){let a=-1,u=0;for(const b of n){if(se(e[b])&&e[b].variable.bin!==e[f].variable.bin)continue;const m=d(f,b);m>u&&m>=X*i[f].size&&m>=X*A(e[b])&&(a=b,u=m)}a>=0&&(t[f]=s(a))}const h=new Map;return e.forEach((f,a)=>{const u=s(a);(h.get(u)??h.set(u,[]).get(u)).push(a)}),[...h.values()]}const se=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",ie=(e,t)=>e.level===t.level&&e.comparison.family===t.comparison.family&&e.comparison.left===t.comparison.left;function We(e,t,s){const i=c=>t.filter(n=>n.variable.kind===c&&ie(n,e)&&n.effect.direction==="higher"&&s(n));return(i("hardBin").length>0?i("hardBin"):i("softBin")).filter(c=>c!==e).sort((c,n)=>D(n)-D(c))}const je={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},He=2;function ue(e){const t=new Map;for(const i of e){const d=i.comparison.family;(t.get(d)??t.set(d,new Set).get(d)).add(C(i))}const s=[];for(const[i,d]of t)d.size<=He?s.push(...d):s.push(`${d.size} ${je[i]??i}`);return s.join(", ")}const Re=e=>e.charAt(0).toUpperCase()+e.slice(1),P=e=>({kind:"finding",id:e.id}),Ce=e=>({label:Re(G(e)),target:P(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function V(e){const t=e.comparison.family;return{builtin:t==="quadrant"||t==="sector"?"quadrant":t==="reticle-position"?"reticleCell":t==="test-site"?"site":"ring"}}const he=(e,t)=>({chart:"bar",fields:{x:e,y:t,color:{none:!0}},valueLabels:!0,axes:{y:{references:[{stat:"median"}]}}}),J=e=>({test:e}),ne=(e,t=!1)=>({chart:"histogram",fields:{y:J(e),color:{none:!0}},...t?{normalCurve:!0}:{}});function Pe(e,t,s,i){const d=[...e].sort((l,g)=>A(g)-A(l))[0],c=e.find(l=>i.isPassRate(l)&&ie(l,d))??d,n=e.filter(l=>l!==c),h=c.level==="lot"&&"waferIndices"in c.highlight?c.highlight.waferIndices?.length:void 0,f=h!==void 0&&s?` on ${h}/${s} wafers`:"",a=!i.isPassRate(c),u=c.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let b=a?`${C(c)}: ${G(c)} ${E(D(c))} points higher than ${u}${f}`:`${C(c)}: pass rate ${E(D(c))} points below ${u}${f}`;const m=`${b} \u2014 about ${S(A(c))} dies lost`,p=We(c,t,i.isFailBin).map(l=>({f:l,share:D(l)/(D(c)||1)})).filter(l=>a||l.share>=Ee).slice(0,Te);if(a)for(const{f:l}of p)b+=`, ${G(l)} ${E(D(l))} points higher`;else if(p.length>0){const l=p.reduce((N,v)=>N+v.share,0)<=1.000000001,g=l&&p[0].share>.5?"mostly ":"";p.forEach(({f:N},v)=>{b+=v===0?`; ${l?g:""}`:", ",b+=G(N)+(v===0?l?` accounts for ${E(D(N))} of those points`:` is ${E(D(N))} points higher`:l?` for ${E(D(N))}`:` ${E(D(N))} points higher`)})}b+=` \u2014 about ${S(A(c))} dies lost`;const x=n.filter(l=>!ie(l,c));x.length>0&&(b+=` (also seen as ${ue(x)})`);const o=a?G(c):"pass rate";return{kind:"loss",impact:"low",shareOfDies:0,diesLost:A(c),affected:A(c),measure:"",severity:c.severity,text:b,reason:m,brief:`${C(c)}: ${o}, ${S(A(c))} dies`,subject:C(c),target:P(c),chips:[...a?[c]:[],...p.map(({f:l})=>l)].map(Ce),findingIds:[c.id,...n.map(l=>l.id)],testNumbers:[],chart:a?{chart:"bar",fields:{x:V(c),color:{builtin:c.variable.kind==="softBin"?"sbin":"hbin"}},stack:"percent"}:c.level==="lot"?{chart:"heatmap",fields:{x:{builtin:"wafer"},rows:V(c),y:{builtin:"yield"}}}:he(V(c),{builtin:"yield"})}}function Ke(e,t){return e>=Oe||t>=Le?"high":e>=Fe||t>=ze?"medium":"low"}function qe(e){const t=s=>s.stats.yieldPercent==null?0:s.stats.analyzedDies*(1-s.stats.yieldPercent/100);return e.level==="wafer"?t(e):e.perWafer.reduce((s,i)=>s+t(i.summary),0)}function Ge(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((t,s)=>t+s.summary.stats.analyzedDies,0)}const me=e=>e.id.startsWith("inter-wafer:yield:");function Ye(e){const t=[];for(const s of e.findings){if(!me(s)||s.effect.direction!=="lower")continue;const i="waferIndices"in s.highlight?s.highlight.waferIndices?.[0]:void 0,d=i===void 0?void 0:e.perWafer.find(c=>c.waferIndex===i)?.summary.stats.analyzedDies;d!==void 0&&t.push({kind:"loss",impact:"low",shareOfDies:0,diesLost:D(s)*d,affected:D(s)*d,measure:"",severity:s.severity,text:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,reason:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,brief:`${s.comparison.left}: yield, ${S(D(s)*d)} dies`,subject:s.comparison.left,target:P(s),chips:[],findingIds:[s.id],testNumbers:[],chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:{builtin:"yield"}}}})}return t}function Ue(e,t){if(e.level==="wafer"){const c=e.stats.testFailures?.[t];return c?{keys:new Set(c.dieKeys),lost:c.lostDies}:void 0}const s=new Set;let i=0,d=!1;for(const c of e.perWafer){const n=c.summary.stats.testFailures?.[t];if(n){d=!0,i+=n.lostDies;for(const h of n.dieKeys)s.add(`${c.waferIndex}:${h}`)}}return d?{keys:s,lost:i}:void 0}function Xe(e,t){const s=e.stats,i=[],d=n=>he({builtin:e.level==="lot"?"wafer":"ring"},{passRate:n}),c=(n,h,f,a,u,b,m=u,p=!1)=>{if(f<=0||a<=0)return;t.add(n);const x=Ue(e,n),o=x?Math.min(x.lost,f):f,l=f-o,g=f/a*100;i.push({testNumber:n,label:h,verb:u,plainVerb:m,failDies:f,passingDies:l,keys:x?.keys,item:{kind:"loss",impact:"low",shareOfDies:0,diesLost:o,affected:o,measure:"",severity:"info",text:`${h} ${u} on ${S(f)} of ${S(a)} dies (${g.toFixed(1)}%)`+(l>0?`; ${S(l)} of them are binned as passing, so about ${S(o)} dies lost`:""),reason:`${h} ${u} on ${S(f)} of ${S(a)} dies (${g.toFixed(1)}%)`,brief:l>0?`${h}: ${b}, ${S(o)} dies lost`:`${h}: ${S(f)} dies ${b}`,subject:h,target:{kind:"test",testNumber:n},chips:[],findingIds:[],testNumbers:[n],chart:p||e.level==="lot"?d(n):ne(n)}})};for(const n of s.testSpecYield??[]){const h=n.failHighDies===0?"is below its low limit":n.failLowDies===0?"is above its high limit":`is outside its limits (${S(n.failLowDies)} low, ${S(n.failHighDies)} high)`;c(n.testNumber,n.label,n.failLowDies+n.failHighDies,n.totalDies,h,"outside limits",n.failLowDies>0&&n.failHighDies>0?"is outside its limits":h)}for(const n of s.functionalYield??[])c(n.testNumber,n.label,n.failDies,n.totalDies,"fails","fail","fails",!0);return i}const Ve=.5,Je=2,Qe=2,Y=5;function Ze(e,t,s,i){const d=new Set,c=new Map,n=new Map,h=[...e].sort((f,a)=>a.failDies-f.failDies||f.testNumber-a.testNumber);for(const f of h){const a=f.keys;if(i>0&&f.failDies/i<K){d.add(f);continue}let u;if(a&&a.size>0&&i>0)for(const p of t){const x=s.get(p);if(!x||x.size===0)continue;let o=0;for(const g of a)x.has(g)&&o++;const l=o/a.size;l>=Ve&&l>=Je*(x.size/i)&&(!u||o>u.inside)&&(u={item:p,inside:o})}if(!u){d.add(f);continue}const b=c.get(u.item)??0;if(b<Qe){const p=u.inside===f.failDies?"all":S(u.inside);u.item.text+=`. ${f.label} ${f.verb} on ${T(f.failDies,"die")}, ${p} of them in ${u.item.subject}`,c.set(u.item,b+1)}const m=n.get(u.item)??0;m<Y?(u.item.chips.push({label:f.label,target:f.item.target}),n.set(u.item,m+1)):u.item.moreTests=(u.item.moreTests??0)+1,u.item.testNumbers.push(f.testNumber)}return e.filter(f=>d.has(f))}function U(e){return{kind:"signal",impact:"low",shareOfDies:0,diesLost:0,affected:e.affected,measure:e.measure,severity:e.severity,text:e.text,reason:e.reason??e.text,brief:e.brief,subject:e.subject,target:e.target,chips:[],findingIds:e.findingIds??[],testNumbers:e.testNumbers??[],chart:e.chart}}const ae=e=>Math.abs(e)<_e?0:Math.min(1,(Math.abs(e)/Be)**2),j=e=>`${Math.abs(e).toFixed(1)}\u03C3`,et=e=>e.variable.kind==="test"&&e.variable.measure!=="limitFailRate"&&ce.has(e.comparison.family)&&Number.isFinite(e.effect.effectSize??NaN)&&!e.id.startsWith("drift:");function tt(e,t,s){const i=new Map;for(const n of e)!et(n)||n.variable.index===void 0||(i.get(n.variable.index)??i.set(n.variable.index,[]).get(n.variable.index)).push(n);const d=n=>(ee(n)??n.stats.sampleSizeLeft)*ae(n.effect.effectSize??0),c=[];for(const[n,h]of[...i].sort((f,a)=>f[0]-a[0])){const f=[...h].sort((o,l)=>d(l)-d(o)),a=f[0],u=a.effect.effectSize??0;if(d(a)===0)continue;const b=te(a);let m=t.find(o=>o.target.kind==="test"&&o.target.testNumber===n)??t.find(o=>o.testNumbers.includes(n))??t.find(o=>f.some(l=>o.findingIds.includes(l.id))),p=0;for(const o of m?[]:t){const l=s.get(o);if(!l||l.size===0||b.size===0)continue;let g=0;for(const N of b)l.has(N)&&g++;g>=X*Math.min(l.size,b.size)&&g>p&&(p=g,m=o)}if(m){m.text+=`. ${a.summary}`,m.testNumbers.includes(n)||(m.chips.filter(l=>l.target.kind==="test"||l.shift).length<Y?m.chips.push({label:a.variable.label,target:P(a),shift:!0}):m.moreTests=(m.moreTests??0)+1,m.testNumbers.push(n));for(const o of f)m.findingIds.includes(o.id)||m.findingIds.push(o.id);continue}const x=ee(a)??a.stats.sampleSizeLeft;c.push(U({affected:d(a),measure:j(u),severity:a.severity,text:`${a.summary}: a shift of ${j(u)} over ${T(x,"die")}`+(f.length>1?` (also seen as ${ue(f.slice(1))})`:""),reason:`${a.summary}: a shift of ${j(u)} over ${T(x,"die")}`,brief:`${C(a)}: ${a.variable.label} ${a.effect.direction}`,subject:C(a),target:P(a),findingIds:f.map(o=>o.id),testNumbers:[n],chart:{chart:"box",fields:{x:V(a),y:J(n),color:{none:!0}},axes:{y:{references:[{stat:"median"}]}}}}))}return c}function st(e,t){return e.filter(s=>s.id.startsWith("drift:")).map(s=>{const i=s.variable.kind==="yield",d=s.effect.effectSize??0;return U({affected:t*(i?Math.abs(d):ae(d)),measure:i?`${E(Math.abs(d))} pts`:j(d),severity:s.severity,text:s.summary,brief:`${s.variable.label}: drifts across the wafers`,subject:s.variable.label,target:P(s),findingIds:[s.id],...s.variable.index!==void 0?{testNumbers:[s.variable.index]}:{},chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:i||s.variable.index===void 0?{builtin:"yield"}:J(s.variable.index)}}})})}function it(e,t,s){return(e.stats.capability??[]).filter(i=>i.hasSpec&&i.ppk!==null&&i.ppk!==void 0&&i.ppk<De&&!t.has(i.testNumber)).map(i=>{const d=i.ppk,c=Ie(3*d);return U({affected:s*c,measure:`Ppk ${d.toFixed(2)}`,severity:"notable",text:`${i.label} has Ppk ${d.toFixed(2)} against its limits: a spread that would put about ${E(c)}% of the dies outside them`,brief:`${i.label}: Ppk ${d.toFixed(2)}`,subject:i.label,target:{kind:"test",testNumber:i.testNumber},testNumbers:[i.testNumber],chart:ne(i.testNumber,!0)})})}const nt=.05,at=8;function rt(e,t){const s={items:[],compared:[]},i=e.perWafer;if(i.length<4)return s;const d=xe(i.map(o=>({metadata:o.summary.wafer,dieCount:o.summary.stats.totalDies})),{facetableOnly:!0,curation:t}).filter(o=>o.splittable&&o.values.length<=Math.max(2,Math.floor(i.length/2)));if(d.length===0)return s;const c=o=>e.perWaferTestStats?.find(l=>l.waferIndex===o.waferIndex)?.tests??o.summary.stats.perTestStats??[],n=i.map(o=>new Map(c(o).filter(l=>l.count>=2&&Number.isFinite(l.mean)).map(l=>[l.testNumber,l]))),h=new Map;for(const o of n)for(const[l,g]of o)h.has(l)||h.set(l,g.label);const f=i.map(o=>o.summary.stats.analyzedDies),a=[];for(const o of d){const l=i.map(g=>Me(g.summary.wafer,o.key,t));for(const[g,N]of[...h].sort((v,_)=>v[0]-_[0])){const v=new Map,_=[];if(n.forEach((y,I)=>{const k=y.get(g),$=l[I];!k||$===void 0||((v.get($)??v.set($,[]).get($)).push(I),Number.isFinite(k.stddev)&&_.push(k.stddev**2))}),v.size<2)continue;const F=ke([...v].map(([y,I])=>({key:y,values:I.map(k=>n[k].get(g).mean)}))),z=F.welch?.p??F.kruskal?.p,W=_.length?Math.sqrt(_.reduce((y,I)=>y+I,0)/_.length):NaN;if(z===void 0||!Number.isFinite(z)||!(W>0))continue;let M;for(const[y,I]of v){const k=I.map(r=>n[r].get(g).mean),$=[...v].filter(([r])=>r!==y).flatMap(([,r])=>r.map(w=>n[w].get(g).mean));if(k.length<2||$.length<2)continue;const O=k.reduce((r,w)=>r+w,0)/k.length-$.reduce((r,w)=>r+w,0)/$.length,H=O/W;(!M||Math.abs(H)>Math.abs(M.d)+1e-9||Math.abs(Math.abs(H)-Math.abs(M.d))<=1e-9&&(I.length<M.groupWafers||I.length===M.groupWafers&&O>0))&&(M={testNumber:g,label:N,field:o.key,group:y,groupWafers:I.length,groupDies:I.reduce((r,w)=>r+f[w],0),d:H,higher:O>0,p:z})}if(M&&v.size===2){const[y,I]=[...v].find(([k])=>k!==M.group);M.other={group:y,wafers:I.length}}M&&a.push(M)}}const u=Ne(a.map(o=>o.p)),b=new Map;a.forEach((o,l)=>{const g=o.groupDies*ae(o.d);u[l]>=nt||g===0||(b.get(o.field)??b.set(o.field,[]).get(o.field)).push({c:o,q:u[l],weight:g})});const m=a.length?[...new Set(a.map(o=>o.field))].map(o=>oe(o,t)):[],p=(o,l)=>o.other?`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} than on ${l} ${o.other.group} (${o.groupWafers} and ${o.other.wafers} wafers)`:`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} (${o.groupWafers} of ${i.length} wafers) than on the other wafers`;return{items:[...b].map(([o,l])=>{l.sort(($,O)=>Math.abs(O.c.d)-Math.abs($.c.d)||O.weight-$.weight||$.c.testNumber-O.c.testNumber);const g=l.reduce(($,O)=>Math.max($,O.weight),0),N=oe(o,t),[v,..._]=l,F=v.c,z=`${p(F,N)}: a shift of ${j(F.d)}`,W=_.slice(0,2).map(({c:$})=>`${$.label} ${$.higher?"higher":"lower"} on ${$.group} (${j($.d)})`),M=_.length-W.length,y=l.length,I=y===1?`${z}, each wafer one value (q ${re(v.q)})`:`${y} tests differ by ${N}. Largest: ${z}, each wafer one value (q ${re(v.q)}); next: ${W.join(", ")}${M>0?`, and ${M} more`:""}`,k=U({affected:g,measure:j(F.d),severity:v.q<.001?"unusual":"notable",text:I,reason:y===1?z:`${y} tests differ by ${N}. Largest: ${z}`,brief:y===1?`${N} ${F.group}: ${F.label} ${F.higher?"higher":"lower"}`:`${N}: ${y} tests differ`,subject:N,target:{kind:"test",testNumber:F.testNumber},testNumbers:l.map($=>$.c.testNumber),chart:y>1?{chart:"box",level:"wafer",aggregate:"mean",normalize:"zscore",fields:{x:{builtin:"test"},y:{tests:l.slice(0,at).map($=>$.c.testNumber)},color:{meta:o}}}:{chart:"box",level:"wafer",aggregate:"mean",fields:{x:{meta:o},y:J(F.testNumber),color:{meta:o}}}});return y>1&&(k.chips=l.slice(0,Y).map(({c:$})=>({label:`${$.label} ${j($.d)}`,target:{kind:"test",testNumber:$.testNumber}})),y>Y&&(k.moreTests=y-Y)),k}),compared:m}}function ot(e){return e.map(t=>U({affected:t.passingDies,measure:"",severity:"notable",text:`${t.label} ${t.plainVerb} on ${T(t.passingDies,"die")} binned as passing`,brief:`${t.label}: ${S(t.passingDies)} dies out of limits, binned passing`,subject:t.label,target:t.item.target,testNumbers:[t.testNumber],chart:ne(t.testNumber)}))}function lt(e,t){const s=t.passBins&&t.passBins.length>0?`; pass ${we([t.passBins])}`:"";if(e.level==="wafer"){const a=e.stats.yieldPercent;return a==null?`${S(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${a.toFixed(1)}% (${S(e.stats.totalDies)} dies${s}).`}const i=e.lotYieldSeries.map(a=>a.yieldPercent).filter(a=>typeof a=="number");if(i.length===0)return`${T(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const d=i.reduce((a,u)=>a+u,0)/i.length,c=e.perWafer.reduce((a,u)=>a+u.summary.stats.totalDies,0),[n,h]=[be(i).toFixed(1),ge(i).toFixed(1)],f=n!==h?`, range ${n}\u2013${h}%`:"";return`Yield ${d.toFixed(1)}% (mean of ${T(i.length,"wafer")}, ${S(c)} dies${s})${f}.`}function ft(e,t,s=[]){const i=[],d=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(a=>a.summary.stats.testsConsidered)).size,c=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(a=>a.summary.stats.hardBinsConsidered)).size,n=e.stats.testValueAnalysis?.state;if(d>0&&n!=="off"&&i.push(T(d,"test")+(n==="skipped"?" (against their limits only)":"")),c>0&&i.push(T(c,"hard bin")),i.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const a=e.findings.filter(me);i.push(a.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${T(a.length,"outlier wafer")})`),e.stats.waferCount>=ye&&i.push("the yield trend across the wafers (input order)"),s.length&&i.push(`the tests between the groups of ${s.join(", ")} (each wafer one value)`)}const h=e.findings.filter(a=>!t.has(a.id)).length,f=h>0?` ${T(h,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${i.join(", ")}.${f}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}const pe=new WeakMap;export function buildSynthesis(e,t={}){const s=`${t.passBins?.join(",")??"-"}|${t.attributes?JSON.stringify(t.attributes):"-"}`;let i=pe.get(e);i||pe.set(e,i=new Map);const d=i.get(s),c=e.findings;if(d&&d.findings.length===c.length&&d.findings.every((h,f)=>h===c[f]))return d.synthesis;const n=ct(e,t);return Object.freeze(n.items),n.items.forEach(Object.freeze),n.also&&(Object.freeze(n.also.items),n.also.items.forEach(Object.freeze),Object.freeze(n.also)),i.set(s,{findings:[...c],synthesis:Object.freeze(n)}),n}function ct(e,t){const s=synthesisSource(e),i=s.findings,d=s.level==="lot"?s.stats.waferCount:void 0,c=t.passBins,n=new Map(i.map(r=>[r.id,r])),h=(s.level==="wafer"?[s]:s.perWafer.map(r=>r.summary)).every(r=>(r.stats.hardBinsConsidered??[]).length===0),f=r=>c!==void 0&&se(r)&&$e(r.variable.kind,r.variable.bin??NaN,c,!h),a={isPassRate:r=>r.variable.kind==="yield"||c?.length===1&&f(r),isFailBin:r=>c!==void 0&&se(r)&&!f(r)},u=i.filter(r=>ce.has(r.comparison.family)&&A(r)>0&&(a.isPassRate(r)&&r.effect.direction==="lower"||a.isFailBin(r)&&r.effect.direction==="higher")),m=u.some(r=>r.variable.kind==="hardBin")?u.filter(r=>r.variable.kind!=="softBin"):u,p=[],x=new Map,o=new Set;for(const r of Ae(m)){const w=r.map(L=>m[L]),B=Pe(w,i,d,a);p.push(B);const R=B.target.kind==="finding"?B.target.id:void 0;x.set(B,te(w.find(L=>L.id===R)??w[0]))}for(const r of i.filter(w=>w.variable.kind==="spatialPattern")){const w=new Set((r.relatedIds??[]).filter(q=>n.has(q))),B=p.find(q=>q.findingIds.some(Z=>w.has(Z)));if(!B)continue;const R=r.level==="lot"&&"waferIndices"in r.highlight?r.highlight.waferIndices?.length:void 0,L=R!==void 0&&d?` on ${R}/${d} wafers`:"";B.text=`${r.variable.label} pattern${L}. ${B.text}`,B.reason=`${r.variable.label} pattern${L}. ${B.reason}`,B.chips.unshift({label:`${r.variable.label} pattern`,target:P(r)}),B.findingIds.unshift(r.id,...[...w].filter(q=>!p.some(Z=>Z.findingIds.includes(q))))}const l=Ge(s),g=new Set,N=Xe(s,g),v=[...p],_=Ze(N,v,x,l);s.level==="lot"&&p.push(...Ye(s)),p.push(..._.map(r=>r.item));const F=new Set(_.filter(r=>l>0&&r.item.diesLost/l>=K).map(r=>r.testNumber));p.push(...tt(i,[...v,..._.map(r=>r.item)],x),...st(i,l),...it(s,g,l),...ot(N.filter(r=>r.passingDies>0&&!F.has(r.testNumber))));let z=[];if(s.level==="lot"){const r=rt(s,t.attributes);z=r.compared;for(const w of r.items){const B=w.testNumbers[0],R=w.testNumbers.length===1?p.find(L=>L.target.kind==="test"&&L.target.testNumber===B)??p.find(L=>L.testNumbers.includes(B)):void 0;R?R.text+=`. ${w.text}`:p.push(w)}}const W=qe(s),M=p.filter(r=>l>0&&r.affected/l>=K);for(const r of M)r.shareOfDies=r.affected/l,r.impact=Ke(r.shareOfDies,r.kind==="loss"&&W>0?r.diesLost/W:0),r.measure||(r.measure=`${(r.shareOfDies*100).toFixed(1)}%`);const y=r=>`${String(r.testNumbers[0]??"").padStart(10,"0")}${r.findingIds[0]??""}`;M.sort((r,w)=>w.affected-r.affected||(y(r)<y(w)?-1:y(r)>y(w)?1:0));const I=M.slice(0,le),k=M.slice(le);for(const r of[...I,...k])for(const w of r.findingIds)o.add(w);const $=k.length>0?{items:k.slice(0,fe),more:Math.max(0,k.length-fe)}:void 0,O=s.level==="lot"?"region, fail bin or wafer":"region or fail bin",H=i.filter(r=>r.severity==="unusual"&&!o.has(r.id)).length,Q=I.length===0?H>0?`No ${O} costs as much as ${E(K)} yield points, though ${T(H,"finding")} below ${H===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${O} costs as much as ${E(K)} yield points.`:void 0;return{headline:lt(s,t),items:I,...$?{also:$}:{},...Q?{nothing:Q}:{},checked:ft(s,o,z)}}export const synthesisKey=e=>e.target.kind==="finding"?`finding:${e.target.id}`:`test:${e.target.testNumber}`,SYNTHESIS_ALSO_HEADING=`Also, each affecting at least ${(K*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>e.measure,synthesisMoreTests=e=>e.moreTests?`and ${e.moreTests} more test${e.moreTests===1?"":"s"}`:void 0;export function synthesisText(e){return[e.headline,...e.nothing?[e.nothing]:[],...e.items.map((t,s)=>`${s+1}. ${t.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(t=>`${t.brief} (${synthesisRowShare(t)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],e.checked].join(`
|
|
1
|
+
import{maxOf as be,minOf as $e}from"../core/utils.js";import{isPassBin as Ae,passBinsLabel as Te}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as We}from"./lotDrift.js";import{isOneBinCluster as He}from"./filterFindings.js";import{plainBinTerms as Re}from"../renderer/fmt.js";import{benjaminiHochberg as Ce,normalUpperTail as qe}from"./math.js";import{formatP as ye}from"./groupCompare.js";import{adjustedFits as Ke,mergePartitions as Ye,overlapping as Ge}from"./groupEffects.js";import{ringPlotValue as Ue}from"./dieRegions.js";import{parseRegionKey as Ve}from"./regions.js";import{attributeLabel as ie,buildFacetTable as Xe,facetValueOf as Me}from"./facets.js";const Je=1,Qe=2,Ze=.5,Ie=3,xe=5,Q=.01,et=.02,tt=.04,st=.15,it=.4,ue=.5,nt=.1,rt=2,_e=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function we(e){const s=e.highlight;return"dieKeysByWafer"in s&&s.dieKeysByWafer?Object.values(s.dieKeysByWafer).reduce((i,n)=>i+n.length,0):"dieKeys"in s&&s.dieKeys&&s.dieKeys.length>0?s.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function Ne(e){const s=e.highlight,i=new Set;if("dieKeysByWafer"in s&&s.dieKeysByWafer)for(const[n,c]of Object.entries(s.dieKeysByWafer))for(const o of c)i.add(`${n}:${o}`);else if("dieKeys"in s&&s.dieKeys)for(const n of s.dieKeys)i.add(n);return i}const z=e=>Math.abs(e.effect.absoluteDelta??0),K=e=>z(e)*(we(e)??0),W=e=>(e*100).toFixed(1),ae=e=>{const s=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return Re(s)},_=e=>Math.round(e).toLocaleString("en-GB"),H=(e,s,i=`${s}s`)=>`${_(e)} ${e===1?s:i}`;function Z(e){const s=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(s)?`${s} quadrant`:s}const De=He;function ot(e){const s=e.map((f,a)=>a),i=f=>s[f]===f?f:s[f]=i(s[f]),n=e.map(Ne),c=(f,a)=>{const h=n[f].size<=n[a].size?n[f]:n[a],v=h===n[f]?n[a]:n[f];let N=0;for(const w of h)v.has(w)&&N++;return N},o=e.map((f,a)=>a).filter(f=>De(e[f])),r=e.map((f,a)=>a).filter(f=>!De(e[f]));for(let f=0;f<r.length;f++)for(let a=f+1;a<r.length;a++){const h=Math.min(n[r[f]].size,n[r[a]].size);h>0&&c(r[f],r[a])>=ue*h&&(s[i(r[f])]=i(r[a]))}for(const f of o){let a=-1,h=0;for(const v of r){if(ve(e[v])&&e[v].variable.bin!==e[f].variable.bin)continue;const N=c(f,v);N>h&&N>=ue*n[f].size&&N>=ue*K(e[v])&&(a=v,h=N)}a>=0&&(s[f]=i(a))}const $=new Map;return e.forEach((f,a)=>{const h=i(a);($.get(h)??$.set(h,[]).get(h)).push(a)}),[...$.values()]}const ve=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",ke=(e,s)=>e.level===s.level&&e.comparison.family===s.comparison.family&&e.comparison.left===s.comparison.left;function at(e,s,i){const n=o=>s.filter(r=>r.variable.kind===o&&ke(r,e)&&r.effect.direction==="higher"&&i(r));return(n("hardBin").length>0?n("hardBin"):n("softBin")).filter(o=>o!==e).sort((o,r)=>z(r)-z(o))}const lt={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},ft=2;function Be(e){const s=new Map;for(const n of e){const c=n.comparison.family;(s.get(c)??s.set(c,new Set).get(c)).add(Z(n))}const i=[];for(const[n,c]of s)c.size<=ft?i.push(...c):i.push(`${c.size} ${lt[n]??n}`);return i.join(", ")}const dt=e=>e.charAt(0).toUpperCase()+e.slice(1),ee=e=>({kind:"finding",id:e.id}),ct=e=>({label:dt(ae(e)),target:ee(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function he(e){const s=e.comparison.family;return{builtin:s==="quadrant"||s==="sector"?"quadrant":s==="reticle-position"?"reticleCell":s==="test-site"?"site":"ring"}}const Oe=(e,s)=>({chart:"bar",fields:{x:e,y:s,color:{none:!0}},valueLabels:!0,axes:{y:{references:[{stat:"median"}]}}}),pe=e=>({test:e}),Se=(e,s=!1)=>({chart:"histogram",fields:{y:pe(e),color:{none:!0}},...s?{normalCurve:!0}:{}});function ut(e,s,i,n){const c=[...e].sort((u,D)=>K(D)-K(u))[0],o=e.find(u=>n.isPassRate(u)&&ke(u,c))??c,r=e.filter(u=>u!==o),$=o.level==="lot"&&"waferIndices"in o.highlight?o.highlight.waferIndices?.length:void 0,f=$!==void 0&&i?` on ${$}/${i} wafers`:"",a=!n.isPassRate(o),h=o.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let v=a?`${Z(o)}: ${ae(o)} ${W(z(o))} points higher than ${h}${f}`:`${Z(o)}: pass rate ${W(z(o))} points below ${h}${f}`;const N=`${v} \u2014 about ${_(K(o))} dies lost`,w=at(o,s,n.isFailBin).map(u=>({f:u,share:z(u)/(z(o)||1)})).filter(u=>a||u.share>=nt).slice(0,rt);if(a)for(const{f:u}of w)v+=`, ${ae(u)} ${W(z(u))} points higher`;else if(w.length>0){const u=w.reduce((F,R)=>F+R.share,0)<=1.000000001,D=u&&w[0].share>.5?"mostly ":"";w.forEach(({f:F},R)=>{v+=R===0?`; ${u?D:""}`:", ",v+=ae(F)+(R===0?u?` accounts for ${W(z(F))} of those points`:` is ${W(z(F))} points higher`:u?` for ${W(z(F))}`:` ${W(z(F))} points higher`)})}v+=` \u2014 about ${_(K(o))} dies lost`;const B=r.filter(u=>!ke(u,o));B.length>0&&(v+=` (also seen as ${Be(B)})`);const g=a?ae(o):"pass rate";return{kind:"loss",impact:"low",shareOfDies:0,diesLost:K(o),affected:K(o),measure:"",severity:o.severity,text:v,reason:N,brief:`${Z(o)}: ${g}, ${_(K(o))} dies`,subject:Z(o),target:ee(o),chips:[...a?[o]:[],...w.map(({f:u})=>u)].map(ct),findingIds:[o.id,...r.map(u=>u.id)],testNumbers:[],chart:a?{chart:"bar",fields:{x:he(o),color:{builtin:o.variable.kind==="softBin"?"sbin":"hbin"}},stack:"percent"}:o.level==="lot"?{chart:"heatmap",fields:{x:{builtin:"wafer"},rows:he(o),y:{builtin:"yield"}}}:Oe(he(o),{builtin:"yield"})}}function ht(e,s){return e>=tt||s>=it?"high":e>=et||s>=st?"medium":"low"}function pt(e){const s=i=>i.stats.yieldPercent==null?0:i.stats.analyzedDies*(1-i.stats.yieldPercent/100);return e.level==="wafer"?s(e):e.perWafer.reduce((i,n)=>i+s(n.summary),0)}function mt(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((s,i)=>s+i.summary.stats.analyzedDies,0)}const Fe=e=>e.id.startsWith("inter-wafer:yield:");function gt(e){const s=[];for(const i of e.findings){if(!Fe(i)||i.effect.direction!=="lower")continue;const n="waferIndices"in i.highlight?i.highlight.waferIndices?.[0]:void 0,c=n===void 0?void 0:e.perWafer.find(o=>o.waferIndex===n)?.summary.stats.analyzedDies;c!==void 0&&s.push({kind:"loss",impact:"low",shareOfDies:0,diesLost:z(i)*c,affected:z(i)*c,measure:"",severity:i.severity,text:`${i.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${_(z(i)*c)} dies lost`,reason:`${i.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${_(z(i)*c)} dies lost`,brief:`${i.comparison.left}: yield, ${_(z(i)*c)} dies`,subject:i.comparison.left,target:ee(i),chips:[],findingIds:[i.id],testNumbers:[],chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:{builtin:"yield"}}}})}return s}function bt(e,s){if(e.level==="wafer"){const o=e.stats.testFailures?.[s];return o?{keys:new Set(o.dieKeys),lost:o.lostDies}:void 0}const i=new Set;let n=0,c=!1;for(const o of e.perWafer){const r=o.summary.stats.testFailures?.[s];if(r){c=!0,n+=r.lostDies;for(const $ of r.dieKeys)i.add(`${o.waferIndex}:${$}`)}}return c?{keys:i,lost:n}:void 0}function $t(e,s){const i=e.stats,n=[],c=r=>Oe({builtin:e.level==="lot"?"wafer":"ring"},{passRate:r}),o=(r,$,f,a,h,v,N=h,w=!1)=>{if(f<=0||a<=0)return;s.add(r);const B=bt(e,r),g=B?Math.min(B.lost,f):f,u=f-g,D=f/a*100;n.push({testNumber:r,label:$,verb:h,plainVerb:N,failDies:f,passingDies:u,keys:B?.keys,item:{kind:"loss",impact:"low",shareOfDies:0,diesLost:g,affected:g,measure:"",severity:"info",text:`${$} ${h} on ${_(f)} of ${_(a)} dies (${D.toFixed(1)}%)`+(u>0?`; ${_(u)} of them are binned as passing, so about ${_(g)} dies lost`:""),reason:`${$} ${h} on ${_(f)} of ${_(a)} dies (${D.toFixed(1)}%)`,brief:u>0?`${$}: ${v}, ${_(g)} dies lost`:`${$}: ${_(f)} dies ${v}`,subject:$,target:{kind:"test",testNumber:r},chips:[],findingIds:[],testNumbers:[r],chart:w||e.level==="lot"?c(r):Se(r)}})};for(const r of i.testSpecYield??[]){const $=r.failHighDies===0?"is below its low limit":r.failLowDies===0?"is above its high limit":`is outside its limits (${_(r.failLowDies)} low, ${_(r.failHighDies)} high)`;o(r.testNumber,r.label,r.failLowDies+r.failHighDies,r.totalDies,$,"outside limits",r.failLowDies>0&&r.failHighDies>0?"is outside its limits":$)}for(const r of i.functionalYield??[])o(r.testNumber,r.label,r.failDies,r.totalDies,"fails","fail","fails",!0);return n}const yt=.5,wt=2,Nt=2,le=5;function vt(e,s,i,n){const c=new Set,o=new Map,r=new Map,$=[...e].sort((f,a)=>a.failDies-f.failDies||f.testNumber-a.testNumber);for(const f of $){const a=f.keys;if(n>0&&f.failDies/n<Q){c.add(f);continue}let h;if(a&&a.size>0&&n>0)for(const w of s){const B=i.get(w);if(!B||B.size===0)continue;let g=0;for(const D of a)B.has(D)&&g++;const u=g/a.size;u>=yt&&u>=wt*(B.size/n)&&(!h||g>h.inside)&&(h={item:w,inside:g})}if(!h){c.add(f);continue}const v=o.get(h.item)??0;if(v<Nt){const w=h.inside===f.failDies?"all":_(h.inside);h.item.text+=`. ${f.label} ${f.verb} on ${H(f.failDies,"die")}, ${w} of them in ${h.item.subject}`,o.set(h.item,v+1)}const N=r.get(h.item)??0;N<le?(h.item.chips.push({label:f.label,target:f.item.target}),r.set(h.item,N+1)):h.item.moreTests=(h.item.moreTests??0)+1,h.item.testNumbers.push(f.testNumber)}return e.filter(f=>c.has(f))}function te(e){return{kind:"signal",impact:"low",shareOfDies:0,diesLost:0,affected:e.affected,measure:e.measure,severity:e.severity,text:e.text,reason:e.reason??e.text,brief:e.brief,subject:e.subject,target:e.target,chips:[],findingIds:e.findingIds??[],testNumbers:e.testNumbers??[],chart:e.chart}}const me=e=>Math.abs(e)<Ze?0:Math.min(1,(Math.abs(e)/Qe)**2),Y=e=>`${Math.abs(e).toFixed(1)}\u03C3`,kt=e=>e.variable.kind==="test"&&e.variable.measure!=="limitFailRate"&&_e.has(e.comparison.family)&&Number.isFinite(e.effect.effectSize??NaN)&&!e.id.startsWith("drift:");function St(e,s,i){const n=new Map;for(const r of e)!kt(r)||r.variable.index===void 0||(n.get(r.variable.index)??n.set(r.variable.index,[]).get(r.variable.index)).push(r);const c=r=>(we(r)??r.stats.sampleSizeLeft)*me(r.effect.effectSize??0),o=[];for(const[r,$]of[...n].sort((f,a)=>f[0]-a[0])){const f=[...$].sort((g,u)=>c(u)-c(g)),a=f[0],h=a.effect.effectSize??0;if(c(a)===0)continue;const v=Ne(a);let N=s.find(g=>g.target.kind==="test"&&g.target.testNumber===r)??s.find(g=>g.testNumbers.includes(r))??s.find(g=>f.some(u=>g.findingIds.includes(u.id))),w=0;for(const g of N?[]:s){const u=i.get(g);if(!u||u.size===0||v.size===0)continue;let D=0;for(const F of v)u.has(F)&&D++;D>=ue*Math.min(u.size,v.size)&&D>w&&(w=D,N=g)}if(N){N.text+=`. ${a.summary}`,N.testNumbers.includes(r)||(N.chips.filter(u=>u.target.kind==="test"||u.shift).length<le?N.chips.push({label:a.variable.label,target:ee(a),shift:!0}):N.moreTests=(N.moreTests??0)+1,N.testNumbers.push(r));for(const g of f)N.findingIds.includes(g.id)||N.findingIds.push(g.id);continue}const B=we(a)??a.stats.sampleSizeLeft;o.push(te({affected:c(a),measure:Y(h),severity:a.severity,text:`${a.summary}: a shift of ${Y(h)} over ${H(B,"die")}`+(f.length>1?` (also seen as ${Be(f.slice(1))})`:""),reason:`${a.summary}: a shift of ${Y(h)} over ${H(B,"die")}`,brief:`${Z(a)}: ${a.variable.label} ${a.effect.direction}`,subject:Z(a),target:ee(a),findingIds:f.map(g=>g.id),testNumbers:[r],chart:{chart:"box",fields:{x:he(a),y:pe(r),color:{none:!0}},axes:{y:{references:[{stat:"median"}]}}}}))}return o}function Mt(e,s){return e.filter(i=>i.id.startsWith("drift:")).map(i=>{const n=i.variable.kind==="yield",c=i.effect.effectSize??0;return te({affected:s*(n?Math.abs(c):me(c)),measure:n?`${W(Math.abs(c))} pts`:Y(c),severity:i.severity,text:i.summary,brief:`${i.variable.label}: drifts across the wafers`,subject:i.variable.label,target:ee(i),findingIds:[i.id],...i.variable.index!==void 0?{testNumbers:[i.variable.index]}:{},chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:n||i.variable.index===void 0?{builtin:"yield"}:pe(i.variable.index)}}})})}function It(e,s,i){return(e.stats.capability??[]).filter(n=>n.hasSpec&&n.ppk!==null&&n.ppk!==void 0&&n.ppk<Je&&!s.has(n.testNumber)).map(n=>{const c=n.ppk,o=qe(3*c);return te({affected:i*o,measure:`Ppk ${c.toFixed(2)}`,severity:"notable",text:`${n.label} has Ppk ${c.toFixed(2)} against its limits: a spread that would put about ${W(o)}% of the dies outside them`,brief:`${n.label}: Ppk ${c.toFixed(2)}`,subject:n.label,target:{kind:"test",testNumber:n.testNumber},testNumbers:[n.testNumber],chart:Se(n.testNumber,!0)})})}const ge=.05,xt=8,Le=.01,_t=.05,Dt=.25,Bt=1,Ot=3,je=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;function Ft(e,s,i,n=[]){const c={items:[],compared:[],possible:[]},o=e.perWafer;if(o.length<4)return c;const r=Xe(o.map(t=>({metadata:t.summary.wafer,dieCount:t.summary.stats.totalDies})),{facetableOnly:!0,curation:s}).filter(t=>t.splittable&&t.values.length<=Math.max(2,Math.floor(o.length/2)));if(r.length===0)return c;const $=Ye(r.map(t=>({key:t.key,groupOf:o.map(d=>Me(d.summary.wafer,t.key,s))}))),f=t=>e.perWaferTestStats?.find(d=>d.waferIndex===t.waferIndex)?.tests??t.summary.stats.perTestStats??[],a=o.map(t=>new Map(f(t).filter(d=>d.count>=2&&Number.isFinite(d.mean)).map(d=>[d.testNumber,d]))),h=new Map;for(const t of a)for(const[d,p]of t)h.has(d)||h.set(d,p.label);const v=o.map(t=>t.summary.stats.analyzedDies),N=o.map(t=>t.summary.stats.yieldPercent===null?void 0:t.summary.stats.yieldPercent/100),w=o.map(t=>{const d=t.summary.stats.hardBinCounts,p=d?Object.values(d).reduce((m,y)=>m+y,0):0;return d&&p>0?new Map(Object.entries(d).map(([m,y])=>[Number(m),y/p])):void 0}),B=(t,d,p,m)=>{let y;for(const[x,L]of t){const k=L.map(d),j=[...t].filter(([S])=>S!==x).flatMap(([,S])=>S.map(d));if(k.length<2||j.length<2)continue;const A=k.reduce((S,O)=>S+O,0)/k.length-j.reduce((S,O)=>S+O,0)/j.length,b=A/p;(!y||Math.abs(b)>Math.abs(y.d)+1e-9||Math.abs(Math.abs(b)-Math.abs(y.d))<=1e-9&&(L.length<y.groupWafers||L.length===y.groupWafers&&A>0))&&(y=m(x,L,b,A>0))}if(y&&t.size===2){const[x,L]=[...t].find(([k])=>k!==y.group);y.other={group:x,wafers:L.length}}return y},g=[],u=[],D=[];for(const[t,d]of[...h].sort((p,m)=>p[0]-m[0])){const p=a.flatMap(y=>{const x=y.get(t);return x&&Number.isFinite(x.stddev)?[x.stddev**2]:[]}),m=p.length?Math.sqrt(p.reduce((y,x)=>y+x,0)/p.length):NaN;m>0&&D.push({testNumber:t,label:d,values:a.map(y=>y.get(t)?.mean),scale:m})}D.push({testNumber:NaN,label:"Yield",values:N,scale:1,scope:v});const F=[...e.stats.regionYield?.ring??[]].sort((t,d)=>t.yieldPercent-d.yieldPercent)[0];if(F&&o.length>0){const t=o.map(d=>{const p=d.summary.stats.regionYield?.ring?.find(m=>m.key===F.key);return p?p.yieldPercent/100:void 0});if(t.every(d=>d!==void 0)){const d=o.map(p=>p.summary.stats.regionYield?.ring?.find(m=>m.key===F.key)?.n??0);D.push({testNumber:NaN,label:`${F.label} pass rate`,values:t,scale:1,region:F.label,regionValue:Ue(Ve(F.key).ring),scope:d})}}for(const t of D)for(const{partition:d,used:p,fitted:m,allowedFor:y}of Ke(t.values,$)){const x=d.id,L=d.keys;if(!m)continue;const k=B(m.byGroup,b=>p[b],t.scale,(b,P,S,O)=>({part:x,keys:L,testNumber:t.testNumber,label:t.label,group:b,members:P,groupWafers:P.length,groupDies:P.reduce((T,I)=>T+v[I],0),d:S,higher:O,p:m.p,...t.region?{region:t.region,regionValue:t.regionValue}:{},...y?{allowedFor:y}:{}}));if(!k)continue;const j=k.members.map(b=>p[b]),A=[...m.byGroup].filter(([b])=>b!==k.group).flatMap(([,b])=>b.map(P=>p[P]));if(t.scope){const b=S=>S.reduce((O,T)=>O+t.scope[T],0),P=[...m.byGroup].filter(([S])=>S!==k.group).flatMap(([,S])=>S);k.lost=(k.higher?b(P):b(k.members))*Math.abs(k.d)}if(k.separated=$e(j)>be(A)||be(j)<$e(A),Number.isNaN(t.testNumber)){if(i&&!t.region){let b=0;const P=new Set(w.flatMap(O=>O?[...O.keys()]:[])),S=o.map((O,T)=>T).filter(O=>!k.members.includes(O)&&N[O]!==void 0);for(const O of P){if(i.includes(O))continue;const T=U=>U.reduce((ze,Pe)=>ze+(w[Pe]?.get(O)??0),0)/Math.max(1,U.length),I=(T(k.members)-T(S))*(k.higher?-1:1);I>b&&(b=I,k.bin=O)}}u.push(k)}else g.push(k)}const R=Ce([...g,...u].map(t=>t.p)),C=t=>R[t],ne=new Map;g.forEach((t,d)=>{const p=t.groupDies*me(t.d);C(d)>=ge||p===0||(ne.get(t.part)??ne.set(t.part,[]).get(t.part)).push({c:t,q:C(d),weight:p})});const fe=[...new Set([...g,...u].flatMap(t=>t.keys))].map(t=>ie(t,s)),q=t=>je(t.map(d=>ie(d,s))),G=t=>{const d=`${ie(t.keys[0],s)} ${t.group}`;if(t.keys.length===1)return d;const p=o[t.members[0]].summary.wafer,m=t.keys.slice(1).map(y=>`${ie(y,s)} ${Me(p,y,s)??""}`.trim());return`${d} (${je(m)} group${m.length===1?"s":""} the same wafers)`},V=t=>t.allowedFor?`, allowing for ${q(t.allowedFor)}`:"",X=t=>{const d=$.find(m=>m.id===t),p=d?Ge(d,$):[];return p.length===0?"":`. ${p.map(m=>`${q(m.partition.keys.slice(0,1))} puts ${m.agree} of ${m.of} wafers in the same groups`).join("; ")}, so the wafers cannot fully tell ${p.length===1?"the two":"them"} apart`},J=t=>`${ie(t.keys[0],s)} ${t.other.group}`,se=t=>t.other?`${t.label} is ${t.higher?"higher":"lower"} on ${G(t)} than on ${J(t)} (${t.groupWafers} and ${t.other.wafers} wafers)`:`${t.label} is ${t.higher?"higher":"lower"} on ${G(t)} (${t.groupWafers} of ${o.length} wafers) than on the other wafers`,re=[...ne].map(([t,d])=>{d.sort((I,U)=>Math.abs(U.c.d)-Math.abs(I.c.d)||U.weight-I.weight||I.c.testNumber-U.c.testNumber);const p=d.reduce((I,U)=>Math.max(I,U.weight),0),m=d[0].c.keys,y=m[0],x=q(m),[L,...k]=d,j=L.c,A=`${se(j)}: a shift of ${Y(j.d)}${V(j)}`,b=k.slice(0,2).map(({c:I})=>`${I.label} ${I.higher?"higher":"lower"} on ${I.keys.length>1?ie(I.keys[0],s)+" ":""}${I.group} (${Y(I.d)})`),P=k.length-b.length,S=d.length,O=(S===1?`${A}, each wafer one value (q ${ye(L.q)})`:`${S} tests differ by ${x}. Largest: ${A}, each wafer one value (q ${ye(L.q)}); next: ${b.join(", ")}${P>0?`, and ${P} more`:""}`)+X(t),T=te({affected:p,measure:Y(j.d),severity:L.q<.001?"unusual":"notable",text:O,reason:S===1?A:`${S} tests differ by ${x}. Largest: ${A}`,brief:S===1?`${x} ${j.group}: ${j.label} ${j.higher?"higher":"lower"}`:`${x}: ${S} tests differ`,subject:x,target:{kind:"test",testNumber:j.testNumber},testNumbers:d.map(I=>I.c.testNumber),chart:S>1?{chart:"heatmap",level:"wafer",aggregate:"mean",normalize:"zscore",fields:{x:{meta:y},y:{tests:d.slice(0,xt).map(I=>I.c.testNumber)}}}:{chart:"box",level:"wafer",aggregate:"mean",fields:{x:{meta:y},y:pe(j.testNumber),color:{meta:y}}}});return S>1&&(T.chips=d.slice(0,le).map(({c:I})=>({label:`${I.label} ${Y(I.d)}`,target:{kind:"test",testNumber:I.testNumber}})),S>le&&(T.moreTests=S-le)),T});u.forEach((t,d)=>{const p=C(g.length+d),m=t.lost??t.groupDies*Math.abs(t.d);if(p>=ge||Math.abs(t.d)<Le)return;const y=q(t.keys),x=`${(Math.abs(t.d)*100).toFixed(1)} points`,L=`${t.bin!==void 0?`, mostly in hard bin ${t.bin}`:""}${V(t)}`,k=t.other?`${t.label} is ${x} ${t.higher?"higher":"lower"} on ${G(t)} than on ${J(t)} (${t.groupWafers} and ${t.other.wafers} wafers)`:`${t.label} is ${x} ${t.higher?"higher":"lower"} on ${G(t)} (${t.groupWafers} of ${o.length} wafers) than on the other wafers`;re.push(te({affected:m,measure:x,severity:p<.001?"unusual":"notable",text:`${k}${L}, each wafer one value (q ${ye(p)})${X(t.part)}`,reason:`${k}${L}`,brief:`${y} ${t.group}: ${t.region?"ring pass rate":"yield"} ${t.higher?"higher":"lower"}`,subject:y,target:{kind:"group",field:t.keys[0],fields:t.keys},testNumbers:[],chart:{chart:"bar",fields:{x:{meta:t.keys[0]},y:{builtin:"yield"},color:{meta:t.keys[0]}},valueLabels:!0,...t.region?{where:{conditions:[{field:{builtin:"ring"},values:[t.regionValue??t.region]}]}}:{}}}))});const de=v.reduce((t,d)=>t+d,0),oe=new Set([...g.filter((t,d)=>C(d)<ge&&t.groupDies*me(t.d)>0).map(t=>t.part),...u.filter((t,d)=>C(g.length+d)<ge&&Math.abs(t.d)>=Le).map(t=>t.part)]),ce=[...g.filter(t=>Math.abs(t.d)>=Bt),...u.filter(t=>(t.lost??0)>=Math.min(Q*de,...n.map(d=>Dt*d)))].filter(t=>t.separated&&t.p<_t&&!oe.has(t.part)),l=new Map;for(const t of ce)(l.get(`${t.part}|${t.group}`)??l.set(`${t.part}|${t.group}`,[]).get(`${t.part}|${t.group}`)).push(t);const M=[],E=g.length+u.length;for(const t of l.values()){const d=t.find(b=>Number.isNaN(b.testNumber)),p=t.filter(b=>!Number.isNaN(b.testNumber)||!d||b.higher===d.higher);if(p.length<2)continue;const m=p[0],y=b=>Number.isNaN(b.testNumber)?`${b.label} ${b.higher?"higher":"lower"} by ${(Math.abs(b.d)*100).toFixed(1)} points`:`${b.label} ${b.higher?"higher":"lower"} (${Y(b.d)})`,x=m.other?`than on ${J(m)} (${m.groupWafers} and ${m.other.wafers} wafers)`:`than on the other wafers (${m.groupWafers} of ${o.length})`,L=`${G(m)}: ${p.map(y).join("; ")} ${x}`,k=q(m.keys),j=p.reduce((b,P)=>Math.max(b,P.lost??0),0),A=te({affected:j,measure:`${p.length} measures`,severity:"info",text:`Possibly ${L}. No wafer of the group overlaps the others on ${p.length===2?"either":`any of ${p.length}`}, but the sample is too small to confirm it once ${E} comparisons are allowed for`,reason:`Possibly ${L}`,brief:`${k} ${m.group}: possible, not confirmed`,subject:k,target:{kind:"group",field:m.keys[0],fields:m.keys},testNumbers:p.filter(b=>!Number.isNaN(b.testNumber)).map(b=>b.testNumber),chart:{chart:"bar",fields:{x:{meta:m.keys[0]},y:{builtin:"yield"},color:{meta:m.keys[0]}},valueLabels:!0}});M.push(A)}return M.sort((t,d)=>d.affected-t.affected),{items:re,compared:fe,possible:M.slice(0,Ot)}}export function groupColouredChart(e,s){const i=e.fields?.x,n=e.fields?.color;return!s||e.chart!=="bar"||!i||Array.isArray(i)||!("builtin"in i)||i.builtin!=="wafer"||!n||!("none"in n)?e:{...e,fields:{...e.fields,x:[{slot:"groupBy"},{builtin:"wafer"}],color:{follow:"groupBy"}}}}function Lt(e){return e.map(s=>te({affected:s.passingDies,measure:"",severity:"notable",text:`${s.label} ${s.plainVerb} on ${H(s.passingDies,"die")} binned as passing`,brief:`${s.label}: ${_(s.passingDies)} dies out of limits, binned passing`,subject:s.label,target:s.item.target,testNumbers:[s.testNumber],chart:Se(s.testNumber)}))}function jt(e,s){const i=s.passBins&&s.passBins.length>0?`; pass ${Te([s.passBins])}`:"";if(e.level==="wafer"){const a=e.stats.yieldPercent;return a==null?`${_(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${a.toFixed(1)}% (${_(e.stats.totalDies)} dies${i}).`}const n=e.lotYieldSeries.map(a=>a.yieldPercent).filter(a=>typeof a=="number");if(n.length===0)return`${H(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const c=n.reduce((a,h)=>a+h,0)/n.length,o=e.perWafer.reduce((a,h)=>a+h.summary.stats.totalDies,0),[r,$]=[$e(n).toFixed(1),be(n).toFixed(1)],f=r!==$?`, range ${r}\u2013${$}%`:"";return`Yield ${c.toFixed(1)}% (mean of ${H(n.length,"wafer")}, ${_(o)} dies${i})${f}.`}function Et(e,s,i=[]){const n=[],c=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(a=>a.summary.stats.testsConsidered)).size,o=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(a=>a.summary.stats.hardBinsConsidered)).size,r=e.stats.testValueAnalysis?.state;if(c>0&&r!=="off"&&n.push(H(c,"test")+(r==="skipped"?" (against their limits only)":"")),o>0&&n.push(H(o,"hard bin")),n.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const a=e.findings.filter(Fe);n.push(a.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${H(a.length,"outlier wafer")})`),e.stats.waferCount>=We&&n.push("the yield trend across the wafers (input order)"),i.length&&n.push(`the tests between the groups of ${i.join(", ")} (each wafer one value)`)}const $=e.findings.filter(a=>!s.has(a.id)).length,f=$>0?` ${H($,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${n.join(", ")}.${f}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}const Ee=new WeakMap;export function buildSynthesis(e,s={}){const i=`${s.passBins?.join(",")??"-"}|${s.attributes?JSON.stringify(s.attributes):"-"}`;let n=Ee.get(e);n||Ee.set(e,n=new Map);const c=n.get(i),o=e.findings;if(c&&c.findings.length===o.length&&c.findings.every(($,f)=>$===o[f]))return c.synthesis;const r=zt(e,s);return Object.freeze(r.items),r.items.forEach(Object.freeze),r.possible&&(r.possible.forEach(Object.freeze),Object.freeze(r.possible)),r.also&&(Object.freeze(r.also.items),r.also.items.forEach(Object.freeze),Object.freeze(r.also)),n.set(i,{findings:[...o],synthesis:Object.freeze(r)}),r}function zt(e,s){const i=synthesisSource(e),n=i.findings,c=i.level==="lot"?i.stats.waferCount:void 0,o=s.passBins,r=new Map(n.map(l=>[l.id,l])),$=(i.level==="wafer"?[i]:i.perWafer.map(l=>l.summary)).every(l=>(l.stats.hardBinsConsidered??[]).length===0),f=l=>o!==void 0&&ve(l)&&Ae(l.variable.kind,l.variable.bin??NaN,o,!$),a={isPassRate:l=>l.variable.kind==="yield"||o?.length===1&&f(l),isFailBin:l=>o!==void 0&&ve(l)&&!f(l)},h=n.filter(l=>_e.has(l.comparison.family)&&K(l)>0&&(a.isPassRate(l)&&l.effect.direction==="lower"||a.isFailBin(l)&&l.effect.direction==="higher")),N=h.some(l=>l.variable.kind==="hardBin")?h.filter(l=>l.variable.kind!=="softBin"):h,w=[],B=new Map,g=new Set;for(const l of ot(N)){const M=l.map(d=>N[d]),E=ut(M,n,c,a);w.push(E);const t=E.target.kind==="finding"?E.target.id:void 0;B.set(E,Ne(M.find(d=>d.id===t)??M[0]))}for(const l of n.filter(M=>M.variable.kind==="spatialPattern")){const M=new Set((l.relatedIds??[]).filter(p=>r.has(p))),E=w.find(p=>p.findingIds.some(m=>M.has(m)));if(!E)continue;const t=l.level==="lot"&&"waferIndices"in l.highlight?l.highlight.waferIndices?.length:void 0,d=t!==void 0&&c?` on ${t}/${c} wafers`:"";E.text=`${l.variable.label} pattern${d}. ${E.text}`,E.reason=`${l.variable.label} pattern${d}. ${E.reason}`,E.chips.unshift({label:`${l.variable.label} pattern`,target:ee(l)}),E.findingIds.unshift(l.id,...[...M].filter(p=>!w.some(m=>m.findingIds.includes(p))))}const u=mt(i),D=new Set,F=$t(i,D),R=[...w],C=vt(F,R,B,u);i.level==="lot"&&w.push(...gt(i)),w.push(...C.map(l=>l.item));const ne=new Set(C.filter(l=>u>0&&l.item.diesLost/u>=Q).map(l=>l.testNumber));w.push(...St(n,[...R,...C.map(l=>l.item)],B),...Mt(n,u),...It(i,D,u),...Lt(F.filter(l=>l.passingDies>0&&!ne.has(l.testNumber))));let fe=[],q=[];if(i.level==="lot"){const l=Ft(i,s.attributes,s.passBins,w.filter(M=>M.kind==="loss").map(M=>M.diesLost));fe=l.compared,q=l.possible;for(const M of l.items){const E=M.testNumbers[0],t=M.testNumbers.length===1?w.find(d=>d.target.kind==="test"&&d.target.testNumber===E)??w.find(d=>d.testNumbers.includes(E)):void 0;t?t.text+=`. ${M.text}`:w.push(M)}}const G=pt(i),V=w.filter(l=>u>0&&l.affected/u>=Q);for(const l of V)l.shareOfDies=l.affected/u,l.impact=ht(l.shareOfDies,l.kind==="loss"&&G>0?l.diesLost/G:0),l.measure||(l.measure=`${(l.shareOfDies*100).toFixed(1)}%`);const X=l=>`${String(l.testNumbers[0]??"").padStart(10,"0")}${l.findingIds[0]??""}`;V.sort((l,M)=>M.affected-l.affected||(X(l)<X(M)?-1:X(l)>X(M)?1:0));const J=V.slice(0,Ie),se=V.slice(Ie);for(const l of[...J,...se])for(const M of l.findingIds)g.add(M);const re=se.length>0?{items:se.slice(0,xe),more:Math.max(0,se.length-xe)}:void 0,de=i.level==="lot"?"region, fail bin or wafer":"region or fail bin",oe=n.filter(l=>l.severity==="unusual"&&!g.has(l.id)).length,ce=J.length===0?oe>0?`No ${de} costs as much as ${W(Q)} yield points, though ${H(oe,"finding")} below ${oe===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${de} costs as much as ${W(Q)} yield points.`:void 0;return{headline:jt(i,s),items:J,...re?{also:re}:{},...q.length?{possible:q}:{},...ce?{nothing:ce}:{},checked:Et(i,g,fe)}}export const synthesisKey=e=>e.target.kind==="finding"?`finding:${e.target.id}`:e.target.kind==="group"?`group:${e.target.field}`:`test:${e.target.testNumber}`,SYNTHESIS_POSSIBLE_HEADING="Possible, not confirmed",SYNTHESIS_ALSO_HEADING=`Also, each affecting at least ${(Q*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>e.measure,synthesisMoreTests=e=>e.moreTests?`and ${e.moreTests} more test${e.moreTests===1?"":"s"}`:void 0;export function synthesisText(e){return[e.headline,...e.nothing?[e.nothing]:[],...e.items.map((s,i)=>`${i+1}. ${s.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(s=>`${s.brief} (${synthesisRowShare(s)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],...e.possible?[`${SYNTHESIS_POSSIBLE_HEADING}:`,...e.possible.map(s=>`- ${s.text}`)]:[],e.checked].join(`
|
|
2
2
|
`)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Die } from '../core/dies.js';
|
|
2
|
+
/** At most this many dies × tests are read to rank; beyond it the first tests are taken as they come. */
|
|
3
|
+
export declare const RANK_BUDGET = 4000000;
|
|
4
|
+
/**
|
|
5
|
+
* The `limit` tests (of `tests`) with the largest share of variance between wafers, most first. Tests with no spread, or
|
|
6
|
+
* with values on fewer than two wafers, are left out. Past the reading budget the first `limit` tests are returned in order.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rankTestsByWaferSpread(wafers: ReadonlyArray<{
|
|
9
|
+
dies: readonly Die[];
|
|
10
|
+
}>, tests: readonly number[], limit: number): number[];
|
|
11
|
+
//# sourceMappingURL=testsByWafer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{testValue as b}from"../core/dieTable.js";export const RANK_BUDGET=4e6;export function rankTestsByWaferSpread(o,r,d){if(o.length<2)return[];if(o.reduce((e,n)=>e+n.dies.length,0)*r.length>RANK_BUDGET)return r.slice(0,d);const h=[];for(const e of r){let n=0,a=0,l=0;const i=[],p=[];for(const u of o){let t=0,f=0;for(const _ of u.dies){const s=b(_,e);s===void 0||!Number.isFinite(s)||(t++,f+=s,l+=s*s)}t&&(i.push(f/t),p.push(t),n+=t,a+=f)}if(i.length<2||n<2)continue;const c=a/n,m=l-n*c*c;if(!(m>0))continue;let g=0;i.forEach((u,t)=>{g+=p[t]*(u-c)**2}),h.push({test:e,share:g/m})}return h.sort((e,n)=>n.share-e.share).slice(0,d).map(e=>e.test)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wafertools/wafermap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "Interactive wafer map visualization and yield analysis for semiconductor test data. Hard bins, soft bins, test values, retests, edge exclusion, reticle overlays, spatial statistics, failure clustering, and lot-level trend analysis — pure ES modules, no runtime dependencies, no server required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|