-
Notifications
You must be signed in to change notification settings - Fork 35
feature/geometry_hot_fix #385
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,9 +144,11 @@ def traced_grid_2d_list_from( | |
| redshift_list = [galaxies[0].redshift for galaxies in planes] | ||
|
|
||
| for plane_index, galaxies in enumerate(planes): | ||
| scaled_grid = grid.copy() | ||
|
|
||
| scaled_grid = grid.array | ||
|
|
||
| if plane_index > 0: | ||
|
|
||
| for previous_plane_index in range(plane_index): | ||
| scaling_factor = cosmology.scaling_factor_between_redshifts_from( | ||
| redshift_0=redshift_list[previous_plane_index], | ||
|
|
@@ -156,10 +158,14 @@ def traced_grid_2d_list_from( | |
| ) | ||
|
|
||
| scaled_deflections = ( | ||
| scaling_factor * traced_deflection_list[previous_plane_index] | ||
| scaling_factor * traced_deflection_list[previous_plane_index].array | ||
| ) | ||
|
|
||
| scaled_grid -= scaled_deflections | ||
| scaled_grid = scaled_grid - scaled_deflections | ||
|
|
||
| scaled_grid = aa.Grid2DIrregular( | ||
| values=scaled_grid, | ||
| ) | ||
|
Comment on lines
148
to
168
|
||
|
|
||
| traced_grid_list.append(scaled_grid) | ||
|
|
||
|
|
@@ -168,12 +174,7 @@ def traced_grid_2d_list_from( | |
| return traced_grid_list | ||
|
|
||
| deflections_yx_2d = sum( | ||
| map(lambda g: g.deflections_yx_2d_from(grid=scaled_grid, xp=xp), galaxies) | ||
| ) | ||
|
|
||
| # Remove NaN deflection values to sanitize the ray-tracing calculation for JAX. | ||
| deflections_yx_2d = xp.where( | ||
| xp.isfinite(deflections_yx_2d.array), deflections_yx_2d.array, 0.0 | ||
| (g.deflections_yx_2d_from(grid=scaled_grid, xp=xp) for g in galaxies) | ||
| ) | ||
|
Comment on lines
176
to
178
|
||
|
|
||
| traced_deflection_list.append(deflections_yx_2d) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aa.Grid2DIrregularis constructed withoutxp=xp, even though this utility function is explicitly parameterized byxpfor NumPy vs JAX backends. In other JAX-sensitive code paths (e.g. constructing grids inAnalysisLens.tracer_via_instance_from),xpis passed to keep arrays on the correct backend. Consider passingxp=xphere as well to avoid accidental coercion back to NumPy whenxpis JAX.