Skip to content

Commit

Permalink
uniform styles across plots (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
zatkins2 authored Feb 20, 2025
1 parent e241991 commit 5d52d1a
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions project/ACT_DR6/python/paper_plots/results_multifrequency_TT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
from pspy import so_dict, so_spectra, so_cov, pspy_utils
from pspipe_utils import log
import numpy as np
import pylab as plt
import matplotlib.pyplot as plt
import sys, os
import scipy.stats as ss
import pspipe_utils
from matplotlib import rcParams

rcParams["font.family"] = "serif"
rcParams["font.size"] = "20"
rcParams["xtick.labelsize"] = 20
rcParams["ytick.labelsize"] = 20
rcParams["axes.labelsize"] = 20
rcParams["axes.titlesize"] = 20

labelsize = 14
fontsize = 20

d = so_dict.so_dict()
d.read_from_file(sys.argv[1])
Expand Down Expand Up @@ -46,7 +41,8 @@

lth, Dlth = so_spectra.read_ps(f"{bestfit_dir}/cmb.dat", spectra=spectra)

color_list = ["green", "red", "royalblue", "orange", "purple", "yellow"]
color_list = ["green", "red", "royalblue", "orange", "orchid", "yellow"]
zorder_list = [6, 5, 4, 3, 2, 1] # put f220 on bottom

mK_to_muK = 10**3
lpow = 0.1
Expand All @@ -55,11 +51,11 @@
ell_label = multipole


plt.figure(figsize=(16, 8))
plt.ylabel(r"$\ell^{2} D^{TT}_{\ell} [m K^{2}] $", fontsize=40)
plt.xlabel(r"$\ell$", fontsize=40)
plt.figure(figsize=(12, 6), dpi=100)
plt.ylabel(r"$\ell^{2} D^{TT}_{\ell} [m \rm K^{2}] $", fontsize=fontsize)
plt.xlabel(r"$\ell$", fontsize=fontsize)

plt.plot(lth ** lpow, Dlth["TT"] * lth ** 2 / mK_to_muK ** 2, color="gray", alpha=0.6, linestyle="--")
plt.plot(lth ** lpow, Dlth["TT"] * lth ** 2 / mK_to_muK ** 2, color="gray", alpha=0.6, linestyle="--", linewidth=1)

shift_dict = {}
shift_dict["90x90"] = -5
Expand All @@ -73,28 +69,27 @@
shift=5
count=0

for color, case in zip(color_list, case_list):
for color, case, zorder in zip(color_list, case_list, zorder_list):

lb_ml, vec_ml, sigma_ml = np.loadtxt(f"{combined_spec_dir}/{type}_{case}_TT.dat", unpack=True)
lb_ml, vec_th_ml = np.loadtxt(f"{combined_spec_dir}/bestfit_{case}_TT.dat", unpack=True)

if "220" in case:
id = np.where(lb_ml>1500)
alpha = 0.4
else:
id = np.where(lb_ml>500)
alpha = 1

fa, fb = case.split("x")

plt.errorbar((lb_ml[id]+ shift_dict[case]) ** lpow, vec_ml[id] * lb_ml[id] **2 / mK_to_muK **2, sigma_ml[id] * lb_ml[id] **2 / mK_to_muK **2,
fmt=".", color=color, label=f"{fa} GHz x {fb} GHz", alpha=alpha, mfc='w')
plt.errorbar((lb_ml[id]) ** lpow, vec_th_ml[id] * lb_ml[id] **2 / mK_to_muK ** 2,
color=color, fmt="--", alpha=0.7*alpha)
fmt="o", color=color, label=f"{fa} GHz x {fb} GHz", mfc='w', markersize=3, elinewidth=1, zorder=2*zorder)
plt.plot((lb_ml[id]) ** lpow, vec_th_ml[id] * lb_ml[id] **2 / mK_to_muK ** 2,
color=color, linestyle="--", alpha=0.7, zorder=2*zorder-1, linewidth=1)

count += 1
plt.xticks(ticks=ell_tick, labels=ell_label,fontsize=20)
plt.legend(fontsize=20, loc=(0.55,0.6))
plt.xticks(ticks=ell_tick, labels=ell_label)
plt.tick_params(labelsize=labelsize)
plt.legend(fontsize=labelsize, loc=(0.55, 0.6))
plt.savefig(f"{paper_plot_dir}/multifrequency_spectra_TT{tag}.pdf", bbox_inches="tight")
plt.clf()
plt.close()

0 comments on commit 5d52d1a

Please sign in to comment.