Skip to content

Commit

Permalink
Merge pull request #30 from arjunsavel/test_utils_more
Browse files Browse the repository at this point in the history
remove the extra utils code
  • Loading branch information
arjunsavel committed Aug 18, 2024
2 parents b08fb54 + 99a2bb8 commit 39d8e23
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/scope/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def make_outdir(outdir):
print("Directory already exists. Continuing!")


def get_instrument_kernel():
def get_instrument_kernel(resolution_ratio=250000 / 45000):
xker = np.arange(41) - 20
sigma = 5.5 / (2.0 * np.sqrt(2.0 * np.log(2.0))) # nominal
sigma = resolution_ratio / (2.0 * np.sqrt(2.0 * np.log(2.0))) # nominal
yker = np.exp(-0.5 * (xker / sigma) ** 2.0)
yker /= yker.sum()
return yker
Expand Down Expand Up @@ -346,36 +346,6 @@ def calc_crossing_time(
return max_time, max_time_per_pixel, dphase_per_exp, n_exp


# todo: own convolution
def convolve_planet_spectrum(
planet_wave,
planet_flux,
resolution_model=250000,
resolution_instrument=45000,
):
"""
Convolves a planet with rotational and instrumental profile.
"""
scale = 1
vsini = 4.52
ker_rot = get_rot_ker(vsini, planet_wave) # rotation kernel
Fp_conv_rot = np.convolve(
planet_flux, ker_rot, mode="same"
) # convolving with rot kernel

resolution_ratio = resolution_model / resolution_instrument

xker = np.arange(41) - 20
sigma = resolution_ratio / (
2.0 * np.sqrt(2.0 * np.log(2.0))
) # 5.5 is FWHM of resolution element in model wavelength grid "coords"
yker = np.exp(-0.5 * (xker / sigma) ** 2.0) # making a gaussian
yker /= yker.sum() # normalize so that the convolution is mathmatically correct.
planet_flux_conv = np.convolve(Fp_conv_rot, yker, mode="same") * scale

return planet_flux_conv, yker


@njit
def calc_rvs(v_sys, v_sys_measured, Kp, Kstar, phases):
"""
Expand Down

0 comments on commit 39d8e23

Please sign in to comment.