mirror of
https://github.com/Findus23/halo_comparison.git
synced 2024-09-19 16:03:50 +02:00
Adapted spectra plots as per Olivers wishes: changed end to z=0; adapted y-label for power plot; added fine background grid; also slightly shifted positions of wavelet and time labels to keep them symmetric and out of other content as much as possible
This commit is contained in:
parent
630e6e86b2
commit
60bd933469
2 changed files with 14 additions and 4 deletions
4
2d.py
4
2d.py
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Looks like this file takes one snapshot (line 26) and visualises specified halos (line 28) as a 2d-projection. Might not be accurate, hasn't been changed in a long time.
|
||||||
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
|
@ -94,7 +94,7 @@ def create_plot(mode):
|
||||||
# TODO: better names
|
# TODO: better names
|
||||||
ax_ics: "ics",
|
ax_ics: "ics",
|
||||||
ax_z1: "z=1",
|
ax_z1: "z=1",
|
||||||
ax_end: "end"
|
ax_end: "z=0"
|
||||||
}
|
}
|
||||||
bottom_row = i == len(waveforms) - 1
|
bottom_row = i == len(waveforms) - 1
|
||||||
top_row = i == 0
|
top_row = i == 0
|
||||||
|
@ -103,7 +103,7 @@ def create_plot(mode):
|
||||||
if bottom_row:
|
if bottom_row:
|
||||||
ax.set_xlabel("k [Mpc$^{-1}$]")
|
ax.set_xlabel("k [Mpc$^{-1}$]")
|
||||||
ax.text(
|
ax.text(
|
||||||
0.02,
|
0.01,
|
||||||
0.85,
|
0.85,
|
||||||
f"{waveform}",
|
f"{waveform}",
|
||||||
horizontalalignment="left",
|
horizontalalignment="left",
|
||||||
|
@ -111,7 +111,7 @@ def create_plot(mode):
|
||||||
transform=ax.transAxes,
|
transform=ax.transAxes,
|
||||||
)
|
)
|
||||||
ax.text(
|
ax.text(
|
||||||
0.98,
|
0.99,
|
||||||
0.85,
|
0.85,
|
||||||
axes_names[ax],
|
axes_names[ax],
|
||||||
horizontalalignment="right",
|
horizontalalignment="right",
|
||||||
|
@ -129,7 +129,7 @@ def create_plot(mode):
|
||||||
# ax.set_yticklabels([])
|
# ax.set_yticklabels([])
|
||||||
|
|
||||||
if mode == "power":
|
if mode == "power":
|
||||||
ax_ics.set_ylabel("P")
|
ax_ics.set_ylabel("$\\mathrm{{P}}_\\mathrm{{X}}$ / $\\mathrm{{P}}_{{1024}}$")
|
||||||
for j, resolution in enumerate(resolutions):
|
for j, resolution in enumerate(resolutions):
|
||||||
ics_data = spectra_data(waveform, resolution, resolution, Lbox, "ics")
|
ics_data = spectra_data(waveform, resolution, resolution, Lbox, "ics")
|
||||||
ics_k = ics_data["k [Mpc]"]
|
ics_k = ics_data["k [Mpc]"]
|
||||||
|
@ -157,6 +157,8 @@ def create_plot(mode):
|
||||||
ax_end.semilogx(end_k, end_p1, color=colors[j])
|
ax_end.semilogx(end_k, end_p1, color=colors[j])
|
||||||
for ax in [ax_ics, ax_z1, ax_end]:
|
for ax in [ax_ics, ax_z1, ax_end]:
|
||||||
ax.set_ylim(0.9, 1.10)
|
ax.set_ylim(0.9, 1.10)
|
||||||
|
ax.set_axisbelow(True)
|
||||||
|
ax.grid(color='black', linestyle=':', linewidth=0.5, alpha=0.5)
|
||||||
|
|
||||||
|
|
||||||
# fig.suptitle(f"Power Spectra {time}") #Not needed for paper
|
# fig.suptitle(f"Power Spectra {time}") #Not needed for paper
|
||||||
|
@ -190,6 +192,10 @@ def create_plot(mode):
|
||||||
crossing_value = end_pcross[crossing_index] # and here
|
crossing_value = end_pcross[crossing_index] # and here
|
||||||
crossings[i][j] = crossing_value
|
crossings[i][j] = crossing_value
|
||||||
|
|
||||||
|
for ax in [ax_ics, ax_z1, ax_end]:
|
||||||
|
ax.set_axisbelow(True)
|
||||||
|
ax.grid(color='black', linestyle=':', linewidth=0.5, alpha=0.5)
|
||||||
|
|
||||||
ax_end.set_xlim(right=k0 * resolutions[-1])
|
ax_end.set_xlim(right=k0 * resolutions[-1])
|
||||||
ax_end.set_ylim(0.8, 1.02)
|
ax_end.set_ylim(0.8, 1.02)
|
||||||
if bottom_row:
|
if bottom_row:
|
||||||
|
|
Loading…
Reference in a new issue