Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFW and TNFW implementation #174

Open
andreasfilipp opened this issue Mar 8, 2024 · 2 comments
Open

NFW and TNFW implementation #174

andreasfilipp opened this issue Mar 8, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request feat Features: Introduces a new feature to the codebase user experience Issues and PRs related to user facing changes

Comments

@andreasfilipp
Copy link
Collaborator

The NFW profile is currently defined by the concentration c, and the TNFW by the scale radius r_s.
Ideally we would like to have both parameterizations available for both lens classes.

@andreasfilipp andreasfilipp added enhancement New feature or request user experience Issues and PRs related to user facing changes feat Features: Introduces a new feature to the codebase labels Mar 8, 2024
@andreasfilipp
Copy link
Collaborator Author

Further, TNFW misbehaves for big truncation radii.

TNFW should give similar kappa map to NFW, especially for high truncation radii, but e.g.

tnfw = caustics.TNFW(cosmology=cosmology, tau=500.)

nfw = caustics.NFW(cosmology=cosmology)

z_lens = torch.tensor([0.5])
z_s = 1.0

m200 = torch.tensor([1e11])

conc = concentration(m200)

r_scale = scale_radius_fct(m200, 0.5)
r_scale = torch.tensor(r_scale)

x0 = torch.tensor([-0.5]) 
y0 = torch.tensor([0.5]) 

params_tnfw = torch.stack((z_lens, x0, y0, m200, r_scale), dim=1)
params_nfw = torch.stack((z_lens, x0, y0, m200, conc), dim=1)

alpha_x_tnfw, alpha_y_tnfw = tnfw.reduced_deflection_angle(theta_x, theta_y, z_s, params_tnfw)
alpha_x_nfw, alpha_y_nfw = nfw.reduced_deflection_angle(theta_x, theta_y, z_s, params_nfw)

kappa_tnfw = tnfw.convergence(theta_x, theta_y, z_s, params_tnfw)
kappa_nfw = nfw.convergence(theta_x, theta_y, z_s, params_nfw) 

with

 def concentration( m_200):  # m in Msun!!!
     return 6 * (m_200 / (1e12 ))**(-0.098) 
 
 def scale_radius_fct( m, z): # m in Msun!!!
     c = concentration(m)
     # Compute r_200 from m_200
     rho_c = cosmology.critical_density(z)
     r_200 = (3 * m / (4 * torch.pi * 200 * rho_c)) ** (1 / 3)
     # Use NFW Definition
     rs = r_200 / c
     # Convert to angular size
     D_z = cosmology.angular_diameter_distance(z) 
     rs = (rs / D_z) * 180 / torch.pi * 60**2 #*M_s**(1/3)
     return rs # arcsec

cosmology = caustics.cosmology.FlatLambdaCDM()

returns very different kappa maps. (same features, but very different scales)

@ConnorStoneAstro
Copy link
Member

Progress on this from with #304 , this is a format for making new parametrizations. Further work to be done here for TNFW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feat Features: Introduces a new feature to the codebase user experience Issues and PRs related to user facing changes
Projects
None yet
Development

No branches or pull requests

3 participants