Skip to content

Commit

Permalink
fix: handle None period
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrcia committed Nov 1, 2024
1 parent 59cebdc commit 33eb505
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions spotter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ def shifted_spectra(spectra, shift):

def integrated_spectrum(N, theta, phi, period, radius, wv, spectra, phase, inc):
spectra = jnp.atleast_2d(spectra)
mask, projected, limb = mask_projected_limb(vec(N), phase, inc=inc)
w_shift = doppler_shift(theta, phi, period, radius, phase)
dw = wv[1] - wv[0]
shift = w_shift[:, None] * wv / dw
limb_geometry = projected * mask * limb
spectra_shifted = shifted_spectra(spectra, shift)
if period is None:
spectra_shifted = spectra
else:
mask, projected, limb = mask_projected_limb(vec(N), phase, inc=inc)
w_shift = doppler_shift(theta, phi, period, radius, phase)
dw = wv[1] - wv[0]
shift = w_shift[:, None] * wv / dw
limb_geometry = projected * mask * limb
spectra_shifted = shifted_spectra(spectra, shift)
return jnp.sum(spectra_shifted * limb_geometry[:, None], 0) / jnp.sum(
limb_geometry[:, None] * spectra[None, :]
)

0 comments on commit 33eb505

Please sign in to comment.