[AstroPy] astropy table to numpy array
martin
martinberoiz at gmail.com
Thu May 15 19:20:44 EDT 2014
Hello,
I’m trying to convert an astropy.table.table.Table object (named out) to a numpy array, but it will convert each row to a tuple.
Also the type for the array is strange. I copy a snippet of what I’m trying to do below:
np.array(out)
Out[77]:
array([(1, 9642.374, 41.886, 1.109, 2.45, 0.718),
(2, 1430.236, 57.642, 1.277, 2.33, 0.51),
(3, 638.677, 77.257, 1.254, 5.18, 0.784), ...,
(6762, 1211.064, 937.82, 907.38, 1.81, 0.25),
(6763, 1090.107, 911.179, 906.314, 2.68, 0.353),
(6764, 2348.992, 333.94, 899.355, 3.67, 0.591)],
dtype=[('NUMBER', '<i8'), ('FLUX_APER', '<f8'), ('X_IMAGE', '<f8'), ('Y_IMAGE', '<f8'), ('FWHM_IMAGE', '<f8'), ('ELLIPTICITY', '<f8')])
Does anyone know how to get a 2D numpy array of all floats from an astropy table?
Thanks,
M.
More information about the AstroPy
mailing list