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.4.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.4-py3-none-any.whl (99.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: primefeat-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 6da9d05948e9cafe0544844ad5cc4ca4542bdbf41081da9bbc4046435b4485d1
MD5 6ffbde1536fd5d1e0ee51e363612bcc1
BLAKE2b-256 d83a3a8fbf116178796cea4cbca5dd3e7453986ecfb0ebf6a883c69898801b94

See more details on using hashes here.

File details

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

File metadata

  • Download URL: primefeat-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 99.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3e1085a37a703f7fdcd00f4dd9bd75da387a3a5c11639528ddeca569f3b54f92
MD5 a283dc3aca1121a638fe641a63e37aee
BLAKE2b-256 8130b75c6f5a26d6d69ff6926cef228b4e021a1072c941e9f72791264156ca13

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