Skip to content
andreicuceuPublic

Repository files navigation

Vega

https://github.com/andreicuceu/vega/actions/workflows/python_package.yml/badge.svg?branch=master https://readthedocs.org/projects/vega/badge/?version=latest

Vega is a tool for computing 3D correlation function and power spectrum models primarily for Lyman-α (Lyα) forest analyses. It is built to be modular and highly flexible in terms of the tracers being used. So far, Vega has been used to analyze the Lyα forest auto-correlation and its cross-correlation with galaxies and quasars (e.g., Gerardi et al. 2022, Gordon et al. 2023, Herrera-Alcantar et al. 2025, Karaçaylı et al. 2026), as well as auto- and cross-correlations of metal lines such as CIV and SiIV (e.g., Guy et al. 2025, Bault et al. 2026), Damped Lyman-α (DLA) absorbers (Pérez-Ràfols et al. 2023), and Strong Blended Lyman-α (SBLA) absorbers (Pérez-Ràfols et al. 2023).

Vega is currently being used by the Lyα forest working group in DESI to measure Baryon Acoustic Oscillations (BAO) and perform full-shape analyses of Lyα forest auto- and cross-correlations (e.g., DESI et al. 2025a, DESI et al. 2025b, Cuceu et al. 2025).

Installation

Vega requires Python 3.11 or newer and is tested on Python 3.11--3.14. We recommend to start by creating a fresh conda environment, preferably with the latest supported Python version:

conda create --name vega python=3.14
conda activate vega

For a stable release, download the wheel and SHA256SUMS from the GitHub Releases page. Verify the downloaded file on Linux, then install it with:

sha256sum --check SHA256SUMS --ignore-missing
python -m pip install ./vega-X.Y.Z-py3-none-any.whl

The wheel is the recommended installation artifact. If you need to build Vega from source, download the source distribution from the same release and run:

sha256sum --check SHA256SUMS --ignore-missing
python -m pip install ./vega-X.Y.Z.tar.gz

Install optional dependencies for the part of Vega you use. Append the extra to the verified wheel path, for example python -m pip install './vega-X.Y.Z-py3-none-any.whl[templates]'. For an editable checkout, use python -m pip install -e '.[templates]'.

Optional installation features
Extra Dependencies Use
[mpi] mpi4py MPI command-line scripts and the PolyChord sampler interface. An MPI implementation must also be installed outside Python.
[pocomc] pocomc, mpi4py, schwimmbad PocoMC sampling, including its MPI pool. The sampler interface imports mpi4py even when use_mpi = False. [samplers] is an identical compatibility alias.
[templates] camb, fitsio make_template.py and its CAMB power-spectrum templates.
[docs] Sphinx documentation tools Build the documentation.

The [dev] extra supplies tests and development tools; it does not include these optional runtime features. PolyChord requires a separate installation of PolyChordLite and its pypolychord bindings; see the PolyChord installation instructions.

The DESI instrumental-systematics table generator in vega/models/instrumental_systematics/write_desi_instrumental_syst_table.py is a maintainer utility, not part of the standard installation features. It requires desimeter, desimodel, and the corresponding DESI data files.

For development, clone the public repository and install it in editable mode with the development dependencies:

git clone https://github.com/andreicuceu/vega.git
cd vega
python -m pip install -e '.[dev]'

Install the Git hooks once in each clone, then check the complete source tree:

pre-commit install
pre-commit run --all-files

The hooks apply Ruff's safe lint fixes and formatting to staged Python files before each commit. Run pre-commit run --all-files and the relevant pytest suite before opening a pull request.

GitHub also generates Source code archives for tags. These are repository snapshots rather than the tested Python release artifacts. Archives for tags that contain .git_archival.txt can recover their version without a .git directory, but the release wheel and source distribution remain the canonical installation inputs.

If you are at NERSC and want your vega environment to show up as Jupyter kernel, you can run the following command:

python -m ipykernel install --user --name vega --display-name Vega

The MPI and PocoMC features need an MPI implementation as well as mpi4py. At NERSC, build mpi4py against the available MPI wrappers when needed:

MPICC="cc -shared" pip install --force-reinstall --no-cache-dir --no-binary=mpi4py mpi4py

Vega has interfaces for PolyChord and PocoMC. Neither is needed for the iminuit minimizer. The PolyChord installation procedure at NERSC follows.

Installing Polychord

Here are instructions for installing Polychord at NERSC. Note that this requires the default Perlmutter environment with no changes (except module load python). Start by following the steps above to install vega and its dendencies. After that clone Polychord:

git clone https://github.com/PolyChord/PolyChordLite.git
cd PolyChordLite

In the PolyChordLite folder, you will find a make file named "Makefile_gnu". You need to open and edit this file by changing lines 2-4 from:

FC = mpifort
CC = mpicc
CXX = mpicxx

to

FC = ftn
CC = CC
CXX = CC

After that, you can install PolyChord:

make veryclean
make COMPILER_TYPE=gnu
python -m pip install .

Check the bindings on an interactive compute node after installation:

python -c 'import pypolychord; from pypolychord.settings import PolyChordSettings'

Finally, you should add this line to your .bashrc file, or at the beginning of your scripts (make sure to replace it with the correct path to your version of PolyChord):

export LD_LIBRARY_PATH=/path/to/PolyChordLite/lib:${LD_LIBRARY_PATH}

Usage

Vega needs one "main.ini" file with the configuration, and at least one correlation config file. These correlation config files are generally of the form "lyaxlya.ini" for the Lyman alpha forest auto-correlation, or "qsoxlya.ini" for its cross-corelation with quasars. More complex cases also appear if we use the part of the Lyman alpha forest that appears left of the Lyman beta peak (i.e. in the Lyman beta part of the forest). These are generally called lyalyaxlyalyb.ini, which means we correlate Lya absorption in the Lya forest, denoted Lya(Lya), with Lya absorption in the Lyb part of the forest, denoted Lya(Lyb).

In the examples folder you can find examples of these config files with a lot of comments explaining what each option does. If you don't understand something, or we missed something, please open an issue.

Vega now has a Config Builder that is designed to create full Vega config files with minimal input. This is now the preffered way of interacting with Vega, as it automates fits and reduces the chance of mistakes. You can use the BuildConfig class interactively (e.g. in a notebook) as shown in this tutorial.

Using the terminal

You can call Vega from a terminal using the scripts in the bin folder, and pointing them to a "main.ini" file like this:

python run_vega.py path_to/main.ini

The "run_vega.py" script can be used for computing model correlations and for running the fitter. However, these can also be run interactively (see next section).

On the other hand the sampler (PolyChord) cannot be run interactively and needs to be called using the second script like this:

python run_vega_mpi.py path_to/main.ini

We strongly suggest you run the sampler in parallel on many cores, as normal run-times are of the order 10^2 - 10^4 core hours.

Interactive use

You can run Vega interactively using Ipython or a Jupyter notebook. This example notebook takes you through the steps of intializing Vega, computing a model and performing a fit.

This process is much more powerful compared to running in terminal as you directly have access to all the output, model components and fit results. Additionally, Vega was built in a modular structure with the aim of the user being able to call each module independently. Therefore, you have access to much more functionality this way. The documentation is the best source on how to run these modules independently, but if you can't find something there, please open an issue and we will try to help you and also improve the documentation.

Vega also has a FitResults module for analysing the results of a fit. You can find example usage of it in this notebook.

Credits

This package is based on picca fitter2 found here: https://github.com/igmhub/picca/tree/v4/py/picca/fitter2, and was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Releases

Used by

Contributors

Languages