SkillAgentSearch skills...

Stanhf

Convert a histfactory model into a Stan model

Install / Use

/learn @xhep-lab/Stanhf
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<h1 align="center"> 🌀 stanhf </h1> <h3 align="center"> <i>Convert a histfactory model into a Stan model</i> </h3> <div align="center">

arXiv GitHub License GitHub Actions Workflow Status GitHub Tag PyPI - Version

</div> <br>

Convert a histfactory declarative specification of a model in json into a Stan model. Stan is a probabilistic programming language and a set of algorithms with automatic differentiation.

We follow the histfactory specification as closely as possible and the target function (log-likelihood) should match that from pyhf up to a constant term to within a negligible numerical difference.

See the paper at [2503.22188] for more information.

Install

pip install stanhf

At runtime, the first time you use stanhf it could install cmdstan if it isn't found. This is required to lint, validate and compile any Stan models, though stanhf can be used as a conversion tool without it.

Run

Stanhf consists of one CLI. See

stanhf --help

for details. Try e.g.,

stanhf ./examples/normfactor.json

This converts, compiles and validates the example model. The compiled model is a cmdstan executable. You can run the usual Stan algorithms (HMC, optimization etc) through this executable.

Workflows

See EXAMPLE.md for a walkthrough of how to run and analyse outpus from a compiled Stan model.

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated9mo ago
Forks0

Languages

Python

Security Score

77/100

Audited on Jun 5, 2025

No findings