Skip to content

Instantly share code, notes, and snippets.

@rodluger
Created September 19, 2020 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodluger/7ff11fb908a7caae4c1c72f855b87a74 to your computer and use it in GitHub Desktop.
Save rodluger/7ff11fb908a7caae4c1c72f855b87a74 to your computer and use it in GitHub Desktop.
Degeneracies in the light curve inversion problem for mapping stars and planets
import starry
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
# Settings
starry.config.lazy = False
np.random.seed(12)
# Load a map of the earth
map = starry.Map(15)
map.inc = 60.0
map.load("earth")
# Even Ylm degrees can be inferred to some extent
l_vis = np.append([1], np.arange(2, map.ydeg + 1, 2, dtype=int))
# Odd Ylm degrees are always in the null space
l_null = np.arange(3, map.ydeg + 1, 2, dtype=int)
# Plot the light curve
fig, ax = plt.subplots(1)
theta = np.linspace(0, 360, 1000)
ax.plot(theta, map.flux(theta=theta))
ax.set_xlabel(r"$\theta$ [degrees]")
ax.set_ylabel("normalized flux")
fig.savefig("star.pdf", bbox_inches="tight")
# Now set the coefficients in the null space to random
# values. This *does not change the light curve*, by
# definition. But it *does* change the surface map!
a = 0.01
for i in tqdm(range(9)):
if i > 1:
for l in l_null:
map[int(l), :] = np.exp(-a * l ** 2) * np.random.randn(2 * l + 1)
map.show(theta=np.linspace(0, 360, 50), file="star%d.gif" % (i + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment