Table 2 User tutorial for AlloySustainability: this tutorial provides step-by-step instructions for installing and using the AlloySustainability package to compute and visualize the sustainability impacts of alloys.

From: Sustainability indicators in high entropy alloy design: an economic, environmental, and societal database

1. Installation

Step 1: Ensure Python 3.6+ is installed. For best compatibility, use Google Colab, which offers a preconfigured Python environment with most dependencies pre-installed and seamless cloud data integration.

Step 2: Install the package using pip: pip install AlloySustainability

If you are using JupyterLab, restart the kernel after installation to ensure the package is recognized.

2. Basic Usage

2.1 Importing Modules

To use the package, import the necessary functions:

from AlloySustainability.computations import (

load_element_indicators,

load_RTHEAs_vs_Fe_df,

load_HTHEAs_vs_Ni_df,

compute_impacts

)

from AlloySustainability.visualization import plot_alloy_comparison

import matplotlib.pyplot as plt

2.2 Loading Data

The package provides data for sustainability indicators and reference alloy classes.

Load sustainability indicators:

element_indicators = load_element_indicators()

Load reference alloy classes:

RTHEAs_Fe_df = load_RTHEAs_vs_Fe_df()

HTHEAs_Ni_df = load_HTHEAs_vs_Ni_df()

2.3 Defining the Alloy Composition

Define the alloy’s chemical composition as a list of mass fractions for 18 elements. The sum of the fractions should equal 1.0.

Example:

composition_mass = [0, 0.2, 0.2, 0, 0, 0, 0.2, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0, 0.2]

2.4 Computing Sustainability Indicators

Pass the composition and the loaded indicators to compute_impacts:

new_alloy_impacts = compute_impacts(composition_mass, element_indicators)

This will return a DataFrame containing the computed indicators for your alloy.

2.5 Visualizing the Results

Generate violin plots to compare your alloy’s metrics with reference classes:

fig = plot_alloy_comparison(new_alloy_impacts, RTHEAs_Fe_df, HTHEAs_Ni_df)

plt.show()

3. Additional Notes

Ensure the mass fractions sum to 1.0.

The visualization function automatically retrieves comparison data from embedded CSV files.

4. Need Help?

For further assistance or to report issues, please visit the GitHub repository or the PyPI page: https://pypi.org/project/AlloySustainability/