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
  • Methods
  • exists_scenario(name)
  • get_scenario(name)
  • get_scenarios()
  • add_scenario(name,[description])
  • get_dataset(name,[data_format])
  • get_datasets()
  • add_dataset(name, data_format, file, [description], [scenario])
  • import_dataset(file,[name],[data_format],[include_graphs],[description],[scenario])
  • exists_graph(name,[tags])
  • get_graph(name,[tags])
  • get_graphs()
  • add_graph(name,[title],[xdata],[ydata],[legend],[xtitle],[ytitle],[csvfile],[overwrite],[description],[tags],[scenario])
  • get_mesh()
  • get_meshes()
  • add_mesh(file, [description])
  • get_file(name)
  • get_files()
  • add_file(name, filepath, [description])
  • get_script(name)
  • get_scripts()
  • add_script()
  • add_video(file,name,[description],[tags],[thumbnail])
  • add_screenshot(file,name,[description],[tags])
  • delete()

Was this helpful?

  1. Iota Python Reference Library

Project

PreviousSessionNextScenario

Last updated 5 years ago

Was this helpful?

iota.session.Project()

Description Iota project object.

Methods

Variables

  • name (str) project name

  • description (str) project description

  • id (int) project Id

Methods

Return a scenario belonging to a specified project, by name

Arguments

  • name: (str) scenario name

Example

if project.exists_scenario('my_scenario'):
  print('scenario exist')

Return a scenario belonging to a specified project, by name

Arguments

  • name: (str) scenario name

Example

scenario = project.get_scenario(name='my_scenario')

Return the list of scenarios in the project

Example

for scenario in project.get_scenarios():
  print('scenario: {}'.format(scenario.name))

Create and return a scenario, described by name and optional description and tags

Arguments

  • name: (str) scenario name

  • description: (str) scenario description (default: None)

Example

new_scenario = project.add_scenario(
  name = 'scenario 01',
  description = 'simulation mixing analysis with speeed = 30 RPM'
  )

Return a dataset record specified by name

Arguments

  • name: (str) scenario name

  • data_format: (str) data format of the dataset to be loaded. The project can have more than one dataset with the same name if data_format is different. (default: None)

Example

dataset = project.get_dataset(
  name = 'mixing_rpm_30',
  data_format = 'PADEM'
  )

Return the list of dataset records in the project

Example

print('List of datasets in the project')
for dataset in project.get_datasets():
  print('dataset: {} (format: {})'.format(dataset.name,dataset.data_format))

Add a Iota Dataset file to the project data_format must be one of PADEM or PACG

Arguments

  • name: (str) dataset name

  • data_format: (str) format of the dataset

  • file: (str) dataset filepath

  • description: (str) dataset description (default: None)

  • scenario: (str) add dataset to a specific scenario (default: None)

Example

project.add_dataset(
  name = 'mixing_rpm_32',
  data_format = 'PADEM',
  file = '/path/to/my/dataset/mixing_rpm_32.meta',
  description = 'mixing analysis with drum speed of 32 RPM'
  )

Import external Dataset to the project data_format must be one of the accepted formats: [EDEM 2017]

Arguments

  • file: (str) dataset filepath

  • name: (str) dataset name. If not defined, used the basename of the filepath (Default: None)

  • data_format: (str) format of the dataset

  • include_graphs: (bool) import any graph available in the dataset to the project

  • description: (str) dataset description (Default: None)

  • scenario: (str) add dataset to a specific scenario (default: None)

Example

project.import_dataset(
  file = '/path/to/my/edem/dataset/simulation.dem',
  name = 'mixing_rpm_34',
  data_format = 'EDEM 2017',
  include_graphs = True,
  description = 'mixing analysis with drum speed of 34 RPM'
  )

Return True if graph exists, specified by name (and tags)

Arguments

  • name: (str) graph name

  • tags: (dict) tags dictionary

Example

exists_graph = project.exists_graph(
  name = 'Reaction Force',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )
if exists_graph: 
  print('graph exist!')

Return a graph, specified by name (and tags)

Arguments

  • name: (str) graph name

  • tags: (dict) tags dictionary

Example

graph = project.get_graph(
  name = 'Reaction Force',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )

Return the list of graphs in the project

Example

print('List of graphs:')
for graph in project.get_graphs():
  print('Graph: {}'.format(graph.name))

Add a new graph to the project. The graph can be defined in a csv file or by defining all the components (data, titles, etc)

Arguments

  • name: (str) graph name

  • title: (str) graph title

  • filepath: (str) optional file path for new graph file (Default: None)

  • xdata: (iota.ArrayFloat) array of data representing the values of axis X

  • ydata: (list[iota.ArrayFloat]) list of arrays representing the data series

  • legend: (list[str]) list of names for the data series

  • xtitle: (str) title of the axis X

  • ytitle: (str) title of the axis Y

  • csvfile: (str) csv file containing the graph data. If this is defined, none of the previous variables are considered

  • description: (str) graph description

  • tags: (dict) tags dictionary

  • overwrite: (bool) overwrite graph file if already exists

Example

x_values = iota.ArrayFloat([0,1,2,3,4,5,6])
average_force = iota.ArrayFloat(len(x_values),10.0)
graph = project.add_graph(
  name = 'Average Force',
  title = 'Average Force',
  xtitle = 'Step',
  xdata = x_values,
  ytitle = 'Force',
  legend = ['Force'],
  ydata = [average_force],
  tags = {
    'dataset': 'mixing_rpm_34'
    },
  overwrite = True
  )

graph2 = project.add_graph(
  name = 'Average Torque',
  csvfile = '/path/to/my/graph/torque.csv',
  tags = {
    'dataset': 'mixing_rpm_34'
    }
  )

Return a mesh specified by a name

Arguments

  • name: (str) mesh name

Example

mesh_record = project.get_mesh(
  name = 'mixing_drum_v02'
  )

Return th elist of meshes in the project

Example

print('List of meshes:')
for mesh in project.get_meshes():
  print(' mesh: {}'.format(mesh.name))

Add a mesh by filepath to the project

Arguments

  • file: (str) mesh filepath

  • description: (str) mesh description

Example

project.add_mesh(
  file = '/path/to/my/mesh/mixing_drum_v2.stl',
  description = 'Mixing drum with inclinantion of 30 degrees'
  )

Return a file, specified by name

Arguments

  • name: (str) file name

Example

file = project.get_file(
  name = 'list of values test 2'
  )

Return the list of files in the project

Example

print('List of files:')
for file in project.get_files():
  print(' file: {}'.format(file.name))

Create and return a file, describe by name, filepath and optional description

Arguments

  • name: (str) scenario name

  • filepath: (str) file path

  • description: (str) file description (Default: None)

Example

project.add_file(
  name = 'my text file',
  filepath= '/path/to/my/file/text.txt',
  description='this file contains the summary of parameters used for the simulations'
  )

Return a script spcified by a name

Arguments

  • name: (str) script name

Example

script_file = project.get_script(
  name = 'calculate mixing index'
  )

Return the list of scripts in the project

Example

print('List of scripts:')
for script in project.get_scripts():
  print(' script: {}'.format(script.name))

Add a script (python file) to the project

Arguments

  • name: (str) script name

  • filepath: (str) script file path

  • description: (str) script description (Default: None)

Example

project.add_script(
  name = 'calculate mixing index',
  filepath = '/path/to/my/scripts/calculate_mixing_index.py',
  description = 'This script calculate the Lacey mixing index using binning'
  )

Add a video file to the project

Arguments

  • file: (str) video file path

  • name: (str) video name

  • description: (str) video description (Default: None)

  • tags: (dict) tags dictionary (Default: None)

  • thumbnail: (str) image file to be used as a thumbnail (Default: None)

Example

project.add_video(
  file = '/path/to/my/videos/mixer_rpm_32_velocity_X.mp4',
  name = 'Mixer at 32 RPM',
  description = 'This video shows the velocity profile in X direction for the case with drum speed at 32 RPM',
  tags = {
    'dataset': 'mixer_rpm_32',
    'result': 'Velocity (X)'
    }
  )

Add image file to the project

Arguments

  • file: (str) screenshot file path

  • name: (str) screenshot name

  • description: (str) screenshot description (Default: None)

  • tags: (dict) tags dictionary (Default: None)

Example

project.add_video(
  file = '/path/to/my/images/mixer_rpm_32_velocity-Y_time3.42.png',
  name = 'Mixer at 32 RPM',
  description = 'Velocity profile in Y direction for the case with drum speed at 32 RPM. Time = 3.42s',
  tags = {
    'dataset': 'mixer_rpm_32',
    'result': 'Velocity (Y)',
    'timestep': '3.42'
    }
  )

Delete project from the database (and disk if applicable)

Example

name = project.name
project.delete()
if not session.exist_project(name):
  print('project removed')

exists_scenario
get_scenario
get_scenarios
add_scenario
get_dataset
get_datasets
add_dataset
import_dataset
exists_graph
get_graph
get_graphs
add_graph
add_file
get_file
get_files
get_mesh
get_meshes
add_mesh
get_script
get_scripts
add_script
add_video
add_screenshot
run_batch_processing
delete
exists_scenario(name)
get_scenario(name)
get_scenarios()
add_scenario(name,[description])
get_dataset(name,[data_format])
get_datasets()
add_dataset(name, data_format, file, [description], [scenario])
import_dataset(file,[name],[data_format],[include_graphs],[description],[scenario])
exists_graph(name,[tags])
get_graph(name,[tags])
get_graphs()
add_graph(name,[title],[xdata],[ydata],[legend],[xtitle],[ytitle],[csvfile],[overwrite],[description],[tags],[scenario])
get_mesh()
get_meshes()
add_mesh(file, [description])
get_file(name)
get_files()
add_file(name, filepath, [description])
get_script(name)
get_scripts()
add_script()
add_video(file,name,[description],[tags],[thumbnail])
add_screenshot(file,name,[description],[tags])
delete()