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
Index
Index
A
|
B
|
C
|
D
|
E
|
F
|
G
|
I
|
L
|
M
|
R
|
S
|
W
A
apodize_binary_mask_prof() (in module foregrounds_diffusion.masking)
apply() (in module foregrounds_diffusion.plot_style)
apply_maxmin_normalization() (in module foregrounds_diffusion.preprocessing)
apply_stdnorm() (in module foregrounds_diffusion.preprocessing)
augment_images_unique() (in module foregrounds_diffusion.preprocessing)
B
bandpass_filter() (in module foregrounds_diffusion.flatmaps)
boundary_apod_mask() (in module foregrounds_diffusion.masking)
build_lbin_idx_fft2() (in module foregrounds_diffusion.flatmaps)
C
cl2map() (in module foregrounds_diffusion.flatmaps)
cl_to_cl2d() (in module foregrounds_diffusion.flatmaps)
compute_cross_moments() (in module foregrounds_diffusion.moments)
compute_mfs() (in module foregrounds_diffusion.morphology)
compute_minkowski_tensors() (in module foregrounds_diffusion.morphology)
compute_peak_minima_counts() (in module foregrounds_diffusion.peak_counts)
compute_scattering_coefficients() (in module foregrounds_diffusion.scattering_stats)
compute_scattering_covariance() (in module foregrounds_diffusion.scattering_stats)
compute_summed_moments() (in module foregrounds_diffusion.moments)
convert_eb_qu() (in module foregrounds_diffusion.flatmaps)
count_minima_binned() (in module foregrounds_diffusion.peak_counts)
count_peaks_binned() (in module foregrounds_diffusion.peak_counts)
D
denormalize_dm_maps() (in module foregrounds_diffusion.preprocessing)
E
extract_cutouts() (in module foregrounds_diffusion.stacking)
F
find_minima() (in module foregrounds_diffusion.peak_counts)
find_peaks() (in module foregrounds_diffusion.peak_counts)
fitgaussian() (in module foregrounds_diffusion.statistics)
fitting_func() (in module foregrounds_diffusion.statistics)
foregrounds_diffusion.flatmaps
module
foregrounds_diffusion.masking
module
foregrounds_diffusion.moments
module
foregrounds_diffusion.morphology
module
foregrounds_diffusion.peak_counts
module
foregrounds_diffusion.plot_style
module
foregrounds_diffusion.preprocessing
module
foregrounds_diffusion.scattering_stats
module
foregrounds_diffusion.stacking
module
foregrounds_diffusion.statistics
module
G
gaussian() (in module foregrounds_diffusion.statistics)
get_apodised_mdpl2_cluster_mask() (in module foregrounds_diffusion.masking)
get_cluster_mask_radius() (in module foregrounds_diffusion.masking)
get_lpf_hpf() (in module foregrounds_diffusion.flatmaps)
(in module foregrounds_diffusion.preprocessing)
get_lxly() (in module foregrounds_diffusion.flatmaps)
get_lxly_az_angle() (in module foregrounds_diffusion.flatmaps)
get_mask_using_gaussian_fitting() (in module foregrounds_diffusion.masking)
get_mdpl2_conversion_factors_K_to_MjyperSr() (in module foregrounds_diffusion.masking)
get_mdpl2_halo_cat() (in module foregrounds_diffusion.masking)
get_patch_centers() (in module foregrounds_diffusion.preprocessing)
get_peak_masks() (in module foregrounds_diffusion.masking)
get_point_source_mask_in_healpix() (in module foregrounds_diffusion.masking)
I
inpaint_masked_regions() (in module foregrounds_diffusion.masking)
L
load_all_moments() (in module foregrounds_diffusion.preprocessing)
M
make_gaussian_realisation() (in module foregrounds_diffusion.flatmaps)
map2cl() (in module foregrounds_diffusion.flatmaps)
map2cl_torch() (in module foregrounds_diffusion.flatmaps)
mean_cls() (in module foregrounds_diffusion.moments)
mean_cross_cls() (in module foregrounds_diffusion.moments)
module
foregrounds_diffusion.flatmaps
foregrounds_diffusion.masking
foregrounds_diffusion.moments
foregrounds_diffusion.morphology
foregrounds_diffusion.peak_counts
foregrounds_diffusion.plot_style
foregrounds_diffusion.preprocessing
foregrounds_diffusion.scattering_stats
foregrounds_diffusion.stacking
foregrounds_diffusion.statistics
moments() (in module foregrounds_diffusion.statistics)
R
radial_profile() (in module foregrounds_diffusion.flatmaps)
renormalize_dm_maps() (in module foregrounds_diffusion.preprocessing)
replace_zeros_with_neighbor_avg() (in module foregrounds_diffusion.preprocessing)
rescale_samples() (in module foregrounds_diffusion.preprocessing)
S
scattering_summary() (in module foregrounds_diffusion.scattering_stats)
select_snr_pixels() (in module foregrounds_diffusion.stacking)
smooth_map() (in module foregrounds_diffusion.peak_counts)
split_data_to_tensors() (in module foregrounds_diffusion.preprocessing)
stats() (in module foregrounds_diffusion.statistics)
W
wiener_filter() (in module foregrounds_diffusion.preprocessing)