kevin218 / Eureka

Eureka! is a data reduction and analysis pipeline intended for time-series observations with JWST.
https://eurekadocs.readthedocs.io/
MIT License
60 stars 47 forks source link

Stage 6 RuntimeWarning: invalid value encountered #452

Closed kcrasmus closed 2 years ago

kcrasmus commented 2 years ago

Instrument

Light curve fitting (Stages 4-6)

What happened?

I am running Eureka from S3, but when I get to Stage 6, I get this error:

2022-08-14 15:54:41,519 - stpipe - WARNING - /mmfs1/home/kcrasmus/src/eureka/src/eureka/S6_planet_spectra/plots_s6.py:96: RuntimeWarning: invalid value encountered in sqrt return (r/y_scalar)**(1/expFactor)/scaleHeight - H_0

I guess this is implying that y_scalar is zero. I don't have a model yet, which may be the problem? I do not think it is scaleHeight because I have that set to 2.3 in the S5 epf.

Error traceback output

slurm-5868303.txt S6_TRAPPIST-1c.txt S5_TRAPPIST-1c.txt

What operating system are you using?

Linux

What version of Python are you running?

3.9

What Python packages do you have installed?

No response

Code of Conduct

taylorbell57 commented 2 years ago

Not having a model to plot at the same time won't be an issue at all as you have correctly set model_spectrum to None for that case. The S5 EPF file is also not relevant for this issue - none of those settings impact Stage 6 directly. I would mention that a mean molecular weight (planet_mu in your S6 ECF) of 2.3 implies an H2 and He dominated atmosphere which is not likely to be the correct value for such a small planet.

The main issue though is likely a bug caused by you setting the planet_Rp manually but not the planet_R0 manually - I know that leaving both set to None works well, but it appears that only setting one of them might cause an issue. I'll look into this more shortly, but as a short-term fix you are likely fine setting planet_Rp to None which should avoid a crash (but do consider using a mean molecular weight more appropriate to the atmosphere you'd expect).

And note that you are able to run just Stage 6 on it's own, so you won't need to re-run everything from scratch or anything.

kcrasmus commented 2 years ago

also, perhaps this is a second issue, but the spectra I'm getting look like this:

[image: fig6101_transmission.png]

thanks, kaitlin

On Tue, Aug 16, 2022 at 2:18 PM Kaitlin Rasmussen @.***> wrote:

Hello,

 Which file is planet_Rp in? I see a planet_Rad in S6.ecf but not a

planet_Rp. If I set both planet_Rad and planet_R0 to None, I get the same error.

Thanks, Kaitlin

On Tue, Aug 16, 2022 at 2:05 PM Taylor James Bell < @.***> wrote:

Not having a model to plot at the same time won't be an issue at all as you have correctly set model_spectrum to None for that case. The S5 EPF file is also not relevant for this issue - none of those settings impact Stage 6 directly. I would mention that a mean molecular weight (planet_mu in your S6 ECF) of 2.3 implies an H2 and He dominated atmosphere which is not likely to be the correct value for such a small planet.

The main issue though is likely a bug caused by you setting the planet_Rp manually but not the planet_R0 manually - I know that leaving both set to None works well, but it appears that only setting one of them might cause an issue. I'll look into this more shortly, but as a short-term fix you are likely fine setting planet_Rp to None which should avoid a crash (but do consider using a mean molecular weight more appropriate to the atmosphere you'd expect).

And note that you are able to run just Stage 6 on it's own, so you won't need to re-run everything from scratch or anything.

— Reply to this email directly, view it on GitHub https://github.com/kevin218/Eureka/issues/452#issuecomment-1217164574, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2E4CUEHCTG52VV7DHIAV5LVZP7C5ANCNFSM56TGW42Q . You are receiving this because you authored the thread.Message ID: @.***>

taylorbell57 commented 2 years ago

I believe you're replying by email rather than on GitHub, and your attached image doesn't seem to be able to make it through that way. Can you send it on GitHub instead of email?

kcrasmus commented 2 years ago

gotcha. here it is: fig6101_transmission

thanks, kaitlin

taylorbell57 commented 2 years ago

I'll also note that you should look at your outputs from Stage 5 - the lsq fitter failed to converge with the default value for lsq_maxiter. If you set lsq_maxiter to something ~10x the number of evaluations it stopped at (2001 according to the log you sent me, so try 20000) then lsq should converge.

As for the plot, I'm not sure what your concern is. If you want y error bars, you'll need to use one of the methods that gives uncertainties on fitted parameters (emcee of dynesty). If you're concerned by the near-zero transit depth, then you should look at what happened during Stage 5 (see again my comments above for lsq convergence).

kcrasmus commented 2 years ago

This is NIRSpec spectra, so shouldn't there be ~432 data points in the spectrum? Also, the lsq fitter failed to converge even with 30,000 iterations. Not sure what could be causing that. slurm-5873588.txt S5_TRAPPIST-1c.ecf.txt S5_TRAPPIST-1c.epf.txt S6_TRAPPIST-1c.ecf.txt

taylorbell57 commented 2 years ago

In your stage 4 you'll have set the number of spectral bins you want to two. You can set that to None to have unbinned spectra (very time consuming) or whatever coarser wavelength resolution you want. Not sure why lsq isn't converging - you should try troubleshooting that yourself using the plots and logs

kcrasmus commented 2 years ago

ah, gotcha. okay, I'll see if I can figure out the non-convergence problem and report back if I figure it out. Thanks for all your help!

taylorbell57 commented 2 years ago

Ohh, I finally understand the issue you encountered with Stage 6 now - it was that you had gotten a point so close to zero that the primary y-axis has values below Rp/R* = 0, and when you then try to take the square-root of that to convert it to a scale height you end up with an imaginary number. I'll have to think a bit on how to handle that properly

kcrasmus commented 1 year ago

Hello,

 Which file is planet_Rp in? I see a planet_Rad in S6.ecf but not a

planet_Rp. If I set both planet_Rad and planet_R0 to None, I get the same error.

Thanks, Kaitlin

On Tue, Aug 16, 2022 at 2:05 PM Taylor James Bell @.***> wrote:

Not having a model to plot at the same time won't be an issue at all as you have correctly set model_spectrum to None for that case. The S5 EPF file is also not relevant for this issue - none of those settings impact Stage 6 directly. I would mention that a mean molecular weight (planet_mu in your S6 ECF) of 2.3 implies an H2 and He dominated atmosphere which is not likely to be the correct value for such a small planet.

The main issue though is likely a bug caused by you setting the planet_Rp manually but not the planet_R0 manually - I know that leaving both set to None works well, but it appears that only setting one of them might cause an issue. I'll look into this more shortly, but as a short-term fix you are likely fine setting planet_Rp to None which should avoid a crash (but do consider using a mean molecular weight more appropriate to the atmosphere you'd expect).

And note that you are able to run just Stage 6 on it's own, so you won't need to re-run everything from scratch or anything.

— Reply to this email directly, view it on GitHub https://github.com/kevin218/Eureka/issues/452#issuecomment-1217164574, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2E4CUEHCTG52VV7DHIAV5LVZP7C5ANCNFSM56TGW42Q . You are receiving this because you authored the thread.Message ID: @.***>

taylorbell57 commented 1 year ago

Sorry, I mistyped - I meant planet_Rad not planet_Rp. What version of eureka are you using, as you shouldn't get this error now with the newest version