Setup¶
A run is described by a RunConfig, normally read from YAML by BayesEoRParser.
run_setup then loads the data, builds or reuses the operators, and returns a
SetupResult holding everything the sampler needs.
from bayeseor_jax import BayesEoRParser, run_setup
config = BayesEoRParser().parse_args(["--config", "config.yaml"])
setup = run_setup(config)
See construction and execution for what setup does. Each setting is documented on the guide page it affects, and the examples show complete, commented configurations.
Main interface¶
bayeseor_jax.setup.run_setup
¶
run_setup(config: RunConfig, *, build_foreground_kl: bool = False, kl_f: float = 0.1) -> SetupResult
Prepare the physical operators, priors and marginalised likelihood.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RunConfig
|
Requested data/model/inference settings. Actual observation axes and model coordinates are resolved locally without modifying this object. |
required |
build_foreground_kl
|
bool
|
Construct the weighted foreground operator and reduce it into config.foreground_kl_path before joint assembly. Rebuilds the basis when explicitly requested; otherwise loads the supplied basis unchanged. |
False
|
kl_f
|
float
|
Maximum discarded foreground RMS relative to the noise when building the KL basis. Defaults to 0.1; ignored when loading an existing basis. |
0.1
|
Returns:
| Type | Description |
|---|---|
SetupResult
|
Configured likelihood, coefficient and power-spectrum priors, matrix builder, selected visibility data and cosmological bin metadata. |
Notes
This coordinates loading, geometry, component construction, joint assembly and likelihood products; it does not run nested sampling. KL construction uses the resolved observation, physical prior and inference noise weights. A supplied KL operator is loaded with a standard-normal prior, and is only recomputed when build_foreground_kl is explicitly enabled. Omitted image and transverse Fourier resolutions are inferred from the selected observation. Explicit values below the estimates trigger warnings but are retained; these checks do not replace convergence studies.
bayeseor_jax.setup.SetupResult
¶
Container for setup outputs consumed by downstream samplers.
bayeseor_jax.configuration.BayesEoRParser
¶
Read the existing YAML/CLI options into a typed run configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Forwarded to |
()
|
|
**kwargs
|
Forwarded to |
()
|
|
parse_as_dict
|
bool
|
Return a plain dictionary instead of RunConfig when explicitly enabled.
The standard workflow uses the typed result directly in |
False
|
Notes
YAML keys use underscores and CLI flags use dashes. The options retain
their existing names and required fields. The CLI output directory keeps
its historical ./BayesEoROutputs/ default; direct RunConfig construction
retains the Python setup default ./.
Examples:
>>> config = BayesEoRParser().parse_args([
... "--config", "examples/eor/config.yaml",
... ])
>>> isinstance(config, RunConfig)
True
parse_args
¶
parse_args(args_str=None)
Read YAML/CLI settings and return a typed, requested RunConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args_str
|
list of str or None
|
CLI tokens, or None to read the process command line. |
None
|
Returns:
| Type | Description |
|---|---|
RunConfig or dict
|
Typed settings by default; a plain mapping when the parser was
explicitly created with |
Configuration objects¶
RunConfig holds every setting, and ModelConfig the subset that defines the
physical operators. Both are frozen dataclasses: use dataclasses.replace to
derive a new configuration.
bayeseor_jax.configuration.RunConfig
dataclass
¶
Requested settings for data preparation, model construction and inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_path
|
Path or str
|
Visibility input and optional instrument/noise products. |
None
|
inst_model
|
Path or str
|
Visibility input and optional instrument/noise products. |
None
|
noise_data_path
|
Path or str
|
Visibility input and optional instrument/noise products. |
None
|
n_u_eor
|
optional
|
Requested Fourier-grid dimensions and spacings; None permits setup to infer them from the selected observation and image geometry. |
None
|
n_v_eor
|
optional
|
Requested Fourier-grid dimensions and spacings; None permits setup to infer them from the selected observation and image geometry. |
None
|
du_eor
|
optional
|
Requested Fourier-grid dimensions and spacings; None permits setup to infer them from the selected observation and image geometry. |
None
|
dv_eor
|
optional
|
Requested Fourier-grid dimensions and spacings; None permits setup to infer them from the selected observation and image geometry. |
None
|
n_eta
|
optional
|
Requested Fourier-grid dimensions and spacings; None permits setup to infer them from the selected observation and image geometry. |
None
|
n_freq
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
f0_mhz
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
df_mhz
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
n_t
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
d_t
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
jd_center
|
optional
|
Requested observation axes (MHz, seconds and Julian dates). Raw data determine the actual axes; preprocessed vectors require these settings. |
None
|
nside
|
optional
|
HEALPix resolution, field diameters in degrees and telescope location (latitude/longitude in degrees, altitude in metres). If nside is None, setup estimates it from the longest selected baseline and highest selected frequency, using the same resolution for both components. |
None
|
fov_eor
|
optional
|
HEALPix resolution, field diameters in degrees and telescope location (latitude/longitude in degrees, altitude in metres). If nside is None, setup estimates it from the longest selected baseline and highest selected frequency, using the same resolution for both components. |
None
|
fov_fg
|
optional
|
HEALPix resolution, field diameters in degrees and telescope location (latitude/longitude in degrees, altitude in metres). If nside is None, setup estimates it from the longest selected baseline and highest selected frequency, using the same resolution for both components. |
None
|
telescope_latlonalt
|
optional
|
HEALPix resolution, field diameters in degrees and telescope location (latitude/longitude in degrees, altitude in metres). If nside is None, setup estimates it from the longest selected baseline and highest selected frequency, using the same resolution for both components. |
None
|
footprint_nside
|
int or None
|
Select the time-union field boundaries on a coarser grid, then model all selected pixels' children at nside. None selects on the model grid. This controls coverage only, not either component's resolution. |
None
|
priors
|
optional
|
Log10 power bounds and the per-bin linear-uniform prior mask. |
None
|
uniform_priors
|
optional
|
Log10 power bounds and the per-bin linear-uniform prior mask. |
None
|
foreground_prior_std_mk
|
optional
|
Physical spectral-component widths, or a preconstructed KL operator whose coefficients instead have unit prior variance. |
(8690.961932554002, 2479547.297490031, 1406322.413511489)
|
foreground_kl_path
|
optional
|
Physical spectral-component widths, or a preconstructed KL operator whose coefficients instead have unit prior variance. |
(8690.961932554002, 2479547.297490031, 1406322.413511489)
|
output_dir
|
optional
|
Metadata/preprocessed output directories and overwrite permission. |
'./'
|
save_dir
|
optional
|
Metadata/preprocessed output directories and overwrite permission. |
'./'
|
clobber
|
optional
|
Metadata/preprocessed output directories and overwrite permission. |
'./'
|
quiet
|
optional
|
Driver and MultiNest controls. These are not physical model inputs. |
False
|
run
|
optional
|
Driver and MultiNest controls. These are not physical model inputs. |
False
|
resume
|
optional
|
Driver and MultiNest controls. These are not physical model inputs. |
False
|
n_live_scale_factor
|
optional
|
Driver and MultiNest controls. These are not physical model inputs. |
False
|
random_key
|
optional
|
Driver and MultiNest controls. These are not physical model inputs. |
False
|
Notes
Data selection and noise controls retain the YAML/CLI names documented in
docs/examples/configuration.md. Construct directly in Python or obtain from
BayesEoRParser.parse_args. Use dataclasses.replace for a new run
configuration; setup leaves this object unchanged. Sequence inputs are
read-only by convention, even when supplied as lists or NumPy arrays.
bayeseor_jax.configuration.ModelConfig
dataclass
¶
Requested spectral, beam and storage settings for physical operators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
('eor', 'fg', 'eor+fg')
|
Components to construct, independently of the simulated data contents. |
"eor"
|
beta_fg
|
sequence of float
|
Positive power-law indices following the constant foreground component. |
(2.63, 2.82)
|
beam_type
|
str
|
|
'uniform'
|
peak_amp
|
str
|
|
'uniform'
|
fwhm_deg
|
str
|
|
'uniform'
|
diam
|
str
|
|
'uniform'
|
cosfreq
|
str
|
|
'uniform'
|
tanh_freq
|
str
|
|
'uniform'
|
tanh_sl_red
|
str
|
|
'uniform'
|
pol
|
optional
|
Primary-beam settings; angles are in degrees, diameter in metres.
See |
'xx'
|
freq_interp_kind
|
optional
|
Primary-beam settings; angles are in degrees, diameter in metres.
See |
'xx'
|
array_save_directory
|
Path or str
|
Directory for saved component operators and likelihood products. |
'./matrices/'
|
Notes
Actual frequencies, baselines and image/Fourier coordinates are supplied separately to the builder. Requested settings are not overwritten when the observation determines those resolved inputs.