Skip to content

feat: add mixture-model probability utilities, HDF5 persistence, HDF5 file tools, and API consistency improvements#840

Merged
Qazalbash merged 9 commits into
mainfrom
dev
Jun 2, 2026
Merged

feat: add mixture-model probability utilities, HDF5 persistence, HDF5 file tools, and API consistency improvements#840
Qazalbash merged 9 commits into
mainfrom
dev

Conversation

Qazalbash and others added 5 commits May 31, 2026 05:43
…ions (#836)

* feat: implement HDF5 support for saving inference data and configurations

* fix: convert HDF5 dataset attributes to a dictionary

* Add report generation functionality with Papermill and Jupyter Notebook template

- Introduced `generate_report.py` to handle report generation from input data files.
- Integrated Papermill for executing Jupyter Notebook templates and generating HTML reports.
- Added a new Jupyter Notebook template `template_report.ipynb` for report formatting.
- Updated `pyproject.toml` to include new dependencies: `nbconvert`, `papermill`, and `plotly`.
- Registered new command line entry point for report generation in `pyproject.toml`.
- Included the notebook template in package data for distribution.

* Update src/gwkokab/analysis/report/generate_report.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* style: format output notebook path assignment

* feat: add corner library dependency for enhanced plotting capabilities

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: ensure compatibility with JAX Array in HDF5 write function

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* feat: using file descriptor to reduce IO overhead

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
… and `SubPopulationModelCore` (#837)

* refactor: rename parameters for consistency in `MultiSourceModelCore` and `SubPopulationModelCore`

* Update src/gwkokab/analysis/multisource/common.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix: reorder parameters in `MultiSourceModelCore`

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* feat: utils to repack and replace `.h5` and `.hdf5` files

* fix: remove bugs from option parsing and update epilog
…#833)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Qazalbash Qazalbash self-assigned this Jun 2, 2026
@Qazalbash Qazalbash added enhancement New feature or request internal An internal refactor or improvement labels Jun 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the inference output system to save results, sampler configurations, constants, and variables index directly into a single HDF5 file (inference_data.hdf5) instead of multiple text and JSON files. It also introduces a new reporting module to generate HTML reports from the HDF5 data, updates parameter naming conventions across models, and adds utilities for computing marginal densities.

Several issues were identified in the review: in h5repack.py, the options argument should be defined after file to prevent it from consuming all positional arguments; in utils.py, an independent if statement is needed instead of elif to ensure JAX arrays are converted to NumPy arrays even when overwriting existing datasets; in template_report.ipynb, reading chains directly from HDF5 is preferred over np.array_split to avoid errors from unequal chain lengths; in generate_report.py, jupyter should be executed via sys.executable for robustness; and in marginals.py, a safe divisor is required in jnp.where to prevent NaN gradients during JAX operations.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/gwkokab_scripts/h5repack.py
Comment thread src/gwkokab/analysis/core/utils.py
Comment thread src/gwkokab/analysis/report/template_report.ipynb
Comment thread src/gwkokab/analysis/report/generate_report.py
Comment thread src/gwkokab/analysis/utils/marginals.py Outdated
Qazalbash and others added 2 commits June 3, 2026 03:14
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Qazalbash and others added 2 commits June 3, 2026 03:20
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Qazalbash Qazalbash merged commit cf9f5a6 into main Jun 2, 2026
5 checks passed
@Qazalbash Qazalbash deleted the dev branch June 2, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants