Skip to content
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

Adding the option to impose positive values on fitted eclipse maps #559

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5e14a80
Test change to StarryModel identifying where to put positivity constr…
Aug 7, 2023
58eab18
Added positive flux constraint via pixel sampling with Starry
Aug 9, 2023
af514dd
Added meta flags for eclipse mapping
mark-hammond Aug 13, 2023
b270025
Added meta flags for eclipse mapping
mark-hammond Aug 13, 2023
2aeb21d
Adding LogNormal distribution for positive map pixels
mark-hammond Aug 14, 2023
d4244b5
Adding comments and fixing magnitude in map plotter
mark-hammond Aug 14, 2023
64ef8b0
Resolved conflict, now allows negative rp for pixel sampling
mark-hammond Aug 21, 2023
03f5cd4
Fixed reference to starry ydeg to use correct value
mark-hammond Aug 21, 2023
fa63792
Fixed conflicts with main branch
mark-hammond Aug 21, 2023
96910a2
Fixed conflicts with main branch
mark-hammond Aug 21, 2023
5bf2037
Fixed conflicts with main branch
mark-hammond Aug 22, 2023
d8cebc9
Merge remote-tracking branch 'origin/main' into positive_maps
taylorbell57 Aug 24, 2023
9552083
Keeping force_positivity name in meta
taylorbell57 Aug 24, 2023
41710b2
Fixing plots_s5.py formatting for flake8
taylorbell57 Aug 24, 2023
f0e3565
Fixing old typo with emcee log
taylorbell57 Aug 28, 2023
54d1777
Adding meta.exoplanet_first and saving trace
taylorbell57 Aug 28, 2023
ebfe1b1
Adjusting naming and display of eclipse map figure
taylorbell57 Aug 28, 2023
711753e
Fixing StarryModel.py flake8 formatting
taylorbell57 Aug 28, 2023
bdc27f0
Always set oversample to 3 to ensure proper sampling
mark-hammond Sep 5, 2023
a8ba3f5
Calculate starry amp the same with or without pixel sampling
mark-hammond Sep 5, 2023
e443042
Change pixel priors to be exact factors of pi representing the expect…
mark-hammond Sep 5, 2023
d1fe98c
Make pixel prior mean and sigma set by run params file
mark-hammond Sep 18, 2023
a8ab3fa
Change so that map trace is only saved if a map is fitted
mark-hammond Sep 18, 2023
7e92c9d
Added option to output plotted lightcurve data with record_plot_data
mark-hammond Sep 18, 2023
41b8d30
Assume a fixed fp for fitting a pixel map
mark-hammond Sep 18, 2023
2678d84
Add option to set pixel oversampling factor in run parameters
mark-hammond Sep 21, 2023
aff1c7b
Add calculating and saving of binned model_phys
mark-hammond Sep 21, 2023
25e8493
Merge remote-tracking branch 'origin/main' into positive_maps
taylorbell57 Feb 10, 2024
ac48ad1
Tidying some S5 code and fixing flake8 issues
taylorbell57 Feb 10, 2024
e3af769
Merge remote-tracking branch 'origin/main' into positive_maps
taylorbell57 Feb 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import starry
starry.config.quiet = True
starry.config.lazy = True
import pymc3 as pm

from . import PyMC3Model
from ..limb_darkening_fit import ld_profile
Expand Down Expand Up @@ -66,6 +67,9 @@
l_vals = [int(self.paramtitles[ind][1])
for ind in ylm_params]
self.ydeg = max(l_vals)
elif 'pixel_ydeg' in self.paramtitles:

Check warning on line 70 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L70

Added line #L70 was not covered by tests
# read l order used for pixel sampling
self.ydeg = self.parameters.pixel_ydeg.value

Check warning on line 72 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L72

Added line #L72 was not covered by tests
else:
self.ydeg = 0

Expand Down Expand Up @@ -190,8 +194,58 @@
planet.theta0 = 180.0
planet.t0 = temp.t0

# Pixel sampling setup
if 'pixel_ydeg' in self.paramtitles:

# Oversample factor of 3 is a safe bet to achieve pixels
# ~4L^2, but not always necessary
if 'pixel_oversample' in self.paramtitles:
self.oversample = self.parameters.pixel_oversample.value

Check warning on line 203 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L202-L203

Added lines #L202 - L203 were not covered by tests
else:
self.oversample = 3

Check warning on line 205 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L205

Added line #L205 was not covered by tests

# Get pixel transform matrix and number of pixels
A = planet.map.get_pixel_transforms(

Check warning on line 208 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L208

Added line #L208 was not covered by tests
oversample=self.oversample)[3]
self.npix = A.shape[1]

Check warning on line 210 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L210

Added line #L210 was not covered by tests

# Set prior to either be log normal, or normal around zero
pixel_prior_mean = self.parameters.pixel_prior_mean.value
pixel_prior_width = self.parameters.pixel_prior_width.value
if self.force_positivity:
p = pm.LogNormal("p", mu=np.log(pixel_prior_mean/np.pi),

Check warning on line 216 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L213-L216

Added lines #L213 - L216 were not covered by tests
sigma=pixel_prior_width/pixel_prior_mean,
shape=(self.npix,))
else:
p = pm.Normal("p", mu=pixel_prior_mean/np.pi,

Check warning on line 220 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L220

Added line #L220 was not covered by tests
sd=pixel_prior_width/np.pi,
shape=(self.npix, ))

# Transform pixels to spherical harmonics
self.starry_x = tt.dot(A, p)

Check warning on line 225 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L225

Added line #L225 was not covered by tests
# Record spherical harmonics
pm.Deterministic("y", self.starry_x)

Check warning on line 227 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L227

Added line #L227 was not covered by tests

# Instantiate the system
system = starry.System(star, planet, light_delay=self.compute_ltt)

if 'pixel_ydeg' in self.paramtitles:
# Calculate light curve by multiplying spherical harmonics by
# design matrix, then record
self.starry_X = system.design_matrix(self.time)
lcpiece = self.starry_X[:, 0] + tt.dot(self.starry_X[:, 1:],

Check warning on line 236 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L235-L236

Added lines #L235 - L236 were not covered by tests
self.starry_x)

# Calculate and record map
map_plot = starry.Map(ydeg=self.ydeg)
map_plot.amp = self.starry_x[0]
map_plot[1:, :] = self.starry_x[1:]/self.starry_x[0]

Check warning on line 242 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L240-L242

Added lines #L240 - L242 were not covered by tests

pm.Deterministic("flux_model", lcpiece)
pm.Deterministic("map_grid",

Check warning on line 245 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L244-L245

Added lines #L244 - L245 were not covered by tests
np.pi*map_plot.render(projection="rect",
res=100))

self.systems.append(system)

def eval(self, eval=True, channel=None, **kwargs):
Expand Down Expand Up @@ -241,13 +295,17 @@
time = split([time, ], self.nints, chan)[0]

# Combine the planet and stellar flux (allowing negative rp)
fstar, fp = systems[chan].flux(time, total=False)
# Do some annoying math to allow theano functions to compile
# (correctly defined for -1 < rp < 1)
sign = (lib.ceil(rps[chan])+lib.floor(rps[chan]))
fstar = (fstar-1)*sign + 1
fp = fp*sign
lcpiece = fstar+fp
if 'pixel_ydeg' in self.paramtitles:
lcpiece = self.starry_X[:, 0] + tt.dot(self.starry_X[:, 1:],

Check warning on line 299 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L299

Added line #L299 was not covered by tests
self.starry_x)
else:
fstar, fp = systems[chan].flux(time, total=False)
# Do some annoying math to allow theano functions to compile
# (correctly defined for -1 < rp < 1)
sign = (lib.ceil(rps[chan])+lib.floor(rps[chan]))
fstar = (fstar-1)*sign + 1
fp = fp*sign
lcpiece = fstar+fp

if eval:
lcpiece = lcpiece.eval()
Expand Down Expand Up @@ -373,4 +431,13 @@

# Instantiate the system
sys = starry.System(star, planet, light_delay=self.compute_ltt)

if 'pixel_ydeg' in self.paramtitles:
# import pixel values and convert to spherical harmonics
A = planet.map.get_pixel_transforms(

Check warning on line 437 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L437

Added line #L437 was not covered by tests
oversample=self.oversample)[3]
p_fit = newparams[-self.npix:]
self.starry_x = tt.dot(A, p_fit)
self.starry_X = sys.design_matrix(self.time)

Check warning on line 441 in src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/differentiable_models/StarryModel.py#L439-L441

Added lines #L439 - L441 were not covered by tests

self.fit.systems.append(sys)
2 changes: 1 addition & 1 deletion src/eureka/S5_lightcurve_fitting/fitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def emceefitter(lc, model, meta, log, **kwargs):
args=(lc, model, prior1, prior2,
priortype, freenames),
pool=pool)
log.writelog('Running emcee burn-in...')
log.writelog('Running emcee...')
sampler.run_mcmc(pos, meta.run_nsteps, progress=True)
# state = sampler.run_mcmc(pos, meta.run_nsteps, progress=True)
# # Log some details about the burn-in phase
Expand Down
28 changes: 28 additions & 0 deletions src/eureka/S5_lightcurve_fitting/gradient_fitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from . import plots_s5 as plots
from .fitters import group_variables, load_old_fitparams, save_fit
from ..lib.split_channels import get_trim
import arviz as az


def exoplanetfitter(lc, model, meta, log, calling_function='exoplanet',
Expand Down Expand Up @@ -185,6 +186,17 @@

model.setup(lc.time, lc.flux, lc.unc)

if hasattr(meta, 'exoplanet_first') and meta.exoplanet_first:
log.writelog('\nCalling exoplanet first...')

Check warning on line 190 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L190

Added line #L190 was not covered by tests
# RUN LEAST SQUARES
opt_sol = exoplanetfitter(lc, model, meta, log,

Check warning on line 192 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L192

Added line #L192 was not covered by tests
calling_function='nuts', **kwargs)
freepars = opt_sol.fit_params

Check warning on line 194 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L194

Added line #L194 was not covered by tests

if meta.rescale_err:

Check warning on line 196 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L196

Added line #L196 was not covered by tests
# Scale uncertainties with reduced chi-squared
lc.unc *= np.sqrt(opt_sol.chi2red)

Check warning on line 198 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L198

Added line #L198 was not covered by tests

start = {}
for name, val in zip(freenames, freepars):
start[name] = val
Expand Down Expand Up @@ -232,6 +244,16 @@
upper_errs = q[2]-q[1]
lower_errs = q[1]-q[0]

# If pixel sampling, append best fit pixels to fit_params
if "pixel_ydeg" in indep_vars:
trace_az = az.from_pymc3(trace, model=model.model)
trace_fname = meta.outputdir+"S5_trace_map.nc"
log.writelog(f'Saving map trace to {trace_fname}...')
trace_az.to_netcdf(trace_fname)

Check warning on line 252 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L249-L252

Added lines #L249 - L252 were not covered by tests

fit_params = np.append(fit_params,

Check warning on line 254 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L254

Added line #L254 was not covered by tests
trace_az['posterior']['p'][0, 0])

model.update(fit_params)
model.errs = dict(zip(freenames, errs))
if "scatter_ppm" in freenames:
Expand Down Expand Up @@ -291,6 +313,12 @@
'sinusoid_pc' in meta.run_myfuncs)):
plots.plot_phase_variations(lc, model, meta, fitter='nuts')

# Show the inferred planetary brightness map
if meta.isplots_S5 >= 1 and "pixel_ydeg" in indep_vars:
eclipse_maps = np.transpose(trace_az.posterior.stack(

Check warning on line 318 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L318

Added line #L318 was not covered by tests
sample=("chain", "draw"))['map_grid'][:], [2, 0, 1])
plots.plot_eclipse_map(lc, eclipse_maps, meta)

Check warning on line 320 in src/eureka/S5_lightcurve_fitting/gradient_fitters.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/gradient_fitters.py#L320

Added line #L320 was not covered by tests

# Plot Allan plot
if meta.isplots_S5 >= 3:
plots.plot_rms(lc, model, meta, fitter='nuts')
Expand Down
144 changes: 144 additions & 0 deletions src/eureka/S5_lightcurve_fitting/plots_s5.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,42 @@
nbin_plot = len(time)
else:
nbin_plot = meta.nbin_plot

binned_time = util.binData_time(time, time, nbin_plot)
binned_flux = util.binData_time(flux, time, nbin_plot)
binned_unc = util.binData_time(unc, time, nbin_plot, err=True)
binned_normflux = util.binData_time(flux/model_sys-gp, time, nbin_plot)
binned_res = util.binData_time(residuals, time, nbin_plot)
binned_model_phys = util.binData_time(model_phys, time, nbin_plot)

if hasattr(meta, 'record_plot_data'):
if meta.record_plot_data:
np.savez_compressed(meta.outputdir+'time.npz',

Check warning on line 110 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L109-L110

Added lines #L109 - L110 were not covered by tests
data=time.data, mask=time.mask)
np.savez_compressed(meta.outputdir+'flux.npz',

Check warning on line 112 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L112

Added line #L112 was not covered by tests
data=flux.data, mask=flux.mask)
np.savez_compressed(meta.outputdir+'unc.npz',

Check warning on line 114 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L114

Added line #L114 was not covered by tests
data=unc.data, mask=unc.mask)
np.savez_compressed(meta.outputdir+'model_phys.npz',

Check warning on line 116 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L116

Added line #L116 was not covered by tests
data=model_phys.data)
np.savez_compressed(meta.outputdir+'model_sys.npz',

Check warning on line 118 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L118

Added line #L118 was not covered by tests
data=model_sys.data)

np.savez_compressed(meta.outputdir+'binned_time.npz',

Check warning on line 121 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L121

Added line #L121 was not covered by tests
data=binned_time.data,
mask=binned_time.mask)
np.savez_compressed(meta.outputdir+'binned_flux.npz',

Check warning on line 124 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L124

Added line #L124 was not covered by tests
data=binned_flux.data,
mask=binned_flux.mask)
np.savez_compressed(meta.outputdir+'binned_unc.npz',

Check warning on line 127 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L127

Added line #L127 was not covered by tests
data=binned_unc.data,
mask=binned_unc.mask)
np.savez_compressed(meta.outputdir+'binned_normflux.npz',

Check warning on line 130 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L130

Added line #L130 was not covered by tests
data=binned_normflux.data)
np.savez_compressed(meta.outputdir+'binned_res.npz',

Check warning on line 132 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L132

Added line #L132 was not covered by tests
data=binned_res.data)
np.savez_compressed(meta.outputdir+'binned_model_phys.npz',

Check warning on line 134 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L134

Added line #L134 was not covered by tests
data=binned_model_phys.data)

fig = plt.figure(5101, figsize=(8, 6))
plt.clf()
Expand Down Expand Up @@ -781,3 +812,116 @@
fig.savefig(meta.outputdir+fname, bbox_inches='tight', dpi=300)
if not meta.hide_plots:
plt.pause(0.2)


def plot_eclipse_map(lc, flux_maps, meta):
"""Plot fitted eclipse map and lat-lon slices (Figs 5105)

Parameters
----------
lc : eureka.S5_lightcurve_fitting.lightcurve.LightCurve
The lightcurve data object.
flux_maps : array
The posterior distribution of the fitted maps
meta : eureka.lib.readECF.MetaClass
The metadata object.

Notes
-----
History:

- August 14, 2023 Mark Hammond
Initial version.
"""
for i, channel in enumerate(lc.fitted_channels):
fig = plt.figure(5105, figsize=(12, 3))
fig.clf()
axs = fig.subplots(1, 3, width_ratios=[1.4, 1, 1])

Check warning on line 839 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L836-L839

Added lines #L836 - L839 were not covered by tests

lons = np.linspace(-180, 180, np.shape(flux_maps)[2])
lats = np.linspace(-90, 90, np.shape(flux_maps)[1])

Check warning on line 842 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L841-L842

Added lines #L841 - L842 were not covered by tests

# Quantiles
p1 = 0.841
p2 = 0.977
p3 = 0.998

Check warning on line 847 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L845-L847

Added lines #L845 - L847 were not covered by tests

# Plot median map
ca = axs[0].contourf(lons, lats,

Check warning on line 850 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L850

Added line #L850 was not covered by tests
np.quantile(1e6*flux_maps[:], 0.5, axis=0),
cmap='RdBu_r')
axs[0].axhline(0, color='C0', ls='--')
axs[0].axvline(0, color='C3', ls='--')
axs[0].set_xticks([-180, -90, 0, 90, 180])
axs[0].set_yticks([-90, -45, 0, 45, 90])
axs[0].set_xlim([-180, 180])
axs[0].set_ylim([-90, 90])
plt.colorbar(ca, ax=axs[0], pad=0.02)

Check warning on line 859 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L853-L859

Added lines #L853 - L859 were not covered by tests

# Plot slice along equator
lat0 = int(np.shape(flux_maps)[2]/2)
axs[1].fill_between(lons,

Check warning on line 863 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L862-L863

Added lines #L862 - L863 were not covered by tests
1e6*np.quantile(flux_maps[:, lat0], p1, axis=0),
1e6*np.quantile(flux_maps[:, lat0], 1-p1, axis=0),
color='C0', alpha=0.3, ls='None')
axs[1].fill_between(lons,

Check warning on line 867 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L867

Added line #L867 was not covered by tests
1e6*np.quantile(flux_maps[:, lat0], p2, axis=0),
1e6*np.quantile(flux_maps[:, lat0], 1-p2, axis=0),
color='C0', alpha=0.3, ls='None')
axs[1].fill_between(lons,

Check warning on line 871 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L871

Added line #L871 was not covered by tests
1e6*np.quantile(flux_maps[:, lat0], p3, axis=0),
1e6*np.quantile(flux_maps[:, lat0], 1-p3, axis=0),
color='C0', alpha=0.3, ls='None')
axs[1].set_xlim([-180, 180])
axs[1].set_xticks([-180, -90, 0, 90, 180])

Check warning on line 876 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L875-L876

Added lines #L875 - L876 were not covered by tests

# Plot slice along equator
lon0 = int(np.shape(flux_maps)[1]/2)
axs[2].fill_between(

Check warning on line 880 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L879-L880

Added lines #L879 - L880 were not covered by tests
lats,
1e6*np.quantile(flux_maps[:, :, lon0], p1, axis=0),
1e6*np.quantile(flux_maps[:, :, lon0], 1-p1, axis=0),
color='C3', alpha=0.3, ls='None')
axs[2].fill_between(

Check warning on line 885 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L885

Added line #L885 was not covered by tests
lats,
1e6*np.quantile(flux_maps[:, :, lon0], p2, axis=0),
1e6*np.quantile(flux_maps[:, :, lon0], 1-p2, axis=0),
color='C3', alpha=0.3, ls='None')
axs[2].fill_between(

Check warning on line 890 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L890

Added line #L890 was not covered by tests
lats,
1e6*np.quantile(flux_maps[:, :, lon0], p3, axis=0),
1e6*np.quantile(flux_maps[:, :, lon0], 1-p3, axis=0),
color='C3', alpha=0.3, ls='None')
axs[2].set_xlim([-90, 90])
axs[2].set_xticks([-90, -45, 0, 45, 90])

Check warning on line 896 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L895-L896

Added lines #L895 - L896 were not covered by tests

axs[0].set_title('Median Map', fontsize=12)
axs[1].set_title('Fit Along Equator', fontsize=12)
axs[2].set_title(r'Fit Along 0$^{\circ}$ Longitude', fontsize=12)
axs[0].set_ylabel('Latitude', labelpad=-10)
axs[0].set_xlabel('Longitude')
axs[1].set_xlabel('Longitude')
axs[2].set_xlabel('Latitude')
axs[1].set_ylabel(r'$F_{\rm p}/F_{\rm s}$ (ppm)', fontsize=11,

Check warning on line 905 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L898-L905

Added lines #L898 - L905 were not covered by tests
labelpad=-4)
axs[2].set_ylabel(r'$F_{\rm p}/F_{\rm s}$ (ppm)', fontsize=11,

Check warning on line 907 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L907

Added line #L907 was not covered by tests
labelpad=-4)

plt.subplots_adjust(left=0.07,

Check warning on line 910 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L910

Added line #L910 was not covered by tests
bottom=0.17,
right=0.98,
top=0.81,
wspace=0.38,
hspace=0.22)

if lc.white:
fname_tag = 'white'

Check warning on line 918 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L917-L918

Added lines #L917 - L918 were not covered by tests
else:
ch_number = str(channel).zfill(len(str(lc.nchannel)))
fname_tag = f'ch{ch_number}'

Check warning on line 921 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L920-L921

Added lines #L920 - L921 were not covered by tests

fname = (f'figs{os.sep}fig5105_{fname_tag}_eclipse_map' +

Check warning on line 923 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L923

Added line #L923 was not covered by tests
plots.figure_filetype)
fig.savefig(meta.outputdir+fname, bbox_inches='tight', dpi=300)
if not meta.hide_plots:
plt.pause(0.2)

Check warning on line 927 in src/eureka/S5_lightcurve_fitting/plots_s5.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S5_lightcurve_fitting/plots_s5.py#L925-L927

Added lines #L925 - L927 were not covered by tests
Loading
Loading