Skip to content

Introduction

MICRESS tabular files provide detailed insights into the microstructural evolution of materials over time. These files represent a time series of data capturing the state of the system at each timestep. In this guide, we will walk you through the process of reading MICRESS tabular files using MicPy, allowing you to analyze and visualize the data effectively.

Importing the Module

To begin working with MICRESS data, the first step is to import the micpy.tab module into your Python environment. This module provides the tools necessary for reading and manipulating tabular data.

from micpy import tab

Reading the File

Once the module is imported, you can load the data from a tabular file using the read() method provided by the tab module. This method returns a Pandas DataFrame, which is a versatile data structure that allows for efficient data analysis and manipulation.

df = tab.read("A001_Delta_Gamma.TabF")

Displaying the Data

After reading the tabular file, you can easily display the contents of the DataFrame to examine the data. Simply calling the DataFrame object will output the data in a tabular format.

df
Simulation time [s] Temperature [K] Fraction Phase 0 LIQUID Fraction Phase 1 BCC_A2 Fraction Phase 2 FCC_A1
0.0000 1786.00000 1.000000 0.000000 0.000000e+00
1.0000 1785.00000 0.998751 0.001249 0.000000e+00
2.5000 1783.50000 0.992867 0.007133 0.000000e+00
5.0000 1781.00000 0.976858 0.023142 0.000000e+00
7.5000 1778.50000 0.959798 0.040202 0.000000e+00
10.0000 1776.00000 0.932830 0.067170 0.000000e+00
12.5000 1773.50000 0.893747 0.106253 0.000000e+00
15.0000 1771.00000 0.854966 0.145034 0.000000e+00
17.5000 1768.50000 0.817144 0.182856 0.000000e+00
20.0000 1766.00000 0.777741 0.222258 0.000000e+00
22.5000 1763.50000 0.734608 0.265392 0.000000e+00
25.0000 1761.00000 0.688836 0.311164 0.000000e+00
26.0003 1759.99967 0.669966 0.330034 1.000000e-08
27.5000 1758.50000 0.633809 0.308292 5.789968e-02
29.0003 1756.99967 0.597501 0.298283 1.042151e-01
30.0000 1756.00000 0.573271 0.292622 1.341071e-01
32.5000 1753.50000 0.512233 0.281939 2.058275e-01
35.0000 1751.42500 0.461359 0.260637 2.780047e-01
40.0000 1751.47500 0.467859 0.260437 2.717040e-01
45.0000 1751.37500 0.464527 0.259414 2.760585e-01
50.0000 1751.45000 0.467904 0.259227 2.728687e-01

Visualizing the Data

To better understand the data, you can visualize it using the plot() method. This method allows you to specify which columns to plot against each other. For instance, you can plot the phase fractions against the simulation time to observe how they evolve.

ax = df.plot(x=0, y=[2,3,4])

Explore More Visualizations

For more detailed guidance on creating visualizations, including line plots, histograms and subplots, refer to the Visualization section.

Exporting the Data

If you need to save the data for further analysis or sharing, you can export the DataFrame to various file formats such as CSV, Excel, or JSON. In the example below, we export the data to a CSV file using the to_csv() method.

df.to_csv("A001_Delta_Gamma.TabF.csv", index=False)

Contents of A001_Delta_Gamma.TabF.csv:

Simulation time [s],Temperature [K],Fraction Phase 0 LIQUID,Fraction Phase 1 BCC_A2,Fraction Phase 2 FCC_A1
0.0,1786.0,1.0,0.0,0.0
1.0,1785.0,0.99875078,0.00124922,0.0
2.5,1783.5,0.99286749,0.00713251,0.0
5.0,1781.0,0.97685767,0.02314233,0.0
7.5,1778.5,0.95979781,0.04020219,0.0
10.0,1776.0,0.93282975,0.06717025,0.0
12.5,1773.5,0.89374734,0.10625266,0.0
15.0,1771.0,0.85496574,0.14503426,0.0
17.5,1768.5,0.81714441,0.18285559,0.0
20.0,1766.0,0.7777415,0.2222585,0.0
22.5,1763.5,0.73460805,0.26539195,0.0
25.0,1761.0,0.68883648,0.31116352,0.0
26.0003,1759.99967,0.66996575,0.33003424,1e-08
27.5,1758.5,0.63380868,0.30829164,0.05789968
29.0003,1756.99967,0.59750146,0.29828344,0.10421509
30.0,1756.0,0.5732709,0.29262203,0.13410707
32.5,1753.5,0.51223349,0.28193896,0.20582755
35.0,1751.425,0.46135874,0.26063656,0.2780047
40.0,1751.475,0.46785901,0.26043704,0.27170395
45.0,1751.375,0.4645271,0.25941441,0.2760585
50.0,1751.45,0.46790385,0.25922744,0.27286872

Summary

This guide has demonstrated how to read, display, plot, and export data from a MICRESS tabular file using MicPy. By following these steps, you can effectively analyze and visualize the data generated by MICRESS simulations, enabling deeper insights into material behavior over time.

Next Steps

To explore more advanced visualizations and data analysis techniques, refer to the corresponding sections using the navigation menu on the left.