Skip to main content

CosmoForge: umbrella metapackage installing cosmocore, qube-qml, and picslike.

Project description

CosmoForge

Build Status Documentation codecov PyPI Code style: Ruff Python License

CosmoForge logo (light) CosmoForge logo (dark)

📚 Complete Documentation | Installation Guide | Quick Start | API Reference

CosmoForge is a comprehensive Python framework for power spectrum estimation and likelihood analysis of spin-0 and spin-2 fields on the sphere, using Fisher matrix, Quadratic Maximum Likelihood (QML), and pixel-based likelihood methods. While widely applicable to any sky signal (e.g. CMB, galaxy surveys, 21 cm), it is particularly optimized for the analysis of partial-sky, noisy observations with complex noise covariance.

Overview

CosmoForge consists of several interconnected packages designed for efficient and accurate cosmological parameter estimation:

  • cosmocore: Core functionality for cosmological analysis including field management, matrix operations, and I/O utilities
  • qube-qml: QML and Fisher matrix implementations for power spectrum estimation (imported as qube)
  • picslike: Pixel-based Inference with Correlated-Skies Likelihood — pixel-space likelihood analysis for parameter estimation

Features

  • Fisher Matrix Analysis: Fast Fisher matrix computation for cosmological parameter forecasting
  • QML Power Spectrum Estimation: Quadratic Maximum Likelihood estimation for optimal power spectrum recovery
  • Pixel-Based Likelihood: Direct likelihood evaluation in map pixel space for parameter estimation
  • MPI Parallelization: Efficient parallel computation support for large-scale analyses
  • HEALPix Integration: Full support for HEALPix pixelization scheme
  • Flexible Field Management: Support for scalar (spin-0) and tensor (spin-2) fields
  • Beam and Noise Modeling: Comprehensive instrumental effects modeling

Installation

📖 For detailed installation instructions, see the Installation Guide

Requirements

  • Python 3.11–3.13
  • NumPy, SciPy
  • healpy
  • mpi4py (for parallel computation)

Install from PyPI

The umbrella distribution installs all three subpackages:

pip install cosmoforge

Or pick subpackages individually:

pip install cosmocore       # core utilities only
pip install qube-qml        # adds QML / Fisher (imported as `qube`)
pip install picslike        # adds pixel-space likelihood

Install from source

git clone https://github.com/ggalloni/CosmoForge.git
cd CosmoForge
uv sync --all-packages --all-extras --dev

Quick Start

🚀 For comprehensive tutorials and examples, visit the Quick Start Guide and Tutorials

Fisher Matrix Analysis

from qube import Fisher

# Initialize Fisher analysis
fisher = Fisher("config/fisher_config.yaml")
fisher.run()

# Get Fisher matrix
fisher_matrix = fisher.get_fisher_matrix()

QML Power Spectrum Estimation

from qube import Spectra

# Initialize QML analysis
qml = Spectra("config/qml_config.yaml")
qml.run()

# Get power spectra
power_spectra = qml.get_power_spectra()
noise_bias = qml.get_noise_bias()

Pixel-Based Likelihood Analysis

from picslike import PICSLike

# Initialize pixel-based likelihood
picslike = PICSLike(params_file="config/picslike_config.yaml")
picslike.run()

# Get results
chi_squared = picslike.get_chi_squared()
best_fit = picslike.get_best_fit()

Using with Precomputed Fisher

from qube import Fisher, Spectra

# Compute Fisher matrix first
fisher = Fisher("config/fisher_config.yaml")
fisher.run()

# Reuse Fisher computation for QML
qml = Spectra("config/qml_config.yaml", fisher=fisher)
qml.run()

Package Structure

CosmoForge/
├── src/
│   ├── cosmoforge.cosmocore/    # Core functionality (published as `cosmocore`)
│   ├── cosmoforge.qube/         # QML and Fisher analysis (published as `qube-qml`, imported as `qube`)
│   ├── cosmoforge.picslike/     # Pixel-space likelihood (published as `picslike`)
│   └── cosmoforge.meta/         # Umbrella metapackage (published as `cosmoforge`)
├── tests/                       # Test suite
├── docs/                        # Documentation
└── examples/                    # Example configurations

Configuration

CosmoForge uses YAML configuration files to specify analysis parameters:

# Example configuration
nside: 4
lmax: 16
fields: "TEB"
maskfile: "data/mask.fits"
inputclfile: "data/fiducial_cls.txt"
# ... additional parameters

Testing

Run the test suite:

# Run all tests
uv run pytest

# Run specific package tests
uv run --package cosmocore pytest src/cosmoforge.cosmocore/tests/
uv run --package qube pytest src/cosmoforge.qube/tests/
uv run --package picslike pytest src/cosmoforge.picslike/tests/

Performance

CosmoForge is designed for high-performance cosmological analysis:

  • Numba JIT compilation for critical mathematical operations
  • MPI parallelization for distributed computing
  • Optimized matrix operations using LAPACK/BLAS
  • Memory-efficient algorithms for large datasets

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

License

[Add license information]

Citation

If you use CosmoForge in your research, please cite:

[Add citation information]

Support

📖 Complete documentation is available at: https://ggalloni.github.io/CosmoForge/

For questions and support:

  • Open an issue on GitHub
  • Contact: [contact information]

Acknowledgments

CosmoForge builds upon established cosmological analysis methods and libraries:

  • HEALPix for pixelization
  • NumPy/SciPy for numerical computations
  • MPI for parallelization

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosmoforge-1.0.0rc2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmoforge-1.0.0rc2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file cosmoforge-1.0.0rc2.tar.gz.

File metadata

  • Download URL: cosmoforge-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cosmoforge-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 8c1bcb7095f7f1d3d842d1bce638a20e76a7f822da92f1f62c41c2b7d0282496
MD5 8c7a7e399367c94a482a834ddc0a6cb6
BLAKE2b-256 8412de2821ee19fc1476254f4337bc3f9e509000ef8c75a48ac166ddbd502eb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmoforge-1.0.0rc2.tar.gz:

Publisher: publish.yml on ggalloni/CosmoForge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cosmoforge-1.0.0rc2-py3-none-any.whl.

File metadata

  • Download URL: cosmoforge-1.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cosmoforge-1.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa54dcd35b53261d6e9d34a8a8169b2540a7c859174f3f8ccb65df9c821bf106
MD5 21a0558812527ef7997f3c859723fb06
BLAKE2b-256 8ef9d659dfecc81e8bd7db4fbd6048eb01d3e0be6584822a8519ca5a220a0583

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmoforge-1.0.0rc2-py3-none-any.whl:

Publisher: publish.yml on ggalloni/CosmoForge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page