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

Was this helpful?

  1. Examples

Getting the Evolution of the Statistics of a Result

This is an example of a run(scenario) script that loads DEM dataset and calculates for result the values of a list of statistical parameters for each timestep in the datase. The data of temporal evolution of the statistical parameters is saved into the scenario as graph (raw data is also saved into a CSV file) and the graph is exported into a interactive HTML file.

'''This scripts loads the DEM dataset of a scenario. For a given result, it computes the statistical parameters 
    over the particles' mesh for each timestep in the dataset. A graph with the data is saved into the scenario 
    and into a CSV file, and the graph is exported into a HTML file'''

import iota

def run(scenario):

    ## Settings for getting statistics ##
    mesh_name = 'particles'                                   #Name of the mesh that contains the result

    res_name = 'Velocity'                                     #Name of the result
    res_component = 3                                         #Component of the result 
    res_analysis = 'none'                                     #Name of the analysis of the result  
    stats_params = ['min','max','mean','median','stdev','cov'] #Stats parameters to be calculated
    ########################################

    #### Settings for graph saving ######
    Name_graph = 'Statistics {} for {}'.format(res_name,mesh_name)        #Name for the graph
    Title_graph = 'Statistics {} for {}'.format(res_name,mesh_name)       #Title to shown in the graph
    xtitle = 'time (s)'                                                   #Title for x-axis 
    ytitle = 'Velocity Magnitude [m/s]'                                   #Tile for y-axis
    legend = stats_params                                                  #Name of the traces for the graph legend
    graph_file = '{}/graphs/{}'.format(scenario.directory,Name_graph)     #Output name and path for exporting graph
    ########################################     

    dem_dataset = scenario.get_dem_dataset()                    #Get the coarse-graining dataset of the scenario
    dem_data = dem_dataset.data()                                       #Load the data of the coarse-graining dataset

    x_data , y_data = dem_data.statistics_evolution(mesh=mesh_name, result=res_name, 
        analysis=res_analysis, component=res_component, data=stats_params)        #Get evolution statistics

    graph = scenario.add_graph(name=Name_graph, title=Title_graph, xdata=x_data, ydata=y_data, 
        xtitle=xtitle, ytitle=ytitle, legend=legend)        #Save the graph data to database (including raw data to csv file)

    graph.export_html(graph_file)                                #Export the graph into html format
PreviousIntegrating a Result over a MeshNextCreating Multiple Screenshots of a Dataset

Last updated 5 years ago

Was this helpful?