Skip to content

Fixing xI_to_Y and Y_to_xI for retrograde orbits#169

Merged
cchapmanbird merged 2 commits intoBlackHolePerturbationToolkit:masterfrom
Philip-Lynch:Fix-xtoY-retrograde
Sep 16, 2025
Merged

Fixing xI_to_Y and Y_to_xI for retrograde orbits#169
cchapmanbird merged 2 commits intoBlackHolePerturbationToolkit:masterfrom
Philip-Lynch:Fix-xtoY-retrograde

Conversation

@Philip-Lynch
Copy link
Copy Markdown
Contributor

@Philip-Lynch Philip-Lynch commented Sep 16, 2025

Fixes #161
All that was required was adding a sign change to the second term in the final expression in _PN_E for retrograde orbits.

Fix:

def _PN_E(q, p, e, Y):

    # Rest of the function unchanged
    # Determine if orbit is prograde (1) or retrograde (-1)
    grade = - 1 if (Y < 0) ^ (q < 0)   else 1 # Retrograde if (Y<0) xor (q<0), else prograde
    E_square = (rhs_numer -grade* 2.0 * sqrt(rhs_sqrt)) / rhs_denom
    return sqrt(E_square)

Tests:

a = 0.9
p = 10
e = 0.3
xI = -0.5

Y = xI_to_Y( a, p, e,xI)
xI_recovered = Y_to_xI( a, p, e,Y)

(xI,xI_recovered,xI-xI_recovered)

Output:

(-0.5, -0.5000000000000002, 2.220446049250313e-16)
a = 0.9
p = 10
e = 0.3
Y = -0.5

xI = Y_to_xI( a, p, e,Y)
Y_recovered = xI_to_Y( a, p, e,xI)

(Y,Y_recovered,Y-Y_recovered)

Output:

(-0.5, np.float64(-0.5000000000000001), np.float64(1.1102230246251565e-16))

📚 Documentation preview 📚: https://fastemriwaveforms--169.org.readthedocs.build/en/169/

@cchapmanbird cchapmanbird self-requested a review September 16, 2025 15:36
@cchapmanbird cchapmanbird merged commit f94ea84 into BlackHolePerturbationToolkit:master Sep 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AAK inclination regime of validity not well defined

2 participants