mirror of
https://github.com/Findus23/halo_comparison.git
synced 2024-09-19 16:03:50 +02:00
log-std
This commit is contained in:
parent
1cde889797
commit
a6e87c524e
1 changed files with 15 additions and 8 deletions
23
sizes.py
23
sizes.py
|
@ -8,8 +8,9 @@ from matplotlib.axes import Axes
|
||||||
from matplotlib.collections import QuadMesh
|
from matplotlib.collections import QuadMesh
|
||||||
from matplotlib.colors import LogNorm
|
from matplotlib.colors import LogNorm
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
|
|
||||||
# density like in Vr:
|
# density like in Vr:
|
||||||
|
from numpy import log10
|
||||||
|
|
||||||
from halo_vis import get_comp_id
|
from halo_vis import get_comp_id
|
||||||
from paths import base_dir
|
from paths import base_dir
|
||||||
from utils import figsize_from_page_fraction, rowcolumn_labels, waveforms
|
from utils import figsize_from_page_fraction, rowcolumn_labels, waveforms
|
||||||
|
@ -80,17 +81,23 @@ def plot_comparison_hist2d(ax: Axes, ax_scatter: Axes, file: Path, property: str
|
||||||
ax.scatter(df[x_col], df[y_col], c=colors, s=1, alpha=.3)
|
ax.scatter(df[x_col], df[y_col], c=colors, s=1, alpha=.3)
|
||||||
else:
|
else:
|
||||||
stds = []
|
stds = []
|
||||||
|
means = []
|
||||||
for rep_row in range(num_bins):
|
for rep_row in range(num_bins):
|
||||||
rep_x_left = bins[rep_row]
|
rep_x_left = bins[rep_row]
|
||||||
rep_x_right = bins[rep_row] + 1
|
rep_x_right = bins[rep_row] + 1
|
||||||
rep_bin = (rep_x_left < df[x_col]) & (df[x_col] < rep_x_right)
|
rep_bin = (rep_x_left < df[x_col]) & (df[x_col] < rep_x_right)
|
||||||
rep_values = df.loc[rep_bin][y_col]
|
rep_values = log10(df.loc[rep_bin][y_col])
|
||||||
if len(rep_values) > 30:
|
# if len(rep_values) > 30:
|
||||||
mean = rep_values.mean()
|
mean = rep_values.mean()
|
||||||
std = rep_values.std()
|
std = rep_values.std()
|
||||||
stds.append(std)
|
means.append(mean)
|
||||||
else:
|
stds.append(len(rep_values))
|
||||||
stds.append(np.nan)
|
# else:
|
||||||
|
# stds.append(np.nan)
|
||||||
|
means = np.array(means)
|
||||||
|
stds = np.array(stds)
|
||||||
|
print(10 ** (means - stds))
|
||||||
|
ax.fill_between(bins, 10 ** (means - stds), 10 ** (means + stds), color="red", zorder=10, alpha=.6)
|
||||||
ax_scatter.step(bins, stds, label=f"{file.stem}")
|
ax_scatter.step(bins, stds, label=f"{file.stem}")
|
||||||
|
|
||||||
image: QuadMesh
|
image: QuadMesh
|
||||||
|
|
Loading…
Reference in a new issue