shine.validation.simulation¶
Paired-shear simulation driver for bias measurement.
Generates synthetic observations with explicit shear overrides, supporting single, paired (+g/-g), and batched generation modes.
simulation
¶
Paired-shear simulation driver for bias measurement.
SimulationResult(observation, ground_truth)
dataclass
¶
Result of a single bias simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
observation |
Observation
|
The generated Observation (image + noise map + PSF). |
ground_truth |
Dict[str, float]
|
Dictionary of true parameter values used to generate data. |
BatchSimulationResult(images, psf_model, ground_truths, run_ids)
dataclass
¶
Result of batched bias simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
images |
ndarray
|
Stacked observed images, shape (n_batch, nx, ny). |
psf_model |
Any
|
Shared JAX-GalSim PSF object. |
ground_truths |
List[Dict[str, float]]
|
List of ground truth dicts, one per realization. |
run_ids |
List[str]
|
List of run identifiers. |
generate_biased_observation(config, g1_true, g2_true, seed)
¶
Generate a synthetic observation with explicit shear overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ShineConfig
|
SHINE configuration object. |
required |
g1_true
|
float
|
True g1 shear value. |
required |
g2_true
|
float
|
True g2 shear value. |
required |
seed
|
int
|
Random seed for noise generation. |
required |
Returns:
| Type | Description |
|---|---|
SimulationResult
|
SimulationResult containing the observation and ground truth dict. |
Source code in shine/validation/simulation.py
generate_paired_observations(config, g1_true, g2_true, seed)
¶
Generate paired +g/-g observations with the same noise seed.
The paired-shear method cancels shape noise by averaging responses from +g and -g images generated with identical noise realizations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ShineConfig
|
SHINE configuration object. |
required |
g1_true
|
float
|
Positive g1 shear value. |
required |
g2_true
|
float
|
Positive g2 shear value. |
required |
seed
|
int
|
Random seed for noise generation (same for both). |
required |
Returns:
| Type | Description |
|---|---|
Tuple[SimulationResult, SimulationResult]
|
Tuple of (plus_result, minus_result) SimulationResults. |
Source code in shine/validation/simulation.py
generate_batch_observations(config, shear_pairs, seeds, run_id_prefix='batch')
¶
Generate N observations and stack them into arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ShineConfig
|
SHINE configuration object. |
required |
shear_pairs
|
List[Tuple[float, float]]
|
List of (g1, g2) pairs, one per realization. |
required |
seeds
|
List[int]
|
List of random seeds, one per realization. |
required |
run_id_prefix
|
str
|
Prefix for run identifiers. |
'batch'
|
Returns:
| Type | Description |
|---|---|
BatchSimulationResult
|
BatchSimulationResult with stacked images and shared PSF. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If shear_pairs and seeds have different lengths. |