# hr17291109/boss-dq-emulator architecture

> Architecture diagram of the GitHub repository hr17291109/boss-dq-emulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hr17291109/boss-dq-emulator
- Repository: https://github.com/hr17291109/boss-dq-emulator

## Overview

This repository estimates cosmological parameters by comparing Dark Quest halo-catalogue predictions with BOSS CMASS power-spectrum multipoles. The principal workflow runs an inner C++ search over the two galaxy–halo selection parameters: select halos, measure redshift-space multipoles, apply observational window effects, and record fit quality. An outer Python workflow aggregates those scores, fits a Gaussian-process emulator, and samples cosmological posteriors. The README documents these stages; several internal call details and some Python data-loading connections were not shown, so those links are omitted.

Main entry points: [`halos_mcmc.cpp`](https://github.com/hr17291109/boss-dq-emulator/blob/main/halos_mcmc.cpp) (Inner MCMC), [`fielddata.hpp`](https://github.com/hr17291109/boss-dq-emulator/blob/main/fielddata.hpp) (Field & Power), [`pk_tools.hpp`](https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_tools.hpp) (Window & Chi-square), [`cosmo_inference.py`](https://github.com/hr17291109/boss-dq-emulator/blob/main/cosmo_inference.py) (GP & Posterior MCMC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cpp["C++ Fit Pipeline"]
  node_halos_mcmc["Inner MCMC<br/>[halos_mcmc.cpp]"]
  node_chain["Fit Scores"]
end

subgraph group_physics["Simulation Physics"]
  node_selection["Halo Selection<br/>[select_halos.hpp]"]
  node_field["Field &amp; Power<br/>[fielddata.hpp]"]
  node_cosmo["Cosmology Functions<br/>[cosmo.hpp]"]
  node_transfer["Transfer Functions<br/>[transfer.hpp]"]
  node_hod["Galaxy–Halo Model<br/>[hod.hpp]"]
end

subgraph group_python["Python Inference"]
  node_cosmo_inference["GP &amp; Posterior MCMC<br/>[cosmo_inference.py]"]
  node_inference_runner["Inference Runner"]
  node_diagnostics["Chain Diagnostics<br/>[plot_ghc_mcmc.py]"]
  node_diagnostic_runner["Diagnostics Runner"]
  node_posterior["Cosmological Posterior"]
end

subgraph group_compare["Observation Comparison"]
  node_pktools_cpp["Window &amp; Chi-square<br/>[pk_tools.hpp]"]
  node_observations[("BOSS Inputs")]
  node_pk_compare["Python Comparison<br/>[pk_compare.py]"]
  node_pktools_py["Python Power Tools<br/>[pk_tools.py]"]
  node_scpt["Comparison Runner<br/>[scpt.py]"]
end

subgraph group_support["Shared Numerics"]
  node_binned["Binned Data<br/>[binneddata.hpp]"]
  node_binned2d["2D Binned Data<br/>[binneddata_2D.hpp]"]
  node_binning["Power Binning<br/>[binning.hpp]"]
  node_loader["File Loading<br/>[fileloader.hpp]"]
  node_filenames["Simulation Paths<br/>[filenames.hpp]"]
  node_params["Parameter Parsing<br/>[param.hpp]"]
end

node_researcher(("Researcher"))
node_config["Run Configuration"]

node_researcher -->|"runs"| node_halos_mcmc
node_config -->|"configures"| node_halos_mcmc
node_halos_mcmc -->|"selects halos"| node_selection
node_halos_mcmc -->|"measures multipoles"| node_field
node_halos_mcmc -->|"evaluates fit"| node_pktools_cpp
node_selection -->|"provides catalog"| node_field
node_field -.->|"uses cosmology"| node_cosmo
node_field -.->|"applies transfer"| node_transfer
node_halos_mcmc -.->|"uses model"| node_hod
node_pktools_cpp -->|"loads window and covariance"| node_observations
node_observations -->|"supplies comparison data"| node_pk_compare
node_pk_compare -->|"uses tools"| node_pktools_py
node_scpt -->|"runs"| node_pk_compare
node_halos_mcmc -->|"writes fit scores"| node_chain
node_chain -->|"aggregates scores"| node_cosmo_inference
node_inference_runner -->|"runs"| node_cosmo_inference
node_cosmo_inference -->|"samples posterior"| node_posterior
node_diagnostic_runner -->|"runs"| node_diagnostics
node_diagnostics -->|"reads chains"| node_chain
node_halos_mcmc -.->|"loads inputs"| node_loader
node_halos_mcmc -.->|"uses paths"| node_filenames
node_halos_mcmc -.->|"reads parameters"| node_params
node_field -.->|"bins measurements"| node_binned
node_field -.->|"bins measurements"| node_binned2d
node_pktools_cpp -.->|"uses bin grid"| node_binning

click node_config "https://github.com/hr17291109/boss-dq-emulator/blob/main/configs_example/example_highz_ngc.yaml"
click node_halos_mcmc "https://github.com/hr17291109/boss-dq-emulator/blob/main/halos_mcmc.cpp"
click node_selection "https://github.com/hr17291109/boss-dq-emulator/blob/main/select_halos.hpp"
click node_field "https://github.com/hr17291109/boss-dq-emulator/blob/main/fielddata.hpp"
click node_cosmo "https://github.com/hr17291109/boss-dq-emulator/blob/main/cosmo.hpp"
click node_transfer "https://github.com/hr17291109/boss-dq-emulator/blob/main/transfer.hpp"
click node_hod "https://github.com/hr17291109/boss-dq-emulator/blob/main/hod.hpp"
click node_pktools_cpp "https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_tools.hpp"
click node_binned "https://github.com/hr17291109/boss-dq-emulator/blob/main/binneddata.hpp"
click node_binned2d "https://github.com/hr17291109/boss-dq-emulator/blob/main/binneddata_2D.hpp"
click node_binning "https://github.com/hr17291109/boss-dq-emulator/blob/main/binning.hpp"
click node_loader "https://github.com/hr17291109/boss-dq-emulator/blob/main/fileloader.hpp"
click node_filenames "https://github.com/hr17291109/boss-dq-emulator/blob/main/filenames.hpp"
click node_params "https://github.com/hr17291109/boss-dq-emulator/blob/main/param.hpp"
click node_pk_compare "https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_compare.py"
click node_pktools_py "https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_tools.py"
click node_scpt "https://github.com/hr17291109/boss-dq-emulator/blob/main/scpt.py"
click node_cosmo_inference "https://github.com/hr17291109/boss-dq-emulator/blob/main/cosmo_inference.py"
click node_inference_runner "https://github.com/hr17291109/boss-dq-emulator/blob/main/run_cosmo_inference.py"
click node_diagnostics "https://github.com/hr17291109/boss-dq-emulator/blob/main/plot_ghc_mcmc.py"
click node_diagnostic_runner "https://github.com/hr17291109/boss-dq-emulator/blob/main/run_mcmc_diagnostics.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_halos_mcmc,node_chain toneBlue
class node_selection,node_field,node_cosmo,node_transfer,node_hod toneAmber
class node_cosmo_inference,node_inference_runner,node_diagnostics,node_diagnostic_runner,node_posterior toneMint
class node_pktools_cpp,node_observations,node_pk_compare,node_pktools_py,node_scpt toneRose
class node_binned,node_binned2d,node_binning,node_loader,node_filenames,node_params,node_researcher toneIndigo
class node_config toneTeal
```

## Components

### C++ Fit Pipeline

- [Inner MCMC](https://github.com/hr17291109/boss-dq-emulator/blob/main/halos_mcmc.cpp): `halos_mcmc.cpp`
- **Fit Scores**

### Simulation Physics

- [Halo Selection](https://github.com/hr17291109/boss-dq-emulator/blob/main/select_halos.hpp): `select_halos.hpp`
- [Field & Power](https://github.com/hr17291109/boss-dq-emulator/blob/main/fielddata.hpp): `fielddata.hpp`
- [Cosmology Functions](https://github.com/hr17291109/boss-dq-emulator/blob/main/cosmo.hpp): `cosmo.hpp`
- [Transfer Functions](https://github.com/hr17291109/boss-dq-emulator/blob/main/transfer.hpp): `transfer.hpp`
- [Galaxy–Halo Model](https://github.com/hr17291109/boss-dq-emulator/blob/main/hod.hpp): `hod.hpp`

### Python Inference

- [GP & Posterior MCMC](https://github.com/hr17291109/boss-dq-emulator/blob/main/cosmo_inference.py): `cosmo_inference.py`
- [Inference Runner](https://github.com/hr17291109/boss-dq-emulator/blob/main/run_cosmo_inference.py): `run_cosmo_inference.py`
- [Chain Diagnostics](https://github.com/hr17291109/boss-dq-emulator/blob/main/plot_ghc_mcmc.py): `plot_ghc_mcmc.py`
- [Diagnostics Runner](https://github.com/hr17291109/boss-dq-emulator/blob/main/run_mcmc_diagnostics.py): `run_mcmc_diagnostics.py`
- **Cosmological Posterior**

### Observation Comparison

- [Window & Chi-square](https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_tools.hpp): `pk_tools.hpp`
- **BOSS Inputs**
- [Python Comparison](https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_compare.py): `pk_compare.py`
- [Python Power Tools](https://github.com/hr17291109/boss-dq-emulator/blob/main/pk_tools.py): `pk_tools.py`
- [Comparison Runner](https://github.com/hr17291109/boss-dq-emulator/blob/main/scpt.py): `scpt.py`

### Shared Numerics

- [Binned Data](https://github.com/hr17291109/boss-dq-emulator/blob/main/binneddata.hpp): `binneddata.hpp`
- [2D Binned Data](https://github.com/hr17291109/boss-dq-emulator/blob/main/binneddata_2D.hpp): `binneddata_2D.hpp`
- [Power Binning](https://github.com/hr17291109/boss-dq-emulator/blob/main/binning.hpp): `binning.hpp`
- [File Loading](https://github.com/hr17291109/boss-dq-emulator/blob/main/fileloader.hpp): `fileloader.hpp`
- [Simulation Paths](https://github.com/hr17291109/boss-dq-emulator/blob/main/filenames.hpp): `filenames.hpp`
- [Parameter Parsing](https://github.com/hr17291109/boss-dq-emulator/blob/main/param.hpp): `param.hpp`

### Other components

- **Researcher**
- [Run Configuration](https://github.com/hr17291109/boss-dq-emulator/blob/main/configs_example/example_highz_ngc.yaml): `configs_example/example_highz_ngc.yaml`

## Connections

- Researcher → Inner MCMC: runs (evidence: `README.md`)
- Run Configuration → Inner MCMC: configures (evidence: `README.md`)
- Inner MCMC → Halo Selection: selects halos (evidence: `README.md`)
- Inner MCMC → Field & Power: measures multipoles (evidence: `README.md`)
- Inner MCMC → Window & Chi-square: evaluates fit (evidence: `README.md`)
- Halo Selection → Field & Power: provides catalog (evidence: `README.md`)
- Field & Power → Cosmology Functions: uses cosmology (evidence: `fielddata.hpp`)
- Field & Power → Transfer Functions: applies transfer (evidence: `fielddata.hpp`)
- Inner MCMC → Galaxy–Halo Model: uses model
- Window & Chi-square → BOSS Inputs: loads window and covariance (evidence: `README.md`)
- BOSS Inputs → Python Comparison: supplies comparison data (evidence: `README.md`)
- Python Comparison → Python Power Tools: uses tools (evidence: `pk_compare.py`)
- Comparison Runner → Python Comparison: runs (evidence: `scpt.py`)
- Inner MCMC → Fit Scores: writes fit scores (evidence: `README.md`)
- Fit Scores → GP & Posterior MCMC: aggregates scores (evidence: `README.md`)
- Inference Runner → GP & Posterior MCMC: runs (evidence: `run_cosmo_inference.py`)
- GP & Posterior MCMC → Cosmological Posterior: samples posterior (evidence: `README.md`)
- Diagnostics Runner → Chain Diagnostics: runs (evidence: `run_mcmc_diagnostics.py`)
- Chain Diagnostics → Fit Scores: reads chains (evidence: `README.md`)
- Inner MCMC → File Loading: loads inputs (evidence: `halos_mcmc.cpp`)
- Inner MCMC → Simulation Paths: uses paths (evidence: `halos_mcmc.cpp`)
- Inner MCMC → Parameter Parsing: reads parameters (evidence: `halos_mcmc.cpp`)
- Field & Power → Binned Data: bins measurements (evidence: `fielddata.hpp`)
- Field & Power → 2D Binned Data: bins measurements (evidence: `fielddata.hpp`)
- Window & Chi-square → Power Binning: uses bin grid (evidence: `pk_tools.hpp`)
