ML-GPR commands#

These commands require the ml-gpr installation extra:

$ pip install "ps-eor[ml-gpr]"

run_ml_gpr#

Fit the configured ML-GPR model and propagate the posterior to component power spectra:

$ pstool run_ml_gpr stokes_i.h5 stokes_v.h5 ml_gpr.toml \
    --ps_conf pspec.ini \
    --eor_bins_list eor_bins.csv \
    --flag_config flagger.ini \
    --output_dir results

The three required arguments are the Stokes-I cube, Stokes-V cube, and ML-GPR TOML configuration. The optional flagger and power-spectrum configurations use the same formats as run_flagger and make_ps.

By default, the noise input is selected from Stokes I or Stokes V according to the ML-GPR configuration. --file_noise supplies an explicit noise cube instead. When flagging is enabled, the same saved selection is applied to that cube.

For each frequency bin, the command saves:

  • the complete MLGPRResult;

  • posterior foreground, 21-cm, and residual power-spectrum products;

  • scaled-noise and noise-subtracted residual estimates;

  • sampler and power-spectrum diagnostics.

Use --no_plot to skip plot generation while retaining numerical results. --rnd_seed makes stochastic initialization and posterior selection repeatable.

Python API. Reload the saved fit with ps_eor.ml_gpr.fitter.MLGPRResult.load(). Posterior component selection and power-spectrum generation are described in Posterior components and power spectra; the corresponding classes are listed in the high-level ML-GPR API.

run_ml_gpr_inj#

Inject a VAE-generated 21-cm realization before fitting the same data:

$ pstool run_ml_gpr_inj stokes_i.h5 stokes_v.h5 ml_gpr.toml \
    --ps_conf pspec.ini \
    --amplitude 1.0 --x1 1.0 --x2 -0.5 \
    --output_dir injections

--vae_kern_name identifies the VAE component in the ML-GPR model. --x1 and --x2 select its latent coordinates. --amplitude sets the injected signal variance relative to the variance of the chosen noise cube. The generated realization is saved alongside the fit and recovered posterior power spectra, allowing the recovery to be compared with the known input.

The flagging, frequency-bin, power-spectrum, noise-file, and random-seed options have the same meaning as in run_ml_gpr.

Python API. Reload the fit with ps_eor.ml_gpr.fitter.MLGPRResult.load() and the saved injected cube with ps_eor.datacube.CartDataCube.load(). See Running a fit and Posterior components and power spectra for recovery analysis.