[AstroPy] Find record(s) with specific key in fits table
brinkmann at mpia.de
Mon Aug 31 09:36:09 EDT 2015
Currently, after a tedious hour of trying different things, I do the
following to extract records with a specific key from a fits table. In
this case the key name is 'OBJECT' and, say, I am looking for '18_Sco':
$ from astropy.io import fits
$ fits_data = fits.getdata("file.fits")
The disadvantage is that only the first record with that 'OBJECT' key is
$ fits_data[list(fits_data['OBJECT']) == '18_Sco']
does not work. The output is a different record with another 'OBJECT'
name. No idea why...
I can use a list comprehension of the python built-in filter() but that
lasts minutes. The file has >10⁵ records.
There must be an elegant way to do this right! Right?
Thank you, cheers,
Max-Planck-Institut für Astronomie tel: +49(0)6221-528-458
Königstuhl 17 fax: +49(0)6221-528-246
69117 Heidelberg email: brinkmann at mpia.de
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1727 bytes
Desc: not available
More information about the AstroPy