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 image

License: MIT 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 \left(\frac{k}{k*}\right)^{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
chains = pf.get_chains(kmin=1e-4)

# Compute power spectrum posteriors
k = np.logspace(-4, 0, 100)
samples = {
    label: pf.compute_Pk_samples(
        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:
  1e-4:
    Planck:
      path: '/path/to/planck_chain'
    ACTDR6:
      path: '/path/to/actdr6_chain'
      add_h_parameter: true

default:
  skip: 0.3  # Burn-in fraction

Then load chains with:

chains = pf.get_chains(1e-4)  # Loads all chains for kmin = 1e-4

Citation

If you use PrimeFeat in your research, please cite:

@software{primefeat2025,
  author = {Calderon, Rodrigo},
  title = {PrimeFeat: Primordial Power Spectrum Feature Analysis},
  year = {2025},
  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 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.3.tar.gz (53.4 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.3-py3-none-any.whl (59.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for primefeat-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2d78d1e0f82f8b10d62fc380cb268f2036d46f0b290daa581b25f767a821eb38
MD5 1f6e867bed3731cd635986a16edfde9e
BLAKE2b-256 a5a769bb9b011fc53428be9557bdd359b1a224a4e7b066f3f1e9f5a9ed5cbec9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for primefeat-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4edff692aac667984d77ccc40ba34b0c1cd468c924848c190acae61e69104016
MD5 da7773e535a5b89dd3bc555cecf7f44e
BLAKE2b-256 385fbcb6edcd3aead6516ba32af04356bd183ddabe2b7a49c00e63619c49904c

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