Skip to content

Commit

Permalink
SFMS bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Takahiro Morishita committed Feb 19, 2020
1 parent 9196278 commit 3048d25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gsf/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def check_rejuv(age,SF,MS,SFMS_50,lm_old=10.0,delMS=0.2):


def get_SFMS(red,age,mass,IMF=1):
# Based on Speagle+14;
# From Speagle+14 Eq28;
# Chabrier IMF, default
from astropy.cosmology import WMAP9
cosmo = WMAP9
Expand All @@ -179,9 +179,9 @@ def get_SFMS(red,age,mass,IMF=1):

x = np.log10(mass) - CIMF #np.arange(6,13,0.1)
tz = cosmo.age(z=red).value - age # in Gyr
y1 = (0.84 - 0.026*tz) * x - (6.51 - 0.11*tz)
y1 = (0.84 - 0.026*tz) * x - (6.51 - 0.11*tz) # in log Msun/yr
con = (y1<=0)
y1[con] = 1e-10
y1[con] = -10
return y1

# Fitting. (Not sure)
Expand Down
8 changes: 4 additions & 4 deletions gsf/plot_sfh.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,23 +358,23 @@ def plot_sfh(ID0, PA, Z=np.arange(-1.2,0.4249,0.05), age=[0.01, 0.1, 0.3, 0.7, 1
ax1.errorbar(age[conA], np.log10(SFp[:,1])[conA], xerr=[delTl[:][conA]/1e9,delTu[:][conA]/1e9], yerr=[np.log10(SFp[:,1])[conA]-np.log10(SFp[:,0])[conA], np.log10(SFp[:,2])[conA]-np.log10(SFp[:,1])[conA]], linestyle='-', color='k', lw=0.5, marker='')

#############
# Get SFMS;
# Get SFMS in log10;
#############
IMF = int(inputs['NIMF'])
SFMS_16 = get_SFMS(zbes,age,ACp[:,0],IMF=IMF)
SFMS_50 = get_SFMS(zbes,age,ACp[:,1],IMF=IMF)
SFMS_84 = get_SFMS(zbes,age,ACp[:,2],IMF=IMF)

try:
f_rejuv,t_quench,t_rejuv = check_rejuv(age,np.log10(SFp[:,:]),np.log10(ACp[:,:]),np.log10(SFMS_50))
f_rejuv,t_quench,t_rejuv = check_rejuv(age,np.log10(SFp[:,:]),np.log10(ACp[:,:]),SFMS_50)
except:
print('Rejuvenation judge failed. (plot_sfh.py)')
f_rejuv,t_quench,t_rejuv = 0,0,0

# Plot MS?
if f_SFMS:
ax1.fill_between(age[conA], np.log10(SFMS_50)[conA]-0.2, np.log10(SFMS_50)[conA]+0.2, linestyle='-', color='b', alpha=0.3)
ax1.plot(age[conA], np.log10(SFMS_50)[conA], linestyle='--', color='b', alpha=0.5)
ax1.fill_between(age[conA], SFMS_50[conA]-0.2, SFMS_50[conA]+0.2, linestyle='-', color='b', alpha=0.3)
ax1.plot(age[conA], SFMS_50[conA], linestyle='--', color='b', alpha=0.5)

#
# Fit with delayed exponential??
Expand Down

0 comments on commit 3048d25

Please sign in to comment.