-
Notifications
You must be signed in to change notification settings - Fork 3
/
FTI - Open Wafer File.jsl
323 lines (276 loc) · 8.3 KB
/
FTI - Open Wafer File.jsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
//!
Names Default to Here(1);
// Prompt the user for the file to load.
a = New Window(
"Select an FTI file to load:",
<< Modal,
Text Box("Please have all files be from the same lot. I can't guarentee what happens if they're not...", << Set Wrap(800) ),
Text Box(""),
Text Box("File to Load:"),
Line Up Box(
NCol(2),
//editBox = Text Edit Box(
editBox = List Box(
"",
//Set Width(650)
width(1200), nlines(8)
),
Button Box(
"Browse",
Set Script(
//editBox << Set Text(
editBox << Set Items(
Pick File(
"Select FTI File(s) to load.", // prompt
"Z:\Manufacturing\Product Engineering\Wafer Probe\Projects\FTI-OWT Yield and Bin Comparison\reorganized_raw_data\", // Initial dir
{"CSV Files|csv"}, // filter list
1, // First Filter
0, // save flag
"", // default file
multiple // multiple
)
)
)
),
),
Text Box("Identifier Column:"),
flagBox = Text Edit Box(
"",
Set Width(200)
),
Button Box("OK"),
Button Box("Cancel")
);
// Stop the script if the user cancels
If( a["Button"] == -1,
Stop()
);
//file_path = editBox << Get Text;
//flag = flagBox << Get Text;
//Show(file_path);
//Show(flag);
file_paths = editBox << Get Items;
flag = flagBox << Get Text;
Show(file_paths);
Show(flag);
//////////////////////////////////////////////////////
// //
// Begin Loop for opening all files //
// //
//////////////////////////////////////////////////////
num_files = N Items (file_paths);
tables = {};
for (i=1, i<=num_files, i++,
// Set a local variable
file_path = file_paths[i];
// Verify that we're using a .csv file
// Not really needed because the Open File dialog limits to .csv
If( Right(file_path, 4) != ".csv",
Stop()
);
// Load the text file so that we can find the data_start line and the
// header line.
raw_data = Load Text File(file_path);
//Show(raw_data);
// Search for ",,,,,,,,,Test" 13 characters
// Search for "Device,Site,X"
// Since I can't seem to find a function that converts a string
// to a list (like str.split() in Python...), I'll hack one together.
// Technically it won't split the string into a list, but it will count
// the number of lines and then it will return values for the header line
// and the data_start line.
// This function will iterate through the string, counting CRLFs.
// If the CRLF is followed by ",,,,,,,,,Test", then that one is
// set to the col_names_start variable.
// If the CRLF is followed by "Device,Site,X,Y,", then that one is
// set to the data_start_line variable and we break the loop.
col_names_start = -1;
data_start = -1;
line_num = 1;
col_num = 1;
n = 1;
prev_str = "";
line_string = "";
start_of_line_bool = 1;
While(
// Run indefinitely
1,
// Get the current character in the string
substring = Substr(raw_data, n, 1);
// Gotta make sure we increment n, or else we'll look infinitely.
n ++;
col_num ++;
// if the previous character and this character make a CRLF, then
// we increment our line counter, state that we're at the start
// of a line, and reset our column number
If(
prev_str || substring == "\!N", // "\!N" matches the host OS's line break character
//Print(line_string);
line_num ++;
start_of_line_bool = 1;
col_num = 1;
line_string = "";
Continue(); // Don't bother with the rest of the loop
);
// Set the previous string and append to the full line string
prev_str = substring;
line_string ||= substring;
// Then check if our start of line string matches one of our two searches
If(
Starts With(line_string, ",,,,,,,,,Test,") | Starts With(line_string, ",,,,,,Test,"),
col_names_start = line_num;
Continue();
);
If(
Starts With (line_string, "Device,Site,"),
data_start = line_num + 1;
Break();
);
// Make sure we don't run forever. Used only in development.
/*
If(
n >= 8000,
Break();
);
*/
);
Show(line_num);
Show(col_names_start);
Show(data_start);
//Stop();
// Open the file into JMP
dt = Open(
file_path,
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( col_names_start ),
Data Starts( data_start ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
// Append the data table to the list of tables.
Insert Into(tables, dt);
//Close(dt1, NoSave);
/*
if (
// Case 1: 1st iteration of the loop - open initial data table
i == 1,
dt1 = dt;
//Close(dt1, NoSave);
,
// Case 2: all subsequent iterations - concatenate
i > 1,
dt2 = dt;
dt1 << Concatenate(dt2, Append to first table, Create source column);
Close(dt2, NoSave);
);
*/
);
///////////// End Loop for opening all files //////////////////////
Show(tables);
dt1 = tables[1];
// If we have multiple tables, concatenate them together.
if(N Items(tables) > 1,
Remove From(tables, 1);
dt1 << Concatenate(tables, Append to first table, Create source column);
// Close the extra tables
for (i = 1, i <= N Items (tables), i++,
Close(tables[i], NoSave);
);
// Rename the table
table_name = Left(dt1 << Get Name(), 5) || ", Multiple Files";
dt1 << Set Name(table_name);
);
Show(dt1);
// Rename the columns that have headers not on line 25
Column("Column 1") << Set Name("Device");
Column("Column 2") << Set Name("Site");
Column("Column 3") << Set Name("X");
Column("Column 4") << Set Name("Y");
Column("Column 5") << Set Name("Soft Bin");
Column("Column 6") << Set Name("Hard Bin");
Column("Column 7") << Set Name("Wafer");
Column("Column 8") << Set Name("Failed");
Column("Column 9") << Set Name("Alarmed");
//Column("Column 10") << Set Name("Message");
// Figure out what mask we're using and then set the equation for Radius.
// Get the Mask Name from the filename.
lot = Left(dt1 << Get Name(), 5); // TODO: change to account for arbitrary mask name lengths
fullLot = Word(1, dt1 << Get Name(), "_");
mask = Word(2, dt1 << Get Name(), "_");
Show(mask);
// Lookup the Die Size (X, Y). Assume 07G11 if not found.
dieSize = Match(
mask,
"MDH27", {4.34, 6.44},
"07G11", {2.43, 3.3},
"07G13", {4.37, 6.47},
"07G14", {2.33, 2.07},
"07G16", {5.02, 8.49},
"07G17", {2.9, 3.3},
"ECM01", {12.0, 11.0},
{2.43, 3.3}
);
// Look up the CenterXY coord. Assume 07G11 if not found.
centerXY = Match(
mask,
"MDH27", {18.5, 12.5},
"07G11", {29, 21},
"07G13", {16.5, 9.5},
"07G14", {30.5, 33.5},
"07G16", {14.3386, 8.5589},
"07G17", {24.431, 20.894},
"ECM01", {6, 6.5},
{2.43, 3.3}
);
Show(dieSize);
Show(centerXY);
// Add a Radius (mm) column.
radiusCol = dt1 << New Column("Radius (mm)");
radiusCol << Set Formula(
Root(
(dieSize[1] * (:Name("X") - centerXY[1])) ^ 2
+
(dieSize[2] * (:Name("Y") - centerXY[2])) ^ 2,
Empty()
)
);
radiusCol << EvalFormula;
// Add a Radius^2 column.
radius2Col = New Column("Radius^2");
radius2Col << Set Formula(
:Name( "Radius (mm)" )^2
);
radius2Col << EvalFormula;
// Add a flag column, but only if the flag field is not empty
If(
// Test
flag != "",
// True Case
flagCol = New Column("StepNum", Character);
flagCol << Set Each Value(flag);,
// False Case
//do nothing
);
// Some columns have value of "infinity", so we need to remove those and set
// the correct column datatype.
//Column("GateCharge_DRDS-8.5") << Data Type ("Numeric");
//Column("GateCharge_DRDS-8.5") << Modeling Type ("Continuous");
// Set the Modeling Type of some columns
Column("Device") << Modeling Type("Ordinal");
Column("Site") << Modeling Type("Ordinal");
Column("X") << Modeling Type("Continuous");
Column("Y") << Modeling Type("Continuous");
Column("Soft Bin") << Modeling Type("Nominal");
Column("Hard Bin") << Modeling Type("Nominal");
Column("Wafer") << Modeling Type("Ordinal");