foregrounds_diffusion

Getting started

  • Scientific background and model overview
    • The cosmic microwave background and its foregrounds
    • Why model CIB and tSZ jointly?
    • The AGORA simulation
    • The flat-sky approximation
    • Denoising diffusion probabilistic models
    • Interpreting the validation statistics
  • Installation
    • Requirements
    • From source (recommended)
    • Optional dependencies
    • GPU training
    • SLURM cluster
  • Quickstart
    • Load patches and measure power spectra
    • Compute higher-order moments
    • Sample from a trained checkpoint
  • Data conventions
    • Array layout
    • Patch geometry
    • Normalisation
    • Masking and filtering
    • Multipole conventions
  • Contributing
    • Development setup
    • Running tests
    • Adding a module
    • Docstring style
    • Adding a tutorial notebook
    • Building the documentation locally

API reference

  • API Reference
    • flatmaps — Flat-sky Fourier utilities
    • preprocessing — Normalisation and patch extraction
    • moments — Power spectra and higher-order statistics
    • morphology — Minkowski functionals and tensors
    • masking — Peak masks and AGORA cluster masks
    • peak_counts — Peak and minima counting
    • statistics — 2D Gaussian fitting and summary stats
    • stacking — tSZ cluster stacking
    • scattering_stats — Scattering transform statistics
    • plot_style — Publication-quality Matplotlib style

Tutorials

  • 01 — Halo Catalogue
    • 1 Configuration
    • 2 Discover lightcone slice files
    • 3 Load and filter halos
    • 4 Save filtered catalogue
  • 02 — Masking
    • 1 Configuration
    • 2 Load raw maps
    • 3 Convert CIB units
    • 4 Point-source mask
    • 5 Cluster mask
    • 6 Apply masks and degrade
    • 7 Convert to physical units
    • 8 Save masked maps
  • 03 — Patch Extraction and Normalisation
    • 1 Configuration
    • 2 Generate patch centres
    • 3 Extract patches and filter empty regions
    • 4 Normalise and measure power spectra
    • 5 Save training arrays
  • 04 — Model Architecture and Training
    • 1 Setup
    • 2 U-Net and diffusion process
    • 3 Load and split training data
    • 4 Data augmentation
    • 5 Training loop
  • 05 — Sampling and Post-Processing
    • 1 Setup
    • 2 Load checkpoint
    • 3 Reverse diffusion sampling
    • 4 Post-sampling variance rescaling
    • 5 Save samples
  • 06 — Power Spectra Comparison
    • 1 Configuration
    • 2 Load and denormalise maps
    • 3 Inspect sample maps
    • 4 Compute power spectra
    • 5 Results and residuals
  • 07 — Higher-Order Statistics (Bispectrum and Trispectrum)
    • 1 Configuration
    • 2 Pre-compute band-pass filters
    • 3 Optional: ILC noise spectra
    • 4 Load and denormalise maps
    • 5 Compute summed-channel moments
    • 6 Compute cross-channel moments
    • 7 Save and reload
    • 8 Plot summed-channel moments
    • Cross-channel bi- and trispectrum (all CIB × tSZ combinations)
  • 08 — Pixel Histograms and Minkowski Functionals
    • 1 Setup
    • 2 Load maps
    • 3 Pixel intensity histograms
    • 4 Minkowski functional computation
    • 5 Plot Minkowski functionals
  • 09 — tSZ Cluster Stacking
    • 1 Configuration
    • 2 Load and denormalise maps
    • 3 Identify SNR pixels and extract cutouts
    • 4 Compute mean stacked profiles and radial averages
    • 5 Plot stacked images and radial profiles
  • 10 — Peak and Minima Counts
    • 5 Plot peak and minima counts
    • 6 Residuals: (Agora − DDPM) / σ_Agora
  • 11 — Scattering Transforms
    • Installation
    • Installation
    • 4 First-order coefficients — power vs scale
    • 5 Second-order coefficients — cross-scale coupling matrix
    • 6 Summary feature vector and standardised residuals
    • 7 Optional: scattering covariance C11 (Cheng et al. backend)
  • 12 — Minkowski Tensors
    • 5 Anisotropy index β(ν): comparing CIB and tSZ morphology
    • 6 Orientation distribution θ at representative thresholds
    • 7 Standardised residuals: (β_Agora − β_DDPM) / σ_Agora
  • 13 — Profiling and Benchmarking Baseline
    • 1 Setup
    • 2 Baseline measurements (pre-optimisation)
    • 3 Figures (pre-optimisation)
    • 7 Scaling law summary table (pre-optimisation)
    • 4 Optimisations applied
    • 5 Post-optimisation measurements
    • 6 Before/after comparison figures
    • 8 Parallel scaling (§3.2)
  • Paper figures
    • Fig 1
    • Multifrequency maps
    • tSZ-CIB maps
    • Moments
    • Minkowski Functionals
foregrounds_diffusion
  • API Reference
  • View page source

API Reference

All public modules in the foregrounds_diffusion package.

  • flatmaps — Flat-sky Fourier utilities
  • preprocessing — Normalisation and patch extraction
  • moments — Power spectra and higher-order statistics
  • morphology — Minkowski functionals and tensors
  • masking — Peak masks and AGORA cluster masks
  • peak_counts — Peak and minima counting
  • statistics — 2D Gaussian fitting and summary stats
  • stacking — tSZ cluster stacking
  • scattering_stats — Scattering transform statistics
  • plot_style — Publication-quality Matplotlib style
Previous Next

© Copyright 2026, Alex Blake Martín.

Built with Sphinx using a theme provided by Read the Docs.