Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable modeling of starspots with both Fleck and Starry #627

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

erinmmay
Copy link
Collaborator

@erinmmay erinmmay commented Feb 27, 2024

Exactly what the title says - Adds fleck for starspot modeling, modifies starry code to allow starspots (not recommended, very slow...). Adds a plot to show starspots for fleck. This addresses #605

@taylorbell57
Copy link
Collaborator

@erinmmay, once this PR is ready for review, please mark it as such near the bottom of the page and request a review from Kevin and/or I.

@taylorbell57 taylorbell57 added enhancement New feature or request LC Fit labels Mar 1, 2024
@taylorbell57 taylorbell57 added this to In progress in Stage 5: Light Curve Fitting via automation Mar 1, 2024
@taylorbell57 taylorbell57 added this to In progress in Road to v1.1 via automation Mar 1, 2024
@erinmmay
Copy link
Collaborator Author

erinmmay commented May 1, 2024

Resolved conflicts and set fleck's "fast" option as the default (assumes stellar rotation is much longer than transit time and spots are stationary. user still has option to supply stellar rotation and calculate in "slow" mode). Pulling down the new version of the branch with conflicts resolved to test and then will remove "draft" status so it can be reviewed

@erinmmay
Copy link
Collaborator Author

I'm removing the draft status from this to expedite the process so it can be reviewed now, but I still have a couple tests to run (e.g. making sure this works with dynesty) before it should be merged

@erinmmay erinmmay marked this pull request as ready for review May 14, 2024 17:05
@erinmmay erinmmay requested a review from kevin218 May 14, 2024 17:05
Stage 5: Light Curve Fitting automation moved this from In progress to Pending Review May 16, 2024
Copy link
Owner

@kevin218 kevin218 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is some preliminary feedback on this PR.

Comment on lines 80 to 90
# spotstari 90 'fixed' 90 1 N
# spotrot 10 'fixed' 10 1 N
# spotnpts 100 'independent
# spotcon0 0.9 'free' 0 1 U
# spotrad0 0.2 'free' 0 360 U
# spotlat0 0 'free' -90 90 U
# spotlon0 0 'free' -180 180 U
# spotcon1 0.1 'free' 0 1 U
# spotrad1 0.2 'free' 0 1 U
# spotlat1 0 'free' -90 90 U
# spotlon1 0 'free' -180 180 U
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you align the columns so that they are easier to read?


- Star Spot Parameters
- ``spotstari`` - The stellar inclination in degrees.
- ``spotrot`` - The stellar rotation rate in days. For fleck, only assign if you'd like to run in slow mode! (In slow mode the star rotates and spots move appropriately. Otherwise Eureka! will use fleck's slow mode which assumes the stellar rotation is >> transit time and spots are stationary)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Otherwise Eureka! will use fleck's fast mode, which..."

setattr(bm_params, attr, model.parameters.dict[attr][0])
bm_params.u = uarray

fig = plt.figure(1000, figsize=(8, 6))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using figure number 5306. The general numbering scheme is 5XXX for Stage 5, X3XX for isplots >=3, and the last two digits for the actual figure number (01 - 05 are already taken).

star.plot(spotlon[:, None]*unit.deg, spotlat[:, None]*unit.deg,
spotrad[:, None], star_inc*unit.deg,
planet=bm_params, time=0)
fname = (f'figs{os.sep}fig1000_fleck_star_{fitter}')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fig5306

@@ -434,6 +438,10 @@ def emceefitter(lc, model, meta, log, **kwargs):
# Plot fit
if meta.isplots_S5 >= 1:
plots.plot_fit(lc, model, meta, fitter='emcee')

# Plot star spots
if 'fleck_tr' in meta.run_myfuncs and meta.isplots_S5:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta.isplots_S5 >= 3

@@ -900,6 +908,10 @@ def dynestyfitter(lc, model, meta, log, **kwargs):
if meta.isplots_S5 >= 1:
plots.plot_fit(lc, model, meta, fitter='dynesty')

# Plot star spots
if 'fleck_tr' in meta.run_myfuncs and meta.isplots_S5:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta.isplots_S5 >= 3

@@ -1012,6 +1024,10 @@ def lmfitter(lc, model, meta, log, **kwargs):
if meta.isplots_S5 >= 1:
plots.plot_fit(lc, model, meta, fitter='lmfitter')

# Plot star spots
if 'fleck_tr' in meta.run_myfuncs and meta.isplots_S5:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta.isplots_S5 >= 3

@@ -647,6 +647,24 @@ def fit_channel(meta, time, flux, chan, flux_err, eventlabel, params,
nints=lc_model.nints,
num_planets=meta.num_planets)
modellist.append(t_eclipse)
if 'fleck_tr' in meta.run_myfuncs:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to add fleck_tr as an option on line run_myfuncs in the file demos/JWST/S5_template.ecf.

# something that should be a horrible fit
if not ((0 < bm_params.per) and (0 < bm_params.inc < 90) and
(1 < bm_params.a) and (0 <= bm_params.ecc < 1) and
(0 <= bm_params.w <= 360)):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently removed the constraint on omega (see BatmanModels.py). You should check for other differences in BatmanModels.py

Road to v1.1 automation moved this from In progress to Review in progress May 16, 2024
@erinmmay
Copy link
Collaborator Author

addressed comments and updated FleckModel.py to use new PlanetParams class. Fully tested with emcee and dynesty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request LC Fit
Projects
Road to v1.1
Review in progress
Stage 5: Light Curve Fitting
  
Pending Review
Development

Successfully merging this pull request may close these issues.

None yet

3 participants