Skip to content

Commit

Permalink
ok so testing better now
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsavel committed Aug 21, 2024
1 parent dcba311 commit a368c8d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
49 changes: 24 additions & 25 deletions src/scope/emcee_fit_hires.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,32 @@ def log_prob(
Kp, Vsys, log_scale = x
scale = np.power(10, log_scale)
prior_val = prior(x, best_kp)

if not np.isfinite(prior_val):
return -np.inf
return (
prior_val
+ calc_log_likelihood(
Vsys,
Kp,
scale,
wl_cube_model,
wl_model,
Fp_conv,
Fstar_conv,
flux_cube,
n_order,
n_exposure,
n_pixel,
phases,
Rp_solar,
Rstar,
rv_semiamp_orbit,
A_noplanet,
do_pca=do_pca,
n_princ_comp=n_princ_comp,
star=star,
observation="emission",
)[0]
)
ll = calc_log_likelihood(
Vsys,
Kp,
scale,
wl_cube_model,
wl_model,
Fp_conv,
Fstar_conv,
flux_cube,
n_order,
n_exposure,
n_pixel,
phases,
Rp_solar,
Rstar,
rv_semiamp_orbit,
A_noplanet,
do_pca=do_pca,
n_princ_comp=n_princ_comp,
star=star,
observation="transmission",
)[0]
return prior_val + ll


# @numba.njit
Expand Down
2 changes: 1 addition & 1 deletion src/scope/run_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def make_data(
) # returning CCF and logL values


@njit
# @njit
def calc_log_likelihood(
v_sys,
Kp,
Expand Down
2 changes: 1 addition & 1 deletion src/scope/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_baseline_outouts(test_inputs):
star=True,
SNR=0,
rv_semiamp_orbit=0.3229,
observation="emission",
observation="transmission",
tell_type="data-driven",
time_dep_tell=False,
wav_error=False,
Expand Down
7 changes: 4 additions & 3 deletions src/scope/tests/test_emcee_fit_hires.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ def test_likelihood(test_baseline_outouts, test_inputs):
Rstar = 1.0
phases = np.linspace(-0.01, 0.01, n_exposure)
Fp_conv, Fstar_conv, wl_cube_model, wl_model = test_inputs
best_kp = 150
x_good = [150, 0, 0]
x_bad = [104, -20, -0.4]
best_kp = 192.06

x_good = [best_kp, 0, 0]
x_bad = [144, -50, -0.9]
n_princ_comp = 4
log_prob_good = log_prob(
x_good,
Expand Down
2 changes: 1 addition & 1 deletion src/scope/tests/test_run_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_baseline_outputs_take2(test_inputs):
star=True,
SNR=0,
rv_semiamp_orbit=0.3229,
observation="emission",
observation="transmission",
tell_type="data-driven",
time_dep_tell=False,
wav_error=False,
Expand Down

0 comments on commit a368c8d

Please sign in to comment.