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()
hardness_rows = filtered_study.scalar_series("hardness")
pop_in_rows = filtered_study.detect_force_peaks().scalar_series("pop_in_load")
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.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 using methods provided by py4dgeo

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.0.3.tar.gz (413.5 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.0.3-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanodent-0.0.3.tar.gz
  • Upload date:
  • Size: 413.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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.0.3.tar.gz
Algorithm Hash digest
SHA256 61529b9b53d0277c2c6992770716081017dc6dc8f8b098d6b460dce7a41fa86a
MD5 b89c5552acebb3f9cc51c0237c5252bd
BLAKE2b-256 b762992e18a08b4c4f41972e3d4b4a51ad4781e4e6787e6fcac184b7d2bb8042

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanodent-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e68443f0674e816878e848f501eb592890f78d734ee25583a82f7960d5d23064
MD5 7941f5cb976b34a2a86dc7ae3684ea31
BLAKE2b-256 aff3ef9e2a3073d001f92001f0016f3e3fce44c727dbc0953c00ae80ae0aa1d3

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