In [1]:
from astropy.io import fits,ascii
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
import os
import sys
import warnings
warnings.filterwarnings('ignore')
from astropy.table import Table
from astropy.coordinates import SkyCoord
from scipy.stats import ks_2samp
from astropy import units as u
In [2]:
homedir = os.getenv("HOME")
sys.path.append(homedir+'/github/APPSS/')
from a100sdss import ks, anderson
sys.path.append(homedir+'/github/LCS/python/Python3/')
from LCScommon import *
In [3]:
plotdir = homedir+'/research/LCS/plots/'
In [5]:
def sfr_mstar(flags,colorvar,plotbinned=True,v1=.1,v2=1):
plt.figure(figsize=(14,4))
all_axes=[]
for i in range(len(flags)):
plt.subplot(1,3,i+1)
plt.scatter(mstar[flags[i]],sfr[flags[i]],c=colorvar[flags[i]],vmin=v1,vmax=v2)
if i > 0:
plt.yticks([])
plt.axis([8,12,-2,1])
all_axes.append(plt.gca())
xl = np.linspace(8,12,100)
# chi by eye split b/w SF and quiescent
yl = -11.8 + xl
plt.plot(xl,yl,'k--')
# chi by eye fit to main sequence in field
yl = -10.4 + xl
plt.plot(xl,yl,'k-')
if plotbinned:
xbin,ybin,ybinerr= binxycolor(mstar[flags[i]& sf_flag],sfr[flags[i]& sf_flag],colorvar[flags[i] & sf_flag],6,use_median=True)
plt.scatter(xbin,ybin,c=ybinerr,s=300,vmin=v1,vmax=v2,marker='s')
plt.colorbar(ax=all_axes)
def size_vs_size(flags,colorvar,plotbinned=True,v1=1,v2=10):
xmin=0
xmax=15
plt.figure(figsize=(14,4))
all_axes=[]
for i in range(len(flags)):
plt.subplot(1,3,i+1)
#plt.scatter(g.s['Rd'][flags[i]],g.s['fre1'][flags[i]],c=colorvar[flags[i]],vmin=v1,vmax=v2)
plt.scatter(g.s['Rd'][flags[i]],g.s['fre1'][flags[i]],c=colorvar[flags[i]],vmin=v1,vmax=v2)
if i > 0:
plt.yticks([])
plt.axis([xmin,xmax,xmin,xmax])
#plt.gca().set_xscale('log')
#plt.gca().set_yscale('log')
all_axes.append(plt.gca())
xl = np.linspace(xmin,xmax,100)
# chi by eye split b/w SF and quiescent
#yl = -11.8 + xl
plt.plot(xl,xl,'k--')
# chi by eye fit to main sequence in field
#yl = -10.4 + xl
#plt.plot(xl,yl,'k-')
if plotbinned:
xbin,ybin,ybinerr= binxycolor(mstar[flags[i]& sf_flag],sfr[flags[i]& sf_flag],colorvar[flags[i] & sf_flag],6,use_median=True)
plt.scatter(xbin,ybin,c=ybinerr,s=300,vmin=v1,vmax=v2,marker='s')
plt.colorbar(ax=all_axes)
In [181]:
%run ~/github/LCS/python/Python3/LCSbase.py
we can use the GSWLC SFRs and Stellar masses for both the LCS and comparison galaxies. This removes significant uncertainty associated with mixing methods for calculating SFR and Mstar.
redshift limit $0.01 < z < 0.03$
Stellar Mass Limit
SFR Limit
Environment Catalogs
In [30]:
# this catalog is a joined catalog between LCS and GSWLC
# it contains 1505 rows - the number of matches b/w the two catalogs
lcsgsw = fits.getdata('/home/rfinn/research/LCS/tables/lcs-gswlc-x2-match.fits')
#lcsgsw['sampleflag'] = lcsgsw['sampleflag'] == 84
In [31]:
print('number of matches between LCS and GSWLC = ',len(lcsgsw))
print('number with UV = ',sum(lcsgsw['flag_uv'] == 2))
print('number with mid IR = ',sum(lcsgsw['flag_midir'] == 1))
print('number with SDSS galaxy data = ',sum(lcsgsw['flag_mgs'] == 1))
In [ ]:
In [98]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
figname1 = homedir+'/research/LCS/plots/lcs-dvdr.png'
figname2 = homedir+'/research/LCS/plots/lcs-dvdr.pdf'
lcs.plot_dvdr(figname1=figname1,figname2=figname2)
In [34]:
gsw = ascii.read('/home/rfinn/research/GSWLC/GSWLC-X2.dat')
gsw = gsw[((gsw['Z']*3.e5 < 13000.) & (gsw['logMstar']> 0))]
print('number is GSWLC = ',len(gsw))
In [35]:
print(sum(gsw['flag_mgs']))
cutting GSWLC to main SDSS survey area, and then recalculating local densities
In [66]:
%run ~/github/LCS/python/Python3/lcs_paper2.py
figname1 = homedir+'/research/LCS/plots/gswlc-skyplot.png'
figname2 = homedir+'/research/LCS/plots/gswlc-skyplot.pdf'
g.plot_field1(figname1=figname1,figname2=figname2)
In [67]:
%run ~/github/LCS/python/Python3/lcs_paper2.py
figname1 = homedir+'/research/LCS/plots/gswlc-dens-hist.png'
figname2 = homedir+'/research/LCS/plots/gswlc-dens-hist.pdf'
g.plot_dens_hist(figname1=figname1,figname2=figname2)
Could also use Yang catalog to remove all galaxies in halos with log M_halo > 13.5 or 14
Salim+2016 state that $sSFR < -11.5$ should be considered upper limits.
The goal of this figure is to visualize where the $sSFR > -11.5$ is relative to SF main sequence. First need to see if we can show the sSFR of the main sequence.
The Figure below shows the Salim+07 fit to SF main sequence, minus 0.3 dex. Apparently there is a normalization offset b/w Salim+07 and GSWLC from Salim+16. The solid line is the mass-dependent fit to the MS, and the dashed line is a factor of 5 below the MS. The function to plot the lines is from Greg.
lssfr = -0.35*(lmstar - 10) - 9.83
#use their equation 12 for color-selected galaxies including
#AGN/SF composites. This is for log(Mstar)>9.4
#lssfr = -0.53*(lmstar - 10) - 9.87
lsfr = lmstar + lssfr -.3
sfr = 10.**lsfr
repeat above, but only keep galaxies in redshift range of LCS so that we can judge the mass limit where we can probe SF a factor of 5 (or N) below the main sequence
In [9]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
g.plot_ms()
Salim+2016 report $r=18$ limit. This corresponds to $M_r = -18.3$ at the distance of our farthest cluster.
We use the distribution of logMstar vs Mr to determine what stellar mass this corresponds to. The answer is $logMstar = 9.8$.
Therefore, we cut the GSWLC and LCS samples at $logMstar (GSWLC) > 9.8$.
NOTE - we updated this in the second plot, but I can't remember why. Maybe the Tempel sample has a different magnitude cut?
In [50]:
%run ~/github/LCS/python/Python3/lcs_paper2.py
lcs.get_mstar_limit()
In [133]:
%run ~/github/LCS/python/Python3/lcs_paper2.py
lcs.get_mstar_limit()
According to Salim+2016, the mass limit is log10Mstar = 9.8, and the ssfr cut is -11.5.
When we apply these cuts and compare the LCS and GSWLC in the SFR-Mstar plane, the LCS galaxies have a similar distribution of stellar masses, but significantly lower SFRs.
We can also compare sSFRs.
In [58]:
# cutting GSWLC by local density
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
b.plot_sfr_mstar()
In [134]:
# cutting by halo mass: log(M) < 12.5
# mass limit log(M) > 9.9 (instead of 9.8)
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
b.plot_sfr_mstar()
In [6]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcsinfall-gsw-sfms.pdf'
outfile2 = homedir+'/research/LCS/plots/lcsinfall-gsw-sfms.png'
b.plot_sfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [58]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.png'
b.plot_ssfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [129]:
# using sSFR > -11, logMstar > 9.9
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.png'
b.plot_ssfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [8]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcsinfall-gsw-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcsinfall-gsw-ssfrmstar.png'
b.plot_ssfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [80]:
sigma_split = 600
group = lcsgsw['CLUSTER_SIGMA'] < sigma_split
cluster = lcsgsw['CLUSTER_SIGMA'] > sigma_split
In [59]:
flag1 = lcsgsw['membflag'] & (lcsgsw['logMstar']> masscut) & (ssfr > ssfrcut) & group
flag2 = (gsw['logMstar'] > masscut) & (gswssfr > ssfrcut) & field_gsw
print('number in core sample = ',sum(flag1))
print('number in external sample = ',sum(flag2))
colormass(mstar[flag1],sfr[flag1],gsw['logMstar'][flag2],gsw['logSFR'][flag2],'LCS core groups','GSWLC','sfr-mstar-gswlc-field.pdf',ymin=-2,ymax=1.6,xmin=9.5,xmax=11.5,nhistbin=15,ylabel='$\log_{10}(SFR)$',contourflag=False,alphagray=.8)
plt.savefig(homedir+'/research/LCS/plots/lcsgroup-gsw-sfms.pdf')
plt.savefig(homedir+'/research/LCS/plots/lcsgroup-gsw-sfms.png')
In [82]:
flag1 = lcsgsw['membflag'] & (lcsgsw['logMstar']> masscut) & (ssfr > ssfrcut) & cluster
flag2 = (gsw['logMstar'] > masscut) & (gswssfr > ssfrcut) & field_gsw
print('number in core sample = ',sum(flag1))
print('number in external sample = ',sum(flag2))
colormass(mstar[flag1],sfr[flag1],gsw['logMstar'][flag2],gsw['logSFR'][flag2],'LCS core cluster','GSWLC','sfr-mstar-gswlc-field.pdf',ymin=-2,ymax=1.6,xmin=9.5,xmax=11.5,nhistbin=15,ylabel='$\log_{10}(SFR)$',contourflag=False,alphagray=.8)
plt.savefig(homedir+'/research/LCS/plots/lcscluster-gsw-sfms.pdf')
plt.savefig(homedir+'/research/LCS/plots/lcscluster-gsw-sfms.png')
In [99]:
flag1 = lcsgsw['membflag'] & (lcsgsw['logMstar']> masscut) & (ssfr > ssfrcut)
flag2 = (gsw['logMstar'] > masscut) & (gswssfr > ssfrcut) & field_gsw
flag3 = ~lcsgsw['membflag'] & (lcsgsw['logMstar']> masscut) & (ssfr > ssfrcut)
print('number in core sample = ',sum(flag1))
print('number in external sample = ',sum(flag2))
ks(ssfr[flag1],gswssfr[flag2])
plt.figure(figsize=(6,8))
plt.subplot(2,1,1)
mybins = np.linspace(-11.5,-8.75,20)
t = plt.hist(ssfr[flag1],bins=mybins,histtype='step',normed=True,lw=2,label='LCS Core')
t = plt.hist(gswssfr[flag2],bins=mybins,histtype='step',normed=True,lw=2,label='GSWLC')
#t = plt.hist(ssfr[flag3],bins=mybins,histtype='step',normed=True,lw=2,label='LCS External')
plt.legend()
#plt.xlabel('$\log_{10}(sSFR)$',fontsize=20)
plt.ylabel('$Normalized \ Frequency$',fontsize=20)
plt.subplot(2,1,2)
mybins = np.linspace(-11.5,-8.75,20)
#t = plt.hist(ssfr[flag1],bins=mybins,histtype='step',normed=True,lw=2,label='LCS Core')
t = plt.hist(ssfr[flag3],bins=mybins,histtype='step',normed=True,lw=2,label='LCS External')
t = plt.hist(gswssfr[flag2],bins=mybins,histtype='step',normed=True,lw=2,label='GSWLC')
plt.legend()
plt.xlabel('$\log_{10}(sSFR)$',fontsize=20)
plt.ylabel('$Normalized \ Frequency$',fontsize=20)
Out[99]:
In [127]:
plt.figure()
nbins = 50
flag = (g.cat['logSFR'] > -99) & (g.cat['logMstar'] > 9.9) & (g.ssfr < -4)
#t = plt.hist(g.ssfr[flag],bins=nbins,normed=True,histtype='step',label='GSWLC')
t = plt.hist(g.ssfr[flag],bins=nbins,weights=np.ones(sum(flag))/sum(flag),histtype='step',label='GSWLC')
flag = (lcs.cat['logSFR'] > -99) & (lcs.cat['logMstar'] > 9.9) & (lcs.ssfr < -4) & lcs.cat['membflag']
#t = plt.hist(lcs.ssfr[flag],bins=nbins,normed=True,histtype='step',label='LCS')
t = plt.hist(lcs.ssfr[flag],bins=nbins,weights=np.ones(sum(flag))/sum(flag),histtype='step',label='LCS')
plt.legend(loc='upper left')
Out[127]:
In [128]:
plt.figure()
nbins = 50
flag = (g.cat['logSFR'] > -99) & (g.cat['logMstar'] > 9.9) & (g.ssfr < -4)
t = plt.hist(g.ssfr[flag],bins=nbins,normed=True,histtype='step',label='GSWLC')
#t = plt.hist(g.ssfr[flag],bins=nbins,weights=np.ones(sum(flag))/sum(flag),histtype='step',label='GSWLC')
flag = (lcs.cat['logSFR'] > -99) & (lcs.cat['logMstar'] > 9.9) & (lcs.ssfr < -4) & lcs.cat['membflag']
t = plt.hist(lcs.ssfr[flag],bins=nbins,normed=True,histtype='step',label='LCS')
#t = plt.hist(lcs.ssfr[flag],bins=nbins,weights=np.ones(sum(flag))/sum(flag),histtype='step',label='LCS')
plt.legend(loc='upper left')
Out[128]:
In [105]:
# read in matched catalog that has GSWLC and Tempel group galaxies
gg = Table(fits.getdata('/home/rfinn/research/GSWLC/GSWLC-X2-Tempel2012-groups.fits'))
gg = gg[gg['redshift'] < 0.04]
In [106]:
# catalog with group info
tgroups = Table(fits.getdata('/home/rfinn/research/sdss-tempel/dr8_ggc.fits',2))
In [109]:
plt.figure()
mybins = np.linspace(0,200,100)
t = plt.hist(tgroups['nrich'],bins=mybins)
In [110]:
gg
Out[110]:
fit offset between salim+07 mass-dependent main sequence and the MS for the GSWLC. There is about 0.3 dex offset
how to incorporate SFR into simple modeling of cluster infall
In [19]:
%run ~/github/LCS/python/Python3/LCSbase.py
In [35]:
sizecore = np.median(g.sizeratio[g.membflag & g.sampleflag])
In [36]:
sizeexternal = np.median(g.sizeratio[~g.membflag & g.sampleflag])
In [30]:
SFRexternal = 1 - np.exp(-1*np.median(g.sizeratio[~g.membflag & g.sampleflag]))
SFRcore = 1 - np.exp(-1*np.median(g.sizeratio[g.membflag & g.sampleflag]))
In [31]:
# Drop in SFR
drop = 1 - SFRcore/SFRexternal
In [39]:
ratioSize = sizecore/sizeexternal
ratioSFR = SFRcore/SFRexternal
print("drop in size = {:.2f}, drop in SFR ={:.2f}".format(1-ratioSize,1-ratioSFR))
In [57]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
lcs.compare_sfrs(nbins=15)
In [62]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
b.print_lowssfr_nsaids()
In [94]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
b.get_legacy_images(ssfrmax=-11.2,ssfrmin=-11.5)
In [91]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
b.get_legacy_images(lcsflag = ~b.lcs.cat['membflag'],ssfrmax=-11.2,ssfrmin=-11.4)
We are detecting an excess of low sSFR galaxies in LCS core and external samples. Even when we cut by group/cluster mass - we find excess in every combination of LCS sample.
Concern: is sSFR = -11.5 picking up tail of the passive sequence (meaning these are not SF, but we are detecting dust emission from post main sequence stars). If this is the case, then the trends with environment that we are detecting are just due to the morphology-density relation.
For example,
in clusters:
in field:
If we can remove E/S0 from both the field and cluster samples, then we can be more confident that we are detecting low sSFR galaxies.
On the other hand, there can by E/S0 galaxies with some residual SF. Need to think about how this affects results, or do it both ways: with and without a morphology cut.
Two approaches: NSA Sersic index or galaxy zoo morphology from Tempel catalogs
send full catalog, and I will cut in redshift range
using updated catalogs now. the results are unchanged
In [11]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
In [21]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.png'
b.plot_ssfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [45]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar.png'
b.plot_ssfr_mstar(lcsflag=flag,label='LCS infall',outfile1=outfile1,outfile2=outfile2)
In [30]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
outfile1 = homedir+'/research/LCS/plots/lcscore-external-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-external-ssfrmstar.png'
b.plot_ssfr_mstar_lcs(outfile1=outfile1,outfile2=outfile2,nbins=12)
In [47]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-ssfrmstar-BTcut.png'
b.plot_ssfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2,nbins=12)
In [44]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcsinfall-gsw-ssfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcsinfall-gsw-ssfrmstar-BTcut.png'
b.plot_ssfr_mstar(lcsflag=flag,label='LCS infall',outfile1=outfile1,outfile2=outfile2,nbins=12)
In [46]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
outfile1 = homedir+'/research/LCS/plots/lcscore-external-ssfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-external-ssfrmstar-BTcut.png'
b.plot_ssfr_mstar_lcs(outfile1=outfile1,outfile2=outfile2,nbins=12)
In [4]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar.png'
b.plot_sfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [43]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar.png'
b.plot_sfr_mstar(lcsflag=flag,label='LCS infall',outfile1=outfile1,outfile2=outfile2)
In [39]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
outfile1 = homedir+'/research/LCS/plots/lcscore-external-sfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-external-sfrmstar.png'
b.plot_sfr_mstar_lcs(outfile1=outfile1,outfile2=outfile2,nbins=12)
In [19]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
flag = b.lcs.cat['membflag']
outfile1 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-gsw-sfrmstar-BTcut.png'
b.plot_sfr_mstar(lcsflag=flag,outfile1=outfile1,outfile2=outfile2)
In [6]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
flag = ~b.lcs.cat['membflag'] & (b.lcs.cat['DELTA_V'] < 3.)
outfile1 = homedir+'/research/LCS/plots/lcsinfall-gsw-sfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcsinfall-gsw-sfrmstar-BTcut.png'
b.plot_sfr_mstar(lcsflag=flag,label='LCS infall',outfile1=outfile1,outfile2=outfile2)
In [7]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py --cutBT
outfile1 = homedir+'/research/LCS/plots/lcscore-external-sfrmstar-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-external-sfrmstar-BTcut.png'
b.plot_sfr_mstar_lcs(outfile1=outfile1,outfile2=outfile2,nbins=12)
CONCLUSION
In [57]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
outfile1 = homedir+'/research/LCS/plots/lcscore-external-BTcut.pdf'
outfile2 = homedir+'/research/LCS/plots/lcscore-external-BTcut.png'
b.lcs_compare_BT()#outfile1=outfile1,outfile2=outfile2,nbins=12)
plt.savefig(outfile1)
plt.savefig(outfile2)
In [ ]:
With B/T < 0.3 cut
Quick comparison of LCS core and infall.
We are able to detect a difference in sSFRs between core and infall, but the significance is not super high (pvalue = 0.014).
We are therefore getting a consistent story:
Where to next:
Long term:
Concerns:
can we predict the size of the disks in the field?
can we refine the model. fitting disk times, we can also now incorporate SFRs.
infall models tell you time b/w field/infall and field/core
quantify - how much lower are cluster SFRs?
what happens to R24 if disk is truncated?
Then we solve for best-fitting dr/dt - where we compare distribution of shrunk infall sizes with distribution of core sizes using a KS test.
for every galaxy that we are shrinking in size, we use comparison of original profile vs shrunk profile to calculate the change in SFR
Compare the distribution of resulting SFRs to the distribution of SFRs in the core.
Need to compare SFR and size distributions.
IMPLEMENTATION
What if shrinking is due to Truncation rather than shrinking?
if we have a truncated sersic profile and refit with a sersic profile, what happens to the resulting Re?
this will probably make different predictions about SFRs
Questions
What about controlling for stellar mass?
SINGS sample - covers range of galaxies
predict size distributions of field galaxies - motivates measuring the size of SF disk for a large sample of field galaxies
how do we fold in the two KS tests (size and SFRs)? - 2D (size and SFR)
Measuring "Goodness of Fit"
In paper, we used different infall times because we could have a large distribution of infall times.
We assigned infall times randomly, but we let tmax vary. models say infall time should be less than 5 Gyr.
In [26]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/lcs_paper2.py
outfile1 = homedir+'/research/LCS/plots/lcs-core-infall-ssfrmstar.pdf'
outfile2 = homedir+'/research/LCS/plots/lcs-core-infall-ssfrmstar.png'
b.plot_ssfr_mstar_lcs(outfile1=outfile1,outfile2=outfile2)
want to use the full sample for best comparability with model in paper1
table is created by LCSbase.py - update_table()
In [74]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSbase.py
Simulation program will read
'/home/rfinn/research/LCS/tables/LCS_all_size_KE_SFR.fits'
directly
In [34]:
tab = Table.read('/home/rfinn/research/LCS/tables/LCS-simulation-data.fits')
In [49]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py
In [58]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=2,drdt_step=0.05,nrandom=100)
In [73]:
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
plt.savefig('pvalue-SFR-size-tmax2.0Gyr.png')
In [7]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py
In [8]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=2,drdt_step=0.05,nrandom=100)
In [9]:
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax2.0Gyr-shrink0.png')
In [10]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=2,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax2.0Gyr-shrinkorig.png')
In [82]:
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax2.0Gyr-shrink0.png')
In [92]:
ks_2samp(sizes['fcnsersic1'][core_flag],sizes['fcnsersic1'][~core_flag])
Out[92]:
In [95]:
plt.figure()
plt.hist(sizes['fcnsersic1'][core_flag],histtype='step',label='core',cumulative=True,normed=True,bins=20)
plt.hist(sizes['fcnsersic1'][~core_flag],histtype='step',label='external',cumulative=True,normed=True,bins=20)
plt.legend()
Out[95]:
In [281]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=1,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax1.0Gyr-shrink0.png')
In [6]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=3,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('Constraint from size of SF disk (p value)')
plt.ylabel('Constraint from Total SFR (p value)')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('adap2020-timescale.png')
plt.savefig('adap2020-timescale.pdf')
In [59]:
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=15,vmin=-.4,vmax=0)
plt.xlabel('Constraint from size of SF disk (KS p value)',fontsize=18)
plt.ylabel('Constraint from Total SFR (KS p value)',fontsize=18)
cb = plt.colorbar(label='Rate of disk shrinking (1/Gyr)')
cb.set_label('Rate of disk shrinking (1/Gyr)',fontsize=18)
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
plt.axis([-.01,.35,-.01,.2])
xl = np.linspace(.05,1,100)
y1 = np.ones(len(xl))
y2 = .05*np.ones(len(xl))
plt.fill_between(xl,y1=y1,y2=y2,alpha=.1)
plt.text(.2,.11,'Models that meet both \nSFR AND size constraints',horizontalalignment='center',bbox=dict(facecolor='white', alpha=0.8))
plt.text(.2,.025,'Models ruled out by SFR constraints',horizontalalignment='center',bbox=dict(facecolor='white', alpha=0.8))
plt.text(.03,.1,'Models ruled out by size constraints',verticalalignment='center',horizontalalignment='center',rotation=90,bbox=dict(facecolor='white', alpha=0.8))
#ax.set_yscale('log')
plt.savefig('adap2020-timescale.png')
plt.savefig('adap2020-timescale.pdf')
In [40]:
help(plt.text)
In [282]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=2,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax2.0Gyr-shrink0.png')
In [283]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=3,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax3.0Gyr-shrink0.png')
In [284]:
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=4,drdt_step=0.05,nrandom=100)
plt.figure(figsize=(8,6))
plt.scatter(all_p,all_p_sfr,c=all_drdt,s=10,vmin=-.4,vmax=0)
plt.xlabel('p value size')
plt.ylabel('p value SFR')
plt.colorbar(label='dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#ax.set_yscale('log')
plt.savefig('pvalue-SFR-size-tmax4.0Gyr-shrink0.png')
In [280]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24
plot_multiple_tmax_wsfr(nrandom=100)
In [13]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/fit-truncated-sersic-1d.py --nres 20 --ngal 10 --minrtrunc .75 --maxrtrunc 1
In [23]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/fit-truncated-sersic-1d.py --nres 30 --ngal 10 --minrtrunc .5 --maxrtrunc 2
plt.show()
In [108]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/fit-truncated-sersic-1d.py --nres 30 --ngal 500 --minrtrunc .5 --maxrtrunc 3
plt.show()
In [179]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/fit-truncated-sersic-1d.py --nres 30 --ngal 500 --minrtrunc .5 --maxrtrunc 5
plt.show()
pick random dr/dt, where dr/dt is how fast the radius is truncated
to compare sizes, take truncated radius and use fitting function to translate into Re_fit/Re_input. this predicts the effective radius we would get by fitting a single component sersic profile to the truncated profile.
to compare SFRs:
alternate method for computing new SFR:
plot integral of truncated profile (out to rtrunc)/ integral best-fit sersic model (out to 6Re) VS Rtrunc
In [178]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3
plot_multiple_tmax_wsfr2(nrandom=30)
This definitely gives different results. It seems to me that method one is more physical, but method 2 is closer to what we do with the data. Except we get SFRs from the MIPS flux and NUV flux from NSA. We don't use the galfit magnitude to calculate the SFR.
In [177]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3 --sfrint 2
plot_multiple_tmax_wsfr2(nrandom=30)
In [185]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3 --sfrint 2
plot_multiple_tmax_wsfr2(nrandom=10)
In [190]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --rmax 4 --use24 --model 2 --tmax 3 --sfrint 1
plot_multiple_tmax_wsfr2(nrandom=10)
Found that I had the limit se
In [6]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --rmax 4 --use24 --model 2 --tmax 3 --sfrint 1
plot_multiple_tmax_wsfr2(nrandom=10)
In [10]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=3,drdt_step=0.05,nrandom=100)
In [11]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --btcut --use24
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr = run_sim(tmax=3,drdt_step=0.05,nrandom=100)
In [18]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 1 --tmax 3 --sfrint 1
plot_multiple_tmax_wsfr2(nrandom=30)
In [19]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 1 --tmax 3 --sfrint 1 --btcut
plot_multiple_tmax_wsfr2(nrandom=30)
In [154]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 1 --tmax 3 --sfrint 1 --btcut
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [155]:
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=1)
In [106]:
In [141]:
def plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=2,v2=.005,model=1):
'''
make a 1x3 plot showing
(1) pvalue vs dr/dt for size
(2) pvalue vs dr/dt for SFR
(3) pvalue size vs pvalue SFR, color coded by dr/dt
PARAMS
------
* all_drdt : output from run_sum; disk-shrinking rate for each model
* all_p : output from run_sum; KS pvalue for size comparision
* all_p_sfr : output from run_sum; KS pvalue for SFR comparison
* tmax : tmax of simulation, default is 2 Gyr
* v2 : max value for colorbar; default is 0.005 for 2sigma
* model : default is 1; could use this plot for models 1 and 2
OUTPUT
------
* save png and pdf plot in plotdir
* title is: model3-tmax'+str(tmax)+'-size-sfr-constraints-3panel.pdf
'''
plt.figure(figsize=(14,4))
plt.subplots_adjust(wspace=.5,bottom=.15)
xvars = [all_drdt, all_drdt, all_p]
yvars = [all_p, all_p_sfr, all_p_sfr]
xlabels=['dr/dt','dr/dt','pvalue Size']
ylabels=['pvalue Size','pvalue SFR','pvalue SFR']
titles = ['Size Constraints','SFR Constraints','']
allax = []
for i in range(len(xvars)):
plt.subplot(1,3,i+1)
if i < 2:
plt.scatter(xvars[i],yvars[i],s=10,alpha=.5)
plt.title(titles[i])
else:
# plot pvalue vs pvalue, color coded by dr/dt
plt.scatter(all_p,all_p_sfr,c=all_drdt,vmin=-4,vmax=0,s=5)
plt.title('Size & SFR Constraints')
plt.xlabel(xlabels[i],fontsize=16)
plt.ylabel(ylabels[i],fontsize=16)
allax.append(plt.gca())
cb = plt.colorbar(ax=allax,fraction=.08)
cb.set_label('dr/dt')
plt.axhline(y=.05,ls='--')
plt.axvline(x=.05,ls='--')
ax = plt.gca()
#plt.axis([-.01,.35,-.01,.2])
xl = np.linspace(.05,1,100)
y1 = np.ones(len(xl))
y2 = .05*np.ones(len(xl))
plt.fill_between(xl,y1=y1,y2=y2,alpha=.1)
plt.savefig(plotdir+'/model'+str(model)+'-tmax'+str(tmax)+'-size-sfr-constraints-3panel.png')
plt.savefig(plotdir+'/model'+str(model)+'-tmax'+str(tmax)+'-size-sfr-constraints-3panel.pdf')
In [131]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3 --sfrint 1 --btcut
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [138]:
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=2)
In [149]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3 --sfrint 1 --btcut --rmax 1
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=2)
In [150]:
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=2)
In [ ]:
In [ ]:
In [28]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 3 --tmax 3 --sfrint 1 --btcut
plot_multiple_tmax_wsfr2(nrandom=10)
In [24]:
np.random.random()
Out[24]:
In [42]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 3 --tmax 3 --sfrint 1 --btcut
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [55]:
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
plt.figure(figsize=(12,4))
plt.subplots_adjust(wspace=.5)
colors = [all_p,all_p_sfr]
labels = ['size p value','sfr p value']
titles = ['Size Constraints','SFR Constraints']
v2 = .005
for i in range(len(colors)):
plt.subplot(1,2,i+1)
plt.scatter(all_drdt,boost,c=colors[i],vmin=0,vmax=v2,s=15)
cb = plt.colorbar()
cb.set_label(labels[i])
plt.title(titles[i])
plt.xlabel('dr/dt',fontsize=16)
plt.ylabel('I boost/I0',fontsize=16)
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.png')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.pdf')
In [49]:
tmax=2
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [51]:
plt.figure(figsize=(12,4))
plt.subplots_adjust(wspace=.5)
colors = [all_p,all_p_sfr]
labels = ['size p value','sfr p value']
titles = ['Size Constraints','SFR Constraints']
v2 = .005
for i in range(len(colors)):
plt.subplot(1,2,i+1)
plt.scatter(all_drdt,boost,c=colors[i],vmin=0,vmax=v2,s=15)
cb = plt.colorbar()
cb.set_label(labels[i])
plt.title(titles[i])
plt.xlabel('dr/dt',fontsize=16)
plt.ylabel('I boost/I0',fontsize=16)
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.png')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.pdf')
In [52]:
tmax=4
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [68]:
def plot_model3(all_drdt,all_p,all_p_sfr,boost,tmax=2,v2=.005):
plt.figure(figsize=(12,4))
plt.subplots_adjust(wspace=.5)
colors = [all_p,all_p_sfr]
labels = ['size p value','sfr p value']
titles = ['Size Constraints','SFR Constraints']
allax = []
for i in range(len(colors)):
plt.subplot(1,2,i+1)
plt.scatter(all_drdt,boost,c=colors[i],vmin=0,vmax=v2,s=15)
plt.title(titles[i])
plt.xlabel('dr/dt',fontsize=16)
plt.ylabel('I boost/I0',fontsize=16)
allax.append(plt.gca())
cb = plt.colorbar(ax=allax,fraction=.08)
cb.set_label('KS p value')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.png')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints.pdf')
In [103]:
def plot_model3_3panel(all_drdt,all_p,all_p_sfr,boost,tmax=2,v2=.005):
plt.figure(figsize=(14,4))
plt.subplots_adjust(wspace=.01,bottom=.15)
colors = [all_p,all_p_sfr]
labels = ['size p value','sfr p value']
titles = ['Size Constraints','SFR Constraints']
allax = []
for i in range(len(colors)+1):
plt.subplot(1,3,i+1)
if i < 2:
plt.scatter(all_drdt,boost,c=colors[i],vmin=0,vmax=v2,s=10)
plt.title(titles[i])
else:
# plot both together
flag = np.arange(0,len(all_drdt),2)
plt.scatter(all_drdt[flag],boost[flag],c=colors[0][flag],vmin=0,vmax=v2,s=10)
flag = np.arange(1,len(all_drdt),2)
plt.scatter(all_drdt[flag],boost[flag],c=colors[1][flag],vmin=0,vmax=v2,s=10)
#plt.scatter(all_drdt,boost,c=colors[0]+colors[1],vmin=0,vmax=v2,s=10)
plt.title('Size & SFR Constraints')
if i == 0:
plt.ylabel('Iboost/Ie',fontsize=16)
else:
y1,y2 = plt.ylim()
#t = plt.yticks()
#print(t)
plt.yticks([])
plt.ylim(y1,y2)
plt.xlabel('dr/dt',fontsize=16)
allax.append(plt.gca())
cb = plt.colorbar(ax=allax,fraction=.08)
cb.set_label('KS p value')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints-3panel.png')
plt.savefig(plotdir+'/model3-tmax'+str(tmax)+'-size-sfr-constraints-3panel.pdf')
In [80]:
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.05,nrandom=30,plotsingle=False,plotflag=False)
In [73]:
plot_model3(all_drdt,all_p,all_p_sfr,boost)
In [104]:
plot_model3_3panel(all_drdt,all_p,all_p_sfr,boost,tmax=3)
In [99]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 3 --tmax 3 --sfrint 1 --btcut
tmax=4
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr,boost=run_sim(tmax=tmax,drdt_step=.1,nrandom=30,rmax=4,plotsingle=False,plotflag=False)
plot_model3_3panel(all_drdt,all_p,all_p_sfr,boost,tmax=3)
In [103]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 2 --tmax 3 --sfrint 1 --btcut --rmax 4
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr=run_sim(tmax=tmax,drdt_step=.05,rmax=4,nrandom=30,plotsingle=False,plotflag=False)
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=2)
In [104]:
os.chdir(homedir+'/research/LCS/plots/')
%run ~/github/LCS/python/Python3/LCSsimulate-infall-paper2.py --use24 --model 1 --tmax 3 --sfrint 1 --btcut --rmax 4
tmax=3
best_drdt, best_sim_core,ks_p_max,all_drdt,all_p,all_p_sfr=run_sim(tmax=tmax,drdt_step=.05,rmax=4,nrandom=30,plotsingle=False,plotflag=False)
plot_model1_3panel(all_drdt,all_p,all_p_sfr,tmax=3,v2=.005,model=2)
In [9]:
def sersic(x,Ie,n,Re):
bn = 1.999*n - 0.327
return Ie*np.exp(-1*bn*((x/Re)**(1./n)-1))
In [106]:
plt.figure(figsize=(10,8))
plt.subplots_adjust(wspace=.3)
rmax = 4
scaleRe = 0.8
rtrunc = 1.5
n=1
# shrink Re
plt.subplot(3,2,1)
x = np.linspace(0,rmax,100)
Ie=1
Re=1
y = sersic(x,Ie,n,Re)
plt.plot(x,y,label='sersic n='+str(n))
y2 = sersic(x,Ie,n,scaleRe*Re)
plt.plot(x,y2,label="Re -> "+str(scaleRe)+"Re",ls='--')
plt.legend()
plt.xlabel('radius')
plt.ylabel('Intensity')
# plot total flux
plt.subplot(3,2,2)
dx = x[1]-x[0]
sum1 = (y*dx*2*np.pi*x)
sum2 = (y2*dx*2*np.pi*x)
plt.plot(x,np.cumsum(sum1)/np.max(np.cumsum(sum1)),label='sersic n='+str(n))
plt.plot(x,np.cumsum(sum2)/np.max(np.cumsum(sum1)),label="Re -> "+str(scaleRe)+"Re",ls='--')
plt.ylabel('Enclosed Flux')
plt.grid()
# truncated sersic model
plt.subplot(3,2,3)
plt.plot(x,y,label='sersic n='+str(n))
y3 = y.copy()
flag = x > rtrunc
y3[flag] = np.zeros(sum(flag))
plt.plot(x,y3,ls='--',label='truncated at '+str(rtrunc)+' Re')
plt.legend()
plt.ylabel('Intensity')
plt.legend()
#plt.gca().set_yscale('log')
plt.subplot(3,2,4)
sum3 = (y3*dx*2*np.pi*x)
plt.plot(x,np.cumsum(sum1)/np.max(np.cumsum(sum1)),label='sersic n='+str(n))
plt.plot(x,np.cumsum(sum3)/np.max(np.cumsum(sum1)),label='truncated at '+str(rtrunc)+' Re',ls='--')
plt.ylabel('Enclosed Flux')
plt.legend()
plt.grid()
# need to show what measured Re would be in model 2
# truncated and boosted
In [ ]: