Skip to main content

hi_class: Horndeski in the Cosmic Linear Anisotropy Solving System

hi_class extends the CLASS Boltzmann code to cover Horndeski and related scalar-tensor models of dark energy and modified gravity. It is based on CLASS by Julien Lesgourgues, with major inputs from Thomas Tram and others.

hi_class retains the functionality of the corresponding CLASS version and adds support for modified gravity. hi_class v3.4.0.1 is based on CLASS v3.4.0, so the standard CLASS v3.4.0 features, input parameters and outputs are available.

Authors

  • Emilio Bellini
  • Ignacy Sawicki
  • Miguel Zumalacarregui

Installation

From PyPI

pip install hiclassy

This installs the Python wrapper and builds the C core. You need Python 3.9 or newer, make, and C and C++ compilers (e.g. gcc and g++). Pip installs the Python dependencies and compiles the source package locally.

From source

git clone https://github.com/hiclass-code/hi_class_public.git
cd hi_class_public
make class

To build the Python wrapper, run:

make

If compilation fails, check the Makefile for compiler, optimization flags, and OpenMP settings.

Quick start

Use the Python interface:

from hiclassy import HiClass

Since 9 February 2026, the wrapper uses hiclassy and HiClass. To adapt a standard CLASS Python script, replace from classy import Class with from hiclassy import HiClass and Class() with HiClass(). The standard methods of the corresponding CLASS version keep the same names and calling conventions; HiClass adds methods for modified gravity. See the Python wrapper guide for examples and conventions.

If you want to use the C executable instead, you can run:

./class explanatory.ini

Parameter documentation and examples are available in hi_class.ini and explanatory.ini, plus the example files in gravity_models/.

Citing hi_class

If you use hi_class, please cite:

  • M. Zumalacarregui, E. Bellini, I. Sawicki, J. Lesgourgues, P. Ferreira, "hi_class: Horndeski in the Cosmic Linear Anisotropy Solving System", JCAP 1708 (2017) no.08, 019, https://arxiv.org/abs/1605.06102
  • E. Bellini, I. Sawicki, M. Zumalacarregui, "hi_class: Background Evolution, Initial Conditions and Approximation Schemes", https://arxiv.org/abs/1909.01828

Please also cite the relevant CLASS papers, including:

Plotting utilities

The package includes the Class Plotting Utility CPU.py for plotting Cl's, P(k), and related outputs, including model comparisons. Run:

python CPU.py --help

A MATLAB helper is available in plot_CLASS_output.m.

Development

We recommend developing from the GitHub repository:

https://github.com/hiclass-code/hi_class_public

For hi_class-specific updates, see this repository and the gravity_models/ examples.

Support

For support, please open an issue in the repository or refer to the wiki.

Weyl power and growth conventions

Write W = (phi + psi)/2 and Q_W(k,z) = k**4 P_W(k,z). HiClass returns Q_W in 1/Mpc, with k in 1/Mpc. It is the power spectrum of k**2 W, not the dimensionless power per logarithmic interval.

The clients emu_like and hi_fast accept q in h/Mpc and retain the historical numerical normalization S_W(q,z) = h**3 Q_W(h*q,z) for compatibility with existing datasets. This is not matter power in (Mpc/h)**3; new emu_like Weyl headers label it h^3/Mpc. Ratio targets additionally divide by their stored reference spectrum.

For every species, f = (1/2) d ln P / d ln a = -(1+z)/(2P) dP/dz. For Weyl, P denotes the rescaled Weyl power; its growth can be negative. Both clients differentiate HiClass power with second-order differences and dz = 1e-3. They use a forward stencil near z=0. emu_like also uses a backward stencil at the native upper time boundary; hi_fast reserves coverage for its upper stencil. The fixed h normalization cancels in f.

Weyl requires a HiClass build exposing pk_weyl, pk_weyl_lin, get_pk_weyl, and get_pk_weyl_lin. Both clients request wPk automatically. emu_like follows the configured nonlinear setting and rejects nonlinear Weyl requests; hi_fast explicitly uses linear power. The unchanged get_Weyl_pk_and_k_and_z remains a comparison accessor, not the source of client-side extrapolation.

Below the native k_min, the leading-order prescription is Q_W(k,z) = (k/k_min)**n_s Q_W(k_min,z). It assumes a k-independent Weyl source at leading order and a single adiabatic analytic primordial power law with alpha_s = beta_s = 0. Other primordial setups remain usable within the native grid but are rejected below k_min. There is no high-k or redshift extrapolation, and k must be strictly positive. Agreement between implementations does not by itself establish this asymptotic approximation's accuracy for every modified-gravity model.

Regenerating datasets updates targets and reference tables; existing trained emulator weights are not changed by these code updates.

Metadata

Release files for hiclassy 3.4.0.1

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

Source distribution (sdist)

Source distribution for hiclassy 3.4.0.1
File Size Uploaded Provenance Actions
hiclassy-3.4.0.1.tar.gz 6.7 MB Without provenance Details for hiclassy-3.4.0.1.tar.gz

Release files / hiclassy-3.4.0.1.tar.gz

Download URL hiclassy-3.4.0.1.tar.gz
Size 6.7 MB
Tags Source
SHA-256 checksum
How to use checksums
486728435534bb4e44bf994b742c91923526916908694c229e1487d56c31bedf
BLAKE2b-256 checksum
How to use checksums
2f67cb35e8a904ae6cada0867242875e25616046b5591ef0a78043670678a766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for hiclassy 3.4.0.1

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.

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