Skip to content

NFW discontinuity in the convergence #399

Description

@rouzib

Problem

NFW + m3 Multipole lensing model exhibits discontinuities in the convergence profile around r ≈ 1.

Example:

Image

Context

Relevant code is at:

return torch.where(x > 1, f_pos, torch.where(x < 1, f_neg, torch.zeros_like(x)))

Suggested Fix

Apply TNFW-style patch to smooth out these discontinuities with Taylor expansion.

return torch.where(
x < 1 - 1e-2,
torch.arccosh(1 / x_lt1) / (1.0 - x_lt1**2).sqrt(),
torch.where(
x > 1 + 1e-2,
torch.arccos(1 / x_gt1) / (x_gt1**2 - 1.0).sqrt(),
1 - 2 * (x - 1) / 3 + 7 * (x - 1) ** 2 / 15, # where: x == 1
),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions