Skip to main content

Analysis package for nanoindentation experimental data.

Project description

nanodent

License: MIT GitHub Workflow Status codecov Python

Installation

The Python package nanodent can be installed from PyPI:

python -m pip install nanodent

Development installation

If you want to contribute to the development of nanodent, we recommend the following editable installation from this repository:

git clone https://github.com/thomasisensee/nanodent
cd nanodent
python -m pip install --editable .[dev,docs,lint,tests]

Having done so, the test suite can be run using pytest:

python -m pytest

Quick Start

nanodent loads .hld as the canonical source.

from datetime import datetime, timedelta

import matplotlib.pyplot as plt

from nanodent import (
    load_folder,
    plot_experiments,
    plot_group_timeline,
    save_experiment_plots,
)

study = load_folder("path/to/experiment-folder")
filtered_study = study.classify_quality()
filtered_study = filtered_study.analyze_oliver_pharr()
filtered_study = filtered_study.analyze_hertzian()
hardness_rows = filtered_study.scalar_series("hardness")
pop_in_rows = filtered_study.detect_force_peaks().scalar_series("pop_in_load")
radius_rows = filtered_study.scalar_series("hertzian_radius")
tau_rows = filtered_study.scalar_series("tau_max")
manual_groups = filtered_study.group_by_datetime_ranges(
    [
        (
            datetime(2026, 3, 4, 13, 0, 0),
            datetime(2026, 3, 4, 15, 0, 0),
        ),
    ]
)

timeline_fig, timeline_ax = plot_group_timeline(
    filtered_study,
    max_gap=timedelta(minutes=30),
)

fig, ax = plt.subplots()
plot_experiments(
    ax,
    filtered_study,
    fit_kwargs={"color": "gray", "linestyle": "solid", "linewidth": 2},
    zero_onset=False,
    cmap="rainbow",
)

ax.set_xlabel("Displacement h / nm")
ax.set_ylabel("Force P / μN")

saved = save_experiment_plots(
    filtered_study, "plots/", zero_onset=False
)

filtered_study.save_session("analysis-session.pkl")
resumed_study = load_folder("path/to/experiment-folder").load_session(
    "analysis-session.pkl"
)

Study.classify_quality() keeps all experiments loaded but marks heuristically bad runs as enabled=False with a short disabled_reason, currently including gradual_onset, flat_force, and local-jump outliers such as outlier_disp or outlier_force. Grouping and plotting ignore disabled experiments by default; group summaries include them by default so quality decisions stay visible. Pass include_disabled=True when you want disabled runs included in plots or grouping output. plot_experiments(...) and save_experiment_plots(...) always visualize the test force-displacement curve.

The public API also exposes:

  • load_experiment(path) -> Experiment
  • load_folder(path) -> Study
  • Study.analyze_oliver_pharr(...) -> Study
  • Study.analyze_hertzian(...) -> Study
  • Study.scalar_series(...) -> list[dict[str, Any]]
  • Study.save_session(path) -> Path
  • Study.load_session(path) -> Study
  • Study.group_by_datetime_ranges(...) -> list[ExperimentGroup]
  • Study.group_by_time_gap(...) -> list[ExperimentGroup]
  • plot_group_timeline(...) -> tuple[Figure, Axes]
  • plot_experiments(...) -> Axes
  • save_experiment_plots(...) -> list[Path]

Demo notebook

Use the demo notebook to test the functionality of nanodent and see how it can be used to analyze and visualize nanoindentation experiments.

Acknowledgments

This repository was set up using the SSC Cookiecutter for Python Packages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanodent-0.1.0.tar.gz (507.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanodent-0.1.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

Details for the file nanodent-0.1.0.tar.gz.

File metadata

  • Download URL: nanodent-0.1.0.tar.gz
  • Upload date:
  • Size: 507.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nanodent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe846399961d3457d627d00aa81270b5c2590d9fc4fb0d3535affd2ea3d89d63
MD5 cefc97865ea4950867c4756a9e9a18d9
BLAKE2b-256 292eef0fba017037b7ad3cef510b2daa041caae585e06e57668a54a51c4cbec9

See more details on using hashes here.

File details

Details for the file nanodent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nanodent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nanodent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 358df9d0db9bb385f950cc1370cc1b934f840fa6c891c50524a7a7a8f610c83b
MD5 a6e3926945333204e75ae880d2dcc5c4
BLAKE2b-256 6b8e6a541ff4d7aa07d41272f0d3f51ced8714a21a8eafe7265a4d2104b3c06a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page