cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Jackie_
Level VI

Import x and y values from the text file to jmp table

Hi,

 

Reading each line in text file and import each string as a separate row in the jmp data table 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

I cannot share the code I use but here is a quick example with some ideas

Names Default To Here(1);

// load text file
// parse interesting things
// get map to string

map_str =
".....GGG.....
....BGGGG....
...BGGGGGG...
..GGGGGGGGG..
.GGGGGGBBGGG.
GGGGGGGBBGGGB
GGGGGGGGGGGGB
GGGGGGGGGGGGB
.GGGGGGGGGGG.
..GGGGGGGGG..
...GGGGGGG...
....GGGGG....
.....GGG.....";

l = Words(map_str, "\!N");
rowc = N Items(l);
colc = N Items(Words(l[1], ""));

dt = New Table("Untitled",
	Add Rows(rowc * colc),
	New Column("X", Numeric, Continuous),
	New Column("Y", Numeric, Continuous),
	New Column("bin", Character, Nominal, Label(1))
);

For Each({line, idx}, l,
	cur_rows = ((idx - 1) * colc::(idx * colc - 1)) + 1;
	dt[cur_rows, "X"] = ((1::colc))`;
	dt[cur_rows, "Y"] = (J(1, colc) * (idx))`;
	dt[cur_rows, "bin"] = Words(line, "");
);

nw = New Window("test",
	H List Box(
		align("center"),
		Text Box(map_str, <<Set Font Name("Courier New")),
		dt << Graph Builder(
			Size(529, 457),
			Show Control Panel(0),
			Variables(X(:X), Y(:Y), Color(:bin)),
			Elements(Points(X, Y, Legend(9))),
			SendToReport(
				Dispatch(
					{},
					"X",
					ScaleBox,
					{Min(0.461038514127673), Max(13.543406057392), Inc(1), Minor Ticks(0),
					Label Row(Show Major Grid(1))}
				),
				Dispatch(
					{},
					"Y",
					ScaleBox,
					{Min(14), Max(0), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))}
				),
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						9,
						Properties(0, {Marker Size(20)}, Item ID(".", 1)),
						Properties(1, {Marker Size(20)}, Item ID("B", 1)),
						Properties(2, {Marker Size(20)}, Item ID("G", 1))
					)}
				)
			)
		),
		dt << Graph Builder(
			Size(529, 457),
			Show Control Panel(0),
			Variables(X(:X), Y(:Y), Color(:bin)),
			Elements(Heatmap(X, Y, Legend(10), Label("Label by Value"))),
			SendToReport(
				Dispatch({}, "X", ScaleBox, {Min(0.461038514127673), Max(14.3842387539345), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))}),
				Dispatch({}, "Y", ScaleBox, {Min(14.3060372430966), Max(0.789075991529451), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))})
			)
		)
	)
);

jthi_1-1657286717469.png

 

-Jarmo

View solution in original post

jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

Using simpler table

Names Default To Here(1);

// Simple example table
dt = New Table(
	"Untitled",
	Add Rows(9),
	New Column("X", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 1, 2, 3, 1, 2, 3])),
	New Column("Y", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 2, 2, 2, 3, 3, 3])),
	New Column("bin", Character, "Nominal", Set Values({".", "X", ".", "X", "X", "X", ".", "X", "."}))
);

//empty string initialization
str = ""; 

// get unique values for Y
// I will use Associative array instead of Summarize to keep correct format of values
// Summarize would change them to strings
y_uniq = Associative Array(:Y) << get keys; 
For Each({cur_y}, y_uniq,
	cur_line_rows = Loc(dt[0, "Y"], cur_y); // Loc() with datatable subscripting
	line_bins = dt[cur_line_rows, "bin"]; // more datatable subscripting
	bin_str = Concat Items(line_bins, "");
	str = str || bin_str || "\!N"; 
);

// remove extra whitespace
str = Trim Whitespace(str);
Write(str);

jthi_0-1657291336046.png

jthi_1-1657291353870.png

 

-Jarmo

View solution in original post

27 REPLIES 27
txnelson
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

Search the jmp addin and the past discussions for wafermaps. Lots of answers there

Jim
jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

I have formatted couple of different kinds of wafermaps with JMP into XY coordinates (and map file) based on text files. Doing it by "manually" scripting I think the process was something like this:

  1. Parse the text file and get important information (Regex, Words and other character functions are helpful here)
    1. Row count, Column count
    2. X size, Y size
    3. Bin types (especially null/empty type)
    4. Wafermap
    5. Any other information (WAFER ID, type...)
  2. Create new datatable in which you can collect the results into
    1. Row count is most likely row count * column count
    2. You need at least X and Y columns, and if you are interested in different bins add column for that also
  3. Loop over the wafermap string by using Words(wafermap_txt, "\!N") to get each line and build the values by multiplying xsize/ysize depending on which column you are filling.
    1. This step is much easier if you don't care about the widths and heights and can just use 1 / fixed value
    2. Also might be a good idea to just code them as coordinates that JMP map files would need, this allows you to build map shape files by using the sizes.
  4. If you are only interested in the wafermap you could leave out null bins but you have to take it into account when building the map and
-Jarmo
Jackie_
Level VI

Re: Import x and y values from the text file to jmp table and create wafer map

Thanks @jthi 
Would you mind sharing the code just so I can refer?

 

Thanks,

Jack

Jackie_
Level VI

Re: Import x and y values from the text file to jmp table and create wafer map

@jthi 
I want to store the die location and the letters in the jmp data table columns X and Y from the attached text file. How to use JSL to process such txt file as tabular data?

Jacksmith12_0-1657285226094.png

JMP table:

Jacksmith12_1-1657285366605.png

 

jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

I cannot share the code I use but here is a quick example with some ideas

Names Default To Here(1);

// load text file
// parse interesting things
// get map to string

map_str =
".....GGG.....
....BGGGG....
...BGGGGGG...
..GGGGGGGGG..
.GGGGGGBBGGG.
GGGGGGGBBGGGB
GGGGGGGGGGGGB
GGGGGGGGGGGGB
.GGGGGGGGGGG.
..GGGGGGGGG..
...GGGGGGG...
....GGGGG....
.....GGG.....";

l = Words(map_str, "\!N");
rowc = N Items(l);
colc = N Items(Words(l[1], ""));

dt = New Table("Untitled",
	Add Rows(rowc * colc),
	New Column("X", Numeric, Continuous),
	New Column("Y", Numeric, Continuous),
	New Column("bin", Character, Nominal, Label(1))
);

For Each({line, idx}, l,
	cur_rows = ((idx - 1) * colc::(idx * colc - 1)) + 1;
	dt[cur_rows, "X"] = ((1::colc))`;
	dt[cur_rows, "Y"] = (J(1, colc) * (idx))`;
	dt[cur_rows, "bin"] = Words(line, "");
);

nw = New Window("test",
	H List Box(
		align("center"),
		Text Box(map_str, <<Set Font Name("Courier New")),
		dt << Graph Builder(
			Size(529, 457),
			Show Control Panel(0),
			Variables(X(:X), Y(:Y), Color(:bin)),
			Elements(Points(X, Y, Legend(9))),
			SendToReport(
				Dispatch(
					{},
					"X",
					ScaleBox,
					{Min(0.461038514127673), Max(13.543406057392), Inc(1), Minor Ticks(0),
					Label Row(Show Major Grid(1))}
				),
				Dispatch(
					{},
					"Y",
					ScaleBox,
					{Min(14), Max(0), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))}
				),
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						9,
						Properties(0, {Marker Size(20)}, Item ID(".", 1)),
						Properties(1, {Marker Size(20)}, Item ID("B", 1)),
						Properties(2, {Marker Size(20)}, Item ID("G", 1))
					)}
				)
			)
		),
		dt << Graph Builder(
			Size(529, 457),
			Show Control Panel(0),
			Variables(X(:X), Y(:Y), Color(:bin)),
			Elements(Heatmap(X, Y, Legend(10), Label("Label by Value"))),
			SendToReport(
				Dispatch({}, "X", ScaleBox, {Min(0.461038514127673), Max(14.3842387539345), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))}),
				Dispatch({}, "Y", ScaleBox, {Min(14.3060372430966), Max(0.789075991529451), Inc(1), Minor Ticks(0), Label Row(Show Major Grid(1))})
			)
		)
	)
);

jthi_1-1657286717469.png

 

-Jarmo
Jackie_
Level VI

Re: Import x and y values from the text file to jmp table and create wafer map

It works like charm. Thanks alot @jthi,

I'm trying to import the words from the text file to jmp data table, and then assign a different letters to those bins in the jmp table and then convert back to text file with the original formatting 

 

map_str =
".....GGG.....
....BGGGG....
...BGGGGGG...
..GGGGGGGGG..
.GGGGGGBBGGG.
GGGGGGGBBGGGB
GGGGGGGGGGGGB
GGGGGGGGGGGGB
.GGGGGGGGGGG.
..GGGGGGGGG..
...GGGGGGG...
....GGGGG....
.....GGG.....";

How do I convert the data table X , Y and bins back in the text file format with the formatting maintained. Any suggestion?  

jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

Initialize empty string, loop over the tables Y values in order, get row numbers for current y, use those row numbers to get bins, add those bins to initialized string (Concat Items() should help with this), add row change and continue to next Y. After looping trim whitespaces if needed.

-Jarmo
Jackie_
Level VI

Re: Import x and y values from the text file to jmp table and create wafer map

Appreciated @jthi
I am new to JSL coding. Can you share an example? Just as a reference 
 

jthi
Super User

Re: Import x and y values from the text file to jmp table and create wafer map

Using simpler table

Names Default To Here(1);

// Simple example table
dt = New Table(
	"Untitled",
	Add Rows(9),
	New Column("X", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 1, 2, 3, 1, 2, 3])),
	New Column("Y", Numeric, "Continuous", Format("Best", 12), Set Values([1, 1, 1, 2, 2, 2, 3, 3, 3])),
	New Column("bin", Character, "Nominal", Set Values({".", "X", ".", "X", "X", "X", ".", "X", "."}))
);

//empty string initialization
str = ""; 

// get unique values for Y
// I will use Associative array instead of Summarize to keep correct format of values
// Summarize would change them to strings
y_uniq = Associative Array(:Y) << get keys; 
For Each({cur_y}, y_uniq,
	cur_line_rows = Loc(dt[0, "Y"], cur_y); // Loc() with datatable subscripting
	line_bins = dt[cur_line_rows, "bin"]; // more datatable subscripting
	bin_str = Concat Items(line_bins, "");
	str = str || bin_str || "\!N"; 
);

// remove extra whitespace
str = Trim Whitespace(str);
Write(str);

jthi_0-1657291336046.png

jthi_1-1657291353870.png

 

-Jarmo