Note
Go to the end to download the full example code.
Basic Indentation Analysis
This example analyses a FischerScope HDF5 file and plots each indentation curve.
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
import micromechanics
from micromechanics.indentation import Indentation, Tip
repository_root = Path(micromechanics.__file__).resolve().parents[1]
file_name = repository_root / "examples" / "FischerScope" / "N1_1.hdf5"
Define the tip and load the measurement file. The material Poisson ratio enters the conversion from reduced modulus to Young’s modulus.
tip = Tip()
indentation = Indentation(str(file_name), nuMat=0.5, tip=tip)
rows = []
Open hdf5-file: /home/runner/work/micromechanics/micromechanics/examples/FischerScope/N1_1.hdf5
Each iteration selects the next indentation test. analyse performs the
Oliver-Pharr evaluation and stores the resulting values in metaUser.
for testname in indentation:
indentation.analyse()
plt.plot(indentation.h, indentation.p, label=testname)
rows.append(indentation.metaUser.copy())

The force-depth plot gives a quick visual check for repeated measurements, while the dataframe collects the numerical metadata for inspection or export.
plt.xlabel("Depth / um")
plt.ylabel("Load / mN")
plt.legend()
df = pd.DataFrame(rows)
print(df)

/home/runner/work/micromechanics/micromechanics/docs/source/examples/plot_basic_indentation.py:43: UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
plt.legend()
measurementType S_mN/um ... segment code
0 Fischer Scope Indentation HDF5 [14.351223393882231] ... [1] main.py
1 Fischer Scope Indentation HDF5 [15.745680508704035] ... [1] main.py
2 Fischer Scope Indentation HDF5 [15.90439794650668] ... [1] main.py
3 Fischer Scope Indentation HDF5 [16.09010314447615] ... [1] main.py
4 Fischer Scope Indentation HDF5 [15.759372634934243] ... [1] main.py
5 Fischer Scope Indentation HDF5 [15.862357654106562] ... [1] main.py
6 Fischer Scope Indentation HDF5 [15.8718627933634] ... [1] main.py
7 Fischer Scope Indentation HDF5 [15.996195699514974] ... [1] main.py
8 Fischer Scope Indentation HDF5 [15.247469691964719] ... [1] main.py
9 Fischer Scope Indentation HDF5 [15.376666151890324] ... [1] main.py
10 Fischer Scope Indentation HDF5 [16.094757410870745] ... [1] main.py
11 Fischer Scope Indentation HDF5 [15.181851600691974] ... [1] main.py
12 Fischer Scope Indentation HDF5 [15.70333530581793] ... [1] main.py
13 Fischer Scope Indentation HDF5 [15.990322338972552] ... [1] main.py
14 Fischer Scope Indentation HDF5 [16.19108126209852] ... [1] main.py
15 Fischer Scope Indentation HDF5 [15.072117186184686] ... [1] main.py
[16 rows x 11 columns]
Total running time of the script: (0 minutes 0.617 seconds)