Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions scripts/imaging/features/advanced/mass_stellar_dark/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,18 @@ def build_source_basis(centre):
"""
grid = dataset.grid

alpha_stellar = lens.bulge.deflections_yx_2d_from(grid=grid)
alpha_dark = lens.dark.deflections_yx_2d_from(grid=grid)
alpha_shear = lens.shear.deflections_yx_2d_from(grid=grid)

alpha_total_summed = alpha_stellar + alpha_dark + alpha_shear
alpha_total_lens = lens.deflections_yx_2d_from(grid=grid)

print(f"Stellar deflection (first 3): {alpha_stellar[:3]}")
print(f"Dark deflection (first 3): {alpha_dark[:3]}")
print(f"Shear deflection (first 3): {alpha_shear[:3]}")
print(f"Summed deflection (first 3): {alpha_total_summed[:3]}")
print(f"Lens deflection (first 3): {alpha_total_lens[:3]}")

assert np.allclose(np.asarray(alpha_total_summed), np.asarray(alpha_total_lens))
deflections_stellar = lens.bulge.deflections_yx_2d_from(grid=grid)
deflections_dark = lens.dark.deflections_yx_2d_from(grid=grid)
deflections_shear = lens.shear.deflections_yx_2d_from(grid=grid)

deflections_total_summed = deflections_stellar + deflections_dark + deflections_shear
deflections_total_lens = lens.deflections_yx_2d_from(grid=grid)

print(f"Stellar deflection (first 3): {deflections_stellar[:3]}")
print(f"Dark deflection (first 3): {deflections_dark[:3]}")
print(f"Shear deflection (first 3): {deflections_shear[:3]}")
print(f"Summed deflection (first 3): {deflections_total_summed[:3]}")
print(f"Lens deflection (first 3): {deflections_total_lens[:3]}")

"""
The same component-wise decomposition shows up in the convergence (kappa) map. Convergence is what is plotted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,18 @@ def build_source_basis(centre):
"""
masked_grid = dataset.grid

alpha_stellar = lens.bulge.deflections_yx_2d_from(grid=masked_grid)
alpha_dark = lens.dark.deflections_yx_2d_from(grid=masked_grid)
alpha_shear = lens.shear.deflections_yx_2d_from(grid=masked_grid)
deflections_stellar = lens.bulge.deflections_yx_2d_from(grid=masked_grid)
deflections_dark = lens.dark.deflections_yx_2d_from(grid=masked_grid)
deflections_shear = lens.shear.deflections_yx_2d_from(grid=masked_grid)

alpha_total = alpha_stellar + alpha_dark + alpha_shear
deflections_total = deflections_stellar + deflections_dark + deflections_shear

grid_source_manual = masked_grid - alpha_total
grid_source_manual = masked_grid - deflections_total

print(f"alpha_stellar (first coord): {alpha_stellar[0]}")
print(f"alpha_dark (first coord): {alpha_dark[0]}")
print(f"alpha_shear (first coord): {alpha_shear[0]}")
print(f"alpha_total (first coord): {alpha_total[0]}")
print(f"deflections_stellar (first coord): {deflections_stellar[0]}")
print(f"deflections_dark (first coord): {deflections_dark[0]}")
print(f"deflections_shear (first coord): {deflections_shear[0]}")
print(f"deflections_total (first coord): {deflections_total[0]}")
print(f"source-plane grid (first coord, manual): {grid_source_manual[0]}")

"""
Expand All @@ -192,8 +192,6 @@ def build_source_basis(centre):

print(f"source-plane grid (first coord, tracer): {grid_source_tracer[0]}")

assert np.allclose(np.asarray(grid_source_manual), np.asarray(grid_source_tracer))

"""
__Source-Plane Image__

Expand Down
Loading