Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
jvshields committed Sep 26, 2024
1 parent 299dca1 commit cbd238a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions stardis/radiation_field/radiation_field_solvers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,16 @@ def calculate_spherical_ray(thetas, depth_points_radii):
ray_distance_through_layer_by_impact_parameter = np.zeros(
(len(depth_points_radii) - 1, len(thetas))
)


dr = np.diff(depth_points_radii)
for theta_index, theta in enumerate(thetas):
b = depth_points_radii[-1] * np.sin(theta) # impact parameter of the ray
ray_z_coordinate_grid = np.sqrt(
depth_points_radii**2 - b**2
) # Rays that don't go deeper than a layer will have a nan here

ray_distance = np.diff(ray_z_coordinate_grid)

ray_distance = dr * depth_points_radii[1:] / ray_z_coordinate_grid[1:]
# ray_distance = np.diff(ray_z_coordinate_grid)
ray_distance_through_layer_by_impact_parameter[
~np.isnan(ray_distance), theta_index
] = ray_distance[~np.isnan(ray_distance)]
Expand Down

0 comments on commit cbd238a

Please sign in to comment.