Compose: The Bridge Between CAE Data and Open-source Python Libraries

Joseph Pajot
Joseph Pajot
Altair Employee

The internet is full of resources to learn data science.  Altair Compose is the adapter you needed to use your favorite open-source library with CAE data.

As an engineering student, I took many university classes on numerical methods.  However, most of my knowledge about data science has been self-taught from a combination of internet articles and published books.  I certainly learned a lot from these materials, but I was always challenged to connect what I saw in a book to what I do in my engineering work.  Using TensorFlow or scikit-learn on the famous iris dataset seems easy when the data is coming from a conveniently supplied csv file.  However, in my world of virtual physics and CAE, I rarely (if ever) have my data in a file that is so easily imported; my simulation data is frequently spread over multiple files with varied binary formats that depend on the solver used.   So how to best connect my CAE data to tools like python?

image

With a large list of supported CAE readers, a simple to learn programming language, and a connection to python, Altair Compose is a perfect solution to bridge the gap from CAE to data science programming.  To demonstrate, I’ll take a very simple problem and illustrate how easy it is to get CAE data into a pandas dataframe ready to apply the techniques you can learn from a book.

Imagine having run a few variations on your simulation model, changing some inputs each time, as represented in the table below.

Experiment # var1 var2 file
1 0.05 0.1 exp1.h3d
2 0.1 0.15 exp2.h3d
3 0.1 0.1 exp3.h3d

 

Each row in the table represents an experiment, its corresponding input values, and the name of the associated output file from the simulation.  The goal is to use the input data as features for a machine learning model to predict output from the simulation, such as maximum stress in the simulation model.

image

The image blow shows a complete script to do this process in the OML language of Compose.

image

The code in the script can be broken into several logical blocks:

1-7: define the target output data files and identify the data to read

9-15: read the data from each file and find the maximums

17-18: set the ml features

21-26: export the data to python and put into a pandas dataframe

28-30: format the dataframe data for display and then display in the Compose window

This example shows it is simple, straightforward, and efficient to use Compose to connect CAE data to the world of data science.  I encourage everyone interested to make a goal to read about machine learning in python and then try to apply what you learn to some engineering data.  The example presented here is an excellent start to build upon.  I’d love to hear about your experience, answer your questions, or even recommend resources for additional reading in the comments below.

Comments

  • etembras
    etembras
    Altair Employee
    edited November 2022

    Good article @Joseph Pajot . In addition to the technical advantages of Compose, how much do you think that people out there is looking for a way to run python without Anaconda? (due to the fact that Anaconda is not available for commercial use)

  • Joseph Pajot
    Joseph Pajot
    Altair Employee
    edited November 2022

    Good point.  Not all of the popular tools out there are free -- be sure to read the fine print!

    It's probably fair to say that truly expert users may be comfortable with tools like Anaconda, but not everyone is an expert user, of course.  I sometimes feel that having to manage your own python environment and distributions can be a bit intimidating.   Compose ships out of the box with a set python version and friendly programming development environement, so it as close to "plug and play" as it gets.   It works "out of the box" but still has flexibility for configuration -- for example you can still pip intall packages onto it.

    It's a great fit for most users, I think -- especially for those getting started.