cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
pcarroll1
Level IV

Re-binning based on new spec limits

I have a table with a number of parameters with spec limits and a pass fail column.

I use manage Spec limits to change some of the limits and reload them to the columns of the table.

OK so far.

But now I want to re-bin all the devices (i.e. re-determine Pass & Fail) based on the new spec limits.

Since there are many, many parameters writing a formula to do this would be unwieldy and take quite a bit of time.

I could write a script to do it (determining the columns with spec limits and creating a formula column based on that).

But is there anything built into JMP to do this?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Re-binning based on new spec limits

I am not aware of a JMP binning tool based upon Spec Limits, but here is a very efficient piece of code that does the binning.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNames = dt << get column names( continuous, string );

For( i = 1, i <= N Items( colNames ), i++,
	Clear Symbols( specs );
	specs = Column( dt, colNames[i] ) << get property( "Spec Limits" );
	If( Is Empty( specs ) == 0,
		dt << New Column( colNames[i] || " Pass_Fail", character, set each value( "Fail" ) );
		theRows = dt << get rows where( Eval( specs["LSL"] ) <= As Column( dt, colNames[i] ) <= Eval( specs["USL"] ) );
		If( N Rows( theRows ),
			Column( dt, colNames[i] || " Pass_Fail" )[theRows] = "Pass"
		);
	);
);
Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: Re-binning based on new spec limits

I am not aware of a JMP binning tool based upon Spec Limits, but here is a very efficient piece of code that does the binning.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNames = dt << get column names( continuous, string );

For( i = 1, i <= N Items( colNames ), i++,
	Clear Symbols( specs );
	specs = Column( dt, colNames[i] ) << get property( "Spec Limits" );
	If( Is Empty( specs ) == 0,
		dt << New Column( colNames[i] || " Pass_Fail", character, set each value( "Fail" ) );
		theRows = dt << get rows where( Eval( specs["LSL"] ) <= As Column( dt, colNames[i] ) <= Eval( specs["USL"] ) );
		If( N Rows( theRows ),
			Column( dt, colNames[i] || " Pass_Fail" )[theRows] = "Pass"
		);
	);
);
Jim
pcarroll1
Level IV

Re: Re-binning based on new spec limits

Thanks. This worked well.
I also built up an expression in the script loop to use as a formula to calculate the overall pass-fail result.
Greenhorn
Level III

Re: Re-binning based on new spec limits

@txnelson

 

Hey Jim,

 

I'm trying to modify the script you provided here.

I'm failing...

I'd like to have one single additional column which collects the fail categories. The fail category should show the first failing column. Therefore, I loop reverse with the intention to overwrite all the subsequent fail categories.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
dt << New Column( "First_Failed_Test", character, set each value( "Pass" ) );

colNames = dt << get column names( continuous, string );

For( i = N Items( colNames ), i >= 1, i--,
	Clear Symbols( specs );
	specs = Column( dt, colNames[i] ) << get property( "Spec Limits" );
	If( Is Empty( specs ) == 0 | Eval( specs["LSL"] ) != Eval( specs["USL"]) ,

		theRows = dt << get rows where( Eval( specs["LSL"] ) >= As Column( dt, colNames[i] ) >= Eval( specs["USL"] ) );
		If( N Rows( theRows ),
			Column( dt, "First_Failed_Test" )[theRows] = colNames[i]
		);
	);
);

Do you see what is wrong with the script?

Greenhorn
Level III

Re: Re-binning based on new spec limits

		theRows = dt << get rows where( Eval( specs["LSL"] ) >= As Column( dt, colNames[i] ) | As Column( dt, colNames[i] ) >= Eval( specs["USL"] ) );

I got it!

txnelson
Super User

Re: Re-binning based on new spec limits

I think the following script is a better approach for you to take in finding the First Fail test.  This script creates a new column, and populates the column with the name of the First Fail Column

txnelson_0-1669924154108.png

Names Default To Here( 1 );
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
USLVals = LSLVals = [];
For( i = 5, i <= N Cols( dt ), i++,
	USLVals = USLVals || Matrix( (Column( dt, i ) << get property( spec limits ))["USL"] );
	LSLVals = LSLVals || Matrix( (Column( dt, i ) << get property( spec limits ))["LSL"] );
);
dt << New Column( "First Fail", character );

For( i = 1, i <= N Rows( dt ), i++,
	theMin = Min(
		Min( Loc( (USLVals < dt[i, Index( 5, N Cols( dt ) - 1 )]) ) ),
		Min( Loc( (dt[i, Index( 5, N Cols( dt ) - 1 )]) < LSLVals ) )
	);
	:First Fail[i] = Column( dt, theMin + 4 ) << get name;
);

 

Jim
Greenhorn
Level III

Re: Re-binning based on new spec limits

Thanks, Jim! It is definitely much faster. 

Is this approach with matrix able to handle exceptions like "Don't consider columns where USL=LSL" or " Columns with No Spec Limits"?

 

Do I need to create a sub table with valid columns (custom subset of columns and automatic excluding of columns by "non-valid" conditions) first and then apply the proposed script and update the origin the with the result column? --> Is it an efficient way to code?

 

txnelson
Super User

Re: Re-binning based on new spec limits

Your observation is correct.  The code I provided assumes that all columns have spec limits.  Your suggestion of creating a subset containing only fully qualified columns is one way of handling it.  And it would be a good way.

Another alternative would be to add into the provided code, the ability to identify the columns that do not have spec limits, and to just bypass them.  

Either way will work.

Jim