kevin218 / Eureka

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

Adding an astrophysical model to combine all physical models, adding quasi-Lambertian phase curve #663

Open taylorbell57 opened 2 weeks ago

taylorbell57 commented 2 weeks ago

Note that this PR is still a draft and should not yet be reviewed.

Note that this PR builds on PRs #632 and #659 and should only be reviewed after those PRs are merged into main.

This PR adds an AstroModel to both models and differentiable_models to deal with safely combining different astrophysical models. This was in part necessitated by another addition in this PR which adds a quasi-Lambertian phase curve model (based on Agol+2007) which is useful for modelling thermal phase curves of airless worlds. I also spent some time trying to make the PyMC3 models closer to the non-differentiable models to reduce duplicated code.

In addition, this PR allows linear extrapolation of limb-darkening coefficients beyond the edge of the nominal filter range of ExoTiC-LD - I regularly encounter issues with using fixed LD coeffs from ExoTiC-LD because the nominal filter coverage does not extend as far into the edges of the filter as I'd like to use. This works okay in many cases, but in some edge cases it can result in some very strange behaviour.

Things to do before this PR is ready for review include:

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 52.89754% with 1016 lines in your changes missing coverage. Please review.

Project coverage is 54.82%. Comparing base (a939236) to head (55f8e38).

Files Patch % Lines
...curve_fitting/differentiable_models/StarryModel.py 0.00% 110 Missing :warning:
src/eureka/S6_planet_spectra/s6_spectra.py 51.02% 96 Missing :warning:
src/eureka/S1_detector_processing/s1_meta.py 6.12% 92 Missing :warning:
.../eureka/S5_lightcurve_fitting/models/AstroModel.py 70.87% 90 Missing :warning:
...curve_fitting/differentiable_models/PyMC3Models.py 14.58% 82 Missing :warning:
...ightcurve_fitting/differentiable_models/GPModel.py 8.43% 76 Missing :warning:
...tcurve_fitting/differentiable_models/AstroModel.py 23.94% 54 Missing :warning:
...differentiable_models/QuasiLambertianPhaseCurve.py 24.07% 41 Missing :warning:
...tcurve_fitting/models/QuasiLambertianPhaseCurve.py 17.07% 34 Missing :warning:
src/eureka/S4_generate_lightcurves/s4_meta.py 69.31% 27 Missing :warning:
... and 39 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #663 +/- ## ========================================== + Coverage 54.24% 54.82% +0.58% ========================================== Files 101 111 +10 Lines 12793 13363 +570 ========================================== + Hits 6939 7326 +387 - Misses 5854 6037 +183 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kevin218 commented 2 weeks ago

Can the quasi-Lambertian also be used for reflected light?

taylorbell57 commented 2 weeks ago

Can the quasi-Lambertian also be used for reflected light?

Yeah, I believe you'd just need to fix gamma=4

taylorbell57 commented 2 weeks ago

Correction, apparently the best-fit gamma coefficient to approximate a Lambertian phase function was 3.285 - Eric just used 4 in his 2007 paper since it was close-ish and had some nice mathematical properties for his application. If desired, we can add an actual Lambertian phase function later (perhaps with an albedo term as well, so we can handle mixtures of emitted and reflected light with NIRSpec PRISM and NIRISS phase curves) - this quasi-Lambertian was just useful for the TRAPPIST-1 phase curve data (since the 3D modelling folks found that different airless scenarios could be well approximated with the quasi-Lambertian function).

kevin218 commented 2 weeks ago

Yeah, I'm in the position of needing to fit both thermal and reflected light.

With that said, no planet is a perfect Lambertian, and usually far from it, so fitting for gamma may be reasonable. I'll have to run some tests when I get back.

On Fri, Jun 21, 2024, 6:35 AM Taylor James Bell @.***> wrote:

Correction, apparently the best-fit gamma coefficient to approximate a Lambertian phase function was 3.285 - Eric just used 4 in his 2007 paper since it was close-ish and had some nice mathematical properties for his application. If desired, we can add an actual Lambertian phase function later (perhaps with an albedo term as well, so we can handle mixtures of emitted and reflected light with NIRSpec PRISM and NIRISS phase curves) - this quasi-Lambertian was just useful for the TRAPPIST-1 phase curve data (since the 3D modelling folks found that different airless scenarios could be well approximated with the quasi-Lambertian function).

— Reply to this email directly, view it on GitHub https://github.com/kevin218/Eureka/pull/663#issuecomment-2181982647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFC2C7MN7UIBDZ6J3LRIZI3ZIOUQPAVCNFSM6AAAAABJQ5XGBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRHE4DENRUG4 . You are receiving this because you commented.Message ID: @.***>