Beispiel #1
0
                'POS_CATID', 'PM_CATID',
                'MAG', 'MAG_ERR', 'MAG_BAND', 'MAG_CATID',
                'COLOR1_ERR', 'C1_CATID',  # Keep color1, 2, 3
                'COLOR2_ERR', 'C2_CATID',
                'RSV2',
                'VAR_CATID']

    names = [name for name in stars.dtype.names if name not in excludes]
    print('Dtype before excluding:\n', stars.dtype)
    stars = Table([stars[name] for name in names], names=names, copy=False)
    stars = stars.as_array()
    print('Dtype after excluding:\n', stars.dtype)

print('Sorting on Dec and re-ordering')
idx = np.argsort(stars['DEC'])
stars = stars.take(idx)

print('Creating miniagasc.h5 file')
rootname = 'proseco_agasc' if args.proseco else 'miniagasc'
filename = '{}_{}.h5'.format(rootname, args.version)

table_desc, bo = tables.descr_from_dtype(stars.dtype)
minih5 = tables.open_file(filename, mode='w')
minitbl = minih5.create_table('/', 'data', table_desc,
                              title='AGASC {}'.format(num_version))
print('Appending stars to {} file'.format(filename))
minitbl.append(stars)
minitbl.flush()

print('Creating indexes in miniagasc.h5 file')
if not args.proseco: