我正在尝试创建星状表的子集。
被告知我需要使用numpy,但是当我通过numpy访问表时,我似乎并没有得到一个2d的numpy表,并且感到困惑。
我试图创建子集的表来自GAMA调查
我已经尝试过
import numpy as np
from astropy.table import Table
t = Table.read('GAMA_Data/InputCatA.fits')
ta = np.array(t)
我希望执行许多类似的子集
t['PETROMAG_I'] > 17.5)
我收到一些需要使用numpy的建议。我可以通过[]确定'PETROMG_I'是第16列
print(t.colnames.index('PETROMAG_I'))
但是看不到如何处理表或numpy数组的子集
print('Source Table : '+str(len(ta))) print('Shape : '+str(ta.shape)) print(ta)
送礼
Source Table : 960510
Shape : (960510,)
[( 0, 588848900971299297, 145.46972201, 0.65141891, 68987912448, 0, 3.0191224, 20.57372 , 20.748629, 4503874773745664, 0.3678997 , 2.9388053, 1.2919843 , 28.094984, 21.347776, 19.99194 , 19.40016 , 18.74607 , 22.722446, 21.583874, 19.939884, 19.270464, 18.782948, 9843, 756)
( 1, 588848900971299302, 145.47892146, 0.63515137, 68987912448, 0, 3.3755734, 21.073107, 21.055092, 4503874773745664, 0.37012857, 3.619758 , 1.5749472 , 21.076248, 20.432001, 20.08754 , 19.929377, 20.802927, 21.622843, 20.553198, 20.045462, 19.874853, 19.653866, 9843, 756)
我正在尝试创建星状表的子集。有人告诉我我需要使用numpy,但是当我通过numpy访问表时,我似乎没有得到2d numpy表并且感到困惑。我正在尝试的表...
从您的打印输出看,它看起来像是一个元组列表