Datasets
iota.Dataset()
Description
Iota Dataset object.
Methods
Methods
Dataset constructor
Arguments
filename
: (str) file path of the dataset (extension .meta required)mode
: (IO_Type) access mode: WRITE or READ_ONLY. (Default: iota.IO_Type.WRITE)
Example
my_dataset = iota.Dataset(
filename = 'C:\Users\particle\Desktop\my_new_dataset.meta',
mode = iota.IO_Type.WRITE
)
Get dataset name Return the name as a string
Example
name = my_dataset.name()
print(name)
Get dataset software
Example
dataset_software = my_dataset.software()
print(dataset_software)
Get dataset type Returns a value of type iota.DatasetType
Example
dataset_type = my_dataset.type()
print(dataset_type)
Get dataset reader format Returns the internal reader format as string
Example
dataset_reader_format = my_dataset.reader_format()
print(dataset_reader_format)
Get the list of timesteps Returns a list of string that contains the timesteps of the dataset
Example
dataset_timesteps = my_dataset.timesteps()
print(dataset_timesteps)
Checks for the existsence of a timestep on a given mesh Returns a boolean value True if timestep exists, or False otherwise
Arguments
timestep
: (int) timestep index to be checkedmesh
: (str) name of the mesh to be checked
Example
mesh_exists_at_timestep = my_dataset.timestep_exists(0,'my_mesh')
print(mesh_exists_at_timestep)
Get the number of timesteps for a given mesh Returns the number of timesteps as an integer
Arguments
mesh
: (str) name of the mesh
Example
Number_timesteps_for_mesh = my_dataset.timesteps_count('my_mesh')
print(Number_timesteps_for_mesh)
Get maximum global value for pair (result,analysis) for the whole simulation dataset Returns a value of type equal to the result type
Arguments
result
: (str) name of the resultanalysis
: (str) name of the analysis
Example
result_max = my_dataset.result_max('Density','none')
print(result_max)
Get minimum global value for pair (result,analysis) for the whole simulation dataset Returns a value of type equal to the result type
Arguments
result
: (str) name of the resultanalysis
: (str) name of the analysis
Example
result_min = my_dataset.result_min('Density','none')
print(result_min)
Get type of the result pair (result,analysis) Returns a value of type iota.ResultType representing the type
Arguments
result
: (str) name of the resultanalysis
: (str) name of the analysis
Example
result_type = my_dataset.result_max('Density','none')
print(result_type)
Get the list of all results in the dataset for all the meshes, or for a specific mesh Returns a list of strings if no mesh defined, of a list of (string,string) pairs with result name and analysis if a mesh is defined
Arguments
mesh
: (str) name of the mesh (Default: None)
Example
results_list = my_dataset.results()
print(results_list)
result_list_mesh = my_dataset.results('my_mesh')
print(results_list_mesh)
Get the number of results for for a specific mesh Returns an integer that corresponds to the number of results for the specified mesh
Arguments
mesh
: (str) name of the mesh
Example
Number_results_mesh = my_dataset.results_count('my_mesh')
print(Number_results_mesh)
Check for the existence of a result on a given timestep and mesh
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Example
result_exists = my_dataset(0,'my_mesh','Density','none')
print(result_exists)
Get a list of values per vertex/particle of a specific result,analysis and component Returns a value of type iota.ArrayXX representing the values of result component. If component is iota.ALL_COMPONENTS, all components of the result are returned. Otherwise, an iota.ArrayFloat is returned
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Example
result_component_values = my_dataset.get_result_component(1,'my_mesh','Velocity','none',2)
print(result_component_values)
Get minimum result value for a given step, mesh, result and analysis Returns a value of type equal to the result
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Example
result_min_value = my_dataset.get_result_min(1,'my_mesh','Velocity','none')
print(result_min_value)
Get maximum result value for a given step, mesh, result and analysis Returns a value of type equal to the result type
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Example
result_max_value = my_dataset.get_result_max(1,'my_mesh','Velocity','none')
print(result_max_value)
Get a result array for a given step, mesh ad result/analysis, including min and max values Returns a tuple (iota.ArrayXX, min_value, max_value), where XX is a Float or Int depending on the result type
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component index
Example
result_min_max = my_dataset.get_result_component_minmax(1,'my_mesh','Velocity','none',2)
print(result_min_max)
Get information of a given result Returns a dictionary containing: type, name, analysis and list of meshes
Arguments
result
: (str) result nameanalysis
: (str) analysis name
Example
result_info = my_dataset.result_info('Velocity','none')
print(result_info)
Get the list of component labels for a given result/analysis
result
: (str) result nameanalysis
: (str) analysis name
Example
result_interpreter = my_dataset.result_interpreter('Velocity','none')
print(result_interpreter)
Get the legend of the result as shown in the colorbar of result screenshot/animation Returns the string used as label for a given result/analysis, including result name, component and units (if available). If component is iota.ALL_COMPONENTS, a list with legend for each component is returned
result
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component index
Example
result_legend = my_dataset.result_legend('Velocity','none',0)
print(result_legend)
Get list of result legends to shown in graph/animation for a given result/analysis Returns a list of strings representing the labels per component. Equivalent to get_result_legend(result,name,iota.ALL_COMPONENTS)
result
: (str) result nameanalysis
: (str) analysis name
Example
result_legends = my_dataset.result_legends('Velocity','none')
print(result_legends)
Get result type Returns a variable of type iota.ResultType
result
: (str) result nameanalysis
: (str) analysis name
Example
result_type = my_dataset.get_result_type('Velocity','none')
print(result_type)
Get values of a result for a given step, mesh, result and analysis Returns an iota.ArrayXX where XX is a Float or Int depending on the result type
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis name
Example
result_values = my_dataset.get_result(5,'my_mesh','Velocity','none')
Get type of a mesh in the dataset Returns a variable of type iota.MeshType
Arguments
mesh
: (str) mesh name
Example
mesh_type = my_dataset.mesh_type('my_mesh')
print(mesh_type)
Get the list of meshes in the dataset Returns a list of strings representing the name of the meshes
Example
meshes_name = my_dataset.meshes()
print(meshes_name)
Get a mesh for a given step in the dataset Returns a variable of type iota.mesh.Mesh
Arguments
mesh
: (str) mesh namestep
: (int) timestep index
Example
mesh = my_dataset.get_mesh('my_mesh',0)
print(mesh)
Get the vertices of a mesh vertices for a given step in the dataset Returns an array containing the position of each vertex in the mesh
Arguments
mesh
: (str) mesh namestep
: (int) timestep index
Example
mesh_vertices = my_dataset.get_mesh_vertices('my_mesh',0)
print(mesh_vertices)
Get the information on a specific mesh Returns a dictionary containing the variables name, type and dynamic
Arguments
mesh
: (str) mesh name
Example
mesh_info = my_dataset.get_mesh_info('my_mesh')
print(mesh_info)
Get the value of an attribute/variable for a given step and particle mesh Returns an array of values representing for the given attribute/variable: position, orientation, type, group, labels or spheres
Arguments
step
: (int) timestep indexmesh
: (str) particles mesh namevariable
: (str) attribute name: position, orientation, type, group, labels or spheres
Example
particle_mesh_variable = my_dataset.get_particles_mesh(3,'my_particles_mesh','position')
Get the value of a result/analysis in a given point for one or all timesteps Returns a pair (iota.ArrayFloat,list[iota.ArrayFloat]),where the first element is the array of values representing the timesteps and the second one is the list of result arrays per component
Arguments
mesh
: (str) mesh namepoint
: (iota.Vector3d) point to evaluate the resultresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (int) timestep index (Default: iota.ALL_STEPS)
Example
x, y = my_dataset.statistics_evolution('my_mesh',iota.Vector3d(0,0.1,0.5),'Velocity','none',3,step=iota.ALL_STEPS)
print(x)
print(y)
Get the evolution of different statistical variables for a given mesh/result/analsys Returns a pair (iota.ArrayFloat,list[iota.ArrayFloat]),where the first element is the array of values representing the timesteps and the second one is the list of result arrays per variable
Arguments
mesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (int) timestep index (Default: iota.ALL_STEPS)data
: (list[str]) list of statistical values to be evaluated: min, max, mean, stdev, median, cov (Default: [])
Example
x, y = my_dataset.statistics_evolution('my_mesh','Velocity','none',3,step=iota.ALL_STEPS,data=['min','max', 'mean'])
print(x)
print(y)
Get the results evaluated in a give line through a mesh Returns a pair (iota.ArrayFloat,list[iota.ArrayFloat]),where the first element is the array of values representing the point/positions in the line and the second one is the list of result arrays per component
Arguments
mesh
: (str) mesh namepoint_start
: (iota.Vector3d) point representing the start of the linepoint_end
: (iota.Vector3d) point representing the end of the linenum_points
: (int) number of points in the line to evaluate the resultresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (int) timestep indexx_type
: (str) variable to be used in the x axis of the graph: 'x', 'y', 'z', 'dist' (Default: 'dist')
Example
x, y = my_dataset.line_variation('my_mesh',iota.Vector3d(0,0,0),iota.Vector3d(0,0,2.5),50,'Velocity','none',3,5,'z')
print(x)
print(y)
Get the volume/area integral of a result/analysis over a given mesh Returns a pair (iota.ArrayFloat,list[iota.ArrayFloat]),where the first element is the array of values representing the timesteps and the second one is the list of result arrays per component
Arguments
mesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namecomponent
: (int) component indexstep
: (int) timestep index (Default: iota.ALL_STEPS)
Example
x, y = my_dataset.mesh_integral('my_mesh','Velocity','none',3,step=5)
print(x)
print(y)
Sets the name of the dataset
Arguments
name
: (str) new name of the dataset
Example
my_dataset.set_name('new name')
print(my_dataset.name())
Adds a mesh of particles (DEM) to a existing step in the dataset
Arguments
step
: (int) timestep indexmesh
: (iota.mesh.DEM_Mesh) particle (DEM) mesh classname
: (str) mesh name (Default: 'particles')
Example
my_dataset.add_dem_mesh(0,my_DEM_particles_mesh)
Adds a mesh to a existing step in the dataset
Arguments
step
: (int) timestep index or iota.STATIC_MESH if the mesh to be added is staticmesh
: (iota.mesh.Mesh) mesh to be added to the dataset
Examples
my_dataset.add_mesh(5, my_mesh)
my_dataset.add_mesh(iota.STATIC_MESH, my_static_mesh)
Adds a result to a existing mesh and step in the dataset
Arguments
step
: (int) timestep indexmesh
: (str) mesh nameresult
: (str) result nameanalysis
: (str) analysis namedata
: (iota.ArrayXX) array of results to be added to dataset
Example
my_dataset.add_result(5,'my_mesh','my_new_result','none', my_new_result_data)
Creates a mesh slice/cut-plane defined by a pair of vectors (origin,normal) representing the plane and it is added to the dataset as new mesh
Arguments
mesh
: (str) name of the mesh to be cutnormal
: (iota.Vector3d) vector representing the normal direction to define the slice/cut-planeorigin
: (iota.Vector3d) vector contained in the slice/cut-plane planeresult
: (str) name of an existing result in the dataset to be interpolated on the slice/cut-plane. If empty, all results in the dataset are included (Default: '')analysis
: (str) name of the analysis of an existing result in the dataset. If empty, all analysis are included (Default: '')step
: (int) timestep index (Default: iota.ALL_STEPS)
Examples
my_dataset.add_slice('my_mesh',iota.Vector3d(0,0,1), iota.Vector3d(0,0,0),'Velocity','none')
my_dataset.add_slice('my_mesh',iota.Vector3d(0,0,1), iota.Vector3d(0,0,0),'Velocity','none', 3)
Adds a new timestep to the dataset
Arguments
timestep
: (str) timestep to be added
Example
my_dataset.add_timestep('15.65')
print(my_dataset.timesteps())
Deletes a mesh from the dataset
Arguments
mesh
: (str) mesh name
Example
my_dataset.delete_mesh('my_mesh')
Check of a mesh deletion process have finished Returns a pair (bool,str) with the status of the process. If process finished correctly, the boolean is True and message empty. In case of error, the error message is added as the second element of the pair
Example
status, msg = my_dataset.delete_mesh_finished()
print(status, msg)
Last updated
Was this helpful?