Skip to main content

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.

Metadata

Release files for primefeat 0.0.5

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

Source distribution (sdist)

Source distribution for primefeat 0.0.5
File Size Uploaded Provenance Actions
primefeat-0.0.5.tar.gz 85.7 kB Without provenance Details for primefeat-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for primefeat 0.0.5
File Interpreter ABI Platform Actions
primefeat-0.0.5-py3-none-any.whl Python 3 none any Details for primefeat-0.0.5-py3-none-any.whl

Total release size: 184.9 kB

Release files / primefeat-0.0.5.tar.gz

Download URL primefeat-0.0.5.tar.gz
Size 85.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d7ee1f507f23f4699670d9ec3fb8de294bea661eabf19a6816a0a1a591565191
BLAKE2b-256 checksum
How to use checksums
b764b1a772d536167c4d154ec85fd7f3ae1b433ee61fe859a0d29cf35773822d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / primefeat-0.0.5-py3-none-any.whl

Download URL primefeat-0.0.5-py3-none-any.whl
Size 99.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86ec7b6414f3ecf6a418fd763b6bdae1efd9488f8e1bef47b75a1b062c7e67a3
BLAKE2b-256 checksum
How to use checksums
cc6e5a77331ef8bae52dda75e0ed9ff558ec9fe1802cca1f8713e6f77a3c8523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for primefeat 0.0.5

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