Metadata-Version: 2.4
Name: psi-continuum-v2
Version: 0.2.1
Summary: Psi-Continuum v2: cosmological framework and joint likelihood analysis for the Psi-CDM model.
Author-email: "Dmitry V. Klimov" <d.klimov.psi@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/dmitrylife/psi-continuum-v2
Project-URL: Documentation, https://psi-continuum.org
Project-URL: Source, https://github.com/dmitrylife/psi-continuum-v2
Project-URL: Issues, https://github.com/dmitrylife/psi-continuum-v2/issues
Keywords: cosmology,psi-continuum,lcdm,dark-energy,supernovae,bao,desi,pantheon,astrophysics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.9
Requires-Dist: matplotlib>=3.6
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# Psi-Continuum v2  

### A Minimal One-Parameter Extension of ΛCDM  
**Author:** Dmitry V. Klimov
**Status:** Research Prototype (v0.2.1)

![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)
![Reproducible](https://img.shields.io/badge/Reproducible-Build-blueviolet.svg)
![Status](https://img.shields.io/badge/Status-Active%20Research-orange.svg)


## Overview

Psi-Continuum (ΨCDM) is a minimal phenomenological extension of ΛCDM that 
introduces **one additional parameter ε₀**, modifying late-time expansion while
retaining ΛCDM as an exact limit.

Background expansion is written as:

```mathematica
E²(z) = Ω_m (1 + z)³ + (1 − Ω_m) · [1 + ε₀ · g(z)]
```

where g(z) is chosen such that:
- g(0) = 1     → parameter interpretable as a fractional deformation of dark energy,
- g(z → ∞) → 0  → model preserves early ΛCDM behaviour.

If ε₀ = 0 → ΨCDM reduces to ΛCDM.

This repository includes:

- ΛCDM and ΨCDM background cosmology
- Pantheon+ HF supernovae loader + full covariance χ²
- H(z) cosmic chronometer compilation
- SDSS DR12 BAO consensus
- DESI DR2 Gaussian BAO likelihood
- Joint likelihood and χ² breakdown
- ε₀ scanning, minimization, comparison with ΛCDM
- Publication-grade figure generation
- A complete reproducible pipeline (`run_all.py`)

---

## Main Scientific Results

- Pantheon+ HF slightly prefers **ε₀ < 0**  
- DESI DR2 BAO strongly prefers **ε₀ > 0**  
- Joint background fit (SN + H(z) + SDSS DR12 BAO + DESI DR2) yields:

### **ε₀_best = +0.031 ± 0.010**

### **Total Δχ² improvement relative to ΛCDM: −6.9**

This means ΨCDM provides a statistically better description of late-time background data while remaining indistinguishable from ΛCDM at early times.

## Repository Structure

```text
psi-continuum-v2/
├── psi_continuum_v2/
│   ├── analysis/                # reproducible analysis scripts
│   │   ├── styles/              # Matplotlib style sheet for publication plots
│   │   └── *.py
│   ├── cosmology/               # theory, loaders, likelihoods
│   │   ├── background/
│   │   ├── likelihoods/
│   │   ├── data_loaders/
│   │   └── models/
│   ├── check_imports.py         # internal sanity check tool
│   └── __init__.py
│
├── data/                        # input datasets (Pantheon+, H(z), BAO, DESI)
├── results/
│   ├── figures/
│   ├── tables/
│   └── logs/
│
├── examples/                    # minimal demonstration scripts
├── run_all.py
├── requirements.txt
└── README.md
```

Figures generated by the publication pipeline are saved under:

`results/figures/publication/main_figures/`

---

## Installation

## Installation Options

 - Installation via PyPI (recommended)
 - Installation from source (clone repository)

### Installation via PyPI (recommended)

You can install Psi-Continuum v2 directly from PyPI:

```bash
pip install psi-continuum-v2
```

This installs only the code of the package.
All scientific datasets must be downloaded manually and placed into a local `data/` directory (see Section “Preparing the `data/` Directory”).

After installation you can check whether your data directory is correctly set up:

```bash
python -m psi_continuum_v2.check_data
```

If data files are missing, the tool will print clear **MISSING** messages and instructions on where to place them.

To run analysis scripts installed via pip:

```bash
python -m psi_continuum_v2.analysis.sn_test_psicdm_pplus
```

### 1. Clone the repository
```bash
git clone https://github.com/dmitrylife/psi-continuum-v2.git
```

```bash
cd psi-continuum-v2
```

### 2. Create virtual environment

```bash
python3 -m venv sci_venv
```

and

```bash
source sci_venv/bin/activate
```

### 3. Install dependencies

```bash
pip install -r requirements.txt
```

### 4. (Optional) Install the package as editable

```bash
pip install -e .
```

If you installed the package via `pip` (rather than cloning the repository),
you must create a `data/` directory in your current working directory, with the
dataset layout shown in Section 5.

## 5. Preparing the `data/` Directory

The `data/` directory is intentionally **excluded** from both the GitHub repository 
and the PyPI package.  
Users must download all datasets manually and place them in the directory structure shown below.

The expected directory layout is:

```text
data/
├── pantheon_plus/
│   ├── Pantheon+SH0ES.dat
│   └── Pantheon+SH0ES_STAT+SYS.cov
│
├── hz/
│   └── HZ_compilation.csv
│
├── bao/
│   ├── sdss_DR12Consensus_bao.dat
│   └── BAO_consensus_covtot_dM_Hz.txt
│
└── desi/dr2/
    ├── desi_gaussian_bao_ALL_GCcomb_mean.txt
    └── desi_gaussian_bao_ALL_GCcomb_cov.txt
```

You may download these datasets from their original public sources:

 - Pantheon+ HF supernova sample
 - Cosmic chronometer H(z) compilation
 - SDSS DR12 BAO consensus
 - DESI DR2 Gaussian BAO data

Place all files exactly under the paths shown above.

### Quick data status check

After creating the `data/` directory, you can quickly check that all
required files are visible to the package:

```bash
psi-check-data
```

or, equivalently:

```bash
python -m psi_continuum_v2.check_data
```

This command will report, for each dataset, whether the expected files
are present, for example:

```text
Pantheon+ SH0ES   OK
H(z) compilation  MISSING   → please place HZ_compilation.csv into ./data/hz/
SDSS DR12 BAO     OK
DESI DR2 BAO      MISSING   → please place DESI DR2 Gaussian files into ./data/desi/dr2/
```

When installed via pip, the tool looks for the data/ directory in your current working folder.

If some files are missing, the analysis scripts will raise a clear
FileNotFoundError with instructions on where to place the data.

**Now modules can be executed as:**

```bash
python -m psi_continuum_v2.analysis.sn_test_psicdm_pplus
```
---

## Running the Full Pipeline

Execute all analysis scripts sequentially:

```bash
./run_all.py
```

This runs:

1. check_models.py
2. sn_test_lcdm_pplus_simple.py
3. sn_test_psicdm_pplus.py
4. hz_test_psicdm.py
5. bao_desi_dr2_test.py
6. joint_fit_psicdm.py
7. scan_eps_psicdm.py
8. eps_best_joint_test.py
9. make_publication_plots.py

This script automatically loads the `psi_style.mplstyle` file to ensure consistent formatting.

Logs produced in:

```text
results/logs/
```

---

## Running Individual Scripts

Example:

```bash
python -m psi_continuum_v2.analysis.hz_test_psicdm
```

---

## Examples

Minimal demonstration scripts live in:

```text
examples/
```

Run example:

```bash
python examples/example_sn.py
```

---

## Output Structure

### Figures (publication-ready)

Stored in:

```text
results/figures/
```

Publication-ready figures are stored in:

`results/figures/publication/main_figures/`

Appendix figures in:

`results/figures/publication/appendix/`


### Tables

```text
results/tables/
```

### Logs

```text
results/logs/
```

---

## Plotting Style

All publication-ready figures use the custom Matplotlib style:

- `psi_continuum_v2/analysis/styles/`

contains the file:

- `textpsi_style.mplstyle`

This style enforces consistent fonts, line widths, grids, color palette, and
overall layout across all figures generated by the analysis pipeline
(`make_publication_plots.py`).

---

## Scientific Roadmap

Planned upgrades:

 - MCMC inference using emcee
 - Full DESI DR2 non-Gaussian BAO likelihood
 - Growth-rate constraints (fσ₈)
 - CMB distance-prior incorporation
 - Perturbation-theory extension of ΨCDM
 - Exploration of functional forms of g(z)

---

## License

This project is licensed under the terms of the MIT License.
See the **LICENSE** file for details.

---

## Citation

If you use Psi-Continuum v2 in academic work:

```
Klimov, D. V. (2025).
Psi–Continuum Cosmology v2: A Minimal One–Parameter Extension of ΛCDM.
Zenodo. DOI: (to appear)
```

Machine-readable citation is provided in CITATION.cff.

---

## Contact

 - Email: d.klimov.psi@gmail.com
 - Website: https://psi-continuum.org
 
