@wafertools/wafermap 0.37.1 → 0.38.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 +53 -1
- package/README.md +20 -13
- package/dist/packages/canvas-adapter/chartPopulation.d.ts +8 -3
- package/dist/packages/canvas-adapter/chartPopulation.js +1 -1
- package/dist/packages/canvas-adapter/charts/chartShell.d.ts +27 -17
- package/dist/packages/canvas-adapter/charts/chartShell.js +1 -1
- package/dist/packages/canvas-adapter/charts/plotChart.d.ts +0 -7
- package/dist/packages/canvas-adapter/charts/plotChart.js +1 -1
- package/dist/packages/canvas-adapter/drilldown.d.ts +5 -0
- package/dist/packages/canvas-adapter/drilldown.js +1 -1
- package/dist/packages/canvas-adapter/index.d.ts +1 -0
- package/dist/packages/canvas-adapter/index.js +1 -1
- package/dist/packages/canvas-adapter/insightsTab.js +1 -1
- package/dist/packages/canvas-adapter/pinnedTests.d.ts +10 -0
- package/dist/packages/canvas-adapter/pinnedTests.js +1 -0
- package/dist/packages/canvas-adapter/plotCard.d.ts +1 -1
- package/dist/packages/canvas-adapter/plotCard.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.d.ts +3 -3
- package/dist/packages/canvas-adapter/summaryPanel.js +4 -4
- package/dist/packages/canvas-adapter/userGuideHtml.d.ts +1 -1
- package/dist/packages/canvas-adapter/userGuideHtml.js +32 -19
- package/dist/packages/canvas-adapter/version.d.ts +2 -2
- package/dist/packages/canvas-adapter/version.js +1 -1
- package/dist/packages/canvas-adapter/viewSwitch.js +1 -1
- package/dist/packages/renderer/buildWaferMap.js +1 -1
- package/dist/packages/renderer/derivedTests/apply.d.ts +10 -0
- package/dist/packages/renderer/derivedTests/apply.js +1 -1
- package/dist/packages/renderer/derivedTests/check.d.ts +35 -0
- package/dist/packages/renderer/derivedTests/check.js +1 -0
- package/dist/packages/renderer/fmt.d.ts +5 -0
- package/dist/packages/renderer/fmt.js +1 -1
- package/dist/packages/renderer/index.d.ts +2 -0
- package/dist/packages/renderer/index.js +1 -1
- package/dist/packages/stats/analyzeWaferLot.js +1 -1
- package/dist/packages/stats/analyzeWaferMap.js +1 -1
- package/dist/packages/stats/chartCatalogue.js +1 -1
- package/dist/packages/stats/clusterDetection.js +1 -1
- package/dist/packages/stats/plotData.d.ts +7 -0
- package/dist/packages/stats/plotData.js +1 -1
- package/dist/packages/stats/reportHtml.js +33 -29
- package/dist/packages/stats/synthesis.d.ts +1 -1
- package/dist/packages/stats/synthesis.js +1 -1
- package/package.json +8 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{maxOf as me,minOf as ge}from"../core/utils.js";import{isPassBin as be,passBinsLabel as $e}from"../core/passBins.js";import{DRIFT_MIN_WAFERS as we}from"./lotDrift.js";import{isOneBinCluster as ye}from"./filterFindings.js";import{plainBinTerms as ve}from"../renderer/fmt.js";import{benjaminiHochberg as Se,normalUpperTail as Ne}from"./math.js";import{compareGroups as Ie,formatP as re}from"./groupCompare.js";import{attributeLabel as oe,buildFacetTable as ke,facetValueOf as xe}from"./facets.js";const Me=1,De=2,Be=.5,le=3,fe=5,K=.01,_e=.02,Fe=.04,Le=.15,Oe=.4,X=.5,ze=.1,Ae=2,ce=new Set(["ring","quadrant","sector","reticle-position","test-site","cluster","edge-arc"]);function Z(e){const t=e.highlight;return"dieKeysByWafer"in t&&t.dieKeysByWafer?Object.values(t.dieKeysByWafer).reduce((s,i)=>s+i.length,0):"dieKeys"in t&&t.dieKeys&&t.dieKeys.length>0?t.dieKeys.length:e.level==="lot"?void 0:e.stats.sampleSizeLeft}function ee(e){const t=e.highlight,s=new Set;if("dieKeysByWafer"in t&&t.dieKeysByWafer)for(const[i,d]of Object.entries(t.dieKeysByWafer))for(const c of d)s.add(`${i}:${c}`);else if("dieKeys"in t&&t.dieKeys)for(const i of t.dieKeys)s.add(i);return s}const D=e=>Math.abs(e.effect.absoluteDelta??0),E=e=>D(e)*(Z(e)??0),A=e=>(e*100).toFixed(1),G=e=>{const t=e.variable.label.replace(/ \(same dies\)$/,"").replace(/^HBin and SBin (\d+)/,"HBin $1").replace(/^(HBin \d+(?: \([^)]*\))?) and SBin .*$/,"$1");return ve(t)},S=e=>Math.round(e).toLocaleString("en-GB"),T=(e,t,s=`${t}s`)=>`${S(e)} ${e===1?t:s}`;function C(e){const t=e.comparison.left;return e.comparison.family==="quadrant"&&!/quadrant/i.test(t)?`${t} quadrant`:t}const de=ye;function Te(e){const t=e.map((f,n)=>n),s=f=>t[f]===f?f:t[f]=s(t[f]),i=e.map(ee),d=(f,n)=>{const u=i[f].size<=i[n].size?i[f]:i[n],b=u===i[f]?i[n]:i[f];let p=0;for(const m of u)b.has(m)&&p++;return p},c=e.map((f,n)=>n).filter(f=>de(e[f])),r=e.map((f,n)=>n).filter(f=>!de(e[f]));for(let f=0;f<r.length;f++)for(let n=f+1;n<r.length;n++){const u=Math.min(i[r[f]].size,i[r[n]].size);u>0&&d(r[f],r[n])>=X*u&&(t[s(r[f])]=s(r[n]))}for(const f of c){let n=-1,u=0;for(const b of r){if(te(e[b])&&e[b].variable.bin!==e[f].variable.bin)continue;const p=d(f,b);p>u&&p>=X*i[f].size&&p>=X*E(e[b])&&(n=b,u=p)}n>=0&&(t[f]=s(n))}const h=new Map;return e.forEach((f,n)=>{const u=s(n);(h.get(u)??h.set(u,[]).get(u)).push(n)}),[...h.values()]}const te=e=>e.variable.kind==="hardBin"||e.variable.kind==="softBin",se=(e,t)=>e.level===t.level&&e.comparison.family===t.comparison.family&&e.comparison.left===t.comparison.left;function Ee(e,t,s){const i=c=>t.filter(r=>r.variable.kind===c&&se(r,e)&&r.effect.direction==="higher"&&s(r));return(i("hardBin").length>0?i("hardBin"):i("softBin")).filter(c=>c!==e).sort((c,r)=>D(r)-D(c))}const We={ring:"rings",quadrant:"quadrants",sector:"sectors","edge-arc":"edge arcs",cluster:"clusters","reticle-position":"reticle positions","test-site":"test sites"},He=2;function ue(e){const t=new Map;for(const i of e){const d=i.comparison.family;(t.get(d)??t.set(d,new Set).get(d)).add(C(i))}const s=[];for(const[i,d]of t)d.size<=He?s.push(...d):s.push(`${d.size} ${We[i]??i}`);return s.join(", ")}const Re=e=>e.charAt(0).toUpperCase()+e.slice(1),P=e=>({kind:"finding",id:e.id}),je=e=>({label:Re(G(e)),target:P(e),...e.variable.bin!==void 0&&(e.variable.kind==="hardBin"||e.variable.kind==="softBin")?{bin:{kind:e.variable.kind,bin:e.variable.bin}}:{}});function ie(e){const t=e.comparison.family;return{builtin:t==="quadrant"||t==="sector"?"quadrant":t==="reticle-position"?"reticleCell":t==="test-site"?"site":"ring"}}const ne=(e,t)=>({chart:"bar",fields:{x:e,y:t,color:{none:!0}},valueLabels:!0,axes:{y:{references:[{stat:"median"}]}}}),V=e=>({test:e}),he=(e,t=!1)=>({chart:"histogram",fields:{y:V(e),color:{none:!0}},...t?{normalCurve:!0}:{}});function Ce(e,t,s,i){const d=[...e].sort((l,g)=>E(g)-E(l))[0],c=e.find(l=>i.isPassRate(l)&&se(l,d))??d,r=e.filter(l=>l!==c),h=c.level==="lot"&&"waferIndices"in c.highlight?c.highlight.waferIndices?.length:void 0,f=h!==void 0&&s?` on ${h}/${s} wafers`:"",n=!i.isPassRate(c),u=c.comparison.family==="sector"?"the other sectors":"the rest of the wafer";let b=n?`${C(c)}: ${G(c)} ${A(D(c))} points higher than ${u}${f}`:`${C(c)}: pass rate ${A(D(c))} points below ${u}${f}`;const p=`${b} \u2014 about ${S(E(c))} dies lost`,m=Ee(c,t,i.isFailBin).map(l=>({f:l,share:D(l)/(D(c)||1)})).filter(l=>n||l.share>=ze).slice(0,Ae);if(n)for(const{f:l}of m)b+=`, ${G(l)} ${A(D(l))} points higher`;else if(m.length>0){const l=m.reduce((N,v)=>N+v.share,0)<=1.000000001,g=l&&m[0].share>.5?"mostly ":"";m.forEach(({f:N},v)=>{b+=v===0?`; ${l?g:""}`:", ",b+=G(N)+(v===0?l?` accounts for ${A(D(N))} of those points`:` is ${A(D(N))} points higher`:l?` for ${A(D(N))}`:` ${A(D(N))} points higher`)})}b+=` \u2014 about ${S(E(c))} dies lost`;const x=r.filter(l=>!se(l,c));x.length>0&&(b+=` (also seen as ${ue(x)})`);const o=n?G(c):"pass rate";return{kind:"loss",impact:"low",shareOfDies:0,diesLost:E(c),affected:E(c),measure:"",severity:c.severity,text:b,reason:p,brief:`${C(c)}: ${o}, ${S(E(c))} dies`,subject:C(c),target:P(c),chips:[...n?[c]:[],...m.map(({f:l})=>l)].map(je),findingIds:[c.id,...r.map(l=>l.id)],testNumbers:[],chart:n?{chart:"bar",fields:{x:ie(c),color:{builtin:c.variable.kind==="softBin"?"sbin":"hbin"}},stack:"percent"}:ne(ie(c),{builtin:"yield"})}}function Pe(e,t){return e>=Fe||t>=Oe?"high":e>=_e||t>=Le?"medium":"low"}function Ke(e){const t=s=>s.stats.yieldPercent==null?0:s.stats.analyzedDies*(1-s.stats.yieldPercent/100);return e.level==="wafer"?t(e):e.perWafer.reduce((s,i)=>s+t(i.summary),0)}function qe(e){return e.level==="wafer"?e.stats.analyzedDies:e.perWafer.reduce((t,s)=>t+s.summary.stats.analyzedDies,0)}const pe=e=>e.id.startsWith("inter-wafer:yield:");function Ge(e){const t=[];for(const s of e.findings){if(!pe(s)||s.effect.direction!=="lower")continue;const i="waferIndices"in s.highlight?s.highlight.waferIndices?.[0]:void 0,d=i===void 0?void 0:e.perWafer.find(c=>c.waferIndex===i)?.summary.stats.analyzedDies;d!==void 0&&t.push({kind:"loss",impact:"low",shareOfDies:0,diesLost:D(s)*d,affected:D(s)*d,measure:"",severity:s.severity,text:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,reason:`${s.summary.replace(/ percentage points lower than the lot median$/," points below the lot median")} \u2014 about ${S(D(s)*d)} dies lost`,brief:`${s.comparison.left}: yield, ${S(D(s)*d)} dies`,subject:s.comparison.left,target:P(s),chips:[],findingIds:[s.id],testNumbers:[],chart:ne({builtin:"wafer"},{builtin:"yield"})})}return t}function Ye(e,t){if(e.level==="wafer"){const c=e.stats.testFailures?.[t];return c?{keys:new Set(c.dieKeys),lost:c.lostDies}:void 0}const s=new Set;let i=0,d=!1;for(const c of e.perWafer){const r=c.summary.stats.testFailures?.[t];if(r){d=!0,i+=r.lostDies;for(const h of r.dieKeys)s.add(`${c.waferIndex}:${h}`)}}return d?{keys:s,lost:i}:void 0}function Ue(e,t){const s=e.stats,i=[],d=r=>ne({builtin:e.level==="lot"?"wafer":"ring"},{passRate:r}),c=(r,h,f,n,u,b,p=u,m=!1)=>{if(f<=0||n<=0)return;t.add(r);const x=Ye(e,r),o=x?Math.min(x.lost,f):f,l=f-o,g=f/n*100;i.push({testNumber:r,label:h,verb:u,plainVerb:p,failDies:f,passingDies:l,keys:x?.keys,item:{kind:"loss",impact:"low",shareOfDies:0,diesLost:o,affected:o,measure:"",severity:"info",text:`${h} ${u} on ${S(f)} of ${S(n)} dies (${g.toFixed(1)}%)`+(l>0?`; ${S(l)} of them are binned as passing, so about ${S(o)} dies lost`:""),reason:`${h} ${u} on ${S(f)} of ${S(n)} dies (${g.toFixed(1)}%)`,brief:l>0?`${h}: ${b}, ${S(o)} dies lost`:`${h}: ${S(f)} dies ${b}`,subject:h,target:{kind:"test",testNumber:r},chips:[],findingIds:[],testNumbers:[r],chart:m?d(r):he(r)}})};for(const r of s.testSpecYield??[]){const h=r.failHighDies===0?"is below its low limit":r.failLowDies===0?"is above its high limit":`is outside its limits (${S(r.failLowDies)} low, ${S(r.failHighDies)} high)`;c(r.testNumber,r.label,r.failLowDies+r.failHighDies,r.totalDies,h,"outside limits",r.failLowDies>0&&r.failHighDies>0?"is outside its limits":h)}for(const r of s.functionalYield??[])c(r.testNumber,r.label,r.failDies,r.totalDies,"fails","fail","fails",!0);return i}const Xe=.5,Ve=2,Je=2,Y=5;function Qe(e,t,s,i){const d=new Set,c=new Map,r=new Map,h=[...e].sort((f,n)=>n.failDies-f.failDies||f.testNumber-n.testNumber);for(const f of h){const n=f.keys;if(i>0&&f.failDies/i<K){d.add(f);continue}let u;if(n&&n.size>0&&i>0)for(const m of t){const x=s.get(m);if(!x||x.size===0)continue;let o=0;for(const g of n)x.has(g)&&o++;const l=o/n.size;l>=Xe&&l>=Ve*(x.size/i)&&(!u||o>u.inside)&&(u={item:m,inside:o})}if(!u){d.add(f);continue}const b=c.get(u.item)??0;if(b<Je){const m=u.inside===f.failDies?"all":S(u.inside);u.item.text+=`. ${f.label} ${f.verb} on ${T(f.failDies,"die")}, ${m} of them in ${u.item.subject}`,c.set(u.item,b+1)}const p=r.get(u.item)??0;p<Y?(u.item.chips.push({label:f.label,target:f.item.target}),r.set(u.item,p+1)):u.item.moreTests=(u.item.moreTests??0)+1,u.item.testNumbers.push(f.testNumber)}return e.filter(f=>d.has(f))}function U(e){return{kind:"signal",impact:"low",shareOfDies:0,diesLost:0,affected:e.affected,measure:e.measure,severity:e.severity,text:e.text,reason:e.reason??e.text,brief:e.brief,subject:e.subject,target:e.target,chips:[],findingIds:e.findingIds??[],testNumbers:e.testNumbers??[],chart:e.chart}}const ae=e=>Math.abs(e)<Be?0:Math.min(1,(Math.abs(e)/De)**2),H=e=>`${Math.abs(e).toFixed(1)}\u03C3`,Ze=e=>e.variable.kind==="test"&&e.variable.measure!=="limitFailRate"&&ce.has(e.comparison.family)&&Number.isFinite(e.effect.effectSize??NaN)&&!e.id.startsWith("drift:");function et(e,t,s){const i=new Map;for(const r of e)!Ze(r)||r.variable.index===void 0||(i.get(r.variable.index)??i.set(r.variable.index,[]).get(r.variable.index)).push(r);const d=r=>(Z(r)??r.stats.sampleSizeLeft)*ae(r.effect.effectSize??0),c=[];for(const[r,h]of[...i].sort((f,n)=>f[0]-n[0])){const f=[...h].sort((o,l)=>d(l)-d(o)),n=f[0],u=n.effect.effectSize??0;if(d(n)===0)continue;const b=ee(n);let p=t.find(o=>o.target.kind==="test"&&o.target.testNumber===r)??t.find(o=>o.testNumbers.includes(r))??t.find(o=>f.some(l=>o.findingIds.includes(l.id))),m=0;for(const o of p?[]:t){const l=s.get(o);if(!l||l.size===0||b.size===0)continue;let g=0;for(const N of b)l.has(N)&&g++;g>=X*Math.min(l.size,b.size)&&g>m&&(m=g,p=o)}if(p){p.text+=`. ${n.summary}`,p.testNumbers.includes(r)||(p.chips.filter(l=>l.target.kind==="test"||l.shift).length<Y?p.chips.push({label:n.variable.label,target:P(n),shift:!0}):p.moreTests=(p.moreTests??0)+1,p.testNumbers.push(r));for(const o of f)p.findingIds.includes(o.id)||p.findingIds.push(o.id);continue}const x=Z(n)??n.stats.sampleSizeLeft;c.push(U({affected:d(n),measure:H(u),severity:n.severity,text:`${n.summary}: a shift of ${H(u)} over ${T(x,"die")}`+(f.length>1?` (also seen as ${ue(f.slice(1))})`:""),reason:`${n.summary}: a shift of ${H(u)} over ${T(x,"die")}`,brief:`${C(n)}: ${n.variable.label} ${n.effect.direction}`,subject:C(n),target:P(n),findingIds:f.map(o=>o.id),testNumbers:[r],chart:{chart:"box",fields:{x:ie(n),y:V(r),color:{none:!0}}}}))}return c}function tt(e,t){return e.filter(s=>s.id.startsWith("drift:")).map(s=>{const i=s.variable.kind==="yield",d=s.effect.effectSize??0;return U({affected:t*(i?Math.abs(d):ae(d)),measure:i?`${A(Math.abs(d))} pts`:H(d),severity:s.severity,text:s.summary,brief:`${s.variable.label}: drifts across the wafers`,subject:s.variable.label,target:P(s),findingIds:[s.id],...s.variable.index!==void 0?{testNumbers:[s.variable.index]}:{},chart:{chart:"control",fields:{x:{builtin:"waferOrder"},y:i||s.variable.index===void 0?{builtin:"yield"}:V(s.variable.index)}}})})}function st(e,t,s){return(e.stats.capability??[]).filter(i=>i.hasSpec&&i.ppk!==null&&i.ppk!==void 0&&i.ppk<Me&&!t.has(i.testNumber)).map(i=>{const d=i.ppk,c=Ne(3*d);return U({affected:s*c,measure:`Ppk ${d.toFixed(2)}`,severity:"notable",text:`${i.label} has Ppk ${d.toFixed(2)} against its limits: a spread that would put about ${A(c)}% of the dies outside them`,brief:`${i.label}: Ppk ${d.toFixed(2)}`,subject:i.label,target:{kind:"test",testNumber:i.testNumber},testNumbers:[i.testNumber],chart:he(i.testNumber,!0)})})}const it=.05;function nt(e,t){const s={items:[],compared:[]},i=e.perWafer;if(i.length<4)return s;const d=ke(i.map(o=>({metadata:o.summary.wafer,dieCount:o.summary.stats.totalDies})),{facetableOnly:!0,curation:t}).filter(o=>o.splittable&&o.values.length<=Math.max(2,Math.floor(i.length/2)));if(d.length===0)return s;const c=o=>e.perWaferTestStats?.find(l=>l.waferIndex===o.waferIndex)?.tests??o.summary.stats.perTestStats??[],r=i.map(o=>new Map(c(o).filter(l=>l.count>=2&&Number.isFinite(l.mean)).map(l=>[l.testNumber,l]))),h=new Map;for(const o of r)for(const[l,g]of o)h.has(l)||h.set(l,g.label);const f=i.map(o=>o.summary.stats.analyzedDies),n=[];for(const o of d){const l=i.map(g=>xe(g.summary.wafer,o.key,t));for(const[g,N]of[...h].sort((v,_)=>v[0]-_[0])){const v=new Map,_=[];if(r.forEach((y,I)=>{const k=y.get(g),$=l[I];!k||$===void 0||((v.get($)??v.set($,[]).get($)).push(I),Number.isFinite(k.stddev)&&_.push(k.stddev**2))}),v.size<2)continue;const F=Ie([...v].map(([y,I])=>({key:y,values:I.map(k=>r[k].get(g).mean)}))),O=F.welch?.p??F.kruskal?.p,W=_.length?Math.sqrt(_.reduce((y,I)=>y+I,0)/_.length):NaN;if(O===void 0||!Number.isFinite(O)||!(W>0))continue;let M;for(const[y,I]of v){const k=I.map(a=>r[a].get(g).mean),$=[...v].filter(([a])=>a!==y).flatMap(([,a])=>a.map(w=>r[w].get(g).mean));if(k.length<2||$.length<2)continue;const L=k.reduce((a,w)=>a+w,0)/k.length-$.reduce((a,w)=>a+w,0)/$.length,R=L/W;(!M||Math.abs(R)>Math.abs(M.d)+1e-9||Math.abs(Math.abs(R)-Math.abs(M.d))<=1e-9&&(I.length<M.groupWafers||I.length===M.groupWafers&&L>0))&&(M={testNumber:g,label:N,field:o.key,group:y,groupWafers:I.length,groupDies:I.reduce((a,w)=>a+f[w],0),d:R,higher:L>0,p:O})}if(M&&v.size===2){const[y,I]=[...v].find(([k])=>k!==M.group);M.other={group:y,wafers:I.length}}M&&n.push(M)}}const u=Se(n.map(o=>o.p)),b=new Map;n.forEach((o,l)=>{const g=o.groupDies*ae(o.d);u[l]>=it||g===0||(b.get(o.field)??b.set(o.field,[]).get(o.field)).push({c:o,q:u[l],weight:g})});const p=n.length?[...new Set(n.map(o=>o.field))].map(o=>oe(o,t)):[],m=(o,l)=>o.other?`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} than on ${l} ${o.other.group} (${o.groupWafers} and ${o.other.wafers} wafers)`:`${o.label} is ${o.higher?"higher":"lower"} on ${l} ${o.group} (${o.groupWafers} of ${i.length} wafers) than on the other wafers`;return{items:[...b].map(([o,l])=>{l.sort(($,L)=>Math.abs(L.c.d)-Math.abs($.c.d)||L.weight-$.weight||$.c.testNumber-L.c.testNumber);const g=l.reduce(($,L)=>Math.max($,L.weight),0),N=oe(o,t),[v,..._]=l,F=v.c,O=`${m(F,N)}: a shift of ${H(F.d)}`,W=_.slice(0,2).map(({c:$})=>`${$.label} ${$.higher?"higher":"lower"} on ${$.group} (${H($.d)})`),M=_.length-W.length,y=l.length,I=y===1?`${O}, each wafer one value (q ${re(v.q)})`:`${y} tests differ by ${N}. Largest: ${O}, each wafer one value (q ${re(v.q)}); next: ${W.join(", ")}${M>0?`, and ${M} more`:""}`,k=U({affected:g,measure:H(F.d),severity:v.q<.001?"unusual":"notable",text:I,reason:y===1?O:`${y} tests differ by ${N}. Largest: ${O}`,brief:y===1?`${N} ${F.group}: ${F.label} ${F.higher?"higher":"lower"}`:`${N}: ${y} tests differ`,subject:N,target:{kind:"test",testNumber:F.testNumber},testNumbers:l.map($=>$.c.testNumber),chart:{chart:"box",fields:{x:{meta:o},y:V(F.testNumber),color:{meta:o}}}});return y>1&&(k.chips=l.slice(0,Y).map(({c:$})=>({label:`${$.label} ${H($.d)}`,target:{kind:"test",testNumber:$.testNumber}})),y>Y&&(k.moreTests=y-Y)),k}),compared:p}}function at(e){return e.map(t=>U({affected:t.passingDies,measure:"",severity:"notable",text:`${t.label} ${t.plainVerb} on ${T(t.passingDies,"die")} binned as passing`,brief:`${t.label}: ${S(t.passingDies)} dies out of limits, binned passing`,subject:t.label,target:t.item.target,testNumbers:[t.testNumber],chart:t.item.chart}))}function rt(e,t){const s=t.passBins&&t.passBins.length>0?`; pass ${$e([t.passBins])}`:"";if(e.level==="wafer"){const n=e.stats.yieldPercent;return n==null?`${S(e.stats.totalDies)} dies, no bin data to judge yield by.`:`Yield ${n.toFixed(1)}% (${S(e.stats.totalDies)} dies${s}).`}const i=e.lotYieldSeries.map(n=>n.yieldPercent).filter(n=>typeof n=="number");if(i.length===0)return`${T(e.stats.waferCount,"wafer")}, no bin data to judge yield by.`;const d=i.reduce((n,u)=>n+u,0)/i.length,c=e.perWafer.reduce((n,u)=>n+u.summary.stats.totalDies,0),[r,h]=[ge(i).toFixed(1),me(i).toFixed(1)],f=r!==h?`, range ${r}\u2013${h}%`:"";return`Yield ${d.toFixed(1)}% (mean of ${T(i.length,"wafer")}, ${S(c)} dies${s})${f}.`}function ot(e,t,s=[]){const i=[],d=e.level==="wafer"?e.stats.testsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.testsConsidered)).size,c=e.level==="wafer"?e.stats.hardBinsConsidered.length:new Set(e.perWafer.flatMap(n=>n.summary.stats.hardBinsConsidered)).size,r=e.stats.testValueAnalysis?.state;if(d>0&&r!=="off"&&i.push(T(d,"test")+(r==="skipped"?" (against their limits only)":"")),c>0&&i.push(T(c,"hard bin")),i.push("the ring, quadrant and sector regions"),e.level==="lot"&&e.stats.waferCount>=3){const n=e.findings.filter(pe);i.push(n.length===0?"wafer-to-wafer yield (no outlier wafers)":`wafer-to-wafer yield (${T(n.length,"outlier wafer")})`),e.stats.waferCount>=we&&i.push("the yield trend across the wafers (input order)"),s.length&&i.push(`the tests between the groups of ${s.join(", ")} (each wafer one value)`)}const h=e.findings.filter(n=>!t.has(n.id)).length,f=h>0?` ${T(h,"smaller finding")} not listed above.`:" Nothing else was found.";return`Compared: ${i.join(", ")}.${f}`}export function synthesisSource(e){return e.level==="lot"&&e.perWafer.length===1?e.perWafer[0].summary:e}export function buildSynthesis(e,t={}){const s=synthesisSource(e),i=s.findings,d=s.level==="lot"?s.stats.waferCount:void 0,c=t.passBins,r=new Map(i.map(a=>[a.id,a])),h=(s.level==="wafer"?[s]:s.perWafer.map(a=>a.summary)).every(a=>(a.stats.hardBinsConsidered??[]).length===0),f=a=>c!==void 0&&te(a)&&be(a.variable.kind,a.variable.bin??NaN,c,!h),n={isPassRate:a=>a.variable.kind==="yield"||c?.length===1&&f(a),isFailBin:a=>c!==void 0&&te(a)&&!f(a)},u=i.filter(a=>ce.has(a.comparison.family)&&E(a)>0&&(n.isPassRate(a)&&a.effect.direction==="lower"||n.isFailBin(a)&&a.effect.direction==="higher")),p=u.some(a=>a.variable.kind==="hardBin")?u.filter(a=>a.variable.kind!=="softBin"):u,m=[],x=new Map,o=new Set;for(const a of Te(p)){const w=a.map(z=>p[z]),B=Ce(w,i,d,n);m.push(B);const j=B.target.kind==="finding"?B.target.id:void 0;x.set(B,ee(w.find(z=>z.id===j)??w[0]))}for(const a of i.filter(w=>w.variable.kind==="spatialPattern")){const w=new Set((a.relatedIds??[]).filter(q=>r.has(q))),B=m.find(q=>q.findingIds.some(Q=>w.has(Q)));if(!B)continue;const j=a.level==="lot"&&"waferIndices"in a.highlight?a.highlight.waferIndices?.length:void 0,z=j!==void 0&&d?` on ${j}/${d} wafers`:"";B.text=`${a.variable.label} pattern${z}. ${B.text}`,B.reason=`${a.variable.label} pattern${z}. ${B.reason}`,B.chips.unshift({label:`${a.variable.label} pattern`,target:P(a)}),B.findingIds.unshift(a.id,...[...w].filter(q=>!m.some(Q=>Q.findingIds.includes(q))))}const l=qe(s),g=new Set,N=Ue(s,g),v=[...m],_=Qe(N,v,x,l);s.level==="lot"&&m.push(...Ge(s)),m.push(..._.map(a=>a.item));const F=new Set(_.filter(a=>l>0&&a.item.diesLost/l>=K).map(a=>a.testNumber));m.push(...et(i,[...v,..._.map(a=>a.item)],x),...tt(i,l),...st(s,g,l),...at(N.filter(a=>a.passingDies>0&&!F.has(a.testNumber))));let O=[];if(s.level==="lot"){const a=nt(s,t.attributes);O=a.compared;for(const w of a.items){const B=w.testNumbers[0],j=w.testNumbers.length===1?m.find(z=>z.target.kind==="test"&&z.target.testNumber===B)??m.find(z=>z.testNumbers.includes(B)):void 0;j?j.text+=`. ${w.text}`:m.push(w)}}const W=Ke(s),M=m.filter(a=>l>0&&a.affected/l>=K);for(const a of M)a.shareOfDies=a.affected/l,a.impact=Pe(a.shareOfDies,a.kind==="loss"&&W>0?a.diesLost/W:0),a.measure||(a.measure=`${(a.shareOfDies*100).toFixed(1)}%`);const y=a=>`${String(a.testNumbers[0]??"").padStart(10,"0")}${a.findingIds[0]??""}`;M.sort((a,w)=>w.affected-a.affected||(y(a)<y(w)?-1:y(a)>y(w)?1:0));const I=M.slice(0,le),k=M.slice(le);for(const a of[...I,...k])for(const w of a.findingIds)o.add(w);const $=k.length>0?{items:k.slice(0,fe),more:Math.max(0,k.length-fe)}:void 0,L=s.level==="lot"?"region, fail bin or wafer":"region or fail bin",R=i.filter(a=>a.severity==="unusual"&&!o.has(a.id)).length,J=I.length===0?R>0?`No ${L} costs as much as ${A(K)} yield points, though ${T(R,"finding")} below ${R===1?"is":"are"} marked unusual.`:`Nothing stands out: no ${L} costs as much as ${A(K)} yield points.`:void 0;return{headline:rt(s,t),items:I,...$?{also:$}:{},...J?{nothing:J}:{},checked:ot(s,o,O)}}export const synthesisKey=e=>e.target.kind==="finding"?`finding:${e.target.id}`:`test:${e.target.testNumber}`,SYNTHESIS_ALSO_HEADING=`Also, each affecting at least ${(K*100).toFixed(0)}% of the dies`,synthesisRowShare=e=>e.measure,synthesisMoreTests=e=>e.moreTests?`and ${e.moreTests} more test${e.moreTests===1?"":"s"}`:void 0;export function synthesisText(e){return[e.headline,...e.nothing?[e.nothing]:[],...e.items.map((t,s)=>`${s+1}. ${t.text}`),...e.also?[`${SYNTHESIS_ALSO_HEADING}: ${e.also.items.map(t=>`${t.brief} (${synthesisRowShare(t)})`).join("; ")}${e.also.more?`; and ${e.also.more} more`:""}.`]:[],e.checked].join(`
|
|
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(`
|
|
2
2
|
`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wafertools/wafermap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.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",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git+https://github.com/wafertools/wafermap.git"
|
|
15
15
|
},
|
|
16
|
+
"funding": "https://wafertools.github.io/support/",
|
|
16
17
|
"bugs": {
|
|
17
18
|
"url": "https://github.com/wafertools/wafermap/issues"
|
|
18
19
|
},
|
|
@@ -132,12 +133,15 @@
|
|
|
132
133
|
"devDependencies": {
|
|
133
134
|
"esbuild": "^0.28.1",
|
|
134
135
|
"jsdom": "^29.1.1",
|
|
135
|
-
"marked": "^18.
|
|
136
|
-
"playwright": "^1.
|
|
136
|
+
"marked": "^18.1.2",
|
|
137
|
+
"playwright": "^1.64.1",
|
|
137
138
|
"serve": "^14.2.0",
|
|
138
|
-
"typescript": "^
|
|
139
|
+
"typescript": "^6.0.3"
|
|
139
140
|
},
|
|
140
141
|
"allowScripts": {
|
|
141
142
|
"esbuild@0.28.1": true
|
|
143
|
+
},
|
|
144
|
+
"overrides": {
|
|
145
|
+
"compression": "^1.8.2"
|
|
142
146
|
}
|
|
143
147
|
}
|