rodluger / starry

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

Loaded planetary flux numpy array not normalized relative to the star? #311

Closed Ryan-Boukrouche closed 12 months ago

Ryan-Boukrouche commented 12 months ago

The code below aims at producing a light curve of a transiting planet from a planetary outgoing radiation map 2D numpy array. The loaded planetary flux is in W/m2, is there any way to normalize it relative to the star? b.map.intensity(x=0,y=0).eval() returns 1064 W/m2, and should return a fraction of unity.

import notebook_setup import starry import matplotlib.pyplot as plt import numpy as np import pymc3 as pm import pymc3_ext as pmx import exoplanet import corner from netCDF4 import Dataset

map = starry.Map(ydeg=20, quiet=True) A = starry.Primary(starry.Map(ydeg=0, udeg=2, amp=1.0), m=M_star, r=R_star, prot=Prot_star) A.map[1] = 0.4 A.map[2] = 0.2

planet_map = map.load(planet_array[:,:])

b = starry.Secondary( map, m=M_T1b, r=R_T1b, inc=I_T1b, prot=Prot_T1b, porb=Porb_T1b ) b.inc = b.map.inc b.Omega = b.map.obl b.theta0 = 180.0

sys = starry.System(A, b)

t = np.linspace(-0.3, 1.3, 1000)

fig, ax = plt.subplots(figsize=(15,5)) ax.plot(t, sys.flux(t).eval()/(A.map.intensity()), label="system flux") ax.plot(t, map.flux(theta=360.0 * t).eval(), "--", label="T1b flux") ax.set_xlabel("time", size=24) ax.set_ylabel("flux", size=24) plt.legend(fontsize=20) plt.show()