Skip to main content

MorphZ

Python versions PyPI version CI Docs GitHub Repo arXiv

MorphZ for high accuracy marginal likelihood estimation and morphological density approximation toolkit for scientific workflows, with utilities for dependency analysis.

  • Flexible Morph backends: independent, pairwise, grouped, and "tree-structured".
  • Bandwidth selection: Scott, Silverman, Botev ISJ, and cross-validation variants.
  • Evidence estimation via bridge sampling with robust diagnostics.
  • Mutual information and Total correlation estimation.
  • Mutual information and Chow–Liu dependency tree visualisation.

Installation

Python 3.10+ is recommended.

pip install morphz

From source (editable):

pip install -e .

Run The Examples

Interactive notebooks live in examples/:

  • examples/eggbox.ipynb — eggbox likelihood (dynesty nested sampling)
  • examples/gaussian shell.ipynb — Gaussian shell (dynesty nested sampling)
  • examples/peak_sampling.ipynb — sharply peaked posterior
  • examples/numpyro_gaussian_shell.ipynb — Gaussian shell with NUTS via NumPyro
  • examples/numpyro_morphz_lnz.ipynb — log-evidence comparison across morph types (NumPyro/NUTS)

Documentation

Jupyter Book powers the project docs. During each build the helper script copies README.md and the contents of examples/ into docs/_auto/ so that the book always reflects the latest files without committing the generated copies.

python -m pip install 'jupyter-book<2'
./docs/build_docs.sh

HTML output is written to docs/_build/html, and GitHub Actions publishes it to GitHub Pages automatically on pushes to main.

API Highlights

  • Morphs: Morph_Indep, Morph_Pairwise, Morph_Group, Morph_Tree.
  • Bandwidths: select_bandwidth, compute_and_save_bandwidths.
  • Evidence: evidence, bridge_sampling_ln (lower‑level), compute_bridge_rmse.
  • Dependency analysis: dependency_tree.compute_and_plot_mi_tree.
  • Total correlation: Nth_TC.compute_and_save_tc.

Notes:

  • If you pass a numeric kde_bw (e.g., 0.9) the library skips bandwidth JSONs.
  • pair/group proposals will compute and cache MI.json/params_*_TC.json on first use.

Dependencies

  • Core: numpy, scipy, matplotlib, corner, networkx, emcee, statsmodels, scikit-learn
  • Optional: pandas (CSV labels), pygraphviz (nicer tree layout), scikit-sparse (optional exception type)

Development

  • Build wheels/sdist: python -m build
  • Check metadata: twine check dist/*
  • Tests live in tests/

Versioning & Release

Versioning is derived from git tags via setuptools_scm.

  • Tag a release: git tag vX.Y.Z && git push --tags
  • CI: publishes to TestPyPI on pushes to main/master; to PyPI on v* tags.
  • Uses PyPI/TestPyPI Trusted Publishing (OIDC). You can also use API tokens if preferred.

License

BSD-3-Clause. See LICENSE for details.

Metadata

Release files for morphZ 0.4.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 morphZ 0.4.0
File Size Uploaded Provenance Actions
morphz-0.4.0.tar.gz 4.1 MB With provenance Details for morphz-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 4.1 MB

Release files / morphz-0.4.0.tar.gz

Download URL morphz-0.4.0.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9d90dcc95dd979f6a3c3505f1960573b1f89949adfecdde426c7da11e76e67f5
BLAKE2b-256 checksum
How to use checksums
fd520472df6f2e7e200602bcd286b623345f9f4bd8469e03f5e15864181f833a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.

Transparency log

Release files / morphz-0.4.0-py3-none-any.whl

Download URL morphz-0.4.0-py3-none-any.whl
Size 58.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
281b8efecc2f759db8e9f432552569af2fde4e4cf0c4669d8c6d86cf1577db9c
BLAKE2b-256 checksum
How to use checksums
117b70e15b64c4e96f14c74ab75ea4b16e614afc437f20c74532fe2cf02e4697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.

Transparency log

Security for morphZ 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for morphz-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.

Transparency log

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.

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