Subscribe Bookmark RSS Feed

Detecting a jump in a parameter and reporting where it is

jmit

Community Trekker

Joined:

Nov 2, 2016

Dear JMP community,

I am struggling to find a way to detect the X-coordinate of a point which stands for the breakage of one product. 

I am sure it is possible to do it by scripts but I have very little experience with JMP.

 

Any help is welcome!!

 

Best regards,

/JM

2016_11_02_16_15_46_Presentation1.pptx_PowerPoint.jpg

 

 

3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Here is a script that will do the calculations to determine the cross over voltage

Names Default To Here( 1 );
dt = Current Data Table();

// Create a summary table to hold the new information
dtsumm = dt << Summary( Group( :batch, :Samples ID ), Freq( "None" ), Weight( "None" ) );

// Add a new column to hold the calculated value for the Voltage value when the data crosses
// crosses the target value
dtsumm << New Column( "V" );
// Create a new column that has the target value
dtsumm << New Column( "Log10 I", set each value( e-06 ) );

// Set the active data table back to the original data table
Current Data Table( dt );

// Loop across the active data table and calculate the voltage when the Y variable crosses the 
// target value
For Each Row(
	currow = Row();
	curbatch = dt:batch[Row()];
	cursampleID = :Samples ID[Row()];
	
	// Get the row in the output table that matches the Batch value and Samples ID
	// value for the row in the main table the looping is working on
	dtsummRow = (dtsumm << get rows where( dtsumm:batch == curbatch & dtsumm:Samples ID == cursampleID ))[1];
	
	// Don't process the data if the crossing point has been previously found
	If( Is Missing( dtsumm:v[dtsummRow] ),
		// Find all of the matching rows above the current looping row
		Highrows = dt << get rows where( dt:batch == curbatch & dt:Samples ID == cursampleID & Row() > currow );
		// If the target value lies between the current rows Y value and the next matching rows Y value then
		// determine the crossing voltage value by doing an interprelation of the voltage values of the current row
		// and the next matching rows value.
		If( dt:Name( "Log10 I [A]" )[Row()] <= dtsumm:Log10 I[dtsummRow] & dt:Name( "Log10 I [A]" )[Min( Highrows )] > dtsumm:Log10 I[dtsummRow],
			dtsumm:V[dtsummRow] = dt:V[Row()] + (dt:V[Min( Highrows )] - dt:V[Row()]) * (dtsumm:Log10 I[dtsummRow] - dt:Name( "Log10 I [A]" )[Row()])
			 / (dt:Name( "Log10 I [A]" )[Min( Highrows )] - dt:Name( "Log10 I [A]" )[Row()])
		);
	);
);
Jim
jmit

Community Trekker

Joined:

Nov 2, 2016

Thanks a lot! It helps a lot. Since we show the way to script in JMP, I enter into the code and found that there was a little mistake. I replaced "set each value( e-06 ) " to set each value( -6 )" -log10 I- and it works perfectly. Also, may I ask you why in JMP: dtsumm:v[dtsummRow] is not generating any errors. I would have put dtsumm:V[dtsummRow] as the name of the column is in caps. Again, thx a lot for your help! /JM
txnelson

Super User

Joined:

Jun 22, 2012

JMP column names are case insensitive......in most cases, so referencing it as "v" or "V" has no impact on the execution of the code.
Jim