Iota User Manual
  • Introduction
  • Installing Iota
  • Registering Iota license
  • Getting started
  • Simulation Data Interfaces
    • Support ANSYS Fluent simulations
    • Support EDEM simulations
    • Support LIGGGHTS simulations
      • LIGGGHTS-DUMP
      • LIGGGHTS-VTK
  • Iota Python Reference Library
    • iota.dataset
    • iota.graph
    • iota.render
    • iota.media
    • iota.coarsegraining
    • iota.mesh
  • Licensing
    • Iota-Suite End User Agreement
    • Third Party Licenses
      • Assimp License (BSD)
      • Boost Software License v1.0
      • Boost Software License v1.0
      • Eigen License (MPL2)
      • HDF5 License
      • Netgen License (GNU LGPL 2.0)
      • PSF License for Python3.5
      • Zlib License
      • Plotly License (MIT)
      • Peewee License (MIT)
      • Hug License (MIT)
      • Anaconda License (BSD)
      • FFmpeg License (GNU LGPL 2.1)
      • STB License (MIT)
      • FreeType2 License
      • Libpng License
      • GLFW License (ZLIB)
      • GLEW License
      • NumPy License
      • Pythreejs License
      • Jupyter License
Powered by GitBook
On this page
  • class Scene
  • Methods
  • class MeshMode
  • class VideoFormat

Was this helpful?

  1. Iota Python Reference Library

iota.render

Previousiota.graphNextiota.media

Last updated 3 years ago

Was this helpful?

Description

This module provides functionalities to create scenes to render in 3D the data in simulation datasets. It also provides methods to create screenshots and videos from 3D render of the scenes.

Scene class object. This object contains the settings of a scene to generate a 3D render

Parameters

  • pac_file: (str) path and file name to a .pac file that contains the scene settings to be loaded (Default: None)

Example

Creating a scene with the default settings based on a fluent dataset

my_dataset = iota.dataset.load_fluent(case_files=['C:/Users/Stephen/Myimulations/myfluentsimulation.cas.gz'], data_files=['C:/Users/Stephen/Myimulations/myfluentsimulation.dat.gz'])
my_scene = iota.render.Scene(dataset=my_dataset)
print(my_scene)

Creating a scene based on the settings stored in a pac file

my_scene = iota.render.Scene(pac_file='C:/Users/Stephen/MyScenes/myscene_settings.pac')
print(my_scene)

Methods

Display a scene as 3D interactive render on the working notebook

Parameters

  • step: (int) index of timestep for the scene (Default: 0)

  • width : (int) width of the display of the scene in pixels (Default: 800)

  • height : (int) height of the video display of the scene in pixels (Default: 600)

Example

Displaying a scene

my_scene.display()

Displaying a scene for the 5th step of the scene dataset and with a with equal to 1000 pixels and a height equal to 800 pixels

my_scene.display(step = 4, width=1000, height=800)

Set the view of the scene so that x-axis is perpendicular to the screen

Parameters

  • positive: (bool) If True the positive x-axis point inwards (Default: True)

Example

Setting the view of the scene with the positive x-axis being perpendicular to the the screen and pointing inwards

my_scene.set_view_x()

Setting the view of the scene with the positive x-axis being perpendicular to the the screen and pointing outwards

my_scene.set_view_x(positive=False)

Set the view of the scene so that y-axis is perpendicular to the screen

Parameters

  • positive: (bool) If True the positive y-axis point inwards (Default: True)

Example

Setting the view of the scene with the positive y-axis being perpendicular to the the screen and pointing inwards

my_scene.set_view_y()

Setting the view of the scene with the positive y-axis being perpendicular to the the screen and pointing outwards

my_scene.set_view_y(positive=False)

Set the view of the scene so that z-axis is perpendicular to the screen

Parameters

  • positive: (bool) If True the positive z-axis point inwards (Default: True)

Example

Setting the view of the scene with the positive z-axis being perpendicular to the the screen and pointing inwards

my_scene.set_view_z()

Setting the view of the scene with the positive z-axis being perpendicular to the the screen and pointing outwards

my_scene.set_view_z(positive=False)

Set the view of the scene to isometric

Parameters

  • positive: (bool) If True the positive parts of the axis point inwards (Default: True)

Example

Setting the view of the scene to isometric view

my_scene.set_iso()

Setting the view of the scene to isometric with the positive part of the axis pointing outwards

my_scene.set_iso(positive=False)

Set a result-analysis to be rendered for a mesh (or all meshes) in the scene

Parameters

  • mesh: (str) name of the mesh to set with a result. If mesh=None, the result is set for all the meshes in the scene

  • result: (str) name of the result to be rendered

  • analysis: (str) name of the analysis to be rendered

  • component: (int) index of the component of the result to be rendered (Default: 0)

  • minmax: ([float, float]) min and max value for the colorbar of the scene. If not provided, the min and max values of the colorbar are automatically set to the min and max values of the result to be rendered (Default: None)

  • colouring: (str) colormap for the colorbar of the scene (Default: 'jet')

Example

Setting the mesh called 'my_mesh' to be rendered with the magnitude of the velocity of the analysis 'phase-1' and colorbar using the default colormap, with min and max value set to the min and max value of the result

my_scene.set_result(mesh='my_mesh', result='VELOCITY', analysis='phase-1', component=3)

Setting all meshes to be rendered with the magnitude of the velocity of the analysis 'phase-1' and colorbar using the default colormap, with min and max value set to the min and max value of the result

my_scene.set_result(mesh=None, result='VELOCITY', analysis='phase-1', component=3)

Setting all meshes to be rendered with the magnitude of the velocity of the analysis 'phase-1' and colorbar using the default colormap, with min value equal to 0.1 and max value equal to 0.8

my_scene.set_result(mesh=None, result='VELOCITY', analysis='phase-1', component=3, minmax=[0.1, 0.8])

Setting all meshes to be rendered with the magnitude of the velocity of the analysis 'phase-1' and colorbar using the 'volcano' colormap, with min value equal to 0.1 and max value equal to 0.8

my_scene.set_result(mesh=None, result='VELOCITY', analysis='phase-1', component=3, colouring='volcano', minmax=[0.1, 0.8])

Shows the colourmaps available, ordered alphabetically

Set the behaviour with contour regions outside the minmax range

Parameters

  • outofrange_rule: (int) behaviour. 0: empty; 1: colour using outofrange_colour; 2: extrapolate from colourmap (Default: 0)

  • outofrange_colour: (tuple of three floats) normalised RGB triplet for the desired colour when outofrange_rule is 1 (Default: (0.5, 0.5, 0.5) )

Example

Colour the values outside of the minmax range in black

my_scene.set_outofrange_colouring(outofrange_rule=1, outofrange_colour=(0, 0, 0))

Colour the values outside of the minmax range extrapolating from the colourmap

my_scene.set_outofrange_colouring(outofrange_rule=2)

Set the render mode for a mesh in the scene

Parameters

  • mesh: (str) name of the mesh

  • visibility: (float) level of opacity between 0.0 and 1.0 (Defaut: 1.0)

Example

Setting the mesh called 'my_mesh' to be rendered as a solid a level of opacity equal to 0.5

my_scene.set_mesh(mesh='my_mesh', visibility=0.5)

Setting the mesh called 'my_mesh' to be rendered as a solid with wireframe a level of opacity equal to 1.0

my_scene.set_mesh(mesh='my_mesh', mode=iota.render.MeshMode.WIREFRAME2)

Setting the mesh called 'my_mesh' to invisible

my_scene.set_mesh(mesh='my_mesh', visbility=0.0)

Parameters

  • filename: (str) name for the pac file where the scene settings will be exported to (Default: None)

Returns

Example

Exporting the scene setting to a pac file

scene_exported = my_scene.export(filename='C:/Users/Stephen/MyScenes/my_scene.pac')
print(scene_exported)

Generate a screenshot or a set of screenshots based on the scene settings

Parameters

  • filename: (str) name for the files of the screenshots to be generated

  • tsart: (int) index of the step that defines the start of the steps interval for the screenshot generation

  • tend: (int) index of the step that defines the end of the steps interval for the screenshot generation

  • timestep_frequency: (int) defines the frequency of the steps within the defined interval that will be used for the screenshot generation

Returns

Example

Generating a screenshot based on the scene settings and for the 2nd step of the dataset in the scene

my_screenshot = my_scene.create_screenshots(
    filename='C:/Users/Stephen/MyScreenshots/my_screenshots', 
    tstart=1, tend=1, timestep_frequency=1)
my_screenshot[0].display()

Generating a sequence of screenshot based on the scene settings for every step within the interval defined from the 2nd step to the 5th step of the dataset in the scene

my_screenshots = my_scene.create_screenshots(
    filename='C:/Users/Stephen/MyScreenshots/my_screenshots', 
    tstart=1, tend=4, timestep_frequency=1)
my_screenshots[0].display()   #screenshot for the 2nd step in the dataset
my_screenshots[1].display()   #screenshot for the 3rd step in the dataset
my_screenshots[2].display()   #screenshot for the 4th step in the dataset
my_screenshots[3].display()   #screenshot for the 5th step in the dataset

Generating a sequence of screenshot based on the scene settings with a step frequency equal to 2 (i.e., a step every 2 steps) within the interval defined from the 2nd step to the 5th step of the dataset in the scene

my_screenshots = my_scene.create_screenshots(
    filename='C:/Users/Stephen/MyScreenshots/my_screenshots', 
    tstart=1, tend=4, timestep_frequency=2)
my_screenshots[0].display()   #screenshot for the 2nd step in the dataset
my_screenshots[1].display()   #screenshot for the 4th step in the dataset

Generate a video based on the scene settings

Parameters

  • filename: (str) name for the files of the screenshots to be generated

  • frame_rate: (int) frame rate for the video, i.e, frames per second (Default: 5)

  • tsart: (int) index of the step that defines the start of the steps interval for the video generation. If None, the interval starts from the first step in the dataset (Default: None)

  • tend: (int) index of the step that defines the end of the steps interval for the video generation. If None, the interval goes up to the last step in the dataset (Default: None)

Returns

Example

Generating a video based on the scene settings and for all the step of the dataset in the scene

my_video = my_scene.create_video(filename='C:/Users/Stephen/MyVideos/my_video.mp4')
my_video.display()

Generating a video in AVI format and based on the scene settings using the frame rate of 10 frames per second. The video will includes the dataset steps going from the 3rd step to 50th step

my_video = my_scene.create_video(filename='C:/Users/Stephen/MyVideos/my_video.avi',
                                 frame_rate= 10,
                                 format = iota.render.VideoFormat.AVI,
                                 tstart=2, 
                                 tend=49)
my_video.display()

Attributes

  • iota.render.MeshMode.SOLID: the mesh is rendered as a solid

  • iota.render.MeshMode.WIREFRAME: only the wireframe of the mesh is rendered

  • iota.render.MeshMode.WIREFRAME2: the mesh is rendered as a solid with its wireframe

Attributes

Display a 3D interactive render on the working notebook given a set of scene settings

Parameters

  • step: (int) index of the timestep in the dataset to be rendered (Default: None) (Default: 0)

  • result: (str) name of the result in the dataset to be rendered. If provided, it overwrites the result from the given scene object for the render settings (Default: None)

  • analysis: (str) name of the analysis in the dataset to be rendered. If provided, it overwrites the analysis from the given scene object for the render settings (Default: None)

  • component: (int) index of the component of the result-analysis in the dataset to be rendered. If provided, it overwrites the component from the given scene object for the render settings (Default: None)

  • minmax: ([float, float]) min and max value for the colorbar to be rendered. If provided, it overwrites the min and max values from the given scene object for the render settings (Default: None)

  • width : (int) width of the display of the scene in pixels (Default: 800)

  • height : (int) height of the video display of the scene in pixels (Default: 600)

Example

Displaying a 3D render using an existing scene settings but using a new dataset and setting the step to the 3rd one in the dataset

iota.render.display(scene = my_scene, dataset=my_new_dataset, step=2)

Displaying a 3D render using an existing scene settings but rendering the magnitude of the velocity of the analysis 'phase-1' at the 5th step of the dataset and setting the min and max values of the colorbar to 0.2 and 0.8 respectively

iota.render.display(scene = my_scene, result='VELOCITY', analysis='phase-1', component=3, step=4, mimax=[0.2, 0.8])

Generate a screenshot or a set of screenshots based on a given set of scene settings

Parameters

  • filename: (str) name for the files of the screenshots to be generated

  • tsart: (int) index of the step that defines the start of the steps interval for the screenshot generation

  • tend: (int) index of the step that defines the end of the steps interval for the screenshot generation

  • timestep_frequency: (int) defines the frequency of the steps within the defined interval that will be used for the screenshot generation

Returns

Example

Generating a screenshot based on an existing scene settings but using a new dataset and setting the screenshot for the 3rd step in the dataset

my_screenshot = iota.render.create_screenshots(scene=my_scene, filename= 'C:/Users/Stephen/MyScreenshots/my_screenshot.png', dataset = my_dataset, tstart=2, tend=2, timestep_frequency=1)

Generating a sequence of screenshot based on an existing scene settings but using a new dataset and setting the screenshots for every step within the interval defined from the 2nd step to the 5th step in the dataset

my_screenshots = my_scene.create_screenshots(scene=my_scene, dataset= my_dataset, filename='C:/Users/Stephen/MyScreenshots/my_screenshots', tstart=1, tend=4, timestep_frequency=1)
my_screenshot[0].display()   #screenshot for the 2nd step in the dataset
my_screenshot[1].display()   #screenshot for the 3rd step in the dataset
my_screenshot[2].display()   #screenshot for the 4th step in the dataset
my_screenshot[3].display()   #screenshot for the 5th step in the dataset

Generating a sequence of screenshot based on an existing scene settings but using a new dataset and setting the screenshots to be generated with a step frequency equal to 2 (i.e., a step every 2 steps) within the interval defined from the 2nd step to the 5th step in the dataset

my_screenshots = my_scene.create_screenshots(sceme=my_scene, dataset=my_dataset, filename='C:/Users/Stephen/MyScreenshots/my_screenshots', tstart=1, tend=4, timestep_frequency=2)
my_screenshots[0].display()   #screenshot for the 2nd step in the dataset
my_screenshots[1].display()   #screenshot for the 4th step in the dataset

Generate a video based on a given set of scene settings

Parameters

  • filename: (str) name for the files of the screenshots to be generated

  • frame_rate: (int) frame rate for the video, i.e, frames per second (Default: 5)

  • tsart: (int) index of the step that defines the start of the steps interval for the video generation. If None, the interval starts from the first step in the dataset (Default: None)

  • tend: (int) index of the step that defines the end of the steps interval for the video generation. If None, the interval goes up to the last step in the dataset (Default: None)

Returns

Example

Generating a video based on an existing scene settings but using a new dataset and including all the steps in the dataset

my_video = iota.render.create_video(scene= my_scene, dataset=my_dataset, filename='C:/Users/Stephen/MyVideos/my_video.mp4')
my_video.display()

Generating a video in AVI format and based on an existing scene settings but using a new dataset and setting the frame rate of 10 frames per second. The video will includes the steps within the interval defined from the 3rd to 50th step in the dataset

my_video = my_scene.create_video(scene= my_scene,
                                 dataset=my_dataset,
                                 filename='C:/Users/Stephen/MyVideos/my_video.avi',
                                 frame_rate= 10,
                                 format = iota.render.VideoFormat.AVI,
                                 tstart=2, 
                                 tend=49)
my_video.display()

dataset : () a dataset object to use as the base to create a scene with default settings (Default: None)

mode: () render mode for the mesh (Default: iota.render.MeshMode.SOLID)

Export the scene setting to pac file on disk and/or a object

A object with the settings of the scene

A list of objects that corresponds to the screenshots generated

format: () format for the video file (Default: iota.render.MP4)

A objects that corresponds to the video generated

Mesh render mode class object. It is usually used to the define the render mode of the meshes in a scene (see method)

Class object to define the video format. It is usually used as an input parameter for the video generation methods (see the methods and )

iota.render.VideoFormat.MPEG: . File extension: .mpg

iota.render.VideoFormat.AVI: . File extension: .avi

iota.render.MeshMode.MP4: . File extension: .mp4

iota.render.MeshMode.WEBM: . File extension: .webm

scene: () a scene object that contains the settings for the render

dataset : () a dataset object to be rendered. If provided, it overwrites the dataset from the given scene object for the render settings (Default: None)

scene: () a scene object that contains the settings for the render

dataset : () a dataset object to be rendered. If provided, it overwrites the dataset from the given scene object for the render settings (Default: None)

A list of objects that corresponds to the screenshots generated

scene: () a scene object that contains the settings for the render

dataset : () a dataset object to be rendered. If provided, it overwrites the dataset from the given scene object for the render settings (Default: None)

format: () format for the video file (Default: iota.render.MP4)

A objects that corresponds to the video generated

iota.medio.IotaImage
iota.medio.IotaVideo
H.264 format
Audio Video Interleave format
MPEG-4 Part 14 format
WebM format
iota.medio.IotaImage
iota.medio.IotaVideo
create_video
Scene
set_view_x
set_view_z
set_view_z
set_view_iso
set_result
possible_result_colours
set_outofrange_colouring
set_mesh
display
export
create_screenshots
MeshMode
SOLID
WIREFRAME
WIREFRAME2
VideoFormat
MPEG
AVI
MP4
WEBM
display
create_screenshots
create_video
class Scene
iota.render.Scene(dataset, pac_file)
Scene.display(step, width, height)
Scene.set_view_x(positive)
Scene.set_view_y(positive)
Scene.set_view_z(positive)
Scene.set_view_iso(positive)
Scene.set_result(mesh, result, analysis, component, minmax, colouring)
Scene.possible_result_colours()
Scene.set_outofrange_colouring(outofrange_rule,outofrange_colour)
Scene.set_mesh(mesh, mode, visibility)
iota.render.MeshMode
Scene.export(filename)
Scene
iota.render.Scene
Scene.create_screenshots(filename, tstart, tend, timestep_frequency)
Scene.create_video(filename, frame_rate, format, tstart, tend)
iota.render.VideoFormat
class MeshMode
Scene.set_mesh()
class VideoFormat
Scene.create_video()
iota.render.create_video()
iota.render.display(scene, dataset, step, result, analysis, component, minmax, width, height)
iota.render.Scene
iota.render.create_screenshots(scene, dataset, filename, tstart, tend, timestep_frequency)
iota.render.Scene
iota.render.create_video(scene, dataset, filename, frame_rate, format, tstart, tend)
iota.render.Scene
iota.render.VideoFormat
iota.dataset.Dataset
iota.dataset.Dataset
iota.dataset.Dataset
iota.dataset.Dataset