Skip to main content

A python package for the exploration of primordial features.

Project description

PrimeFeat

Logo

Primordial Power Spectrum Feature Analysis for Cosmology

Python 3.10+ image License: MIT image

Docs image image

A Python package for detecting and characterizing features in the primordial power spectrum from MCMC cosmological parameter chains. Designed for precision cosmology research seeking evidence of physics beyond the standard inflationary paradigm.

Features

🎯 Power Spectrum Analysis

  • Fast computation of $\mathcal{P}_\zeta(k)$ posteriors from MCMC chains with intelligent caching
  • Support for binned features: $\mathcal{P}_\zeta(k) = A_s (k/k_0)^{n_s-1} [1 + \delta(k)]$
  • Automatic detection of amplitude parameter names across different samplers

🔬 Statistical Analysis

  • Gaussian Process-based significance testing for feature detection
  • Principal Component Analysis (PCA) for dimensionality reduction
  • Bin correlation analysis and effective degrees of freedom estimation

⚙️ Workflow Automation

  • YAML-based chain configuration for reproducible analyses
  • Automatic chain loading with get_chains(kmin)
  • Integration with GetDist for MCMC analysis

Quick Start

import primefeat as pf
import numpy as np

# Load chains from YAML config
kmin=1e-4
chains = pf.get_chains(kmin)

# Compute power spectrum posteriors
k = np.logspace(-4, 0, 100)
samples = {
    label: pf.compute.samples_Pk(
        k, chain, 
        nbins=20, 
        k_start=1e-4, 
        k_end=0.23,
        include_powerlaw=True
    )
    for label, chain in chains.items()
}

# Plot with publication style
colors = ['#2E86AB', '#A23B72', '#F18F01']
fig = pf.plot.posteriors_PPS(
    k, samples, colors=colors,
    mode="full",  # Full P(k) with A_s and n_s
    figsize=(8, 5)
)

Installation

pip install primefeat

Or install from source:

git clone https://github.com/rcalderonb6/primefeat.git
cd primefeat
pip install -e .

Configuration

Create a chains.yaml file to manage your MCMC chains:

chains:
  CMB:
    Planck:
      path: '/path/to/planck_chain'
    ACTDR6:
      path: '/path/to/actdr6_chain'
      add_h_parameter: true

  Low-z:
    Pantheon+:
      path: 'path/to/pantheon+'
    DESI DR2:
      path: 'path/to/desi_dr2'

default:
  skip: 0.3  # Burn-in fraction

Then load chains with:

chains = pf.get_chains('CMB')  # Loads all chains for CMB runs
# chains = pf.get_chains('Low-z')  # Loads all chains for Low-z probes

Citation

If you use PrimeFeat in your research, please cite:

@software{primefeat2026,
  author = {Calderon, Rodrigo},
  title = {PrimeFeat: Primordial Power Spectrum Feature Analysis},
  year = {2026},
  url = {https://github.com/rcalderonb6/primefeat}
}

License

MIT License - see LICENSE for details.

Contact

Rodrigo Calderon - calderon.cosmology@gmail.com


Looking for features in the primordial power spectrum that may hint at new physics beyond vanilla inflation.

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

primefeat-0.0.5.tar.gz (85.7 kB view details)

Uploaded Source

Built Distribution

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

primefeat-0.0.5-py3-none-any.whl (99.2 kB view details)

Uploaded Python 3

File details

Details for the file primefeat-0.0.5.tar.gz.

File metadata

  • Download URL: primefeat-0.0.5.tar.gz
  • Upload date:
  • Size: 85.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for primefeat-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d7ee1f507f23f4699670d9ec3fb8de294bea661eabf19a6816a0a1a591565191
MD5 e7c8d04f476fbdbfa93bdd40562d2c76
BLAKE2b-256 b764b1a772d536167c4d154ec85fd7f3ae1b433ee61fe859a0d29cf35773822d

See more details on using hashes here.

File details

Details for the file primefeat-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: primefeat-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 99.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for primefeat-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 86ec7b6414f3ecf6a418fd763b6bdae1efd9488f8e1bef47b75a1b062c7e67a3
MD5 2e84ea3e1129ce4defea367b9e8098d3
BLAKE2b-256 cc6e5a77331ef8bae52dda75e0ed9ff558ec9fe1802cca1f8713e6f77a3c8523

See more details on using hashes here.

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