From b9749291b5c6e60577ba7c3bfc1d0f4552df7adc Mon Sep 17 00:00:00 2001 From: Folkert Nobels Date: Thu, 25 Apr 2019 18:20:41 +0200 Subject: [PATCH 1/2] Update the rho vs SFR plot --- .../plotSolution.py | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py index 89a879231..88d31782e 100644 --- a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py +++ b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py @@ -116,6 +116,9 @@ stars_pos[:,2] -= centre[2] # Turn the mass into better units gas_mass *= unit_mass_in_cgs / Msun_in_cgs +# Calculate the median gas mass +median_gas_mass = np.median(gas_mass) + # Turn the SFR into better units gas_SFR = np.maximum(gas_SFR, np.zeros(np.size(gas_SFR))) gas_SFR /= unit_time_in_cgs / year_in_cgs @@ -166,19 +169,6 @@ savefig("rhoT_SF.png", dpi=200) ########################################################################3 -# 3D Density vs SFR -figure() -subplot(111, xscale="log", yscale="log") -scatter(gas_nH, gas_SFR, s=0.2) -plot([1, 100], 2e-5 * np.array([1, 100]) ** 0.266667, "k--", lw=1) -xlabel("${\\rm Density}~n_{\\rm H}~[{\\rm cm^{-3}}]$", labelpad=0) -ylabel("${\\rm SFR}~[{\\rm M_\\odot~\\cdot~yr^{-1}}]$", labelpad=-7) -xlim(1e-4, 3e3) -ylim(8e-6, 2.5e-4) -savefig("rho_SFR.png", dpi=200) - -########################################################################3 - star_mask = ( (stars_pos[:, 0] > -15) & (stars_pos[:, 0] < 15) @@ -224,6 +214,23 @@ xlim(-1.4, 4.9) ylim(-0.5, 2.2) savefig("density-sSFR.png", dpi=200) +SFR_low = 10**(np.log10(sSFR)+np.log10(year_in_cgs)+np.log10(median_gas_mass)) +SFR_high = 10**(np.log10(sSFR_high_den)+np.log10(year_in_cgs)+np.log10(median_gas_mass)) +SFR_low_min = np.floor(np.log10(.75*np.min(SFR_low))) +SFR_high_max = np.ceil(np.log10(1.25*np.max(SFR_high))) + +# 3D Density vs SFR +figure() +subplot(111, xscale="log", yscale="log") +scatter(gas_nH, gas_SFR, s=0.2) +plot(rhos,SFR_low,'k--',lw=1,label='SFR low density EAGLE') +plot(rhoshigh,SFR_high,'k--',lw=1,label='SFR high density EAGLE') +xlabel("${\\rm Density}~n_{\\rm H}~[{\\rm cm^{-3}}]$", labelpad=0) +ylabel("${\\rm SFR}~[{\\rm M_\\odot~\\cdot~yr^{-1}}]$", labelpad=-7) +xlim(1e-2, 1e5) +ylim(10**SFR_low_min, 10**SFR_high_max) +savefig("rho_SFR.png", dpi=200) + ########################################################################3 # Select gas in a pillow box around the galaxy -- GitLab From 2eface37aa2d24623775b350d9b278368d66a593 Mon Sep 17 00:00:00 2001 From: Folkert Nobels Date: Fri, 26 Apr 2019 15:10:10 +0200 Subject: [PATCH 2/2] Update the figure and add header to file --- .../plotSolution.py | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py index 88d31782e..f83607e03 100644 --- a/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py +++ b/examples/IsolatedGalaxy/IsolatedGalaxy_starformation/plotSolution.py @@ -1,3 +1,23 @@ +#!/usr/bin/env python3 +################################################################################ +# This file is part of SWIFT. +# Copyright (c) 2019 Folkert Nobels (nobels@strw.leidenuniv.nl) +# Matthieu Schaller (schaller@strw.leidenuniv.nl) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +################################################################################ import matplotlib matplotlib.use("Agg") @@ -220,17 +240,18 @@ SFR_low_min = np.floor(np.log10(.75*np.min(SFR_low))) SFR_high_max = np.ceil(np.log10(1.25*np.max(SFR_high))) # 3D Density vs SFR +rcParams.update({"figure.subplot.left": 0.18}) figure() subplot(111, xscale="log", yscale="log") scatter(gas_nH, gas_SFR, s=0.2) plot(rhos,SFR_low,'k--',lw=1,label='SFR low density EAGLE') plot(rhoshigh,SFR_high,'k--',lw=1,label='SFR high density EAGLE') xlabel("${\\rm Density}~n_{\\rm H}~[{\\rm cm^{-3}}]$", labelpad=0) -ylabel("${\\rm SFR}~[{\\rm M_\\odot~\\cdot~yr^{-1}}]$", labelpad=-7) +ylabel("${\\rm SFR}~[{\\rm M_\\odot~\\cdot~yr^{-1}}]$", labelpad=2) xlim(1e-2, 1e5) -ylim(10**SFR_low_min, 10**SFR_high_max) +ylim(10**SFR_low_min, 10**(SFR_high_max+0.1)) savefig("rho_SFR.png", dpi=200) - +rcParams.update({"figure.subplot.left": 0.15}) ########################################################################3 # Select gas in a pillow box around the galaxy -- GitLab