cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • We’re improving the Learn JMP page, and want your feedback! Take the survey
  • JMP monthly Newswire gives user tips and learning events. Subscribe
Choose Language Hide Translation Bar
DSchweitzer
Level III

JMP slows to a stop when building many graphs using JSL

I am working on a script that will create many graphs, determine a regression fit for each graph, and then save all the regression coefficients to a table. The script performs that actions that I want, but comes to a grinding halt as the number of columns to evaluate increases. The script seems to retain the plots and generated panels in the background that are created within the For loop even when I  try to close them within the loop (I don't need the individual graphs or tables box data once the plot has been been sent to a journal (for  pdf export ) and the regression coefficients have been extracted). 

When I step through the script using the debugger , the script runs to the end and does not show the individual windows, but when I stop the debugger (red square) all of the individual windows from within the for loop are created. The script iterates over 600 columns and the corresponding number of windows that are created in the background (set as invisible) brings jmp to a grinding halt over time. 
 
When using a script to iterate through a dataset to perform some analysis or generate many graphs, what is the best way to close the "intermediate" windows, plots, etc that are created so that the memory burden that is generated is minimized?  I
 
Below is a partial snippet from the script where I iterate through the columns.
For( i = 7, i <=ncols, i++,

biv = dt << Bivariate(
Y(Column(colList[i]) ),
X( :Temperature ),
Fit Line( {Line Color( "Medium Dark Red" )} ), invisible);
rbiv = biv << Report;
biv << Close;
rbiv[Frame Box( 1 )] << Frame Size( 550, 400 );
rbiv << Page Break;
rbiv << Journal;

dtx= Report( biv )["Parameter Estimates"][Table Box( 1 )] << make combined data table;
// dty= Report( biv )["Lack Of Fit"][Table Box( 1 )] << make combined data table;
dtSlope << Concatenate(dtx ,"Append to first table");
// dtFit << Concatenate(dty ,dtSlope, "Append to first table");
// Close(dty, NoSave);
Close(dtx, NoSave);
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
peng_liu
Staff

Re: JMP slows to a stop when building many graphs using JSL

I think that you need to change the highlighted line to: "rbiv << Close Window;" And also move it down to where you no longer need it, e.g. where the arrow points to.

 

peng_liu_0-1748900713669.png

"rbiv << Close Window;" means that you want to close the report window.

peng_liu_1-1748900848029.png

It surprised me that "biv << Close Window;" works, too. But I won't recommend it, at least because the behavior is undocumented.

View solution in original post

DSchweitzer
Level III

Re: JMP slows to a stop when building many graphs using JSL

Thank you. Both solutions/recommendations helped but for different reasons. 

Yes, the error appears to have been my incorrect use of the command biv << Close and not biv << Close Window. The Close command did not generate an error or appear to anything (hence my issue). This can be one of the frustrating issues with JSL. Commands or arguments that are not correct or appropriate in many cases do not generate errors and just quietly do nothing.  This makes it difficult to troubleshoot if the issue is the script itself or an incorrect use of a command.

 

Once I changed to the correct Close command, the incorrect location in the script became obvious since it generated an error since I still needed the it to grab the Parameter Estimates.   

 

Really appreciate, the help....

 

 

View solution in original post

4 REPLIES 4
peng_liu
Staff

Re: JMP slows to a stop when building many graphs using JSL

I think that you need to change the highlighted line to: "rbiv << Close Window;" And also move it down to where you no longer need it, e.g. where the arrow points to.

 

peng_liu_0-1748900713669.png

"rbiv << Close Window;" means that you want to close the report window.

peng_liu_1-1748900848029.png

It surprised me that "biv << Close Window;" works, too. But I won't recommend it, at least because the behavior is undocumented.

DSchweitzer
Level III

Re: JMP slows to a stop when building many graphs using JSL

Thank you. Both solutions/recommendations helped but for different reasons. 

Yes, the error appears to have been my incorrect use of the command biv << Close and not biv << Close Window. The Close command did not generate an error or appear to anything (hence my issue). This can be one of the frustrating issues with JSL. Commands or arguments that are not correct or appropriate in many cases do not generate errors and just quietly do nothing.  This makes it difficult to troubleshoot if the issue is the script itself or an incorrect use of a command.

 

Once I changed to the correct Close command, the incorrect location in the script became obvious since it generated an error since I still needed the it to grab the Parameter Estimates.   

 

Really appreciate, the help....

 

 

jthi
Super User

Re: JMP slows to a stop when building many graphs using JSL

Outside of making sure those windows are getting closed properly, depending on your JMP version, you might want to add Invisible or even Private to your Bivariate message and also to make combined data table

Names Default To Here(1);

cols = {"height", "weight"};
dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt_res = Empty();
For Each({colname}, cols,
	// You can also use Private, it is generally faster but more dificult to debug and utilize
	biv = dt << Bivariate(Y(Eval(colname)), X(:weight), Fit Line({Line Color({230, 159, 0})}), Invisible); 

	// this can also be made invisible/private
	dt_biv = Report(biv)["Parameter Estimates"][Table Box(1)] << make combined data table(Invisible); 
	biv << close window;
	dt_biv << Delete Scripts(dt_biv << Get Table Script Names);
	
	// wait(0); // wait(0) isn't usually not necessary
	
	If(Is Empty(dt_res),
		dt_res = dt_biv;
		dt_res << Set Name("Biv Parameter Estimates");
	,
		dt_res << Concatenate(
			dt_biv,
			"Append To First Table"
		);
		
		Close(dt_biv, no save);
	);
);

dt_res << show window; // use result
-Jarmo

Re: JMP slows to a stop when building many graphs using JSL

Do you need the full Bivariate Fit report? Or are you only looking for Parameter Estimates (slope & intercept, along with the associated Std Errors and t Ratios)? If the latter, have you tried using Fit Curve instead of Fit Y by X? In my experience, Fit Curve is faster and makes it easier to handle large numbers of curves. 

Recommended Articles