I am trying to cut out several selected objects in a astronomical catalog (FITS file) using the python package astropy. My question is how to cut out these objects and save them in a new catalog?
Asked
Active
Viewed 109 times
1 Answers
2
convert them to a astropy.table.Table
object:
from astropy.table import Table
orig_catalogue = Table.read('filename.fits')
and then select your targets (using indexing. i.e. to find all the objects that are more interesting than 100) and write them to a new fits file:
new_catalogue = orig_catalogue[orig_catalogue['interesting'] > 100]
new_catalogue.write('new_filename.fits')

MSeifert
- 145,886
- 38
- 333
- 352
-
Thanks. But my problem is that I don't have a specific field to index. Instead, I want to select objects by a function `selection() ` . Maybe I have to append the catalog to include an extra column showing it is selected or not? – 陈灵健 Mar 15 '16 at 01:58