jesterTOV.inference.flows module

jesterTOV.inference.flows module#

Normalizing flow models for gravitational wave and other posterior density estimation. JESTER uses normalizing flows to build smooth density estimates from discrete posterior samples — for example from bilby GW analyses — so they can be evaluated at arbitrary points during inference.

Flow Model#

The Flow class is the central object: it wraps a trained flowjax normalizing flow and exposes a simple log_prob interface that handles data standardization automatically.

flow.Flow(flow, metadata, flow_kwargs)

Wrapper class for flowjax normalizing flows with automatic standardization handling.

flow.load_model(output_dir)

Load a trained flow model from saved files.

Training#

Flows are trained on posterior samples (stored as .npz files) using train_flow_from_config(), which is driven by FlowTrainingConfig. The CLI entry point jester_train_flow invokes main() directly.

config.FlowTrainingConfig(**data)

Configuration for training normalizing flows on posterior samples.

train_flow.load_posterior(filepath, ...[, ...])

Load posterior samples from npz file with flexible parameter selection.

train_flow.train_flow(flow, data, key[, ...])

Train the normalizing flow on data.

train_flow.train_flow_from_config(config)

Train a normalizing flow using a configuration object.

train_flow.save_model(flow, output_dir, ...)

Save trained flow model, architecture kwargs, and metadata.

Bilby Posterior Extraction#

When starting from a bilby HDF5 result file (e.g. a published GW analysis), use extract_gw_posterior_from_bilby() to extract the relevant posterior columns into a .npz file that the flow-training pipeline can consume. The CLI entry point jester_extract_gw_posterior_bilby exposes this function without requiring a full bilby installation.

bilby_extract.extract_gw_posterior_from_bilby(...)

Extract GW posterior samples from a bilby result HDF5 file.