Working with auxi's Material Physical Property DataSets

Purpose

The purpose of this example is to introduce and demonstrate the DataSet class in auxi's material physical property tools package.

Background

Material physical property models are created based on sets of data that are determined experimentally. One can also test an existing property model against a data set to determine how well the model describes the physical property in question. In auxi these data sets are stored in csv files that have a specific format required by auxi. The DataSet class makes it easy to create, store, read, and use these data sets from inside the Python environment.

Items Covered

The following items in auxi are discussed and demonstrated in this example:

  • auxi.tools.materialproperties.core.DataSet

Example Scope

In this example we will address the following aspects:

  1. Importing the DataSet class.
  2. How to create your own physical property data set csv file with the create_template() method.
  3. Reading your data set csv file into a Dataset object.
  4. How to use the data sets for materials that are included in auxi.

Demonstrations

Importing the DataSet Class

Before you can use that DataSet class, you need to import it from auxi.


In [ ]:
from auxi.tools.materialphysicalproperties.core import DataSet

You are now ready to use the DataSet class.

Creating Your Own Data Set

The DataSet's create_template method makes it easy to create your own physical property data set. You only provide the material, path, and show parameters. A csv file will then be generated, and it will be automatically opened in your default csv editor if you set show to True.

In this csv file you would see text between < > signs. This indicates which text you should edit, like parameter name, units, symbol and values.


In [ ]:
path = '../../temp'
material = 'auxiite'

DataSet.create_template(material, path, show=True)

You can now edit the data set and save it for further use.

Reading Your Data Set

To read your data set into a DataSet object, you do the following:


In [ ]:
dataset = DataSet('data/dataset-auxiite2.csv')

We can now use the content of the DataSet object. For this example, we will print the different variables inside the object. These include:

  • Material name
  • Data set description
  • Reference
  • List of names, symbols, display symbols, and units for the columns in the data set

In [ ]:
print('Material:         ', dataset.material)
print('Description:      ', dataset.description)
print('References:       ', dataset.reference)
print('Properties:       ', dataset.col_names)
print('Symbols:          ', dataset.col_symbols)
print('Display symbols:  ', dataset.display_symbols_dict)
print('Units:            ', dataset.col_units)
print('Data:')
print(dataset.data)

You can also print the content of the data set by simply doing the following:


In [ ]:
print(dataset)

Using auxi's Own Data Sets

For convenience auxi contains a number of material physical property data sets that you can easily access and use. These are contained in the gases and liquids modules in the auxi.tools.materialproperties package.

Let's look at the data set for air.


In [ ]:
from auxi.tools.materialphysicalproperties.gases import air_dataset
print(air_dataset)

There is also a data set for water.


In [ ]:
from auxi.tools.materialphysicalproperties.liquids import h2o_dataset
print(h2o_dataset)