我有一个约50GB的fits文件,其中包含多个HDU,它们都具有相同的格式:一个带有1E5对象和1E6时间戳的(1E5 x 1E6)数组. HDU描述了不同的物理属性,例如磁通,RA,DEC等.我只想从每个HDU中读取5个对象(即(5 x 1E6)阵列).
python 2.7,
糟糕的1.0.3,
linux x86_64
到目前为止,我尝试了很多发现的建议,但是没有任何效果.我最好的方法仍然是:
#the five objects I want to read out
obj_list = ['Star1','Star15','Star700','Star2000','Star5000']
dic = {}
with fits.open(fname, memmap=True, do_not_scale_image_data=True) as hdulist:
# There is a special HDU 'OBJECTS' which is an (1E5 x 1) array and contains the info which index in the fits file corresponds to which object.
# First, get the indices of the rows that describe the objects in the fits file (not necessarily in order!)
ind_objs = np.in1d(hdulist['OBJECTS'].data, obj_list, assume_unique=True).nonzero()[0] #indices of the candidates
# Second, r