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
10 changes: 6 additions & 4 deletions src/scope/broadening.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ def I_darken_disk(x, y, epsilon):
-------
:res1: the intensity at that point on the disk.
"""
lon = np.arcsin(x)
lat = np.arcsin(y)

return I_darken(lon, lat, epsilon)
if x**2 + y**2 <= 1:
lon = np.arcsin(x)
lat = np.arcsin(y)
return I_darken(lon, lat, epsilon)
else:
return 0.0


def I_darken_disk_integrated(x, y, epsilon):
Expand Down
4 changes: 3 additions & 1 deletion src/scope/rm_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def occult_grid(occulted_grid, grid, planet_location, r_p):
theta2 = planet_location[1]

# calculate the distance between the planet and the grid points
r = np.sqrt(r1**2 + r2**2 - 2 * r1 * r2 * np.cos(theta1 - theta2))
r = np.sqrt(
np.clip(r1**2 + r2**2 - 2 * r1 * r2 * np.cos(theta1 - theta2), 0, None)
)

# find the points where the planet is
planet_points = np.where(r <= r_p)
Expand Down
2 changes: 1 addition & 1 deletion src/scope/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def calc_limb_darkening(u1, u2, a, b, Rstar, ph, LD):
"""
if LD: # apply limb darkening. 1D style!
x = (a * np.sin(2 * np.pi * ph)) / (Rstar * rsun)
mu = np.sqrt(1 - x**2 - b**2)
mu = np.sqrt(np.clip(1 - x**2 - b**2, 0, 1))
if x**2 <= 1 - b**2:
I = 1 - u1 * (1 - mu) - u2 * (1 - mu) ** 2
else:
Expand Down
Loading