Commit ce804c70 authored by Maxime Rey's avatar Maxime Rey
Browse files

Improvement: 'Ms_Mh_relation' bit faster and symbols adapted for paper.

parent 8ad9531c
......@@ -3126,7 +3126,7 @@ def Ms_Mh_relation(genpath, folders, timesteps, labels, xmin=None, ymin=None, no
import os
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(12, 7.2))
shape_s = ['o', 'X', 'P', 'D']
shape_s = ['o', 'X', 'P', '.', 'x', '+'] # Use 'D' in fourth & '1' in eigth if fourth simulation.
shape_g = ['.', 'x', '+', '1']
g2Msun = 1/1.989e33
vmin, vmax = 0, 7
......@@ -3151,7 +3151,7 @@ def Ms_Mh_relation(genpath, folders, timesteps, labels, xmin=None, ymin=None, no
cu2cm = info['unit_l'] * info['boxlen']
center_cm, r200_cm = [cen*cu2cm for cen in center], r200*cu2cm
# Stars
star_mass, star_x, star_y, star_z, _, _, _, _, _, _, _ = ras.extract_stars(RamsesDir, timestep, factor=1, rmsat=True, saveinfile=True)
star_mass, star_x, star_y, star_z, _, _, _, _, _, _, _ = ras.extract_stars(RamsesDir, timestep, factor=1, rmsat=False, saveinfile=True)
rad_stars = np.sqrt((star_x-center_cm[0])**2+(star_y-center_cm[1])**2+(star_z-center_cm[2])**2)
M_star_ISM.append(np.sum(star_mass[rad_stars<0.1*r200_cm])/1.989e33)
M_star_CGM.append(np.sum(star_mass[(rad_stars>0.1*r200_cm) & (rad_stars < r200_cm)])/1.989e33)
......@@ -3162,12 +3162,13 @@ def Ms_Mh_relation(genpath, folders, timesteps, labels, xmin=None, ymin=None, no
M_gas_ISM.append(np.sum(mass[rad_gas<0.1*r200_cm])*g2Msun)
M_gas_CGM.append(np.sum(mass[(rad_gas>0.1*r200_cm) & (rad_gas<r200_cm)])*g2Msun)
# DM
# M_dm.append(ras.get_m200(genpath+folder,timestep)) # DM from simulation. Should use DM from a DM-only simulation.
M_dm.append(ras.get_m200('/scratch/Cral/mrey/ICs/Zoom-56-35796/dmRun2-LSS1Rvir', timestep))
if folder==folders[0]:
M_dm.append(ras.get_m200('/scratch/Cral/mrey/ICs/Zoom-56-35796/dmRun2-LSS1Rvir', timestep))
M_star_ISM, M_gas_ISM = np.array(M_star_ISM), np.array(M_gas_ISM)
M_star_CGM, M_gas_CGM = np.array(M_star_CGM), np.array(M_gas_CGM)
M_halo = np.array(M_dm) # M_star_ISM + M_gas_ISM + M_star_CGM + M_gas_CGM
if folder==folders[0]:
M_halo = np.array(M_dm)
# Plot selected simulation points.
starplot = plt.scatter(M_halo, M_star_ISM/M_halo if norm else M_star_ISM, vmin=vmin, vmax=vmax, c=redshift, cmap=cm, edgecolors='k', marker=shape_s[ind_f], s=100)
......@@ -3240,7 +3241,6 @@ def Ms_Mh_relation(genpath, folders, timesteps, labels, xmin=None, ymin=None, no
if savefig:
fig.savefig('Ms_Mh.svg')
def content_t(genpath, folders, labels, is_ISM=True, DM=False, xlims=None, ylims=None):
"""
Plots several quantities against time (galaxy stellar and gas mass, dark matter mass and SFR).
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment