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.35122316486651] ... [1] main.py
1 Fischer Scope Indentation HDF5 [15.745680750614438] ... [1] main.py
2 Fischer Scope Indentation HDF5 [15.90439805730888] ... [1] main.py
3 Fischer Scope Indentation HDF5 [16.09010295147651] ... [1] main.py
4 Fischer Scope Indentation HDF5 [15.759372606477493] ... [1] main.py
5 Fischer Scope Indentation HDF5 [15.862357777910967] ... [1] main.py
6 Fischer Scope Indentation HDF5 [15.871862721628293] ... [1] main.py
7 Fischer Scope Indentation HDF5 [15.996196579279452] ... [1] main.py
8 Fischer Scope Indentation HDF5 [15.24746967801729] ... [1] main.py
9 Fischer Scope Indentation HDF5 [15.376666240263122] ... [1] main.py
10 Fischer Scope Indentation HDF5 [16.09475997375254] ... [1] main.py
11 Fischer Scope Indentation HDF5 [15.181851666496254] ... [1] main.py
12 Fischer Scope Indentation HDF5 [15.703335447957938] ... [1] main.py
13 Fischer Scope Indentation HDF5 [15.990322177801245] ... [1] main.py
14 Fischer Scope Indentation HDF5 [16.191081893635452] ... [1] main.py
15 Fischer Scope Indentation HDF5 [15.072117198490727] ... [1] main.py
[16 rows x 11 columns]
Total running time of the script: (0 minutes 0.688 seconds)