rodluger / starry

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

Rigorous test suite #4

Closed rodluger closed 6 years ago

rodluger commented 6 years ago

I tested the code a ton, but we still need a rigorous set of benchmarks in the tests/ folder

ericagol commented 6 years ago

It's useful to have analytic tests to compare with, and one that could be tried is a limb-brightened star. I derived the analytic formulae for this paper:

http://adsabs.harvard.edu/abs/2010ApJ...722L..75S

Of course, this is circularly symmetric, and so would involve a series of m=0 spherical harmonics (I think), but may still be an adequate test.

Another potentially useful test may be that the l -> \infinity case gives a flat light curve (since adjacent bright and dark regions will cancel out). Of course for finite l this will lead to rapid up and down fluctuations during the occultation, but of some amplitude $\propto l^{-2}$, so I'm not sure, whether a large enough l can be reached numerically to make this test useful.

Finally, a delta function expansion (http://mathworld.wolfram.com/SphericalHarmonicClosureRelations.html) can be computed analytically for a bright point on a sphere, and thus may prove to be a useful test as the occultation light curve can be easily computed analytically (it will be a step function which is unity when the point is on the visible hemisphere and unocculted). Again, I'm not sure how high of an l one would have to expand to in order to achieve sufficient numerical accuracy, but at least this series should converge, I expect, as l^{-2}.

rodluger commented 6 years ago

@jlustigy suggested adding assert statements in the figure scripts and importing them into a test function in the tests directory. It's hacky, but will give us excellent coverage while avoiding code duplication!

rodluger commented 6 years ago

Between @dflemin3's benchmarks against spiderman, my benchmarks against batman, the test scripts I have so far, and my hack to run the tutorial notebooks as test scripts, I think we have a fairly robust suite of unit tests, so I'm closing this issue.