What is the easiest way to fill in a table with the "good" die locations?
I guess there is a much easier way than this one ...
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Wafer Stacked.jmp" );
dt << Select Where( :Defects == 0 ) << Delete Rows;
xmin = -21;
ymin = -21;
xmax = 21;
ymax = 21;
dx= xmax-xmin;
dy= ymax-ymin;
nItems= (dx +1)*(dy + 1)-1;
tmp = New Table();
tmp<< Add Rows( nItems );
tmp: column1 << Data Type( Character ) << set name("Lot");
tmp << new column("Wafer");
tmp << new column("x", Set Each Value(xmin + Floor((row()-1)/dx)));
tmp << new column("y", Set Each Value(ymin +Mod((row()-1),dy)));
label= new column("label",Character, Set Each Value(Char(:x)||" "||Char(:y)));
tmp << new column("missing");
myEntries = tmp:label << get values();
entriesAsCols = tmp << Split(
Split By( :x, :y ),
Split( :missing ),
Group( :lot, :wafer ),
OutPut Table("split")
);
myMatrix = entriesAsCols << Join(
With( dt ),
Merge Same Name Columns,
Match Flag(0),
By Matching Columns( :Lot = :Lot, :Wafer=:Wafer ),
Drop multiples( 0, 1 ),
Include Nonmatches( 0, 1 ),
OutputTable("Matrix")
);
// Stack data table
// → Data Table( "Untitled 26" )
cols = Transform each ({col},As List( myEntries),Column(myMatrix,Char(col)));
myMatrixStacked = myMatrix << Stack(
columns(cols),
Source Label Column( "label" ),
Stacked Data Column( "Data" ),
"Non-stacked columns"n( Keep( :Lot, :Wafer ) ),
Output Table("stacked")
);
myMatrixStacked << new Column ("Defects", Set Each Value(.));
colX = myMatrixStacked << new column ("X_Die",Set Each Value(Num(Word(1,:label," "))));
colY = myMatrixStacked << new column ("Y_Die",Set Each Value(Num(Word(2,:label," "))));
floodedTable = dt << Join(
With( myMatrixStacked ),
Match flag(0),
Merge Same Name Columns,
By Matching Columns(
:Lot = :Lot, :Wafer = :Wafer, :X_Die = :X_Die, : Y_Die = :Y_Die
),
Include Nonmatches( 1, 1 ),
OutputTable("flooded")
);
floodedTable << Recode Column(
dt:Defects,
{Map Value( _rcOrig, {., 0}, Unmatched( _rcNow ) )},
Target Column( :Defects )
);
CLose(dt,myMatrix,entriesAsCols,myMatrixStacked, noSave);