## Perform a Bivariate Analysis on a sorted column

Contributor

Joined:

Jul 20, 2017

So I am doing a Bivariate analysis for Current versus Area. I have a column with different IDs like 26,35, etc. and want to perform an analysis for each one and have it show on different plots but in the same GUI that I've put together. Any help would be really appreciated!

You will see below that Column 3 is the Column I sorted!

``````dt = Current Data Table();
//Change the Max Ic to Max Jc and organize table by reticle
dt << sort( by( Column( 3 ) ), Replace Table );

Column1 = Column( dt, "Corrected Area (um^2)" );
Column2 = Column( dt, "Max Ic (mA)" );

Column3 = New Column( "Max Jc (mA/um^2)" );
Column3 << set values( (Column2 << get as matrix) * 100 );
Column3 << set name( "Max Jc (mA/um^2)" );

//Obtain the Max Ic
MaxIc = Col Max( Column2 );
Save Text File( "\$Python.py", str( MaxIc ), Mode( "Append" ) );
//Save Text File("\$Python.py", MaxIc, Mode("Append") );
//allows manipulation to columns to go unaltered between runs
Close( dt, Save( filepath ) );

//Call CreateBivariate to do a bivariate (two variable) analysis
//list allows you to do more analysis
status = List( 0, 0 );
New Window( "Custom Analysis",
H List Box(
V List Box(

Panel Box( "Controls",
Text Box( "Choose Analysis" ),
choice = Check Box(
{"Distribution", "Fit Line"},
current = choice << Get( 1 );
xParam = Column1; //Corrected Area
yParam = Column2; //Max Ic

//Get the distribution
If( And( current, Not( status[1] ) ),
dt << Append(
dt = V List Box(
bivDistribution = Distribution( Y( Eval( yParam ) ), X( Eval( xParam ) ), )
)
);
status[1] = 1; //mark as present
);

//Perform a Bivariate Analysis
current = choice << Get( 2 );
If( And( current, Not( status[2] ) ),
dt << Append(
dt = V List Box(
bivPlatform = Bivariate(
Y( Eval( yParam ) ),
X( Eval( xParam ) ),
Fit Line( {Line Color( {213, 72, 87} )} ),
Fit Line( {Line Color( {57, 177, 67} )} ),

)
)
);

status[2] = 1; //mark as present

);
)
);
),
dt = V List Box()
)
);``````
1 ACCEPTED SOLUTION

Accepted Solutions

Staff

Joined:

Jun 23, 2011

Solution

Sorting the data set might benefit you but it is unnecessary for the Distribution or Bivariate platforms to work.

Include the By( Column( 3 ) ) argument to the Bivariate() function call in your script.

Learn it once, use it forever!
6 REPLIES

Staff

Joined:

Jun 23, 2011

Can you use column 3 in the Bivariate By role? That way would be the simplest and use the built-in platform behavior.

Why are you sorting the data?

I would recommend using a different name for the variable that stores the reference to the vertical list box than the name that you used for the variable to store the data table reference.

Anyway, hope this suggestion helps.

Learn it once, use it forever!

Contributor

Joined:

Jul 20, 2017

So after I sort the column I have something like

Reticle: 26 in one column and Max Ic in another column
Reticle:25 in that column and it's respective Max Ic

So I want to perform separate bivariate analysis depending on what reticle
it is!

Thanks,

Tyler

Staff

Joined:

Jun 23, 2011

Solution

Sorting the data set might benefit you but it is unnecessary for the Distribution or Bivariate platforms to work.

Include the By( Column( 3 ) ) argument to the Bivariate() function call in your script.

Learn it once, use it forever!

Contributor

Joined:

Jul 20, 2017

That worked perfectly!!! Very simple fix! Last question you don't have to answer, how could I save all of those images to a png?

I have tried:

dt <<save picture("T:\W\Wintermute\50 Sandbox\Gingrich\69977JM",png),

But it gives me an Error log?

Thanks,

Tyler

Contributor

Joined:

Jul 20, 2017

Is it possible to sort by two columns? It works for column(3) so far, and incredibly well, thanks again for the help--but can I do ( by(column3) || by(column4) )

Thanks,

Tyler

Staff

Joined:

Jun 23, 2011

Use this:

``By( col 3, col 4 )``
Learn it once, use it forever!