Mo-Ghani / Sampling

Demonstrations of how to use MCMC and nested sampling algorithms on real data sets
6 stars 0 forks source link

A question for the Exoplanet Light Curve Analysis example #1

Open MinyuLi opened 2 years ago

MinyuLi commented 2 years ago

Hi, I am debuging the codes of Exoplanet Light Curve Analysis with emcee and UltraNest, which in this URL: https://mo-ghani.github.io/Sampling/LightCurve/LightCurve/#modelling-with-emcee

I also use the same Kepler source same as you: kplr011904151-2010265121752_llc.fits.

But when I run the python code, there comes a runtime warning: Catch

I debug it and find that after running "run_mcmc" for a while, in function "transit", the paramter "df" is 1.66555, and it cause "f*(1-df)" be a negative value, and input to "lmbda". Catch2A6A

After that, when running the code "np.log(lmbda)", it cause a exception. And the program could not go on.

So my question is what's the meaning of "f*(1-df)", and how to resolve it.

Thank you very much! and thanks for a patience!

Minyu Li from China Email: 2049337534@qq.com

mattpitkin commented 2 years ago

Hi Mingyu,

In this example you'll want to set the prior on df so that it can only be between 0 and 1. In the logprior function you could add the line:

if theta[1] < 0 or theta[1] >= 1:
    return -np.inf

This assumes, like in the example, that the df parameter is the second parameter in the theta list. Hope that helps.

MinyuLi commented 2 years ago

Oh! Thank you very much, I will try this method. Good luck! 😄

---Original--- From: "Matt @.> Date: Fri, Sep 2, 2022 16:06 PM To: @.>; Cc: @.**@.>; Subject: Re: [Mo-Ghani/Sampling] A question for the Exoplanet Light CurveAnalysis example (Issue #1)

Hi Mingyu,

In this example you'll want to set the prior on df so that it can only be between 0 and 1. In the logprior function you could add the line: if theta[1] < 0 or theta[1] >= 1: return -np.inf
This assumes, like in the example, that the df parameter is the second parameter in the theta list. Hope that helps.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

MinyuLi commented 2 years ago

Hi Mo-Ghani: I added the restriction as you said in the "logprior" function, and got this results: Figure_1

then I resize the initial flux restrictions as follow: f_min = 541200 #4.9 f_max = 541700 #5.8 then the results is like this: Figure_2

After that I modified the normal prior on flux drop as follow (the values are as you mentioned in the web site):

normal prior on flux drop

df_mu = 0.00025 #0.19 df_sig = 0.00003 #0.005

Then I got the similar results as you: Figure_4 Figure_5

Howevery my question is: how can I know the "right" normal prior before you mentioned it. If I analyze a new resource, how to to judge these a priori values? Goog luck! Thank you very much!