当前位置: 首页>>代码示例>>Python>>正文


Python Table.where方法代码示例

本文整理汇总了Python中atpy.Table.where方法的典型用法代码示例。如果您正苦于以下问题:Python Table.where方法的具体用法?Python Table.where怎么用?Python Table.where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在atpy.Table的用法示例。


在下文中一共展示了Table.where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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 = [], [], [], [], []
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:hubble_sequence-phi.py

示例2: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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']
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:metals-detected__vs_undetected.py

示例3: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:single_ps_coma.py

示例4: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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 = []
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:detection-rates_selection_tester.py

示例5: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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)
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:mass_functions.py

示例6: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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)
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:luminocity_function_250um.py

示例7: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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']
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:ave_parameters_cluster_filament.py

示例8: subplots

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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()



开发者ID:9217392354A,项目名称:astro-scripts,代码行数:29,代码来源:goldmine_Vs_zoo_grid.py

示例9: lmfitter

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:chemical_evolution.py

示例10: range

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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()


开发者ID:9217392354A,项目名称:astro-scripts,代码行数:30,代码来源:gridmaker_coma.py

示例11: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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]
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:functions.py

示例12: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:detection_rates_morphologial_envionment.py

示例13: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]

#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)
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:function_hist.py

示例14: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
#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])
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:morph_coma.py

示例15: range

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import where [as 别名]
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

开发者ID:9217392354A,项目名称:astro-scripts,代码行数:30,代码来源:dust-sed-or-250.py


注:本文中的atpy.Table.where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。