本文整理汇总了Python中atpy.Table类的典型用法代码示例。如果您正苦于以下问题:Python Table类的具体用法?Python Table怎么用?Python Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_component
def add_component(self, catalog_format, catalog_name,
object_name, plot_pivot=False, **ecpl_params):
""" Read necessary parameters from FITS file and plot butterfly
Parameters:
catalog_format = 'hess', 'fermi'
catalog_name = FITS file name
object_name = object name string in 'name' column
Note: Since every catalog has columns with different
names and units, a general SED plotting is not possible.
Instead for each catalog type a handler function that
deals converts to a standard format is called.
@todo: Possibly pass plotting parameters along here by
appending them to the ecpl_params dictionary
-> I don't think this works at the moment!!!"""
from atpy import Table
# Get the catalog from file and initialize some things
self.catalog_format = catalog_format
self.catalog_name = catalog_name
self.object_name = object_name
self.catalog = Table(catalog_name).data
# Build a dictionary of parameters needed for the plot
self.ecpl_params = ecpl_params
self.get_ecpl_params()
# Plot curve
self.plot_ecpl(plot_pivot=plot_pivot, **ecpl_params)
# Plot points if present
if self.plot_points is not None:
# Get the values needed for plotting
e = self.plot_points[0]
f = self.plot_points[1]
f_err = self.plot_points[2]
e_err = self.plot_points[3]
is_ul = self.plot_points[4]
for ii in range(e.size):
self.plot_point(e[ii], f[ii],
f_err=f_err[ii],
e_err=[[e_err[0][ii]], [e_err[1][ii]]],
ul=is_ul[ii])
# Remove so that it doesn't get plotted again.
self.plot_points = None
示例2: Table
#program to plot STELLAR MASS
# 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 = ['*', '+']
示例3: Table
#into the folder and let it work its magic. This dose'nt inlcude that bg fit
# Chris Fuller March 2014
import os
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.
示例4: Table
#code the reads in the main table and then sets ngp fluxes to 0 if sep gt 3.5
#Chris Fuller, March 2014
#import modules and functions
print 'importing modules and functions...'
from atpy import Table
from numpy import where, float
from os.path import join as pj
#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
示例5: Table
#program to plot STELLAR MASS
# 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
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]
示例6: get_test_runlist
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
示例7: Table
#program to create mass and parameter fuctions
# 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 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)
示例8: Table
# 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"
示例9: Table
#program to create mass and parameter fuctions
# 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 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)
#volumes
volumes = [114.2, 2872.8]#, 62.4, 3.4] #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)]#, [-1.,3.6E7,0.006], [-0.9,5.7E7,0.7]]
示例10: Table
# 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('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)
示例11: Table
#program that reads in results from Matt's SED fitter and
# then creates a unfied dust mass cloumn
import numpy as np
from os.path import join as pj
from atpy import Table
import matplotlib.pyplot as plt
import pylab as pl
cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/sed-fits/sed-all.fits")
bands = ["F500","F350","F250","F160","F100"]
""" Create detected column """
cat.remove_columns(['DETECTED'])
""" Loop through cat bands and add number to detected col """
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
示例12: Table
# various parameters across the hubble sequence
# using the goldmine morphology
# 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
#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))
示例13: Table
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
#switches
no_morph = 3 #number of morphology bins between 0 and 1
no_density = 4 #number of sigma and radial density bins between logmin and logmax
sfactor = 0.0
colours = ['r', 'g', 'b']
types = ['early', 'inter', 'late']
from lmfit import minimize, Parameters,report_fit
detect_col = 'F250' #'F250'
#Inputs
cat = Table("/Users/chrisfuller/Documents/phd/herchel/coma/final_outputs/coma_supercluster_cal12_pacscorrected.fits")
#cat = cat.where(cat.SMASS > 9.1)
cat.RADIUS_VIR = np.log10(cat.RADIUS_VIR)
###################### functions ######################
def er(a,b):
return np.sqrt(a) / b
def super_histogram(a, bins, sfactor):
#create temp array to hold histogram
hist = []
#loop through bins
for ii in range(0, len(bins)-1):
width = bins[ii+1] - bins[ii]
示例14: Table
# 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 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))
示例15: Table
from os.path import join as pj
#switches
no_morph = 3 #number of morphology bins between 0 and 1
no_density = 5 #number of sigma and radial density bins between logmin and logmax
sfactor = 1.0
colours = ['r', 'g', 'b']
types = ['Early', 'Inter', 'Late']
morph= 'pS0' #columb morphology data is taken from
detect_col = 'F250_ngp_test' #'F250'
#Inputs
#cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/coma_supercluster_cal12.fits")
cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/final_outputs/test.fits")
###################### functions ######################
def er(a,b):
return np.sqrt(a) / b
def super_histogram(a, bins, sfactor):
#create temp array to hold histogram
hist = []
#loop through bins
for ii in range(0, len(bins)-1):
width = bins[ii+1] - bins[ii]
lower = bins[ii] - width*sfactor
upper = bins[ii+1] + width*sfactor