From c6a0cdad37e9a90edf015feca391f6f9f3256b2c Mon Sep 17 00:00:00 2001 From: Noe Brucy Date: Thu, 28 Nov 2024 11:57:16 +0100 Subject: [PATCH] repo organisation --- README.md | 3 +- .../load_data_arepo.py | 0 .../load_data_suez.py | 0 params_gal.yml => loaders/params_gal.yml | 0 galsec_plot.py => plots/galsec_plot.py | 29 +++++++------------ pipeline_MW.py => plots/pipeline_MW.py | 0 6 files changed, 12 insertions(+), 20 deletions(-) rename load_data_arepo.py => loaders/load_data_arepo.py (100%) rename load_data_ramses.py => loaders/load_data_suez.py (100%) rename params_gal.yml => loaders/params_gal.yml (100%) rename galsec_plot.py => plots/galsec_plot.py (60%) rename pipeline_MW.py => plots/pipeline_MW.py (100%) diff --git a/README.md b/README.md index d994bd5..1f39e88 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# galaxy_ninja +# Galaxy Ninja +A useful binning and computation tool for numerical simulations \ No newline at end of file diff --git a/load_data_arepo.py b/loaders/load_data_arepo.py similarity index 100% rename from load_data_arepo.py rename to loaders/load_data_arepo.py diff --git a/load_data_ramses.py b/loaders/load_data_suez.py similarity index 100% rename from load_data_ramses.py rename to loaders/load_data_suez.py diff --git a/params_gal.yml b/loaders/params_gal.yml similarity index 100% rename from params_gal.yml rename to loaders/params_gal.yml diff --git a/galsec_plot.py b/plots/galsec_plot.py similarity index 60% rename from galsec_plot.py rename to plots/galsec_plot.py index 68d12c7..9c07494 100644 --- a/galsec_plot.py +++ b/plots/galsec_plot.py @@ -3,26 +3,12 @@ Galaxy kiloparsec plotter """ from astropy.table import QTable +import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np - def plot_radial(table: QTable): - fig = plt.figure(figsize=(6, 5)) - # setting the axis limits in [left, bottom, width, height] - rect = [0.1, 0.1, 0.8, 0.8] - - # the polar axis: - ax_polar = fig.add_axes(rect, polar=True, frameon=False) - rmax = 10 - ax_polar.set_rmax(rmax) - - ax_polar.set_xticklabels([]) - - sc = ax_polar.scatter(table["phi"], table["r"], c=table["mass"], s=100, alpha=1) - plt.colorbar(sc) - fig, ax = plt.subplots(subplot_kw=dict(projection="polar"), figsize=(6, 5)) rbins = np.unique(table["r"]) @@ -35,8 +21,8 @@ def plot_radial(table: QTable): C = np.log10(table["mass"][mask].value) N = len(C) - C = np.arange(N) + r.value - np.random.shuffle(C) + # C = np.arange(N) + r.value + # np.random.shuffle(C) C = C.reshape(1, N) P = np.zeros(shape=(2, N + 1)) @@ -50,6 +36,11 @@ def plot_radial(table: QTable): P[0, -1] = P[0, 0] P[1, -1] = P[1, 0] - pc = ax.pcolormesh(P, R, C, cmap="tab20c") # , vmin=6, vmax=9) + pc = ax.pcolormesh(P, R, C, cmap="inferno") # , vmin=6, vmax=9) print(P, R, C) - # fig.colorbar(pc) + fig.colorbar(pc) + +def plot_hist2d(table, x, y): + plt.figure() + plt.hist2d(np.log10(table[x].value) - 6, np.log10(table[y].value), + bins=100, cmap="magma", weights=table["mass"], norm=mpl.colors.LogNorm()) diff --git a/pipeline_MW.py b/plots/pipeline_MW.py similarity index 100% rename from pipeline_MW.py rename to plots/pipeline_MW.py