"""This module introduces uniform plot formatting and parameter label generation."""
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from superphot_plus.constants import BIGGER_SIZE, MEDIUM_SIZE, SMALL_SIZE
[docs]
CUSTOM_COLORSET = [
'#4477AA',
'#EE6677',
'#228833',
'#CCBB44',
'#66CCEE',
'#AA3377',
'#BBBBBB',
]
[docs]
def band_colors(c):
"""Return face and edge colors for light curve plotting."""
face_dict = {
"r": '#EE6677',
"g": '#4477AA',
}
edge_dict = {
'r': '#BB5566',
'g': '#004488'
}
return face_dict[c], edge_dict[c]
[docs]
def param_labels(aux_bands=None, ref_band=None, log=True):
"""Return properly formatted parameter labels
for plotting.
Parameters
----------
aux_bands : array-like, optional
The auxiliary bands for naming, in order. Defaults to None,
in which case we assume only the base band.
Returns
----------
plot_labels : list
All properly formatted plotting labels.
"""
if ref_band is not None:
if log:
plot_labels = [
rf"$\log_{{10}}A_{{{ref_band}}}$",
rf"$\beta_{{{ref_band}}}$",
rf"$\log_{{10}}\gamma_{{{ref_band}}}$",
rf"$t_{{0, {ref_band}}}$",
rf"$\log_{{10}}\tau_\mathrm{{rise, {ref_band}}}$",
rf"$\log_{{10}}\tau_\mathrm{{fall, {ref_band}}}$",
rf"$\log_{{10}}\sigma_\mathrm{{extra, {ref_band}}}$",
]
else:
plot_labels = [
rf"$A_{{{ref_band}}}$",
rf"$\beta_{{{ref_band}}}$",
rf"$\gamma_{{{ref_band}}}$",
rf"$t_{{0, {ref_band}}}$",
rf"$\tau_\mathrm{{rise, {ref_band}}}$",
rf"$\tau_\mathrm{{fall, {ref_band}}}$",
rf"$\sigma_\mathrm{{extra, {ref_band}}}$",
]
else:
if log:
plot_labels = [
r"$\log_{10}A$",
r"$\beta$",
r"$\log_{10}\gamma$",
r"$t_0$",
r"$\log_{10}\tau_\mathrm{rise}$",
r"$\log_{10}\tau_\mathrm{fall}$",
r"$\log_{10}\sigma_\mathrm{extra}$",
]
else:
plot_labels = [
r"$A$",
r"$\beta$",
r"$\gamma$",
r"$t_0$",
r"$\tau_\mathrm{rise}$",
r"$\tau_\mathrm{fall}$",
r"$\sigma_\mathrm{extra}$",
]
save_labels = [
"logA",
"beta",
"loggamma",
"t0",
"logtaurise",
"logtaufall",
"sigmaextra",
]
if aux_bands is None:
aux_bands = []
for aux_b in aux_bands:
plot_labels.extend(
[
rf"$A_{{{aux_b}}}$",
rf"$\beta_{{{aux_b}}}$",
rf"$\gamma_{{{aux_b}}}$",
rf"$t_\mathrm{{0, {aux_b}}}$",
rf"$\tau_\mathrm{{rise, {aux_b}}}$",
rf"$\tau_\mathrm{{fall, {aux_b}}}$",
rf"$\sigma_\mathrm{{extra, {aux_b}}}$",
]
)
save_labels.extend(
[
f"A_{aux_b}",
f"beta_{aux_b}",
f"gamma_{aux_b}",
f"t0_{aux_b}",
f"taurise_{aux_b}",
f"taufall_{aux_b}",
f"extrasigma_{aux_b}",
]
)
plot_labels.append(r"$\chi^2$")
save_labels.append("chisquared")
return np.array(plot_labels), np.array(save_labels)