2022-05-24 17:06:49 +02:00
|
|
|
from pathlib import Path
|
2022-05-09 15:20:10 +02:00
|
|
|
from sys import argv
|
|
|
|
|
2022-06-10 11:06:32 +02:00
|
|
|
import numpy as np
|
2022-05-04 13:42:57 +02:00
|
|
|
import pandas as pd
|
|
|
|
from matplotlib import pyplot as plt
|
|
|
|
from matplotlib.axes import Axes
|
2022-06-10 11:06:32 +02:00
|
|
|
from matplotlib.colors import LogNorm
|
2022-05-04 13:42:57 +02:00
|
|
|
from matplotlib.figure import Figure
|
|
|
|
|
2022-05-24 17:06:49 +02:00
|
|
|
file = Path(argv[1])
|
2022-05-06 13:23:31 +02:00
|
|
|
|
|
|
|
df = pd.read_csv(file)
|
2022-05-04 13:42:57 +02:00
|
|
|
|
2022-05-24 17:06:49 +02:00
|
|
|
with pd.option_context('display.max_rows', None):
|
2022-06-10 11:06:32 +02:00
|
|
|
print(df[["ref_npart", "comp_npart", "ref_cNFW", "comp_cNFW"]])
|
2022-05-06 09:51:43 +02:00
|
|
|
# df = df.iloc
|
2022-05-04 13:42:57 +02:00
|
|
|
|
|
|
|
fig: Figure = plt.figure()
|
|
|
|
ax: Axes = fig.gca()
|
2022-06-03 10:33:16 +02:00
|
|
|
# hist2d, log?
|
2022-05-24 17:06:49 +02:00
|
|
|
|
2022-06-10 11:06:32 +02:00
|
|
|
x_col = "ref_cNFW"
|
|
|
|
y_col = "comp_cNFW"
|
|
|
|
|
|
|
|
# x_col = "ref_Mvir"
|
|
|
|
# y_col = "comp_Mvir"
|
|
|
|
|
|
|
|
min_x = min([min(df[x_col]), min(df[y_col])])
|
|
|
|
max_x = max([max(df[x_col]), max(df[y_col])])
|
|
|
|
|
|
|
|
bins = np.geomspace(min_x, max_x, 100)
|
2022-05-24 17:06:49 +02:00
|
|
|
|
2022-05-11 14:22:34 +02:00
|
|
|
# ax.scatter(df["ref_sizes"], df["comp_sizes"], s=1, alpha=.3)
|
2022-06-10 11:06:32 +02:00
|
|
|
# ax.scatter(df[x_col], df[y_col], s=1, alpha=.3)
|
|
|
|
_, _, _, hist = ax.hist2d(df[x_col], df[y_col], bins=(bins, bins), norm=LogNorm())
|
2022-05-24 17:06:49 +02:00
|
|
|
|
|
|
|
# ax.set_xscale("log")
|
|
|
|
ax.set_xlabel(x_col)
|
|
|
|
ax.set_ylabel(y_col)
|
|
|
|
# ax.set_yscale("log")
|
|
|
|
|
2022-06-10 11:06:32 +02:00
|
|
|
fig.colorbar(hist)
|
2022-05-04 13:42:57 +02:00
|
|
|
|
2022-06-03 10:33:16 +02:00
|
|
|
ax.loglog([min_x, max_x], [min_x, max_x], linewidth=1, color="C2")
|
2022-05-09 15:20:10 +02:00
|
|
|
|
|
|
|
fig2: Figure = plt.figure()
|
|
|
|
ax2: Axes = fig2.gca()
|
|
|
|
|
2022-05-24 17:06:49 +02:00
|
|
|
ax2.hist(df["distance"][df["distance"] < 50], bins=100)
|
2022-05-12 16:03:43 +02:00
|
|
|
ax2.set_xlabel("distance/R_vir_ref")
|
2022-05-09 15:20:10 +02:00
|
|
|
for a in [ax, ax2]:
|
2022-05-24 17:06:49 +02:00
|
|
|
a.set_title(file.name)
|
2022-05-09 15:20:10 +02:00
|
|
|
|
2022-06-10 11:06:32 +02:00
|
|
|
fig.savefig(Path(f"~/tmp/comparison_{file.stem}.pdf").expanduser())
|
|
|
|
fig2.savefig(Path(f"~/tmp/distances_{file.stem}.pdf").expanduser())
|
|
|
|
fig.suptitle
|
2022-05-04 13:42:57 +02:00
|
|
|
plt.show()
|