OpenTEA - Control of complex nested objects.

OpenTEA stands for Open Transparent and Extensible Applications.

The Opentea I and II series

logo_opentea2

Opentea I and II series are written in TclTK and Python 2.7, funded by Safran group and some internal resources. The I to II transition is a refactoring applying pylint standards, logging and error checking, simpler installation procedures and was funded by early months of MOSAIC project, from Safran tech. It is the major technology we use to provide Industrial Interfaces to Safran engineers.

snapshot_opentea2

Writing a GUI is done with eXtensible Markup Language (XML) specifications :

(...)
<xor name="outputbased" title="Simulation duration" default="iteration">
    <model name="time" title="Time-based">
        <param name="total" title="Duration [s]" type="double_gt0" default="1.0e-5" />         
    </model>
    <model name="iteration" title="Iteration-based">
        <param name="total" title="Duration [its]" type="integer_ge1" default="100" />         
    </model>    
</xor>
(...)

The python process underneath, triggered by lower left “Process button” in a subprocess, access to the informations with :

(...)
# time/it based
    if pro.ds.getValue("outputbased", "avbp") == "time":
        duration = float(pro.ds.getValue("total", "avbp", "time"))
        init_time = float(pro.ds.getValue("dtsum", "avbp", "inittime"))
        total_time = init_time + duration
        run_ctrl("simulation_end_time", total_time)
    else:
        total_ite = int(pro.ds.getValue("total", "avbp", "iteration"))
        run_ctrl("simulation_end_iteration", total_ite)
(...)

To install opentea 2, go to the not so short OpenTEA2 install guide

OpenTEA III Series

logo_opentea3

The openTEA III series was funded by MOSAIC project from Safran Tech and ICARUS project from Region Occitanie. Written in Python 3 and Tkinter, the core differences with opentea II are :

  • Stateless setup - in opposition to tabs-by-tabs setups, which allowed history bugs.
  • GUI is not the only frond-end proposed to the users. Scripting with scenarios is supported to help optimization studies or translation from some CGNS setups to code specific commands.
  • Single command installation for a full distribution in a no-internet zone.

It is available on pipy, documentation is on readtthedocs, sources are mirrored on gitlab.com

snapshot_opentea3

OpenTEA is, a GUI engine, based on the json-SCHEMA description : e.g. assume a nested information conforming to the following SCHEMA :

---
title: "Trivial form..."
type: object
properties:
  first_tab:
    type: object
    title: Only tab.
    process: custom_callback.py
    properties:
      first_block:
        type: object
        title: Custom Block
        properties:
          number_1:
            title: "Number 1"
            type: number
            default: 32.
          operand:
            title: "Operation"
            type: string
            default: "+"
            enum: ["+", "-", "*", "/"]
          number_2:
            title: "Number 2"
            type: number
            default: 10.
          result:
            title: "result"
            state: disabled
            type: string
            default: "-"

The openTEA GUI will show as :

Trivial GUI

In this form, a callback can be added to each tab. The corresponding custom_callback.py script is :

"""Module for the first tab."""

from opentea.process_utils import process_tab

def custom_fun(nob):
    """Update the result."""

    operation = nob["first_tab"]["first_block"]["operand"]
    nb1 = nob["first_tab"]["first_block"]["number_1"]
    nb2 = nob["first_tab"]["first_block"]["number_2"]

    res = None
    if operation == "+":
        res = nb1 + nb2
    elif operation == "-":
        res = nb1 - nb2
    elif operation == "*":
        res = nb1 * nb2
    elif operation == "/":
        res = nb1 / nb2
    else:
        res = None

    nob["first_tab"]["first_block"]["result"] = res
    return nob

if __name__ == "__main__":
    process_tab(custom_fun)

In this example, we used a vanilla Python nob object, i.e. a nested dictionary. Actually we have a more efficient way to fetch information from large datatrees.

Opentea III relies on the standard SCHEMA and provide essentially three services :

  • creating a Tkinter form on a SCHEMA specifications.
  • accurate validation of a SCHEMA for large and complex nested objects - allow to get clear and precise errors in setups/ .
  • Inference of a valid nested object with respect to a SCHEMA - allow to provide partial information and let the SCHEMA fill in the blanks.

Acknowledgements

The Cerfacs wishes to thank Région Occitanie and BPI France for their support through the FUI ICARUS.

logobpi logooccitanie

Like this post? Share on: TwitterFacebookEmail


Antoine Dauptain is a research scientist focused on computer science and engineering topics for HPC.

Keep Reading


Published

Category

Our Creations

Tags

Stay in Touch