Iota Python API
1.0.0
1.0.0
  • Introduction
  • Getting started with Iota Python Library and Iota IPython Terminal
    • Starting a Session
    • Creating a New Project
    • Loading a Project
    • Creating a New Scenario
    • Loading a Scenario
    • Importing a Dataset
    • Running Coarse-graining
  • Writing Scripts
    • Generic Scripts
    • Run(scenario) Scripts
  • Running Scripts
    • Running Generic Scripts
    • Running run(scenario) Scripts
  • Iota Python Reference Library
    • Datasets
    • Graphs
    • Scene renderer
    • Meshing
    • Variable types
    • Session
    • Project
    • Scenario
    • Graph
    • Dataset
    • Mesh
    • Script
    • File
    • Auxiliar
    • Enums
  • Examples
    • Creating a New Project
    • Creating a New Scenario
    • Creating Multiple Scenarios
    • Loading a Project and a Scenario
    • Importing a Dataset into a Scenario
    • Importing Multiple Datasets into different Scenarios
    • Creating a Cut-Plane with Results in a Dataset
    • Creating a New Result in a Dataset
    • Calculating a KPI and Exporting into a Graph
    • Getting the Profile of Result along a Line
    • Creating Multiple Result Line Variations and Plotting them in a Single Graph
    • Integrating a Result over a Mesh
    • Getting the Evolution of the Statistics of a Result
    • Creating Multiple Screenshots of a Dataset
    • Creating Multiple Videos of a Dataset
    • Cloninig Settings and Running Coarse-graining for Multiple Scenarios
    • Automating EDEM Simulations runs and Iota Analyses
Powered by GitBook
On this page
  • Running Generic Scripts
  • Running run(scenario) Scripts
  • Running a script as a Post-Analysis in coarse-graining
  • Running a script using the iota script.run method
  • Runninng a script using import and run function

Was this helpful?

Running Scripts

PreviousRun(scenario) ScriptsNextRunning Generic Scripts

Last updated 5 years ago

Was this helpful?

This section describes how users can run the scripts that they have written using the .

Users can run their in the Iota IPython terminal by using the command . For example:

%run 'C:/Users/stephen/My Iota Scripts/Analysis backhoe.py'

Figure 3 - Start menu entry on Windows where Iota IPython Terminal is highlighted

The run(scenario) scripts always take as argument a object and can be executed in different ways:

If a run(scenario) script has been imported into a project/scenario, users can add those scripts to the section . Once the scripts have been added to the section, those scripts will be automatically run when running the coarse-graining for the scenario. A summary of the steps required to add and run the script as a Post-Analysis using the GUI is as follows:

  1. Load a project

  2. Import your run(scenario) to the Scripts section of the Project page.

  3. Load a scenario

  4. Go to coarse-graining page.

  5. Set your coarse-graining settings

  6. In the Output tab of the coarse-graining page, go to section "Post-Analysis" and select the script imported in the step 2.

  7. Click on Start button to run the coarse-graining analysis including the run(scenario) script added in the previous step.

Note that if the script was added to the Post-Analysis sections and the coarse-graining settings were saved, executing the coarse-graining for that scenario in the Iota IPython Terminal will also run the coarse-graining analysis including the run(scenario). This can be useful for the users because they can import the scripts and set the coarse-graining for multiple scenarios using the GUI and then execute coarse-graining in batch using the Iota Python Library.

run(scenario) scripts that have been imported into the project/scenario can be also executed using the run method available for the iota scripts objects. The following example shows how to import and run a run(scenario) script using the run method:

import iota
my_session = iota.session('stephen','C:/Users/stephen/ParticleAnalytics/config.ini')
my_project = my_session.get_project('Backhoe optimization')
my_script = my_project.add_script(name = 'My new script', filepath = 'C:/Users/stephen/My Iota Scripts/my_run_scenario_script.py',description = 'My new run(scenario) script')
my_scenario = my_project.get_scenario('Initial design') 
my_script.run(scenario = my_scenario)

If you had already imported the script into your projec/scenario you can replace the add_script step by the get_script:

import iota
my_session = iota.session('stephen','C:/Users/stephen/ParticleAnalytics/config.ini')
my_project = my_session.get_project('Backhoe optimization')
my_script = my_project.get_script(name = 'My script name in Iota')
my_scenario = my_project.get_scenario('Initial design') 
my_script.run(scenario = my_scenario)

Users can also run run(scenario) scripts using the standard Python importcommand and then calling to the run function already included in the run(scenario) script. In this case, users may need to add the directory where the script is located into the Python paths by using the sys.path.append function. See the example below:

import iota
import sys
sys.path.append('C:/Users/stephen/My Iota Python Scripts')

my_session = iota.session('stephen','C:/Users/stephen/ParticleAnalytics/config.ini')
my_project = my_session.get_project('Backhoe optimization')
my_scenario = my_project.get_scenario('Initial design') 
import My_run_script 
My_run_script.run(scenario)

Note that in this case, the script does not need to be imported into a Iota project/scenario in order to execute the script.

Running a script using the iota script.run method
Runninng a script using import and run function
Iota Python Library
generic scripts
%run
scenario
Post-Analysis
Post-Analysis
Running Generic Scripts
Running run(scenario) Scripts
Running a script as a Post-Analysis in coarse-graining.
Running a script using the Iota script.run method
Runninng a script using import and run function
Running a script as a Post-Analysis in coarse-graining