repo organisation
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# galaxy_ninja
|
||||
# Galaxy Ninja
|
||||
|
||||
A useful binning and computation tool for numerical simulations
|
||||
@@ -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())
|
||||
Reference in New Issue
Block a user