Skip to content

fix: update normalization constant calculation in SmoothedPowerlawPrimaryMassRatio#848

Merged
Qazalbash merged 2 commits into
mainfrom
fix-probs
Jun 13, 2026
Merged

fix: update normalization constant calculation in SmoothedPowerlawPrimaryMassRatio#848
Qazalbash merged 2 commits into
mainfrom
fix-probs

Conversation

@Qazalbash

Copy link
Copy Markdown
Member

No description provided.

@Qazalbash Qazalbash self-assigned this Jun 13, 2026
@Qazalbash Qazalbash added the internal An internal refactor or improvement label Jun 13, 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 wraps the trapezoidal integration result for the primary mass distribution normalization constant in a logarithm (jnp.log) to correctly compute _logZ. The reviewer notes that directly applying jnp.log without safety guards can lead to numerical instability, such as underflow to zero resulting in -inf or NaN values. They suggest adding a guard using jnp.where to handle non-positive or invalid integration results safely.

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/models/mass/_models.py Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Qazalbash Qazalbash merged commit 821d20b into main Jun 13, 2026
5 checks passed
@Qazalbash Qazalbash deleted the fix-probs branch June 13, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant