コード例 #1
0
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))

#convert radius vir to log10
cat.add_column('G2S', cat.GMASS - cat.SMASS)
cat.add_column('G2D', cat.GMASS - cat.DMASS)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)

#w1 = np.where(cat.goldmine == 13)[0]
#cat.goldmine[w1] = 9
#w2 = np.where(cat.goldmine == 18)[0]
#cat.goldmine[w2] = 8

#select detected galaxies
#cat = cat.where(np.nan_to_num(cat.K) != 0.0)
cat = cat.where(cat.D250 == 1)

cols = ['SMASS', 'DUST_STARS', 'DMASS', 'sSFR','SRF', 'SFR2D']
labs = ['$\log_{10} (M_{stars} / $M$_{\odot}$)', '$\log_{10} (M_{dust} / M_{star}$)', '$\log_{10} (M_{dust} / $M$_{\odot}$)','$\log_{10}$(sSFR) (Yr$^{-1}$)','$\log_{10}$(SFR) (Yr$^{-1}$)', '$\log_{10}$($SFR/M_{Dust}$)']



#create figure and subplots
fig, subs = plt.subplots(nrows=len(cols), ncols=1, sharex=True, sharey=False, squeeze=False, figsize = (8., 9.5), facecolor='w',edgecolor='w')

##################################################################################
#function that bins up something and then finds errors that are error in mean
def mean_binup(x, y, bins):
	#intialise list to hold y values
	y_mean, x_mean, y_error, y_n, y_std = [], [], [], [], []
コード例 #2
0
#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat.add_column('all', cat.g)
cat.all = 1
cat.add_column('colour', cat.g - cat.r)

#cat = cat.where(cat.bptclass ==1)

#convert radius vir to log10
cat.RADIUS_VIR = np.log10(cat.RADIUS_VIR)

#select detected galaxies
#cat = cat.where(np.nan_to_num(cat.K) != 0.0)
detected = cat.where((cat.DMASS_TYPE != 0) & (np.nan_to_num(cat.METAL) > 0.0)) 
undetected = cat.where((cat.DMASS_TYPE == 0) & (np.nan_to_num(cat.METAL) > 0.0)) 

cats = [detected, undetected]
du  = ['FIR-detected', 'FIR-undetected']
lisy = ['-', '--']
mark = ['*', '+']


#switchs
N_den = 7 #number of density bins
N = 60
bin_type = 'fixed'
types = ['late', 'inter']

types_lab = ['late', 'intermediate']
コード例 #3
0
import numpy as np  
from os.path import join as pj
import aplpy as ap
from atpy import Table
import matplotlib.pyplot as plt
###################### inputs ######################
gal_name = 'CCC2099'

folder_fig = '/Users/chrisfuller/Dropbox/phd/herchel/coma/fig_gen/' + gal_name + '/'
folder_cat = '/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/'

print "reading in cat"
cat = Table(pj(folder_cat,"coma_supercluster_cal12.fits"))

#select galaxy
galaxy = cat.where(cat.OBJECT == gal_name)

#change dir to folder directory
os.chdir(folder_fig)

#################### functions ###################

#function to plot FIR contours
def plottabw(name,fname,texts,x,y):
    print name
    #find optical parameters
    a,b,pa = galaxy.FULLMAJAX[0],galaxy.FULLMINAX[0], galaxy.PA[0]
    #pa = pa + 90.
    rDust = galaxy.R250[0]*1.3 
    ra,dec = galaxy.GRA2000[0], galaxy.GDEC2000[0]
    beam = 18.2/3600.0
コード例 #4
0
#import
print 'importing modules...'
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
#remove numpy runtime warings
#np.seterr(invalid='ignore')

#Inputs
print 'reading in cats'
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
cat_name = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,cat_name))
cluster = cat.where(cat['RADIUS_VIR'] <=  1.0)
filament = cat.where(cat['RADIUS_VIR'] >  1.0)

#User variables
params = ['SMASS','Mr'] #, 'g', 'r', 'i', 'z'] #parameters to check against detection rates
detCols = ['F250','NGPFLUX250']#, 'RERUNF250'] #detection rate columns
N = 4 #number of bins
morphological_types = ['early', 'late', 'inter'] #morphological types
morphological_colours = ['r', 'b', 'g'] #colous for each line
xlabs = ['$log_{10}(M_{star}/$M$_{\odot})$','$(M_{r})$']
texts = ['(This paper)', 'NGP H-ATLAS Catalogue', 'RERUN FLUX250'] 

### Functions ###
def plot_sub(sub, dcol, para, bins):

	lines = []
コード例 #5
0
#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator

#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12_pacscorrected.fits' #input name
cat = Table(pj(folder,fname))
virgo = Table('/Users/chrisfuller/Dropbox/phd/herchel/virgo/virgo-all-data-v2.fits')
fornax = Table('/Users/chrisfuller/Dropbox/phd/herchel/fornax/final_outputs/stellar-mass-fornax_final.fits')
cat = cat.where(cat.F250 >= 50.0E-3)

D_coma = 100.0*3.0857E22
D_virgo = 14.0*3.0857E22
D_fornax = 19.0*3.0857E22
#D_virgo = np.array(virgo.MPG*3.0857E22, dtype=np.float64)

#add columns coma
L250 = cat.F250 * (4.*np.pi*D_coma**2) * 10E-26
L250[np.nan_to_num(L250) > 0.0] = np.log10(L250[np.nan_to_num(L250) > 0.0])
cat.add_column('L250', L250)

#add columns virgo 
L250_virgo = virgo.F250 * (4.*np.pi*D_virgo**2) * 10E-26
L250_virgo[np.nan_to_num(L250_virgo) > 0.0] = np.log10(L250_virgo[np.nan_to_num(L250_virgo) > 0.0])
virgo.add_column('L250',L250_virgo)
コード例 #6
0
#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator
 

#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
virgo = Table('/Users/chrisfuller/Dropbox/phd/herchel/virgo/virgo-all-data.fits')
fornax = Table('/Users/chrisfuller/Dropbox/phd/herchel/fornax/final_outputs/stellar-mass-fornax_final.fits')
cat = cat.where(cat.F250 >= 50.0E-3)

D_coma = 100.0*3.0857E22
D_virgo = 14.0*3.0857E22
D_fornax = 19.0*3.0857E22
#D_virgo = np.array(virgo.MPG*3.0857E22, dtype=np.float64)

#add columns coma
L250 = cat.F250 * (4.*np.pi*D_coma**2) * 10E-26
L250[np.nan_to_num(L250) > 0.0] = np.log10(L250[np.nan_to_num(L250) > 0.0])
cat.add_column('L250', L250)

#add columns virgo 
L250_virgo = virgo.F250 * (4.*np.pi*D_virgo**2) * 10E-26
L250_virgo[np.nan_to_num(L250_virgo) > 0.0] = np.log10(L250_virgo[np.nan_to_num(L250_virgo) > 0.0])
virgo.add_column('L250',L250_virgo)
コード例 #7
0
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat.add_column('DUST_STARS_BELL', cat.DMASS - cat.SMASS_BELL)
cat.add_column('all', cat.g)
cat.all = 1
#caculated extra columns
cat.add_column('D2G', - cat.HI_ALL2 +cat.DMASS)
cat.add_column('G2S', cat.HI_ALL2 - cat.SMASS)
cat.add_column('SFR2G', cat.SRF - cat.HI_ALL2)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)
cat.add_column('colour', cat.g - cat.r)


#select currentCat galaxies
firCat = cat.where(cat.DMASS_TYPE != 0)
gasCat = cat.where(np.nan_to_num(cat.HI_ALL2) > 0.0)
metalCat = cat.where(np.nan_to_num(cat.METAL) > 0.0)
gasfirCat = cat.where((cat.DMASS_TYPE != 0) & (np.nan_to_num(cat.HI_ALL2) > 0.0))
sedCat = cat.where(cat.DMASS_TYPE == 2)
hCat = cat.where(np.nan_to_num(cat.H) != 0)
jCat = cat.where(np.nan_to_num(cat.J) != 0)
kCat = cat.where(np.nan_to_num(cat.K) != 0)
zCat = cat.where(np.nan_to_num(cat.z) != 0)

parameters = ['H','J','K', 'u_1', 'g', 'r','i', 'z','SMASS', 'SMASS']
names =      ['H','J','K', 'u'  , 'g', 'r','i', 'z','Stellar Mass(NIR) ', 'Stellar Mass (All)']
cats = [hCat, jCat, kCat, cat, cat, cat, cat, cat, kCat, cat]

types = ['late', 'inter', 'early']
コード例 #8
0
N=2

fig, subs = subplots(nrows=N, ncols=1, sharex=True, sharey=False, squeeze=True, figsize = (4.5,8.5), facecolor='w',edgecolor='w')

sub1 = subs[N-1]

bins = arange(0,10,1)

smass_bins = linspace(min(cat_master.SIGMA10), max(cat_master.SIGMA10), N+1)


for j in range(N):
	lower = smass_bins[j]
	upper = smass_bins[j+1]

	cat  = cat_master.where((cat_master.SIGMA10 >= lower) & (cat_master.SIGMA10 <= upper)  & ( nan_to_num(cat_master.F250) > 0.0))

	sub = subs[j]

	sub.plot(cat.pS0, cat.D2S, 'kx') #yerr=sqrt(hist_N), c=cols[i], ls='-')#, label=morph[i])

	sub.text(0.02, 0.9,  '$'+ str(around(lower)) + '< $log_{10} (\SIGMA_{10})$ < ' + str(around(upper)) + '$', transform=sub.transAxes, fontsize=12, verticalalignment='top')
sub1.set_xlabel('Morphological Type')
sub1.set_ylabel('$log(M_{dust}/M_{stars})$')
#sub1.set_xticklabels( ('E', 'S0', 'S0/Sa', 'Sa', 'Sab', 'Sb', 'Sbc', 'Sc', 'Scd', 'Sd') )
subplots_adjust(left=0.11, bottom=0.12, right=0.96, top=0.98, wspace=0.0, hspace=0.0)
legend()



コード例 #9
0
def lmfitter(x, y):
    params = Parameters()
    params.add('m', value=0.01, vary=True)

    out = minimize(residual, params, args=(x, y))
    report_fit(params)
    return out.params['m'].value, 0.0, out.params['m'].stderr, 0.0

def model(params, x):
    a = params['m'].value
    return a*x

##################################################

#select galaxies that have all the metallicities we need
zcat = cat.where((np.nan_to_num(cat.METAL) > 0.0) & (np.nan_to_num(cat.HI_ALL2) > 0.0)  & (cat.DMASS_TYPE != 0))

#caculate the fraction of metals in the dust and in the gas
print np.mean(10**zcat.DMASS/ 10**zcat.MZGAS ) 
print np.std(10**zcat.DMASS/ 10**zcat.MZGAS ) / np.sqrt(len(zcat)*1.0)

#caculate total mass
total = np.log10(10**zcat.Mgastot + 10**zcat.SMASS + 10**zcat.DMASS)

fig, subs = plt.subplots(nrows=1, ncols=1, figsize = (4., 4.), facecolor='w',edgecolor='w')
cluster = np.where(zcat.RADIUS_VIR <= 1.0)
filament = np.where(zcat.RADIUS_VIR > 1.0)
################################################################################

# xxx and yyy
xx = 10**zcat.SMASS / 10**total
コード例 #10
0
density_bins = np.logspace(np.min(np.log10(sigma5)),np.max(np.log10(sigma5)),no_bins)

#create figure to plot over 
fig= plt.figure(figsize = (4.0,6.5),facecolor='w',edgecolor='w')

#create subplots
p1 = plt.subplot(211)
p2 = plt.subplot(212)

#loop through all density bins
for i in range(0,len(density_bins)-1):

	#density limits
	den_min = density_bins[i]#*0.2 
	den_max = density_bins[i+1]#*1.8

	#select cat
	selection = cat.where((sigma5 > den_min) & (sigma5 < den_max))

	#send cat to plotta
	double_plot([p1,p2], [0.,1.1,0.25], selection, 'pS0', [-0.09, 1.09], [0,100], False, True, colours[i], lstr(den_min) + '<log10sigma5<' + lstr(den_max) )




plt.subplots_adjust(left=0.08, bottom=0.08, right=0.98, top=0.99, wspace=0.0, hspace=0.0)
#fig.savefig(pj('/Users/chrisfuller/Desktop/','per_det_accros_hubble_seq_zoo.pdf'))
plt.show()


コード例 #11
0
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator
import scipy
#remove numpy runtime warings
np.seterr(invalid='ignore')


#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat = cat.where(cat.SMASS > 6.8)


#volumes
volumes = [114.2, 2872.8] #volume Mpc using spere and cylender 
volumesGas = [114.2*0.5, 2872.8*0.3] #volume Mpc using spere and cylender 
#volumes  = [114.2, 38782.8]
#volumes= [1.0, 1.0]

#cats
cats = [cat.where(cat.RADIUS_VIR <= 1.0), cat.where(cat.RADIUS_VIR > 1.0)]
cats_names = ['Cluster&', 'Filament&']

#plotting parameters
line_syles = ['-', '--']
lines = [9.1, 9.3, 6.5]
#import mods
from atpy import Table
import numpy as np
from os.path import join as pj

#Inputs
# input/output folder
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" 
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))

#Types
types = ['late', 'inter', 'early']

#cats
cluster = cat.where(cat.RADIUS_VIR <= 1.0)
filament = cat.where(cat.RADIUS_VIR > 1.0)

cats = [cluster, filament]

def detRate(tab, m):
	t = tab.where(tab[morph] == 1)
	detected = len(t.where(t.D250 == 1))
	detError = np.sqrt(detected)

	total = len(t)*1.0
	per = detected*100.0 / total
	perError = detError*100.0 / total

	return detected, detError, per, perError
コード例 #13
0

#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator
import scipy

#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat = cat.where(cat.SMASS > 6.8)


#cats
cats = [cat.where(cat.RADIUS_VIR <= 1.0), cat.where(cat.RADIUS_VIR > 1.0)]
cats_names = ['Cluster&', 'Filament&']

N = 12


#columns to plot
plots = [	['SMASS', 'HI_ALL2', 'DMASS']] 
lines = [9.1, 9.1, 6.4]
limits = [[8,12], [8, 11], [6,9]]

plots = np.array(plots)
コード例 #14
0
#This program takes a catalogue and converts it into a goldmine type morphological classification

#import moduals
from atpy import Table
from numpy import nan_to_num, where, arange, histogram, log10, array
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
import matplotlib.pylab  as pl

#Inputs

cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/coma_supercluster_cal12.fits")

fornax = cat.where((cat['RADIUS'] <  6048.0)& (cat.goldmine != -32768))
virgo  = cat.where((cat['RADIUS'] >= 6048.0)& (cat.goldmine != -32768))




###################### functions ######################
def w(cat,x):
    return where(cat['goldmine']==x)[0]
    
def dw(f):
    f = nan_to_num(f)
    return where((f>0.0))
    

#p(total_fornax[i],detected_fornax[i])
コード例 #15
0
for i in range(len(bands)):
	band = bands[i]

	cat.add_column('D' + band[-3:], [0]*len(cat))

	flux = np.nan_to_num(cat[band])

	w = np.where(flux != 0.0)[0]

	cat['D' + band[-3:]][w] = 1

total = cat.D500 + cat.D350 + cat.D250 + cat.D160 + cat.D100


five_cluster = cat.where((total == 5) & (cat.RADIUS_VIR <= 1.0))
five_filament = cat.where((total == 5) & (cat.RADIUS_VIR > 1.0))

""" create new columum dmass and dmass_type """

dmass, dmass_type = np.array([0.0]*len(cat)) , np.array([0]*len(cat))

w_five = np.where(total == 5)[0]
w_250 = np.where((total != 5) & (total != 0))[0]

dmass[w_five] = cat.DMASS_SED[w_five]
dmass_type[w_five] = 2
dmass[w_250]  = cat.DMASS_250[w_250]
dmass_type[w_250] = 1

コード例 #16
0
#p(total_cluster[i],detected_cluster[i])
def p(a,b):
    per = np.round(float(b)*100.0/a, decimals = 0)
    error = np.sqrt(b) / a
    return str(np.int(per))+'\\,$\\pm$\\,'+str(np.int(np.round(error*100.0, decimals=0)))
    
def er(a,b):
    return np.sqrt(a) #*100.0 / b


    
####################### main ##########################
    

early = cat.where(cat.early==1)
inter = cat.where(cat.inter==1)
late = cat.where(cat.late==1)


################### plotting ##########################




early_hist,bin_edges    =  histogram(early.SMASS, bins = 10)
inter_hist,bin_edges    =  histogram(inter.SMASS, bins = 10)
late_hist,bin_edges    =  histogram(late.SMASS, bins = 10)


#per_early = np.cumsum(array(early_hist, dtype=float)*1.0) / len(cat)
コード例 #17
0
ファイル: img_grab.py プロジェクト: 9217392354A/astro-scripts
# Program to grab SDSS images for the HRS matched to size of SPIRE PLW
# written 29th May 2012

# import modules
import numpy as np
import os
import sys
from os.path import join as pj
from atpy import Table

print 'reading in cats'
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
cat_name = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,cat_name))

cat = cat.where((cat.goldmine < 2) & (cat.goldmine > -10) & (cat.late == 1))

npix=400
pixScale = 0.4

# outfolder
outFolder = '/Users/chrisfuller/Desktop/'

os.chdir(outFolder)

for i in range(len(cat)):
    name = cat.OBJECT[i]
    coord = cat.GRA2000[i], cat.GDEC2000[i]

 
    outFile = name  + "-SDSS.jpg"
#program to caculate the number and persentage of galaxies detected in the filament for each morphologcail type
# Chris Fuller, April 2014


#import moduals
from atpy import Table
import numpy as np

types = ['late','inter', 'early' ]

#Inputs
cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/coma_supercluster_cal12.fits")
cat = cat.where(cat.SMASS > 9.1)

for i in range(3):
	t = types[i]
	print t

	#sample
	sample_det, sample_tot = len(cat.where((cat[t]==1) & (cat.D250==1)))*1.0, len(cat.where(cat[t]==1))*1.0
	sample_per, sample_per_err = sample_det*100.0/sample_tot, np.sqrt(sample_det)*100.0/sample_tot

	sample =  str(int(sample_det)) + ' of '+ str(int(sample_tot)) +  ' (' + str(int(sample_per)) + '\\,$\\pm$\\,' + str(int(sample_per_err)) + '\\,\\%)'

	#cluster
	cluster_det, cluster_tot = len(cat.where((cat[t]==1) & (cat.D250==1) & (cat.RADIUS_VIR <= 1.0)))*1.0, len(cat.where((cat[t]==1) & (cat.RADIUS_VIR <= 1.0) ))*1.0
	cluster_per, cluster_per_err = cluster_det*100.0/cluster_tot, np.sqrt(cluster_det)*100.0/cluster_tot

	cluster =  str(int(cluster_det)) + ' of '+ str(int(cluster_tot)) +  ' (' + str(int(cluster_per)) + '\\,$\\pm$\\,' + str(int(cluster_per_err)) + '\\,\\%)'

	#filament
コード例 #19
0
import scipy


#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat.add_column('DUST_STARS_BELL', cat.DMASS - cat.SMASS_BELL)
cat.add_column('all', cat.g)
cat.all = 1

#convert radius vir to log10
cat.RADIUS_VIR = np.log10(cat.RADIUS_VIR)

#select detected galaxies
detected = cat.where(cat.DMASS_TYPE != 0)


#switchs
N_den = 7 #number of density bins
N = 60
bin_type = 'fixed'
types = ['late', 'inter', 'early']#, 'all']
colours = ['b', 'g', 'r']#, 'k']


mms = {} #dic to hold grads
mes = {} # dic to hold grad errrors

#quanties on x axcis
xcols  = ['SIGMA1', 'SIGMA5', 'SIGMA10', 'RADIUS_VIR']
コード例 #20
0
#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator


#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12_pacscorrected.fits' #input name
cat = Table(pj(folder,fname))

selection = cat.where(cat.DMASS_TYPE == 2)
#selection = cat.where((cat.DMASS_TYPE == 2) & (cat.F160 > (43.8*10**-3)*3.0) & (cat.F100 > (24.0*10**-3)*3.0))


types = ['early', 'inter', 'late'] 
labels = ['early', 'uncertain', 'late'] 
colours = ['r', 'g', 'b']
ylims = [10, 39, 78]
#quanties on the yaxis
xlabs = ['$Log_{10} (M_{dust} / $M$_{\odot}$)', 'Dust Temp. (K)','$Log_{10} (M_{dust} / M_{stars}$)']

	
#create figure and subplots
fig, subs = plt.subplots(nrows=3, ncols=3, sharex=False, sharey=False, squeeze=False, figsize = (8., 4.), facecolor='w',edgecolor='w')

コード例 #21
0
#import
print 'importing modules...'
from atpy import Table
from numpy import histogram, arange, sqrt
from os.path import join as pj
from matplotlib.pyplot import subplots, show, subplots_adjust, legend
from matplotlib.ticker import MaxNLocator

#Inputs
print 'reading in cats'
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
cat_name = 'coma_supercluster_cal12_pacscorrected.fits' #input name
cat = Table(pj(folder,cat_name))

early = cat.where(cat.early == 1)
late  = cat.where(cat.late  == 1)
inter = cat.where(cat.inter == 1)


cats = [early, late, inter]
cols = ['r', 'b', 'g']

morph = ['early', 'late', 'inter']

fig, subs = subplots(nrows=1, ncols=1, sharex=True, sharey=False, squeeze=True, figsize = (8.0,4.5), facecolor='w',edgecolor='w')

sub1 = subs

bins = arange(0,10,1)
コード例 #22
0
cat = Table(pj(folder,fname))
cat.add_column('all', cat.g)
cat.all = 1

#cat = cat.where(cat.bptclass ==1)


#convert radius vir to log10
cat.RADIUS_VIR = np.log10(cat.RADIUS_VIR)
cat.add_column('G2S', cat.HI_ALL2 - cat.SMASS)
cat.add_column('G2D', cat.HI_ALL2 - cat.DMASS)


#select detected galaxies
#cat = cat.where(np.nan_to_num(cat.K) != 0.0)
detected = cat.where((np.nan_to_num(cat.HI_ALL2) > 0.0) & (cat.D250 == 1)) 
undetected = cat.where((np.nan_to_num(cat.HI_ALL2) > 0.0) & (cat.D250 == 0)) 

detectedh1 = cat.where(np.nan_to_num(cat.HI_ALL2) > 0.0)
defcat = cat.where(np.nan_to_num(cat.DefHI) > 0.0)

cats = [detected, undetected]

du  = ['FIR-detected', 'FIR-undetected']
lisy = ['-', '--']
mark = ['o', '+']


#switchs
N_den = 6 #number of density bins
N = 60
	#Add title to subplot
	#subs[0,i].text(0.05, 0.95, col, transform=subs[0,i].transAxes, fontsize=12, verticalalignment='top')

	#create empty array to hold fraction of morphological types
	temp_totals = []
	
	print col
	#loop through morphology
	for j in range(0, no_morph):
		morph_lower = bins_morph[j] 
		morph_upper = bins_morph[j+1]

		#print morph_lower, morph_upper
		#selected galaxies that are in morphological bin
		selection_detec = cat.where((cat[morph] > morph_lower) & (cat[morph] < morph_upper) & (np.nan_to_num(cat[detect_col]) != 0.0)) #total
		selection_total = cat.where((cat[morph] > morph_lower) & (cat[morph] < morph_upper)) #total

		#print bins_dens, len(selection_detec), len(selection_total)
		#create temp array to hold fraction detected
		if False:
			detected, _ = np.histogram(selection_detec[col], bins = bins_dens)
			totals  , _ = np.histogram(selection_total[col], bins = bins_dens)

		if True:
			detected = super_histogram(selection_detec[col], bins_dens, sfactor)
			totals = super_histogram(selection_total[col], bins_dens, sfactor)

		#fraction detected of a given morphological type over a range of densityis
		per_det = detected / totals.astype(dtype=np.float)
		print per_det
コード例 #24
0
	bins_morph = np.linspace(0,1,no_morph+1)


	#Add title to subplot
	#subs[0,i].text(0.05, 0.95, col, transform=subs[0,i].transAxes, fontsize=12, verticalalignment='top')

	#create empty array to hold fraction of morphological types
	temp_totals = []
	
	print col
	#loop through morphology
	for j in range(0, no_morph):
		
		#print morph_lower, morph_upper
		#selected galaxies that are in morphological bin
		selection_detec = cat.where((cat[types[j]] == 1) & (cat[types[j]] == 1) & (np.nan_to_num(cat[detect_col]) != 0.0)) #total
		selection_total = cat.where((cat[types[j]] == 1) & (cat[types[j]] == 1)) #total

		#print bins_dens, len(selection_detec), len(selection_total)
		#create temp array to hold fraction detected
		if False:
			detected, _ = np.histogram(selection_detec[col], bins = bins_dens)
			totals  , _ = np.histogram(selection_total[col], bins = bins_dens)

		if True:
			detected = super_histogram(selection_detec[col], bins_dens, sfactor)
			totals = super_histogram(selection_total[col], bins_dens, sfactor)

		#fraction detected of a given morphological type over a range of densityis
		per_det = detected / totals.astype(dtype=np.float)
		print per_det
コード例 #25
0
#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
from matplotlib.ticker import MaxNLocator

#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
virgo = Table('/Users/chrisfuller/Dropbox/phd/herchel/virgo/virgo-all-data-v2.fits')
fornax = Table('/Users/chrisfuller/Dropbox/phd/herchel/fornax/final_outputs/stellar-mass-fornax_final.fits')
cat = cat.where(cat.F250 >= 50.0E-3)


D_coma = 100.0*3.0857E22
D_virgo = 14.0*3.0857E22
D_fornax = 19.0*3.0857E22
#D_virgo = np.array(virgo.MPG*3.0857E22, dtype=np.float64)

#add columns coma
L250 = cat.F250 * (4.*np.pi*D_coma**2) * 10E-26
L250[np.nan_to_num(L250) > 0.0] = np.log10(L250[np.nan_to_num(L250) > 0.0])
cat.add_column('L250', L250)
cat.add_column('colour', cat.g - cat.r)
#cat.add_column('my_morph', cat.pS0 - cat.pE0)

#add columns virgo 
コード例 #26
0
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))

#convert radius vir to log10
cat.add_column('G2S', cat.GMASS - cat.SMASS)
cat.add_column('G2D', cat.GMASS - cat.DMASS)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)

w1 = np.where(cat.goldmine == 13)[0]
cat.goldmine[w1] = 9
w2 = np.where(cat.goldmine == 18)[0]
cat.goldmine[w2] = 8

#select detected galaxies
#cat = cat.where(np.nan_to_num(cat.K) != 0.0)
cat = cat.where((np.nan_to_num(cat.goldmine+10) != 0.0) & (cat.goldmine > -1000.0) & (cat.D250 == 1))

cols = ['SMASS', 'DUST_STARS', 'DMASS', 'sSFR','SRF', 'SFR2D']
labs = ['$\log_{10} (M_{stars} / $M$_{\odot}$)', '$\log_{10} (M_{dust} / M_{star}$)', '$\log_{10} (M_{dust} / $M$_{\odot}$)','$\log_{10}$(sSFR) (Yr$^{-1}$)','$\log_{10}$(SFR) (Yr$^{-1}$)', '$\log_{10}$($SFR/M_{Dust}$)']



#create figure and subplots
fig, subs = plt.subplots(nrows=len(cols), ncols=1, sharex=True, sharey=False, squeeze=False, figsize = (8., 9.5), facecolor='w',edgecolor='w')

##################################################################################
#function that bins up something and then finds errors that are error in mean
def mean_binup(x, y, bins):
	#intialise list to hold y values
	y_mean, x_mean, y_error, y_n, y_std = [], [], [], [], []
コード例 #27
0
# making sed fit output for Coma Galaxies for thesis
# Chris Fuller, May 2013

import numpy as np
from atpy import Table
import matplotlib.pyplot as plt

folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12_pacscorrected.fits' #input name
cat = Table(folder+fname,type='fits')

cat = cat.where(cat.DMASS_TYPE == 2)

bands = ['100', '160', '250', '350', '500']

#inverse_bands =  np.array([500.,350.,250.,160.,100.], dtype=np.float)

#physical constants
h = 6.626e-34
c = 3.0e+8
k = 1.38e-23

########## functions ###############
#this gives a flux in jy for a wavelength, this uses a fixed beta
#wavelength = microns, distance = Mpc, mass = log10 solar mass
def modb(mass,temp,distance,wavelength):
    m = (10**mass)*2E30 #converts mass into kg
    d = distance*3.08567758E22 #converts Mpc to m
    wav = wavelength*1E-6 #convert micron to m
    
    k_l = kappa(wav)
コード例 #28
0
ファイル: fir.py プロジェクト: 9217392354A/astro-scripts
fname = 'coma_supercluster_cal12.fits' #input name
cat = Table(pj(folder,fname))
cat.add_column('DUST_STARS_BELL', cat.DMASS - cat.SMASS_BELL)
cat.add_column('all', cat.g)
cat.all = 1
#caculated extra columns
cat.add_column('G2D', cat.HI_ALL2 - cat.DMASS)
cat.add_column('G2S', cat.HI_ALL2 - cat.SMASS)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)
cat.add_column('colour', cat.g - cat.r)

#convert radius vir to log10
cat.RADIUS_VIR = np.log10(cat.RADIUS_VIR)

#select currentCat galaxies
firCat = cat.where(cat.DMASS_TYPE != 0)
gasCat = cat.where(np.nan_to_num(cat.HI_ALL2) > 0.0)
metalCat = cat.where(np.nan_to_num(cat.METAL) > 0.0)
gasfirCat = cat.where((cat.DMASS_TYPE != 0) & (np.nan_to_num(cat.HI_ALL2) > 0.0))
tempCat = cat.where(cat.DMASS_TYPE == 2)

#switchs
N_den = 7 #number of density bins
N = 60
bin_type = 'fixed'
types = ['late', 'inter', 'early']#, 'all']
colours = ['b', 'g', 'r']#, 'k']


mms = {} #dic to hold grads
mes = {} # dic to hold grad errrors
コード例 #29
0
#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12_pacscorrected.fits' #input name
cat = Table(pj(folder,fname))


#caculated extra columns
cat.add_column('D2G', - cat.HI_ALL2 +cat.DMASS)
cat.add_column('G2S', cat.HI_ALL2 - cat.SMASS)
cat.add_column('SFR2G', cat.SRF - cat.HI_ALL2)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)
cat.add_column('colour', cat.g - cat.r)


#select currentCat galaxies
firCat = cat.where(cat.DMASS_TYPE != 0)
gasCat = cat.where(np.nan_to_num(cat.HI_ALL2) > 0.0)
metalCat = cat.where(np.nan_to_num(cat.METAL) > 0.0)
gasfirCat = cat.where((cat.DMASS_TYPE != 0) & (np.nan_to_num(cat.HI_ALL2) > 0.0))
sfCat = cat.where(cat.bptclass == 1.0)
sffirCat = cat.where((cat.DMASS_TYPE != 0) & (cat.bptclass == 1.0))

firsfmetalCat = cat.where((cat.DMASS_TYPE != 0) & (cat.bptclass == 1.0) & (np.nan_to_num(cat.METAL) > 0.0))

#find min dust
min_dust = min(firCat.DMASS)

N = 6 #number of y bins

#columns to plot
plots = [	[['DMASS','SMASS'],['DMASS','METAL'] ],  
コード例 #30
0
ファイル: gas_data.py プロジェクト: 9217392354A/astro-scripts
# Chris Fuller, June 2014

#import mods
from atpy import Table
import numpy as np
from os.path import join as pj
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator

#Inputs
folder = "/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/" # input/output folder
fname = 'coma_supercluster_cal12.fits' #input nametest.fits

cat = Table(pj(folder,fname))

alfaCat = cat.where(np.nan_to_num(cat.GMASS) > 0.0)
litgCat = cat.where((np.nan_to_num(cat.HI_ALL2) > 0.0) & (np.nan_to_num(cat.GMASS) == 0.0))

gas1 = alfaCat.HI_ALL2
gas2 = litgCat.HI_ALL2
gas3 = cat.HI_ALL2



#clean
gas1 = gas1[gas1>0.0]
gas2 = gas2[gas2>0.0]
gas3 = gas3[gas3>0.0]

bins = np.linspace(min(gas3), max(gas3), 10)