Skip to main content

ktch - A Python package for model-based morphometrics

PyPI version Anaconda-Server Badge codecov License Python

ktch is a Python package for model-based morphometrics with scikit-learn compatible APIs.

Overview

ktch implements the following morphometric analysis methods:

  • Landmark-based methods: Generalized Procrustes Analysis (GPA) with curve/surface semilandmark sliding, thin-plate spline interpolation
  • Harmonic-based methods: Elliptic Fourier Analysis (EFA) for 2D/3D closed curves, spherical harmonic analysis (SPHARM) and disk harmonic analysis (DHA) for surfaces
  • Theoretical morphological models of coiling: Raup's model and the growing tube model
  • File I/O: Support for standard morphometric file formats (TPS, CHC, NEF, SPHARM-PDM, ImageJ ROI)
  • Datasets: Built-in example datasets for learning and testing
  • Visualization: TPS deformation grids, PCA variance plots (with optional plot extra)

All analysis classes follow the scikit-learn API (fit, transform, fit_transform), so you can plug them into your existing pipelines.

Installation

Python >= 3.11 is required.

From PyPI

pip install ktch

From conda-forge

conda install -c conda-forge ktch

Optional dependencies

Via PyPI:

pip install ktch[plot]  # matplotlib, plotly, seaborn for visualization
pip install ktch[data]  # pooch for remote dataset downloads

Via conda-forge:

conda install -c conda-forge ktch-plot  # matplotlib, plotly, seaborn for visualization
conda install -c conda-forge ktch-data  # pooch for remote dataset downloads
conda install -c conda-forge ktch-all   # all optional dependencies

Development installation

git clone https://github.com/noshita/ktch.git
cd ktch
uv sync

Quick start

Elliptic Fourier Analysis on 2D outlines

from sklearn.decomposition import PCA

from ktch.datasets import load_outline_mosquito_wings
from ktch.harmonic import EllipticFourierAnalysis

# Load outline data (126 specimens, 100 points, 2D)
data = load_outline_mosquito_wings()
coords = data.coords

# Elliptic Fourier Analysis
efa = EllipticFourierAnalysis(n_harmonics=20)
coeffs = efa.fit_transform(coords)

# PCA on EFA coefficients
pca = PCA(n_components=5)
pc_scores = pca.fit_transform(coeffs)

Documentation

See doc.ktch.dev for full documentation:

  • Tutorials: Step-by-step guides for GPA, EFA, spherical harmonics, and more
  • How-to guides: Task-oriented recipes for data loading, visualization, and pipeline integration
  • Explanation: Theoretical background on morphometric methods
  • API reference: Complete API documentation

Contributing and support

Bug reports, feature requests, and usage questions are all welcome via GitHub Issues.

See CONTRIBUTING.md for development setup and conventions.

License

ktch is licensed under the Apache License, Version 2.0.

Metadata

Release files for ktch 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ktch 0.12.0
File Size Uploaded Provenance Actions
ktch-0.12.0.tar.gz 793.2 kB Without provenance Details for ktch-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ktch 0.12.0
File Interpreter ABI Platform Actions
ktch-0.12.0-py3-none-any.whl Python 3 none any Details for ktch-0.12.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / ktch-0.12.0.tar.gz

Download URL ktch-0.12.0.tar.gz
Size 793.2 kB
Tags Source
SHA-256 checksum
How to use checksums
af5e7a512f25e028224b3cbcb1627c5be422a02bacde047703dabc96ea85d739
BLAKE2b-256 checksum
How to use checksums
e31dfca48d9c19255a4bacbf681827fe9c27cdab151ed395a660d5917b59c770
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ktch-0.12.0-py3-none-any.whl

Download URL ktch-0.12.0-py3-none-any.whl
Size 813.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d61df233251fdad19bdc75a32dfed454c4483bd1087e4a5e07802fc22c10d9c7
BLAKE2b-256 checksum
How to use checksums
4687dff8987652bc33deb8b889ba1ea53d57288f51148e197ca91410e3d076e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ktch 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page