Log Capture
Log Capture using Run Script
Example 1
Summary: Process of running a Fit Model script, generating predicted values, selecting specific rows, and capturing log output in JMP.
Code:
dt = Open("data_table.jmp");
fm = dt << Run Script( "Fit Model" );
fm << Predicted Values;
dt << Select Rows( [1 2 3 4 5] );
dt << Move Rows( At End );
log1 = Log Capture( fm << Predicted Values );
Code Explanation:
- Open data table;
- Run Fit Model script.
- Add predicted values column.
- Select first five rows.
- Move selected rows to end.
- Capture log output.
Example 2
Summary: Executes Recurrence Analysis and Grouped scripts, capturing logs for Proportional Intensity Model and endtime calculations in columns and fields.
Code:
dt = Open("data_table.jmp");
dt << Run Script( "Recurrence Analysis" );
dt << Run Script( "Recurrence Grouped" );
lcap1 = Log Capture( dt << Run Script( "Proportional Intensity Model" ) );
lcap2 = Log Capture( dt << Run Script( "Recurrence endtime in column" ) );
lcap3 = Log Capture( dt << Run Script( "Recurrence endtime in field" ) );
Code Explanation:
- Open table.
- Run Recurrence Analysis script.
- Run Recurrence Grouped script.
- Capture Proportional Intensity Model log.
- Capture Recurrence endtime in column log.
- Capture Recurrence endtime in field log.
Example 1
Summary: Runs the execution and reporting of SEM: CFA and Mediation analyses on a data table, capturing logs for each script run.
Code:
dt = Open("data_table.jmp");
model_log = Log Capture(
obj7 = dt << Run Script( "SEM: CFA" );
rpt7 = obj7 << Report();
);
model_log = Log Capture(
obj8 = dt << Run Script( "SEM: CFA and Mediation" );
rpt8 = obj8 << Report();
);
Code Explanation:
- Open data table.
- Capture log for SEM: CFA script.
- Run SEM: CFA script on data.
- Generate report from CFA analysis.
- Capture log for SEM: CFA and Mediation script.
- Run SEM: CFA and Mediation script on data.
- Generate report from CFA and Mediation analysis.
Example 2
Summary: Opens a data table, creation of Python commands, log capture from submission, and retrieval of the updated Iris object.
Code:
iris = Open("data_table.jmp");
commands = "\[
iris = jmp.current()
print(iris.name)
]\";
s = Log Capture( Python Submit( commands ) );
iris = Python Get( iris );
Code Explanation:
- Open data table;
- Create Python commands string.
- Capture log from Python submission.
- Retrieve updated Iris object from Python.
Log Capture using Select Rows
Summary: Runs data table operations by opening a file, selecting specific rows, deleting them, capturing log output, and running a Time Series script.
Code:
dt = Open("data_table.jmp");
r = dt << Select Rows( 2 :: 296 );
r << Delete Rows;
log1 = Log Capture( dt << run script( "Time Series" ) );
Code Explanation:
- Open data table.
- Select specific rows.
- Delete selected rows.
- Capture log output.
- Run Time Series script.
Log Capture using Python Send
Example 1
Summary: Opens a data table, sending it to Python for processing, and printing dataset name, row count, and column count.
Code:
commands =
"\[
jmp.run_jsl('''
iris=Open("data_table.jmp");
Python Send(iris); ''')
print ( f"{ iris.name } Row Count: { iris.nrows } Column count: { iris.ncols }\n" )
]\";
s = Log Capture( Python Submit( commands ) );
Code Explanation:
- Open data table;
- Send data to Python.
- Print dataset name.
- Print row count.
- Print column count.
- Capture log output.
Example 2
Summary: Sends a JMP data table to Python for further processing and retrieval, utilizing the
Python Sendfunction.
Code:
iris = Open("data_table.jmp");
Python Send( iris );
commands = "\[
iris = jmp.table('data_table.jmp')
print(iris.name)
]\";
s = Log Capture( Python Submit( commands ) );
iris = Python Get( iris );
Code Explanation:
- Open data table;
- Send data to Python.
- Define Python commands.
- Capture log output.
- Submit Python commands.
- Retrieve updated data.
Example 3
Summary: Modify and retrieve a JMP data table's name through Python scripting, capturing log output and handling potential errors.
Code:
iris = Open("data_table.jmp");
Python Send( iris );
commands = "\[
print(iris.name)
]\";
s = Log Capture( Python Submit( commands ) );
commands = "\[
iris.name = 'New data_table'
]\";
Python Submit( commands );
s = Python Get( iris );
iris = Python Get( iris ) << Get Name;
commands = "\[
try:
iris.name = 7
except ValueError as e:
print( 'DataTable.name: ' + repr(e) )
]\";
s = Log Capture( Python Submit( commands ) );
commands = "\[
try:
iris.name = None
except ValueError as e:
print( 'DataTable.name: ' + repr(e) )
]\";
s = Log Capture( Python Submit( commands ) );
Code Explanation:
- Open data table;
- Send table to Python.
- Execute Python command.
- Capture log output.
- Change table name to "New Iris".
- Submit Python command.
- Retrieve updated table.
- Get new table name.
- Attempt to set invalid table name.
- Capture error message.
Example 4
Summary: Sends a JMP data table to Python, executing commands to print row and column counts, assign the first column to a set, and capture log output.
Code:
iris = Open("data_table.jmp");
Python Send( iris );
commands =
"\[
print ( f"Row Count: { iris.nrows } Column count: { iris.ncols }\n" )
setW = iris[1] # indexed starting with 0
print(f"{setW.name} Row Count: {iris.nrows}")
]\";
s = Log Capture( Python Submit( commands ) );
Code Explanation:
- Open data table;
- Send data to Python.
- Define Python commands.
- Print row and column counts.
- Assign first column to setW.
- Print column name and row count.
- Capture log output.
- Submit Python commands.
Example 5
Summary: Sends a JMP data table to Python for further processing and logging, utilizing the
Python Sendfunction.
Code:
iris = Open("data_table.jmp");
Python Send( iris );
commands = "\[
import jmp
iris = jmp.table('data_table.jmp')
print(iris.__class__)
]\";
s = Log Capture( Python Submit( commands ) );
Code Explanation:
- Open data table;
- Send table to Python.
- Define Python commands.
- Capture log output.
Example 6
Summary: Sends a weight column to Python and captures its output, utilizing Log Capture.
Code:
dt = Open("data_table.jmp");
Python Send( dt:weight );
w = Log Capture( Python Submit( "print(dt_weight)" ) );
Code Explanation:
- Open table.
- Send weight column to Python.
- Capture Python output.
- Log captured output.
Example 7
Summary: Sends a weight column from a JMP data table to Python, capturing the output as a log.
Code:
dt = Open("data_table.jmp");
Python Send( dt:weight, Python Name( "weight" ) );
s = Log Capture( Python Submit( "print(weight)" ) );
Code Explanation:
- Open data table;
- Assign weight column to variable.
- Send weight data to Python.
- Capture Python output.
Example 8
Summary: Sends a JMP data table to Python and captures log output using the Log Capture function, executing a custom Python script.
Code:
dt = Open("data_table.jmp");
Python Send( dt );
s = Log Capture( Python Submit File( "$SAMPLE_SCRIPTS/Python/ListCheck.py" ) );
Code Explanation:
- Open data table;
- Send data to Python.
- Capture log output.
- Execute "ListCheck.py".