Skip to content
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

remove the extra utils code #30

Merged
merged 1 commit into from
Aug 18, 2024
Merged
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
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
Loading