Portfolio Projects Weak-lensing GAN
Machine learning × cosmology

Generating non-Gaussian weak-lensing maps with a four-bin GAN

A joint tomographic generative model that starts from correlated Gaussian convergence fields and learns the nonlinear, non-Gaussian structure of simulated matter maps—while checking one-point statistics, spatial correlations, auto-power, and cross-power between redshift bins.

4joint tomographic channels
256²pixels per convergence map
3,000individual maps in the main run
750four-channel model samples
9.33 Mtrainable GAN parameters
2maps per training batch
01 · Scientific question

Why transform a Gaussian map at all?

Weak gravitational lensing measures how foreground matter distorts images of background galaxies. The convergence field, \(\kappa\), is a projected map of matter overdensity along the line of sight.

Gaussian input

Correct two-point structure

A Gaussian random field can be generated to follow a specified power spectrum and cross-bin covariance.

Missing physics

No nonlinear tail

A Gaussian field does not naturally contain the asymmetric peaks, voids, skewness, or kurtosis created by nonlinear structure formation.

Learning target

Add non-Gaussian structure

The GAN learns to turn the Gaussian ensemble into a generated ensemble that resembles cosmological simulations.

\[ G:\;\kappa_{\mathrm{GRF}} \longrightarrow \widehat{\kappa}_{\mathrm{NG}} \]

Here \(G\) is the generator, \(\kappa_{\mathrm{GRF}}\) is the Gaussian convergence input, and \(\widehat{\kappa}_{\mathrm{NG}}\) is the generated non-Gaussian candidate. The word candidate matters: the discriminator decides whether its local patches resemble real simulation patches.

Essential scientific interpretation. The Gaussian input and the real simulation map shown beside it are independent, unpaired realizations. The real map is a sample from the desired distribution, not the pixel-by-pixel answer for that Gaussian input.
02 · Complete pipeline

From simulations to a tested generator

The project separates data construction, training, checkpoint selection, and held-out diagnostics so that validation and test maps do not leak into the training references.

  1. Loading: read finite numeric NumPy arrays and preserve the channel order.
  2. Leakage-safe splitting: keep all bins from one simulation in exactly one split.
  3. GRF statistics: estimate input covariance only from training targets.
  4. Generation: create new independent GRF realizations with the desired covariance.
  5. Batching: deliver normalized tensors in batches of two.
  6. Adversarial learning: alternate discriminator and generator optimization.
  7. Physics constraints: compare generated ensemble statistics with fixed training references.
  8. Validation: measure generalization without updating either network.
  9. Checkpointing: save the best, latest stable, and periodic states.
  10. Testing: use the untouched 10% split for final maps and ensemble summaries.
03 · Data and tomography

Four views of the same cosmic structure

Every simulation file contains four convergence maps. Each channel corresponds to a source-redshift bin, so the bins observe related projected structure through different lensing kernels and path lengths.

Four weak-lensing convergence maps from one simulation, with a pixel distribution for each tomographic channel.
One simulation, four tomographic channels. Positive \(\kappa\) traces projected overdensity and negative \(\kappa\) traces projected underdensity. Click any project figure to open it at full web resolution.

What the tensor shape means

\[ \text{batch tensor shape}=B\times C\times H\times W =2\times4\times256\times256 \]
B · Batch

Two independent model samples processed together in one optimizer step.

C · Channels

Four ordered tomographic redshift bins kept together as one sample.

H · Height

256 pixel rows in the flat-sky convergence tile.

W · Width

256 pixel columns in the same tile.

How 3,000 maps become 750 model samples

The command-line option --number-of-maps 3000 counts individual single-channel maps. Because every model sample uses four channels, the main experiment loads \(3000/4=750\) simulation groups. The deterministic group split gives:

SplitFractionFour-channel samplesPurpose
Training80%600Update weights and build GRF/physics references
Validation10%75Select checkpoints and monitor generalization
Test10%75Final held-out ensemble diagnostics only

Normalization

Neural networks train more stably when values are centered and similarly scaled. The loaded GRF ensemble \(X\) and target ensemble \(Y\) are standardized separately:

\[ x_{\mathrm{norm}}=\frac{x-\mu_X}{\sigma_X}, \qquad y_{\mathrm{norm}}=\frac{y-\mu_Y}{\sigma_Y}. \]

The four scalar constants \(\mu_X,\sigma_X,\mu_Y,\sigma_Y\) are saved in every checkpoint. For plots, the generated normalized map is converted back to physical convergence units with \(\widehat y=\sigma_Y\widehat y_{\mathrm{norm}}+\mu_Y\).

04 · Correlated Gaussian inputs

How the four redshift bins remain correlated

Four independent GRFs would destroy tomography. Instead, this pipeline estimates a complete scale-dependent \(4\times4\) Fourier covariance matrix and uses it to mix four white-noise fields.

\[ P_{ij}(k)= \left\langle \widetilde{\kappa}_i(\mathbf{k}) \widetilde{\kappa}_j^*(\mathbf{k}) \right\rangle. \]

\(i\) and \(j\) label tomographic bins; the tilde denotes a Fourier transform; the star denotes complex conjugation; and angle brackets mean an average over training realizations and Fourier modes in one radial bin.

\[ C(\mathbf{k})=L(\mathbf{k})L(\mathbf{k})^T, \qquad \widetilde{\kappa}_G(\mathbf{k})=L(\mathbf{k})z(\mathbf{k}), \qquad \mathbb E[\widetilde{\kappa}_G\widetilde{\kappa}_G^\dagger]=C. \]
What is preserved and what is absent? The input GRFs reproduce two-point auto- and cross-power statistics. They still lack non-Gaussian higher-order correlations, asymmetric peaks, and nonlinear structures. Those are left for the generator to learn.
05 · Terminology from first principles

Every building block used by the model

These definitions connect the code words to what physically happens to a \(256\times256\) convergence map.

Tensor
A multidimensional numerical array. A training batch is indexed by sample, channel, row, and column.
Channel
One ordered map plane. Here channels 1–4 represent four tomographic source-redshift bins.
Feature map
An internal learned representation. A feature channel might respond to peaks, edges, voids, or textures rather than a redshift bin.
Convolution
A small learned filter slides across the map and combines nearby pixels. The same filter weights are reused at every position.
Kernel
The local filter window. A 3×3 kernel reads a pixel and its eight immediate neighbours; a 4×4 kernel reads sixteen local values.
Stride
How far the kernel moves. Stride 1 checks every location; stride 2 moves two pixels and roughly halves the spatial resolution.
Padding
Extra boundary values supplied when a kernel reaches beyond an edge, allowing controlled output dimensions.
Reflection padding
Boundary values are mirrored from inside the map instead of inserting zeros. It reduces artificial dark borders but is not periodic padding.
ReLU
The activation \(\max(0,z)\). It keeps positive responses and sets negative responses to zero, making the network nonlinear.
LeakyReLU
Like ReLU, but negative values become \(0.2z\) rather than zero. This preserves a gradient for negative discriminator activations.
Activation function
A nonlinear transformation after a layer. Without it, many stacked convolutions would collapse into one linear operation.
Max pooling
A 2×2 window retains the largest response and advances by two pixels, reducing width and height while keeping strong local features.
Encoder
The contracting half of the U-Net. It reduces spatial resolution and increases feature channels to learn progressively broader context.
Bottleneck
The deepest 16×16, 512-channel representation. It has the widest contextual view but still retains a spatial grid.
Decoder
The expanding half of the U-Net. It restores the map resolution while combining deep context with saved fine-scale features.
Bilinear upsampling
A smooth interpolation that doubles height and width using nearby values, followed here by a learned convolution.
Skip connection
A direct path from an encoder scale to the matching decoder scale, preventing fine spatial information from being lost.
Concatenation
Stacking channels. A decoder feature tensor and its encoder skip tensor are joined along the channel axis.
1×1 convolution
A learned channel mixer at each pixel. The final generator layer converts 32 features into four convergence outputs.
Residual
A learned correction added to an existing field. In physics mode the U-Net predicts what must be added to the GRF.
Parameter
A learned weight or bias. Optimization adjusts parameters to reduce the chosen loss.
Batch
A small group processed before one optimizer update. The project uses batch size 2 to fit 256² four-channel maps on available hardware.
Epoch
One complete pass through all 600 training samples. With batch size 2, one epoch contains 300 training batches.
Loss function
A differentiable numerical objective. Smaller is better for that specific term, but GAN losses must be interpreted jointly.
Gradient
The derivative of the loss with respect to each parameter; it indicates how a small parameter change alters the loss.
Backpropagation
Applying the chain rule backward through the computation graph to calculate all parameter gradients.
Optimizer
The rule that converts gradients into parameter updates. Both networks use Adam with \(\beta_1=0.5,\beta_2=0.999\).
Learning rate
The update scale. Too high can destabilize training; too low can make learning extremely slow.
Logit
An unrestricted discriminator score before sigmoid. Positive logits favour “real”; negative logits favour “generated.”
BCE with logits
Binary cross-entropy combined with sigmoid in one numerically stable operation.
GroupNorm
Normalizes groups of feature channels inside each sample, avoiding unreliable batch statistics when the batch size is only two.
Fourier transform
Rewrites a map as spatial-frequency modes. Large structures occupy low frequencies and fine structures occupy high frequencies.
Power spectrum
The average squared Fourier amplitude versus scale; a two-point statistical summary of spatial structure.
One-point PDF
The distribution of individual pixel values without using their locations. It exposes asymmetry, tails, peaks, skewness, and kurtosis.
Two-point correlation
The average product of map values separated by distance \(r\), measuring how pixels co-vary across spatial separation.
Auto-power
A spectrum within one bin, such as \(C_\ell^{11}\) or \(C_\ell^{44}\).
Cross-power
A spectrum between two bins, such as \(C_\ell^{41}=C_\ell^{14}\), measuring shared scale-dependent structure.
Tomography
Using multiple source-redshift slices to obtain depth-dependent information rather than one projected map alone.
06 · Generator

The U-Net: compress context, then rebuild detail

The generator transforms a normalized four-channel GRF tensor into four generated channels. It contains 8,630,884 trainable parameters and no separate random-noise vector: with fixed weights, the same input produces the same output.

Solid arrows show the main forward path. Dashed arrows are the four U-Net skip connections that move saved encoder features directly to the decoder at the same spatial resolution.

What happens inside one DoubleConv block?

Padding is one pixel on every side, so a stride-1 3×3 convolution preserves height and width. Because padding mode is reflect, pixels needed beyond the edge are mirrored from inside the tile. For example, an edge sequence [a, b, c, d] behaves locally like [b, a, b, c, d, c] rather than being surrounded by zeros.

Layer-by-layer generator dimensions

StageOperationOutputWhy it exists
InputNormalized GRFB × 4 × 256 × 256Four correlated tomographic fields
x₁DoubleConv 4→32B × 32 × 256 × 256Fine pixel-scale features
x₂Pool + DoubleConv 32→64B × 64 × 128 × 128Slightly broader spatial context
x₃Pool + DoubleConv 64→128B × 128 × 64 × 64Intermediate structures
x₄Pool + DoubleConv 128→256B × 256 × 32 × 32Coarse structures
BottleneckPool + DoubleConv 256→512B × 512 × 16 × 16Deep multiscale context
Decoder 1Upsample, Conv, concat x₄, DoubleConvB × 256 × 32 × 32Start spatial reconstruction
Decoder 2Upsample, Conv, concat x₃, DoubleConvB × 128 × 64 × 64Combine context and intermediate detail
Decoder 3Upsample, Conv, concat x₂, DoubleConvB × 64 × 128 × 128Restore smaller-scale structure
Decoder 4Upsample, Conv, concat x₁, DoubleConvB × 32 × 256 × 256Recover full-resolution detail
Output1×1 Conv 32→4B × 4 × 256 × 256Produce one value per bin and pixel

Where the 8,630,884 generator parameters are

Generator componentTrainable parametersRole
First encoder block, 4→3210,432Convert four input bins into 32 learned features
Encoder down 155,42432→64 features
Encoder down 2221,44064→128 features
Encoder down 3885,248128→256 features
Bottleneck block3,539,968256→512 deepest representation
Decoder up 12,949,888512 bottleneck to 256 decoded features
Decoder up 2737,664256→128 decoded features
Decoder up 3184,512128→64 decoded features
Decoder up 446,17664→32 full-resolution features
Final 1×1 convolution13232 features→4 output bins
Generator total8,630,884Approximately 92.5% of the complete GAN

Direct output versus residual output

Adversarial mode

The U-Net output is the map

\(\widehat y_{\mathrm{norm}}=G(x_{\mathrm{norm}})\)

The network must learn both large-scale structure and non-Gaussian corrections through adversarial feedback alone.

Physics mode

The U-Net output is a correction

\(\widehat y_{\mathrm{norm}}=x_{Y\text{-units}}+s\,G(x_{\mathrm{norm}})\)

The GRF supplies the baseline field. The U-Net learns the residual needed to make it non-Gaussian; \(s=1\) in the main run.

A fresh physics run initializes the final convolution to zero. Therefore the initial residual is exactly zero and the complete initial output is the Gaussian input expressed in target-normalized units. Training then learns deviations from that controlled starting point.

07 · Discriminator

A local realism critic with 900 overlapping decisions

The discriminator contains 695,649 parameters. It is unconditioned: it sees a real or generated four-channel candidate, but it never sees the corresponding Gaussian input.

Why is it called PatchGAN?

The final output is not one global “real/fake” number. It is a 30×30 grid, giving 900 logits for each map. One logit depends on a 70×70 input region. Neighbouring logits have centers separated by eight pixels, so their judged regions overlap strongly.

LayerReceptive fieldPatch-center spacingInterpretation
Conv 14×42 pixelsVery local texture
Conv 210×104 pixelsSmall structures
Conv 322×228 pixelsIntermediate structures
Conv 446×468 pixelsBroader patch context
Conv 570×708 pixelsFinal local realism judgment
Reflection padding

Avoids inserting zero-valued borders near patch edges.

GroupNorm

Normalizes within each sample, making it stable for batch size two.

No final sigmoid

The network returns logits; BCEWithLogitsLoss handles sigmoid internally.

Where the 695,649 discriminator parameters are

Discriminator componentTrainable parametersNotes
Conv 1, 4→322,080First four-channel local filters
Conv 2, 32→6432,832Second stride-2 convolution
GroupNorm 64128One scale and shift per channel
Conv 3, 64→128131,200Third stride-2 convolution
GroupNorm 128256One scale and shift per channel
Conv 4, 128→256524,544Stride-1 patch refinement
GroupNorm 256512One scale and shift per channel
Conv 5, 256→14,097Produces the 30×30 logit grid
Discriminator total695,649Approximately 7.5% of the complete GAN
What the discriminator can and cannot enforce. Because it sees all four channels, it can learn local cross-bin relationships. Because it is local and does not see the GRF input, it cannot by itself guarantee correct whole-map power, input-output phase preservation, or correspondence with a particular GRF realization.
08 · Training and losses

Two networks learn through different gradient paths

The generated tensor is used twice: detached when teaching the discriminator, and connected to the computation graph when teaching the generator.

Discriminator objective

\[ \mathcal L_D= \operatorname{BCEWithLogits}(D(y),0.9) + \operatorname{BCEWithLogits}(D(\widehat y),0). \]

Label smoothing changes the real target from 1.0 to 0.9. The fake target stays 0. The code sums the real and fake losses; it does not divide their sum by two.

Generator adversarial objective

\[ \mathcal L_{G,\mathrm{adv}}= \operatorname{BCEWithLogits}(D(\widehat y),1). \]

The generator tries to move every fake patch logit toward the “real” target. Discriminator parameters are frozen for this update, but its operations remain differentiable, so gradients continue backward into the generator.

Physics-mode generator objective

\[ \mathcal L_G= \mathcal L_{\mathrm{adv}} +10\,\mathcal L_{\mathrm{low}} +5\,\mathcal L_P +1\,\mathcal L_{1\mathrm{pt}}. \]
TermWeightWhat is comparedWhy it is needed
Adversarial BCE1Generated patch logits against real target 1Local non-Gaussian realism
Low-frequency L110Generated and input Fourier modes below 0.125 NyquistPreserve large-scale GRF structure
Radial power5Log generated ensemble-mean power against fixed training power in 20 binsControl spatial variance versus scale
One-point statistics1Mean, standard deviation, skewness, and excess kurtosisControl the asymmetric pixel distribution and tails

Main physics-run hyperparameters

Generator LR

2 × 10⁻⁴

Adam step scale for the U-Net.

Discriminator LR

1 × 10⁻⁵

Lower rate to prevent D from racing ahead.

D schedule

Every 2 G steps

Generator still updates every batch.

Instance noise

0.1 → 0

Linearly decays over the first 20 epochs.

  1. Set deterministic Python, NumPy, and PyTorch seeds.
  2. Select CUDA if available, otherwise Apple MPS, otherwise CPU.
  3. Construct the four-channel U-Net and four-channel PatchGAN.
  4. For a fresh physics run, zero-initialize the generator output layer.
  5. Build fixed power and moment references from training targets only.
  6. Loop over 300 training batches per epoch.
  7. Update the discriminator on its scheduled batches.
  8. Update the generator on every batch.
  9. Average each metric over the number of samples, not just batches.
  10. Run 38 validation batches with both networks in evaluation mode.
  11. Save history, quick validation maps, and checkpoint states.

Automatic collapse monitoring

GAN loss is a competition, so a very strong discriminator can starve the generator of useful gradients. The configured safety check can stop when either discriminator train/validation loss falls below 0.4 while either generator adversarial train/validation loss exceeds 2.0, after the warm-up. The rejected state is saved separately as collapse_detected.pt.

A low discriminator loss is not automatically a successful model. Losses must always be interpreted with validation maps, PDFs, correlations, and spectra.
09 · Checkpoints and outputs

What is saved, where it goes, and which state to use

checkpoints_original_allbins_3000maps_physics_joint_3000maps_v1/ ├── best.pt lowest validation total generator loss ├── latest.pt most recent accepted stable epoch ├── epoch_0005.pt periodic snapshot every five epochs ├── epoch_0010.pt ├── ... └── collapse_detected.pt only when the safety check rejects an epoch outputs_original_allbins_3000maps_physics_joint_3000maps_v1/ ├── history.json numerical training/validation history ├── loss_curves.png continuously updated training plot ├── validation_epoch_0001.png ├── validation_epoch_0005.png └── ... plots_original_allbins_3000maps_physics_joint_3000maps_v1/ └── latest_epoch_0219/ ├── validation_examples_6x6_stats.png ├── test_examples_6x6_stats.png ├── loss_curves.png ├── test_power_spectrum_all_test_maps_mean_2sigma.png ├── C11_C41_C44_raw_inverse_pixel.png └── C11_C41_C44_rescaled_ell_max1000.png

Every checkpoint stores the epoch, both networks, both Adam optimizer states, complete metric history, command-line arguments, normalization constants, and number of channels.

Primary report

best.pt

Use for the main validation/test result because physics mode selects it using the lowest validation total generator loss.

Resume training

latest.pt

Use to continue from the most recent accepted stable epoch with matching run settings.

Evolution study

epoch_XXXX.pt

Use when comparing the same held-out test input across exact saved epochs.

Reproducible training command

python train_original.py \
  --tomographic-bin all \
  --number-of-maps 3000 \
  --grf-radial-bins 25 \
  --loss-function physics \
  --epochs 500 \
  --run-tag physics_joint_3000maps_v1

On resume, --epochs 500 means continue until the total epoch number reaches 500; it does not add 500 more epochs.

10 · Held-out diagnostics

Reading the maps and statistics together

These figures were generated from the physics run's epoch-219 checkpoint. Ensemble spectra use all 75 held-out test realizations. The checkpoint is a captured training state, not a claim that epoch 219 is the final or best scientific model.

The 6×6 diagnostic layout

ColumnQuantityQuestion answered
1Correlated Gaussian inputWhat field entered the four-channel generator?
2Real simulation, unpairedWhat does one independent target-distribution sample look like?
3Generated mapWhat non-Gaussian candidate did the generator produce?
4One-point PDFDoes the generated pixel distribution reproduce the simulation peak and tails?
5Two-point correlationDoes generated spatial correlation versus pixel separation resemble the simulation?
6Fourier input-output correlationAt which scales does the generated output preserve the GRF input?
The generator processes all four channels. The current 6×6 figure displays tomographic bin 1 for readability. A visual difference between the real and generated maps is not a pixelwise residual error because the samples are unpaired.
Six-by-six validation diagnostic grid at epoch 219 showing Gaussian inputs, unpaired simulation maps, generated maps, one-point PDFs, two-point correlations, and Fourier input-output correlations.
Validation split, epoch 219. Six independent validation examples; weights are not updated on this split.
Six-by-six held-out test diagnostic grid at epoch 219 showing Gaussian inputs, unpaired simulation maps, generated maps, one-point PDFs, two-point correlations, and Fourier input-output correlations.
Held-out test split, epoch 219. Six examples drawn from the untouched 75-sample test set.

Training history

Training curves through epoch 219 for discriminator loss, generator adversarial loss, total generator loss, low-frequency loss, power loss, and one-point loss.
Physics-run history through epoch 219. Blue curves are training and orange curves are validation. The lower-right panel shows unweighted physics terms; the total generator objective applies their configured weights.

GAN losses need not decrease monotonically because each network is learning against a moving opponent. The validation curves fluctuate more strongly because only 75 validation samples are available. A useful interpretation combines stability of the curves with visual and statistical diagnostics.

Held-out bin-1 power spectrum

Mean convergence power spectrum and central 95.45 percent bands for 75 real and 75 generated held-out bin-1 maps at epoch 219.
All 75 held-out test maps. Black points and grey band show the simulation mean and central 95.45%; the red line and band show the generated ensemble.

At low Fourier wavenumber, the generated mean is below the simulation mean in this checkpoint. The curves become closer over intermediate and high modes, with a small generated high-mode floor near the right edge. This diagnostic therefore identifies scale-dependent agreement and disagreement that a visually realistic map alone cannot reveal.

Tomographic auto- and cross-power

Bin-1 auto-power, bin-4 by bin-1 cross-power, and bin-4 auto-power versus inverse-pixel Fourier wavenumber for GRF, GAN, and simulation maps.
Raw Fourier convention. Horizontal axis is inverse pixels, the native unit when pixel spacing is set to one.
Bin-1 auto-power, bin-4 by bin-1 cross-power, and bin-4 auto-power on a display-rescaled Fourier axis ending at ell 1000.
Display-rescaled convention. The same spectra are relabelled so the maximum displayed mode is 1000; this is not a physical angular calibration.
Cℓ¹¹

Bin-1 auto-spectrum

Tests spatial structure within the lowest displayed tomographic bin.

Cℓ⁴¹ = Cℓ¹⁴

Bin-4/bin-1 cross-spectrum

Tests whether the generated endpoint bins retain the correct shared structure.

Cℓ⁴⁴

Bin-4 auto-spectrum

Tests spatial structure within the highest displayed tomographic bin.

About the horizontal axis. A physical cosmological multipole \(\ell\) requires the angular pixel size in radians. The raw plot uses inverse-pixel wavenumber. Simply rescaling the maximum to 1000 changes the display labels, not the underlying physical calibration.
11 · Toward weak-lensing inference

Where the trained generator enters a shear pipeline

The trained network can be treated as a deterministic transformation with frozen parameters. The conceptual replacement is to generate the non-Gaussian convergence field before converting convergence into shear.

def KGRF_to_Kgen(k_grf, generator, normalization):
    # 1. Convert the external array to PyTorch shape (B, 4, 256, 256)
    # 2. Normalize using the constants stored in the checkpoint
    # 3. Run the frozen generator with gradients disabled
    # 4. Apply the physics residual rule used during training
    # 5. Convert back to physical convergence units
    # 6. Return in the array format expected by the inference code
    return k_gen

k_gen = KGRF_to_Kgen(k_grf, generator, normalization)
gamma1, gamma2 = KZshear(k_gen)

Important interface requirements

  1. Load the exact selected checkpoint and set the generator to evaluation mode.
  2. Freeze its parameters; inference should not retrain the network.
  3. Keep all four tomographic channels in their training order.
  4. Use the checkpoint's saved normalization rather than recomputing it.
  5. Apply the same direct or physics residual output rule used during training.
  6. Convert between JAX and PyTorch arrays without silently changing axis order or precision.
  7. Decide whether gradients through the generator are required by the inference sampler.
  8. Validate the wrapper independently using shapes, moments, spectra, and deterministic repeatability.
This page describes the correct conceptual bridge. A production JAX inference integration still needs an explicit, tested wrapper or a converted model representation. The existing trained weights should remain unchanged during that integration.
12 · Interpretation, limits, and next steps

What the present model establishes—and what remains

What is already implemented

  • Leakage-safe group splitting for four-bin simulation files
  • Training-only auto/cross covariance for correlated GRF synthesis
  • Joint four-channel generator and discriminator
  • Adversarial-only and residual physics training modes
  • Low-frequency, radial-power, and one-point generator constraints
  • Stable checkpointing, resume support, and collapse monitoring
  • Validation/test 6×6 diagnostics and loss histories
  • Held-out auto-power and bin-1/bin-4 cross-power plots

Scientific limitations

  1. Unpaired supervision: the model learns ensemble similarity, not a unique simulation counterpart for each GRF.
  2. Unconditioned discriminator: local realism does not guarantee preservation of a specific input realization.
  3. No cosmological conditioning: cosmological parameters are not explicit network inputs.
  4. No source metadata in the arrays: exact redshift edges, cosmology, angular scale, and noise assumptions must be documented separately.
  5. Reflection boundaries: the convolution convention is not periodic and may affect patches near an edge.
  6. Display versus physical \(\ell\): angular calibration is required before interpreting spectra as cosmological multipoles.
  7. GAN loss ambiguity: neither a small D loss nor a small G adversarial loss is sufficient evidence of scientific fidelity.
  8. Inference validation remains essential: parameter posteriors must be checked for bias after inserting the generator into the lensing likelihood or sampler.

Next validation targets

All ten unique tomographic spectra

Compare four auto-spectra and all six cross-spectra, not only the bin-1/bin-4 endpoint subset.

Higher-order statistics

Add peak counts, Minkowski functionals, bispectrum summaries, and scale-dependent moments.

Boundary and calibration checks

Test periodic convolutions and obtain the physical angular pixel scale for true \(\ell\) axes.

Inference closure tests

Run synthetic truth-recovery experiments and verify unbiased posteriors before scientific deployment.

Reproducibility record

A scientific result should record the Git commit, checkpoint and stored epoch, number of maps, split seed, GRF seed, radial covariance bins, loss weights, both learning rates, device and library versions, tomographic channel order, and angular pixel size used for any physical spectrum.

PyTorch NumPy Matplotlib U-Net PatchGAN Tomographic weak lensing Fourier statistics Apple MPS