本文整理汇总了Python中astropy.table.QTable.sort方法的典型用法代码示例。如果您正苦于以下问题:Python QTable.sort方法的具体用法?Python QTable.sort怎么用?Python QTable.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astropy.table.QTable
的用法示例。
在下文中一共展示了QTable.sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mk_summary
# 需要导入模块: from astropy.table import QTable [as 别名]
# 或者: from astropy.table.QTable import sort [as 别名]
def mk_summary(dlas, prefix, outfil, specpath=None, htmlfil=None):
""" Loops through the DLA list and generates a Table
Also pushes the 1D spectra into the folder
Parameters
----------
dlas : DLASurvey
prefix : str
outfil : str
Name of the output FITS summary file
htmlfil : str, optional
Returns
-------
"""
#
if htmlfil is None:
htmlfil = 'tmp.html'
# # Constructing
# QSO, RA/DEC
cqso = Column(dlas.qso, name='QSO')
ra = dlas.coord.ra.degree[0]
dec = dlas.coord.dec.degree[0]
jname = []
for abs_sys in dlas._abs_sys:
jname.append(survey_name(prefix, abs_sys))
cjname = Column(jname, name='Name')
cra = Column(ra, name='RA', unit=u.degree)
cdec = Column(dec, name='DEC', unit=u.degree)
czem = Column(dlas.zem, name='Z_QSO')
# Begin the Table
dla_table = QTable( [cjname, cqso, cra, cdec, czem] )
# LLS properties
czabs = Column(dlas.zabs, name='ZABS')
cNHI = Column(dlas.NHI, name='logNHI')
csigNHI = Column(dlas.sig_NHI, name='sig(logNHI)')
# Add to Table
dla_table.add_columns([czabs, cNHI, csigNHI])
# Spectra files
all_sfiles = []
for jj,ills in enumerate(dlas._abs_sys):
sub_spec = mk_1dspec(ills, name=cjname[jj], outpath=specpath)
# Pad
while len(sub_spec) < 5:
sub_spec.append(str('NULL'))
# Append
all_sfiles.append(sub_spec)
cspec = Column(np.array(all_sfiles), name='SPEC_FILES')
dla_table.add_column( cspec )
# Sort
dla_table.sort('RA')
# Write
print('Writing {:s}'.format(outfil))
xxf.table_to_fits(dla_table,outfil)
print('Writing {:s}'.format(htmlfil))
Table(dla_table).write(htmlfil)
return dla_table