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


Python Table.add_column方法代码示例

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


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

示例1: get_test_runlist

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
def get_test_runlist():
    """Get a runlist for the tests"""
    from atpy import Table
    table = Table()
    table.add_column('Run', [18373, 20581])
    table.add_column('Start_Time', ['2004-01-19 19:51:26', '2004-04-27 23:31:59'])
    table.add_column('Duration', [1580.0, 1682.0])
    table.add_column('GLON', [184.557, 359.346])
    table.add_column('GLAT', [-5.784, 0.410])
    return table
开发者ID:ellisowen,项目名称:gammapy,代码行数:12,代码来源:horizon_coord_transformations.py

示例2: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
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 
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)
w_detected = np.where(np.nan_to_num(virgo.DMASS) > 6.6)[0]
d250_virgo = np.array([0]*len(virgo))
d250_virgo[w_detected] = 1
virgo.add_column('D250',d250_virgo)

#add columns fornax 
L250_fornax = fornax.F250 * (4.*np.pi*D_fornax**2) * 10E-26
L250_fornax[np.nan_to_num(L250_fornax) > 0.0] = np.log10(L250_fornax[np.nan_to_num(L250_fornax) > 0.0])
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:paras_functions.py

示例3: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
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)
w_detected = np.where(np.nan_to_num(virgo.DMASS) > 6.6)[0]
d250_virgo = np.array([0]*len(virgo))
d250_virgo[w_detected] = 1
virgo.add_column('D250',d250_virgo)

#add columns fornax 
L250_fornax = fornax.F250 * (4.*np.pi*D_fornax**2) * 10E-26
L250_fornax[np.nan_to_num(L250_fornax) > 0.0] = np.log10(L250_fornax[np.nan_to_num(L250_fornax) > 0.0])
fornax.add_column('L250',L250_fornax)
w_detected = np.where(np.nan_to_num(fornax.F250) > 0.0)[0]
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:mass_functions.py

示例4: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
# numbers of each sample
# Chris Fuller, July - 2014

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

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

示例5: randomFraction

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
              'figure.subplot.hspace': .5,
              'figure.subplot.wspace': .15,
              'figure.subplot.left': 0.05,
              'figure.subplot.right': 0.95,
              'figure.subplot.top': 0.95,
              'figure.subplot.bottom': 0.05,
              'figure.figsize': fig_size}
    pylab.rcParams.update(params)

def randomFraction(arr, f):
    return (np.random.rand(len(arr)) < f)


tablename = sys.argv[1]
t = Table(tablename)
t.add_column('nii_ha', t.nii_6584_flux / t.halpha_flux)

sample_filter = (t.redshift < 0.17) & (t.redshift > 0.04)
sample_filter &= (t.m_r < 17.77)


# Completeness in redshift
bounds = [0.04, 0.17, -23.5, -18.5]

redshift = t.redshift[sample_filter]
Mr = t.r[sample_filter]

set_eps_output_1()
pylab.figure()
pylab.axis(bounds)
pylab.xlabel('Redshift')
开发者ID:streeto,项目名称:dissert,代码行数:33,代码来源:histograms.py

示例6: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
#inputs 
print 'reading in data...'
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))

#bands 
bands = ['500', '350', '250'] #f250_1a

#find where sep is greater than 3.5"
w_sp = where(cat.Separation_mine_npg > 3.5)[0]

#loop through bands
for band in bands:
	print 'starting ' + band

	#extract fluxes
	new_fluxes = cat['f' + band + '_1a']
	w_sn = where((new_fluxes / cat['e' + band + '_1a']) < 3.0)[0]

	#set all fluxes greater than 3.5 to 0
	new_fluxes[w_sp] = 0.0

	#set all fluxes to 0 that are less than s/n 3
	new_fluxes[w_sn] = 0.0

	#add new col to table with fluxes
	cat.add_column('NGPFLUX' + band, new_fluxes, unit='Jy', dtype=float)

cat.write(pj(folder, 'test.fits'), overwrite=True)
print 'program complete'
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:set_ngp_fluxes_to_0_if_gt_sep.py

示例7: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [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
from scipy.stats import pearsonr 
np.seterr(all='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))

#caculated extra columns
cat.add_column('G2S', cat.GMASS - cat.SMASS)
cat.add_column('G2D', cat.GMASS - cat.DMASS)
cat.add_column('SFR2D', cat.SRF - cat.DMASS)
cat.add_column('colour', cat.g - cat.r)

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




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

N = 10 #number of y bins
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:scaling_relations_raw_data_FIR-selection.py

示例8: Table

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

示例9: Table

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

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

示例10: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
#program to create dust-to-stars ratio
# Chris Fuller, April 2014

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



#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))

w1 = np.where(cat.D250==1)[0]

new_col = np.array([0.0]*len(cat))

new_col[w1] = cat.DMASS[w1] - cat.SMASS[w1]

cat.add_column('DUST_STARS', new_col)
cat.write(pj(folder,'test-dust-v2.fits'))
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:25,代码来源:add_dust-to-stars.py

示例11: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
# Chris Fuller, April 2014

#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.add_column('all', cat.g)
cat.all = 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)
undetected = cat.where(cat.DMASS_TYPE == 0)

cats = [detected, undetected]
du  = ['FIR-detected', 'FIR-undetected']
lisy = ['-', '--']
mark = ['*', '+']
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:stellar_mass-detected__vs_undetected.py

示例12:

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
xx1 = np.linspace(1.2,2.5,40)
yy1a = 0.5*xx1 - 1.11

xx2 = np.linspace(2.5,3.0,40)
yy2a = xx2 - 2.36


yy1b = yy1a - 0.130
yy2b = yy2a - 0.130


yy1c = yy1a - 0.202
yy2c = yy2a - 0.202

plt.plot(np.log10(cat.W50_1[w90]), np.log10(cat['Si(HI)'][w90]), 'ok')
plt.plot(np.log10(cat.W50_1[w50]), np.log10(cat['Si(HI)'][w50]), 'og')
plt.plot(np.log10(cat.W50_1[w25]), np.log10(cat['Si(HI)'][w25]), 'ob')
plt.plot(np.log10(cat.W50_1[wn90]), np.log10(cat['Si(HI)'][wn90]), 'or')
plt.plot(xx1,yy1a, '-k', xx2, yy2a, '-k', label='90$\%$ completeness')
plt.plot(xx1,yy1b, '--g', xx2, yy2b, '--g', label='50$\%$ completeness')
plt.plot(xx1,yy1c, '--b', xx2, yy2c, '--b', label='25$\%$ completeness')
#plt.legend()
plt.show()





cat.add_column('hiComp', hiComp)
cat.write(pj(folder,'test-v2.fits'))
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:32,代码来源:add_hi_com_col.py

示例13: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
# Chris Fuller, March 2014

#import
print 'importing modules...'
from atpy import Table
import numpy as np
from os.path import join as pj

#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
t = Table(pj(folder,cat_name))


t.add_column('early', [0]*len(t), dtype=np.int16)
t.add_column('late', [0]*len(t), dtype=np.int16)
t.add_column('inter', [0]*len(t), dtype=np.int16)

t['early'][np.where(t.pE0 >= 0.8)[0]] = 1
t['late'][np.where(t.pS0 >= 0.8)[0]] = 1
t['inter'][np.where((t.pE0 < 0.8) & (t.pS0 < 0.8))[0]] = 1



for i in range(len(t)):
	total = t.early[i] + t.late[i] + t.inter[i]
	if total != 1: print 'error', i, t.early[i], t.late[i], t.inter[i], t.pE0[i], t.pS0[i], t.goldmine[i]


t.write(pj(folder, 'test.fits'), overwrite=True)
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:add_myzoo.py

示例14: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [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
from scipy.stats import pearsonr 
np.seterr(all='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))

#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)


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

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

N = 10 #number of y bins

#columns to plot
plots = [	[['sSFR', 'G2S'], ['colour', 'G2S']]]
开发者ID:9217392354A,项目名称:astro-scripts,代码行数:33,代码来源:scaling_relations_raw_data-p2.py

示例15: Table

# 需要导入模块: from atpy import Table [as 别名]
# 或者: from atpy.Table import add_column [as 别名]
# Program to Name galaxies

#scaling relations plots
#Chris Fuller

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

#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)


cat.add_column('OBJECT_NAME_PAPER', Mgas)

#cat.write(pj(folder,'test-dust-v2.fits'), overwrite=True)

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


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