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
base: main
Are you sure you want to change the base?
Conversation
@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. |
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 |
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 |
There was a problem hiding this 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.
demos/JWST/S5_fit_par_template.epf
Outdated
# 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 |
There was a problem hiding this comment.
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?
docs/source/ecf.rst
Outdated
|
||
- 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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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}') |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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)): |
There was a problem hiding this comment.
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
addressed comments and updated FleckModel.py to use new PlanetParams class. Fully tested with emcee and dynesty. |
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