shine.data¶
Data loading and synthetic observation generation.
Handles both observed data (FITS files) and synthetic data generation using
GalSim. Returns standardized Observation objects.
data
¶
Observation(image, noise_map, psf_model, wcs=None)
dataclass
¶
Container for observational data.
Attributes:
| Name | Type | Description |
|---|---|---|
image |
ndarray
|
Observed image as a JAX array. |
noise_map |
ndarray
|
Noise variance map corresponding to the image. |
psf_model |
Any
|
JAX-GalSim PSF object for differentiable convolutions. |
wcs |
Any
|
World Coordinate System information (optional, not yet implemented). |
DataLoader
¶
Loader for observational data and synthetic data generation.
load(config)
staticmethod
¶
Load observational data from file or generate synthetic data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ShineConfig
|
SHINE configuration object containing data paths and parameters. |
required |
Returns:
| Type | Description |
|---|---|
Observation
|
Observation object containing the loaded or generated data. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If a data path is provided (real data loading not implemented). |
Source code in shine/data.py
generate_synthetic(config, g1_true=None, g2_true=None, noise_seed=None)
staticmethod
¶
Generate synthetic galaxy observations using GalSim.
Uses mean values from distribution configs for ground truth parameters, renders the galaxy image, and adds noise to simulate observations. The PSF is pre-built as a JAX-GalSim object to avoid reconstruction on each MCMC iteration during inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ShineConfig
|
SHINE configuration object containing simulation parameters. |
required |
g1_true
|
Optional[float]
|
If provided, overrides the g1 shear from config. |
None
|
g2_true
|
Optional[float]
|
If provided, overrides the g2 shear from config. |
None
|
noise_seed
|
Optional[int]
|
If provided, overrides config.inference.rng_seed for noise RNG. |
None
|
Returns:
| Type | Description |
|---|---|
Observation
|
Observation object with synthetic noisy image, noise map, and JAX-GalSim PSF. |
Source code in shine/data.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
get_mean(param)
¶
Extract mean value from a parameter that may be fixed or distributional.
For fixed numeric values, returns the value directly. For distribution configs, returns the mean (Normal/LogNormal) or midpoint (Uniform).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
Union[float, int, DistributionConfig]
|
Either a fixed numeric value or a DistributionConfig object. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The representative central value of the parameter. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If distribution type is unsupported or missing required fields. |
TypeError
|
If parameter is neither numeric nor a DistributionConfig. |