1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00
halo_comparison/sizes.py

46 lines
1 KiB
Python
Raw Normal View History

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-05-04 13:42:57 +02:00
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
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):
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-03 10:33:16 +02:00
x_col = "ref_Mass_200mean"
y_col = "comp_Mass_200mean"
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-05-24 17:06:49 +02:00
ax.scatter(df[x_col], df[y_col], s=1, alpha=.3)
# ax.set_xscale("log")
ax.set_xlabel(x_col)
ax.set_ylabel(y_col)
# ax.set_yscale("log")
min_x = min([min(df[x_col]), min(df[y_col])])
max_x = max([max(df[x_col]), max(df[y_col])])
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-05-04 13:42:57 +02:00
plt.show()