rodluger / starry

Tools for mapping stars and planets.
https://starry.readthedocs.io
MIT License
142 stars 32 forks source link

Compare to SPIDERMAN #10

Closed rodluger closed 6 years ago

rodluger commented 6 years ago

Probably the easiest way to benchmark stuff.

rodluger commented 6 years ago

Spiderman isn't currently that well documented, and I couldn't get their spherical harmonics brightness maps to work. Since we are benchmarking everything against numerical integration, I'm going to close this issue and move on.

rodluger commented 6 years ago

@jlustigy @dflemin3 Can you guys give this a shot? It would be nice to compare to spiderman.

dflemin3 commented 6 years ago

I'll start hacking on this this afternoon. Any particular test case you had in mind?

rodluger commented 6 years ago

No, but I'm mostly interested in a speed comparison and an accuracy comparison for low degree (l = 1, 2, and 3) maps. See what you can do! I kept getting NaNs in spiderman last time I tried to use their spherical harmonic utilities...

On Tue, May 1, 2018 at 3:11 PM David Fleming notifications@github.com wrote:

I'll start hacking on this this afternoon. Any particular test case you had in mind?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rodluger/starry/issues/10#issuecomment-385744546, or mute the thread https://github.com/notifications/unsubscribe-auth/AI5FK-LavkV7uh2KkHirMKZsDGeAZudsks5tuKVZgaJpZM4SSk7y .

dfm commented 6 years ago

We might also want to comment on the relationship between starry and something like exocartogapher: https://arxiv.org/abs/1802.06805

dflemin3 commented 6 years ago

I've been trying for awhile to get spiderman spherical harmonics to work using their provided examples, but I keep getting assert errors...

rodluger commented 6 years ago

@dflemin3 if you send me a mwe I can email Laura and ask if there's a workaround.

dflemin3 commented 6 years ago

The assert error turned out to be a bit of a strange one. Their brightness maps docs are incomplete and I was able to correct it after poking around their source code. Turns out that, for whatever reason, the quit() function they used in their code was not recognized in my Jupyter notebook (Jupyter lab, python 3.6). I cloned their repo and converted all quit() instances to the sort-of-equivalent sys.exit("Error message") and I got it working, which should be good enough for our purposes since that code was not getting executed for proper inputs.

Here's a simple working example of 2nd degree spherical harmonic map, adapted from their docs, that I can use as a template to working with starry:


import matplotlib.pyplot as plt
import numpy as np
import spiderman as sp

spider_params = sp.ModelParams(brightness_model='spherical')

spider_params.n_layers= 20

spider_params.t0= 200               # Central time of PRIMARY transit [days]
spider_params.per= 0.81347753       # Period [days]
spider_params.a_abs= 0.01526        # The absolute value of the semi-major axis [AU]
spider_params.inc= 82.33            # Inclination [degrees]
spider_params.ecc= 0.0              # Eccentricity
spider_params.w= 90                 # Argument of periastron
spider_params.rp= 0.1594            # Planet to star radius ratio
spider_params.a= 4.855              # Semi-major axis scaled by stellar radius
spider_params.p_u1= 0               # Planetary limb darkening parameter
spider_params.p_u2= 0               # Planetary limb darkening parameter

spider_params.sph= [1.0,1.0,1.0,1.0]              # vector of spherical harmonic weights
spider_params.degree = 2
spider_params.la0 = 0.0
spider_params.lo0 = 0.0

p = np.linspace(0,1,100)
lc = spider_params.lightcurve(p, use_phase=True)

plt.plot(p,lc)
plt.show()
dflemin3 commented 6 years ago

Note that the pip spiderman version is quite different than their bleeding-edge github version that I'm using, so that could explain the NaNs you got, @rodluger

rodluger commented 6 years ago

@dflemin3 How's this coming?

dflemin3 commented 6 years ago

The speedtest aspect is done and on my fork. I just need to rerun it with the same matplotlibrc param file as the rest of the figures for cohesion. I'm still spinning my wheels with the accuracy element as for SPIDERMAN, it seems that there are two issues: 1) The phase curve depends on the orbital period because from a little experimentation, it seems that SPIDERMAN assumes tidal locking, i.e. that the orbital period == the rotational period, which can change the observed signal 2) There always seems to be a minimum, non-zero difference in the lightcurve flux at ingress and egress between SPIDERMAN and starry, no matter what the grid resolution you use for SPIDERMAN.

rodluger commented 6 years ago

OK cool. Do you have time today to hack on this?

rodluger commented 6 years ago

This has been implemented!