From a368c8db96004f3fef09f52b775aa983edf49d5f Mon Sep 17 00:00:00 2001 From: arjunsavel Date: Wed, 21 Aug 2024 17:33:12 -0400 Subject: [PATCH] ok so testing better now --- src/scope/emcee_fit_hires.py | 49 ++++++++++++------------- src/scope/run_simulation.py | 2 +- src/scope/tests/conftest.py | 2 +- src/scope/tests/test_emcee_fit_hires.py | 7 ++-- src/scope/tests/test_run_simulation.py | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/scope/emcee_fit_hires.py b/src/scope/emcee_fit_hires.py index e589e79..af2b14f 100644 --- a/src/scope/emcee_fit_hires.py +++ b/src/scope/emcee_fit_hires.py @@ -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 diff --git a/src/scope/run_simulation.py b/src/scope/run_simulation.py index 5463ca2..9f00c18 100644 --- a/src/scope/run_simulation.py +++ b/src/scope/run_simulation.py @@ -278,7 +278,7 @@ def make_data( ) # returning CCF and logL values -@njit +# @njit def calc_log_likelihood( v_sys, Kp, diff --git a/src/scope/tests/conftest.py b/src/scope/tests/conftest.py index 01b03d3..c66d69b 100644 --- a/src/scope/tests/conftest.py +++ b/src/scope/tests/conftest.py @@ -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, diff --git a/src/scope/tests/test_emcee_fit_hires.py b/src/scope/tests/test_emcee_fit_hires.py index adcd528..083f8ee 100644 --- a/src/scope/tests/test_emcee_fit_hires.py +++ b/src/scope/tests/test_emcee_fit_hires.py @@ -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, diff --git a/src/scope/tests/test_run_simulation.py b/src/scope/tests/test_run_simulation.py index 77dec66..74b8886 100644 --- a/src/scope/tests/test_run_simulation.py +++ b/src/scope/tests/test_run_simulation.py @@ -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,