Getting Started¶
Installation¶
Prerequisites¶
- Python >= 3.11
- A JAX-compatible GPU is recommended but not required
Install from PyPI¶
Install from source (development)¶
For contributing or working on SHINE itself:
Optional extras:
Your First Run¶
SHINE is driven by YAML configuration files. Any parameter specified as a
distribution (e.g. type: Normal) becomes a latent variable for Bayesian
inference; everything else is fixed.
1. Write a config¶
Create a file my_config.yaml:
image:
pixel_scale: 0.2
size_x: 32
size_y: 32
n_objects: 1
fft_size: 128
noise:
type: Gaussian
sigma: 0.01
psf:
type: Gaussian
sigma: 0.1
gal:
type: Exponential
flux: 100.0
half_light_radius: 0.5
shear:
type: G1G2
g1:
type: Normal
mean: 0.02
sigma: 0.05
g2:
type: Normal
mean: -0.01
sigma: 0.05
inference:
method: nuts # "nuts", "map", or "vi"
nuts_config:
warmup: 200
samples: 500
chains: 1
dense_mass: false
map_init:
enabled: true
num_steps: 500
learning_rate: 0.01
rng_seed: 42
Here, flux and half_light_radius are fixed values. The shear components
g1 and g2 are defined as Normal distributions and become the latent
variables to infer.
2. Run inference¶
This will:
- Generate synthetic data from the config (since no
data_pathis specified) - Build the NumPyro probabilistic model
- Run inference using the configured method (NUTS with MAP init in this example)
- Save the posterior as
results/posterior.nc(ArviZ NetCDF format)
Override the output directory with --output:
3. Inspect results¶
The output is an ArviZ InferenceData
object saved in NetCDF format. Load and explore it in Python:
import arviz as az
idata = az.from_netcdf("results/posterior.nc")
print(az.summary(idata, var_names=["g1", "g2"]))
az.plot_trace(idata, var_names=["g1", "g2"])
4. Pedagogical example¶
For a step-by-step walkthrough that builds the config inline and plots diagnostics:
Next Steps¶
- Configuration reference -- full YAML specification
- Architecture overview -- how the pieces fit together
- Validation pipeline -- bias measurement and testing