Skip to main content
Work with float functional data, including modifying parameter configurations. This example first introduces the different representations of float functional data in Granta MI, and then shows how to create and modify series float functional data, and then how to convert series float functional data into the corresponding grid representation.

Connect to MI

Specify a database and table.

Create a new record

Define names for a new record, and an attribute on that record.
Create the new Record object.
Previous cell output:
Get the unpopulated functional attribute for the new record, so we can populate it.
Previous cell output:

Types of functional data in Scripting Toolkit

Granta MI represents float functional data as either series functional or grid functional. Additionally, the schema defines a float functional attribute as containing either point or range data. As a result, there are four possible representations of float functional data in Scripting Toolkit:
  • Point series functional data as an AttributeFunctionalSeriesPoint object
  • Range series functional data as an AttributeFunctionalSeriesRange object
  • Point grid functional data as an AttributeFunctionalGridPoint object
  • Range grid functional data as an AttributeFunctionalGridRange object
These objects do not need to be instantiated manually. When exporting existing data, the appropriate object is chosen automatically based on the data. Empty functional attributes are set as series functional data by default, and the definition of the attribute in the database schema defines whether the point or range variant is chosen. Methods are provided to convert between series and grid representations of functional data. In this case, the “Tensile Stress/Strain, L” attribute is defined as a point attribute, and the type() function shows that a AttributeFunctionalSeriesPoint object has been created accordingly.
Previous cell output:
All float functional attribute values have a defined x-axis parameter. Check the current x-axis parameter with the x_axis property.
Previous cell output:
If the x-axis needs to be changed, use the .with_new_x_axis() method, with the name of the parameter to be used as the x-axis.
Previous cell output:

Create and import series functional data

This section shows how to create and import series-based data. Since this is a point-based functional attribute, create SeriesPoint objects to create single-valued series functional data. This example imports stress-strain data as a function of temperature. A series functional attribute value is defined as a tuple of series objects. There are two series types available, SeriesPoint and SeriesRange. Use the appropriate object depending on the attribute value object type. For series data, each series must be created with two equal-length tuples of x values and y values. Each series may also have a tuple of parameter values and a decoration type. In this example, create two SeriesPoint objects for our two series, each with an additional ‘Temperature’ value. Assign both series to the functional attribute value.
The y-axis unit is set with the .unit property
Parameter units are set by modifying values returned by the .parameters property.
Additional parameter properties can also be modified. These do not affect the behavior of Scripting Toolkit operations, but may modify the behavior of other tools that interact with the data, for example MI Explore and MI Viewer.
Access the functional_attribute.table_view.table_view property to see the underlying data structure of the attribute represented as a list of lists. It shows all parameters supported by the attribute. Parameters that were not populated during the import have been set to None.
Previous cell output:
Use the mi.update() method to import the data into Granta MI.

Editing float functional data

This section shows how to modify series functional data. SeriesPoint objects are immutable, so they cannot be modified. However, existing values can be used when creating a new series. The cell below adds two additional points to the series_2 value.
The functional_attribute.value attribute is a tuple, so it is also immutable. To update the series objects assigned to the value, all series objects must be provided. The cell below defines an entirely new series, and then adds the original first series, the modified second series, and the new third series to the attribute value. Using immutable values in this way provides greater validation, ensuring that any errors in the data are raised as exceptions as soon as they are associated with the attribute value.
Use the mi.update() method to import the data into Granta MI.

Convert series data to grid data

The final section shows how to convert between series and grid representations of float functional data. Use the generate_grid_version() method to convert the series functional attribute value to the equivalent grid functional attribute value object. In this case, our AttributeFunctionalSeriesPoint attribute value is converted to an AttributeFunctionalGridPoint object. This method raises a ValueError if the series functional data cannot be represented as grid functional data.
Previous cell output:
The collection of SeriesPoint objects has been converted to a single GridPoint object. This contains the same information, but note that the temperature values have been expanded to fully populate the grid.
Previous cell output:
The units and parameter configuration options are preserved by the transformation from series to grid representation.
Previous cell output:
Import the modified attribute.
Previous cell output:
Since the attribute now contains grid functional data, the data is exported into a AttributeFunctionalGridPoint object.
Previous cell output: