In this example we have 3 catalogs containing different informations. We want to select data and merge these catalogs in order to plot the size-mass relation for objects with z<0.5. We will see, how to:
Keys: Table, catalog operations (selection, match, join, sort, ...), units, sky coordinates, cosmology, matplotlib (histogram, scatter plot)
import numpy as np
filename = 'data/CheckPositions.dat'
#Open an homogenus table
table = np.loadtxt(filename)
table[0:5]
array([[ 3.30008858e+08, 1.70849750e+01, 7.08309040e+01, 1.34314990e+01, 7.08607000e+01, 1.33912270e+01], [ 2.80007053e+08, 1.62173060e+01, -2.30435670e+01, 6.09456750e+01, -2.30128810e+01, 6.09082740e+01], [ 2.70005300e+08, 1.61864120e+01, -3.30905140e+01, -7.05857920e+01, -3.31175090e+01, -7.05944670e+01], [ 2.70009682e+08, 1.66147790e+01, -4.49628570e+01, 2.19773070e+01, -4.49261170e+01, 2.18768850e+01], [ 2.60012292e+08, 1.72345300e+01, 2.32170960e+01, -7.70041830e+01, 2.31572670e+01, -7.71689770e+01]])
!head -2 $filename
#objID mag exp_x_mm exp_y_mm meas_x_mm meas_y_mm 330008858 17.084975 70.830904 13.431499 70.860700 13.391227
#Select columns and define column types and names
subtable = np.loadtxt(filename, usecols=(0, 1, 2, 4),
dtype={'names': ('ID', 'mag', 'expected', 'measured'),
'formats':('i8', 'f4', 'f4', 'f4')})
subtable[0:5]
array([(330008858, 17.084974, 70.8309 , 70.8607 ), (280007053, 16.217306, -23.043568, -23.01288 ), (270005300, 16.186413, -33.090515, -33.117508), (270009682, 16.614779, -44.962856, -44.926117), (260012292, 17.23453 , 23.217096, 23.157267)], dtype=[('ID', '<i8'), ('mag', '<f4'), ('expected', '<f4'), ('measured', '<f4')])
subtable[0]
(330008858, 17.084974, 70.8309, 70.8607)
A data type object (numpy.dtype
) describes how the bytes, in the fixed-size block of memory, corresponding to an array item, should be interpreted. It describes the following aspects:
astropy.table
provides functionality for storing and manipulating heterogeneous tables of data in a way that is familiar to numpy
users. A few notable capabilities of this package are:
from astropy.table import Table
# https://archive.stsci.edu/missions/hlsp/candels/uds/catalogs/v1/
filename = 'data/hlsp_candels_hst_wfc3_uds_santini_v1_physpar_cat.fits'
physpar = Table.read(filename, format='fits')
physpar
Seq | age_2a_tau | tau_2a_tau | Av_2a_tau | SFR_2a_tau | chi2_2a_tau | age_2d_tau | tau_2d_tau | Av_2d_tau | met_2d_tau | age_4b | EBV_4b | M_l68_6a_tau | M_u68_6a_tau | age_6a_tau | tau_6a_tau | EBV_6a_tau | SFR_6a_tau | met_6a_tau | extlw_6a_tau | chi2_6a_tau | L1400_6a_tau | L2700_6a_tau | UMag_6a_tau | BMag_6a_tau | VMag_6a_tau | RMag_6a_tau | IMag_6a_tau | JMag_6a_tau | KMag_6a_tau | age_10c | SFH_10c | tau_10c | met_10c | M_l99_11a_tau | M_u99_11a_tau | age_11a_tau | SFR_11a_tau | M_l68_12a | M_u68_12a | M_l95_12a | M_u95_12a | age_12a | tau_12a | EBV_12a | met_12a | Lbol_12a | chi2_12a | age_13a_tau | tau_13a_tau | Av_13a_tau | SFR_13a_tau | chi2_13a_tau | age_14a | SFH_14a | tau_14a | EBV_14a | SFR_14a | q_14a | age_6a_tau^NEB | tau_6a_tau^NEB | EBV_6a_tau^NEB | SFR_6a_tau^NEB | met_6a_tau^NEB | extlw_6a_tau^NEB | chi2_6a_tau^NEB | L1400_6a_tau^NEB | L2700_6a_tau^NEB | UMag_6a_tau^NEB | BMag_6a_tau^NEB | VMag_6a_tau^NEB | RMag_6a_tau^NEB | IMag_6a_tau^NEB | JMag_6a_tau^NEB | KMag_6a_tau^NEB | age_6a_deltau | tau_6a_deltau | EBV_6a_deltau | SFR_6a_deltau | met_6a_deltau | extlw_6a_deltau | chi2_6a_deltau | L1400_6a_deltau | L2700_6a_deltau | UMag_6a_deltau | BMag_6a_deltau | VMag_6a_deltau | RMag_6a_deltau | IMag_6a_deltau | JMag_6a_deltau | KMag_6a_deltau | age_6a_invtau | tau_6a_invtau | EBV_6a_invtau | SFR_6a_invtau | met_6a_invtau | extlw_6a_invtau | chi2_6a_invtau | L1400_6a_invtau | L2700_6a_invtau | UMag_6a_invtau | BMag_6a_invtau | VMag_6a_invtau | RMag_6a_invtau | IMag_6a_invtau | JMag_6a_invtau | KMag_6a_invtau | age_10c^dust | SFH_10c^dust | tau_10c^dust | met_10c^dust | age_12a_tau | tau_12a_tau | EBV_12a_tau | met_12a_tau | Lbol_12a_tau | chi2_12a_tau | age_14a_const | EBV_14a_const | SFR_14a_const | q_14a_const | age_14a_lin | EBV_14a_lin | SFR_14a_lin | q_14a_lin | age_14a_deltau | tau_14a_deltau | EBV_14a_deltau | SFR_14a_deltau | q_14a_deltau | age_14a_tau | tau_14a_tau | EBV_14a_tau | SFR_14a_tau | q_14a_tau |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float64 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | int16 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float64 | float32 | int16 | float32 | float64 | float32 | int16 | float32 | float32 | float64 | float32 | int16 | float32 | float32 | float64 | float32 | int16 |
1 | 9.1 | 0.5 | 0.4 | 21.88 | 177.0 | 9.146 | 0.316 | 0.0 | 0.4 | 6.0 | 0.8 | 7.45 | 11.69 | 9.11 | 0.3 | 0.0 | 1.78 | 2.5 | 2 | 126.0 | 1.81e+28 | 3.17e+28 | -20.41 | -21.43 | -21.91 | -22.12 | -22.3 | -22.79 | -22.82 | 8.807 | 1 | 0.1 | 2.0 | 10.11 | 10.35 | 9.121 | 1.06 | 10.35 | 10.73 | 8.92 | 11.2 | 9.157 | 0.4 | 0.0 | 1.0 | 10.91 | 105.0 | 9.1 | 0.398 | 2.2 | 52.48 | 110.0 | 9.071 | 1 | -99.0 | 0.759 | 327.1 | 1 | 9.11 | 0.3 | 0.0 | 1.73 | 2.5 | 2 | 126.0 | 1.82e+28 | 3.19e+28 | -20.44 | -21.42 | -21.9 | -22.11 | -22.27 | -22.76 | -22.79 | 9.11 | 0.2 | 0.0 | 1.9 | 2.5 | 2 | 129.0 | 1.92e+28 | 2.84e+28 | -19.9 | -20.71 | -20.98 | -21.11 | -21.25 | -21.69 | -21.71 | 9.1 | 15.0 | 0.0 | 1.58 | 0.2 | 2 | 131.0 | 2.38e+28 | 2.1e+28 | -19.32 | -19.91 | -20.0 | -20.04 | -20.08 | -20.07 | -19.72 | 9.107 | 1 | 0.3 | 2.0 | 9.207 | 0.3 | 0.0 | 2.5 | 11.04 | 104.0 | 9.071 | 0.759 | 327.1 | 1 | 9.04 | 0.834 | 567.5 | 1 | 9.132 | 0.264 | 0.513 | 39.98 | 1 | 9.131 | 0.419 | 0.469 | 31.78 | 1 |
2 | 10.0 | 7.9 | 0.8 | 0.006 | 9.04 | -99.0 | -99.0 | -99.0 | -99.0 | 6.48 | 0.6 | 6.29 | 7.78 | 9.7 | 1.0 | 0.0 | 0.0 | 0.2 | 2 | 5.32 | 5.11e+24 | 1.14e+25 | -12.2 | -13.19 | -13.77 | -14.02 | -14.24 | -14.47 | -14.2 | 8.157 | 3 | 0.1 | 1.0 | 7.01 | 7.19 | 8.868 | 0.0 | 6.59 | 7.79 | 6.38 | 7.95 | 9.778 | 1.0 | 0.1 | 0.2 | 7.8 | 13.0 | 9.1 | 0.316 | 0.0 | 0.0009 | 10.1 | 8.955 | 4 | 0.151 | 0.058 | 0.0 | 1 | 9.7 | 1.0 | 0.0 | 0.0 | 0.2 | 2 | 5.31 | 5.29e+24 | 1.17e+25 | -12.22 | -13.2 | -13.77 | -14.01 | -14.23 | -14.46 | -14.19 | 9.9 | 1.0 | 0.0 | 0.0 | 0.2 | 2 | 5.34 | 8.73e+24 | 1.39e+25 | -12.24 | -13.21 | -13.76 | -14.0 | -14.23 | -14.46 | -14.19 | 10.0 | 15.0 | 0.2 | 0.01 | 0.2 | 2 | 5.64 | 5.44e+24 | 2.18e+25 | -12.35 | -13.23 | -13.68 | -13.92 | -14.17 | -14.48 | -14.28 | 8.157 | 3 | 0.1 | 1.0 | 9.602 | 1.0 | 0.1 | 0.2 | 7.79 | 13.0 | 9.413 | 0.157 | 0.005 | 1 | 9.544 | 0.19 | 0.007 | 1 | 9.025 | 0.133 | 0.059 | 0.0 | 1 | 8.955 | 0.151 | 0.058 | 0.0 | 1 |
3 | 7.6 | 0.3 | 1.1 | 46.77 | 304.0 | 6.954 | 39.811 | 1.3 | 5.0 | 6.96 | 0.48 | 7.7 | 9.88 | 7.0 | 15.0 | 0.1 | 13.7 | 0.02 | 2 | 261.0 | 2.84e+28 | 3.28e+28 | -19.43 | -19.38 | -19.12 | -18.98 | -18.82 | -18.34 | -17.51 | 9.38 | 1 | 1.0 | 2.0 | 8.77 | 9.29 | 9.21 | 1.22 | 8.39 | 9.55 | 7.66 | 9.76 | 9.398 | 0.1 | 0.0 | 2.5 | 10.28 | 116.0 | 9.4 | 1.259 | 0.0 | 0.8318 | 70.4 | 9.331 | 1 | -99.0 | 0.049 | 1.49 | 1 | 7.35 | 0.3 | 0.06 | 5.58 | 0.02 | 2 | 265.0 | 2.92e+28 | 2.97e+28 | -19.61 | -19.68 | -19.79 | -19.63 | -19.0 | -18.74 | -18.22 | 7.4 | 1.9 | 0.1 | 18.31 | 0.02 | 2 | 261.0 | 2.84e+28 | 3.27e+28 | -19.43 | -19.4 | -19.15 | -19.01 | -18.85 | -18.39 | -17.57 | 7.0 | 0.3 | 0.1 | 14.31 | 0.02 | 2 | 261.0 | 2.84e+28 | 3.27e+28 | -19.42 | -19.38 | -19.12 | -18.98 | -18.82 | -18.35 | -17.52 | 9.342 | 1 | 1.0 | 2.0 | 9.057 | 1.0 | 0.0 | 2.5 | 10.26 | 116.0 | 9.331 | 0.049 | 1.49 | 1 | 8.984 | 0.104 | 2.65 | 1 | 8.404 | 1.083 | 0.145 | 4.325 | 1 | 8.78 | 1.945 | 0.08 | 2.087 | 1 |
4 | 9.1 | 0.3 | 1.0 | 13.8 | 71.9 | 8.903 | 0.2 | 1.3 | 0.2 | 9.3 | 0.4 | 10.6 | 11.23 | 9.23 | 0.3 | 0.06 | 1.37 | 0.2 | 1 | 37.4 | 1.54e+28 | 6.26e+28 | -21.5 | -22.56 | -23.06 | -23.29 | -23.51 | -23.76 | -23.57 | 8.807 | 1 | 0.1 | 2.0 | 10.74 | 11.12 | 9.032 | 14.4 | 10.62 | 11.19 | 10.42 | 11.31 | 9.157 | 0.4 | 0.125 | 1.0 | 11.53 | 21.5 | 9.2 | 0.316 | 0.6 | 4.786 | 24.2 | 9.032 | 4 | 0.262 | 0.251 | 12.49 | 1 | 9.23 | 0.3 | 0.06 | 1.36 | 0.2 | 1 | 37.4 | 1.59e+28 | 6.32e+28 | -21.52 | -22.56 | -23.06 | -23.29 | -23.5 | -23.75 | -23.56 | 9.0 | 0.1 | 0.1 | 2.15 | 1.0 | 1 | 36.8 | 1.38e+28 | 6.12e+28 | -21.43 | -22.63 | -23.06 | -23.26 | -23.44 | -23.76 | -23.7 | 8.9 | 9.0 | 0.55 | 232.4 | 0.2 | 1 | 41.6 | 1.49e+28 | 6.87e+28 | -21.34 | -22.39 | -23.01 | -23.4 | -23.82 | -24.48 | -24.64 | 8.807 | 1 | 0.1 | 2.0 | 9.157 | 0.3 | 0.15 | 1.0 | 11.56 | 21.1 | 9.247 | 0.502 | 143.4 | 1 | 9.294 | 0.543 | 207.8 | 1 | 9.038 | 0.256 | 0.346 | 48.94 | 2 | 9.032 | 0.262 | 0.251 | 12.49 | 1 |
5 | 7.6 | 12.6 | 0.0 | 1288.0 | 964000.0 | 6.845 | 0.01 | 1.1 | 2.5 | 6.6 | 0.8 | 8.69 | 12.6 | 8.8 | 0.1 | 0.2 | 30.81 | 1.0 | 1 | 1280.0 | 9.76e+28 | 7.24e+29 | -24.21 | -25.52 | -25.98 | -26.21 | -26.45 | -26.87 | -26.88 | 8.807 | 1 | 0.1 | 2.0 | -99.0 | -99.0 | -99.0 | -99.0 | 11.67 | 11.78 | 8.72 | 11.93 | 9.157 | 0.4 | 0.0 | 1.0 | 12.23 | 271.0 | 9.1 | 0.316 | 0.0 | 30.2 | 52000.0 | 9.043 | 1 | -99.0 | 0.034 | 34.34 | 1 | 8.8 | 0.1 | 0.2 | 30.51 | 1.0 | 1 | 1280.0 | 9.89e+28 | 7.24e+29 | -24.21 | -25.51 | -25.98 | -26.21 | -26.44 | -26.86 | -26.87 | 9.0 | 0.1 | 0.15 | 36.55 | 1.0 | 1 | 1270.0 | 1.44e+29 | 7.4e+29 | -24.21 | -25.46 | -25.94 | -26.17 | -26.39 | -26.77 | -26.76 | 9.05 | 15.0 | 0.5 | 1541.0 | 0.2 | 1 | 1300.0 | 1.63e+29 | 6.6e+29 | -23.77 | -24.81 | -25.41 | -25.78 | -26.17 | -26.79 | -26.91 | 8.807 | 1 | 0.1 | 2.0 | 9.207 | 0.3 | 0.0 | 2.5 | 12.37 | 270.0 | 9.043 | 0.034 | 34.34 | 1 | 8.893 | 0.029 | 34.9 | 1 | 9.019 | 0.273 | 0.067 | 96.74 | 1 | 9.068 | 0.234 | 0.1 | 34.29 | 2 |
6 | 9.1 | 0.3 | 0.0 | 0.002 | 41.2 | 9.845 | 0.032 | 0.0 | 0.02 | 9.48 | 0.0 | 7.54 | 7.73 | 9.7 | 2.0 | 0.0 | 0.0 | 0.2 | 2 | 12.9 | 4.8e+25 | 5.54e+25 | -13.36 | -14.21 | -14.62 | -14.82 | -15.0 | -15.18 | -14.9 | 8.507 | 3 | 0.1 | 0.5 | 7.18 | 7.54 | 9.07 | 0.0 | 7.1 | 7.32 | 6.92 | 7.55 | 9.057 | 0.0 | 0.025 | 0.2 | 7.71 | 1.37 | 9.1 | 0.316 | 0.0 | 0.0021 | 1.91 | 8.912 | 4 | 0.115 | 0.016 | 0.0 | 1 | 9.7 | 2.0 | 0.0 | 0.0 | 0.2 | 2 | 11.6 | 4.84e+25 | 5.69e+25 | -13.43 | -14.22 | -14.64 | -14.82 | -14.97 | -15.15 | -14.87 | 9.8 | 1.0 | 0.0 | 0.0 | 0.2 | 2 | 13.0 | 4.37e+25 | 5.23e+25 | -13.33 | -14.2 | -14.62 | -14.82 | -15.01 | -15.19 | -14.91 | 10.0 | 15.0 | 0.1 | 0.01 | 0.2 | 2 | 19.7 | 3.57e+25 | 6.93e+25 | -13.45 | -14.24 | -14.59 | -14.77 | -14.97 | -15.18 | -14.93 | 8.407 | 3 | 0.1 | 1.0 | 9.057 | 0.0 | 0.025 | 0.2 | 7.71 | 1.31 | 10.005 | 0.046 | 0.006 | 1 | 10.024 | 0.101 | 0.009 | 1 | 8.978 | 0.108 | 0.016 | 0.0 | 1 | 8.912 | 0.115 | 0.016 | 0.0 | 1 |
7 | 8.3 | 0.3 | 0.6 | 0.417 | 14.4 | 7.903 | 0.008 | 0.1 | 2.5 | 7.3 | 0.12 | 7.31 | 8.33 | 9.06 | 15.0 | 0.03 | 0.18 | 2.5 | 2 | 11.1 | 1.16e+27 | 1.81e+27 | -16.63 | -17.14 | -17.22 | -17.28 | -17.41 | -17.86 | -17.84 | 8.057 | 3 | 0.1 | 2.0 | 7.64 | 7.97 | 8.456 | 0.29 | 7.32 | 8.16 | 7.12 | 8.42 | 8.307 | 0.3 | 0.15 | 1.0 | 9.65 | 9.82 | 7.7 | 10.0 | 1.0 | 1.122 | 10.6 | 8.408 | 1 | -99.0 | 0.115 | 0.304 | 1 | 9.06 | 15.0 | 0.03 | 0.17 | 2.5 | 2 | 10.6 | 1.11e+27 | 1.77e+27 | -16.73 | -17.15 | -17.27 | -17.31 | -17.35 | -17.79 | -17.77 | 9.06 | 1.5 | 0.1 | 0.31 | 2.5 | 2 | 10.1 | 7.64e+26 | 1.92e+27 | -16.71 | -17.14 | -17.17 | -17.2 | -17.35 | -17.86 | -17.84 | 8.3 | 15.0 | 0.15 | 0.43 | 1.0 | 2 | 11.5 | 6.57e+26 | 1.96e+27 | -16.75 | -17.15 | -17.21 | -17.26 | -17.37 | -17.61 | -17.39 | 8.006 | 3 | 0.1 | 2.0 | 7.398 | 0.0 | 0.125 | 2.5 | 9.49 | 9.56 | 8.408 | 0.115 | 0.304 | 1 | 8.657 | 0.12 | 0.338 | 1 | 8.507 | 0.717 | 0.125 | 0.384 | 1 | 8.327 | 0.724 | 0.113 | 0.313 | 1 |
8 | 8.5 | 0.5 | 1.1 | 3.802 | 2.09 | 8.699 | 0.079 | 0.2 | 0.2 | 8.31 | 0.0 | 8.57 | 9.29 | 9.06 | 15.0 | 0.15 | 1.83 | 2.5 | 2 | 1.39 | 2.36e+27 | 8.8e+27 | -18.54 | -19.15 | -19.35 | -19.47 | -19.67 | -20.24 | -20.29 | 9.007 | 3 | 1.0 | 2.0 | 8.61 | 9.16 | 8.24 | 5.5 | 8.21 | 9.41 | 7.83 | 9.73 | 8.004 | 0.3 | 0.125 | 2.5 | 10.19 | 1.65 | 8.4 | 0.316 | 1.2 | 4.365 | 1.99 | 8.475 | 4 | 0.501 | 0.269 | 3.774 | 1 | 9.06 | 15.0 | 0.15 | 1.72 | 2.5 | 2 | 1.47 | 2.31e+27 | 8.72e+27 | -18.66 | -19.18 | -19.41 | -19.51 | -19.64 | -20.19 | -20.24 | 9.11 | 0.4 | 0.15 | 1.77 | 2.5 | 2 | 1.38 | 2.32e+27 | 8.77e+27 | -18.55 | -19.18 | -19.37 | -19.49 | -19.69 | -20.24 | -20.28 | 9.4 | 3.0 | 0.15 | 1.71 | 1.0 | 2 | 1.52 | 2.66e+27 | 8.57e+27 | -18.53 | -19.21 | -19.46 | -19.61 | -19.79 | -20.11 | -19.98 | 8.057 | 3 | 0.1 | 2.0 | 7.699 | 0.0 | 0.175 | 2.5 | 10.32 | 1.64 | 8.603 | 0.286 | 3.83 | 1 | 8.811 | 0.298 | 4.456 | 1 | 8.623 | 0.619 | 0.294 | 5.134 | 1 | 8.475 | 0.501 | 0.269 | 3.774 | 1 |
9 | 9.5 | 5.0 | 0.0 | 0.513 | 3.69 | 9.301 | 1.259 | 0.0 | 0.4 | 9.48 | 0.0 | 8.25 | 9.31 | 9.51 | 9.0 | 0.0 | 0.5 | 2.5 | 2 | 13.7 | 4.65e+27 | 5.96e+27 | -17.96 | -18.54 | -18.75 | -18.88 | -19.06 | -19.57 | -19.55 | 8.006 | 2 | -99.0 | 0.2 | 7.25 | 8.09 | 7.87 | 0.56 | 7.6 | 9.04 | 6.92 | 9.3 | 9.398 | 0.0 | 0.0 | 0.4 | 9.82 | 20.5 | 9.5 | 2.512 | 0.0 | 0.3467 | 14.9 | 9.468 | 1 | -99.0 | 0.022 | 0.46 | 1 | 9.51 | 9.0 | 0.0 | 0.48 | 2.5 | 2 | 14.0 | 4.65e+27 | 6.03e+27 | -18.08 | -18.58 | -18.81 | -18.92 | -19.03 | -19.54 | -19.52 | 9.51 | 0.9 | 0.0 | 0.49 | 2.5 | 2 | 13.9 | 4.63e+27 | 6e+27 | -17.98 | -18.59 | -18.79 | -18.92 | -19.08 | -19.58 | -19.56 | 9.5 | 15.0 | 0.0 | 0.41 | 0.2 | 2 | 13.9 | 6.23e+27 | 5.72e+27 | -18.0 | -18.65 | -18.83 | -18.92 | -19.01 | -19.07 | -18.76 | 8.006 | 2 | -99.0 | 0.2 | 8.906 | 1.0 | 0.0 | 0.2 | 9.79 | 20.9 | 9.468 | 0.022 | 0.46 | 1 | 9.467 | 0.031 | 0.508 | 1 | 9.017 | 0.44 | 0.025 | 0.48 | 1 | 9.035 | 1.257 | 0.023 | 0.467 | 1 |
10 | 8.6 | 0.5 | 0.6 | 5.129 | 2.45 | 8.146 | 0.001 | 0.1 | 0.2 | 8.01 | 0.06 | 9.31 | 9.34 | 8.75 | 0.3 | 0.06 | 1.94 | 0.2 | 2 | 1.36 | 1.62e+28 | 2.4e+28 | -19.65 | -20.37 | -20.52 | -20.58 | -20.66 | -20.68 | -20.37 | 8.207 | 3 | 0.1 | 0.5 | 9.03 | 9.38 | 8.388 | 9.42 | 9.0 | 9.51 | 8.61 | 9.75 | 8.004 | 0.0 | 0.125 | 0.2 | 10.69 | 0.413 | 8.6 | 0.316 | 0.6 | 4.677 | 1.05 | 8.374 | 4 | 0.334 | 0.18 | 7.329 | 1 | 8.75 | 0.3 | 0.06 | 1.86 | 0.2 | 2 | 1.39 | 1.61e+28 | 2.45e+28 | -19.77 | -20.42 | -20.6 | -20.62 | -20.64 | -20.66 | -20.35 | 9.3 | 2.0 | 0.1 | 3.87 | 0.2 | 2 | 1.51 | 1.51e+28 | 2.66e+28 | -19.68 | -20.31 | -20.46 | -20.54 | -20.63 | -20.7 | -20.39 | 9.4 | 1.0 | 0.1 | 3.95 | 0.2 | 2 | 1.46 | 1.52e+28 | 2.64e+28 | -19.67 | -20.29 | -20.44 | -20.52 | -20.62 | -20.7 | -20.4 | 8.207 | 3 | 0.1 | 0.5 | 8.004 | 0.0 | 0.075 | 0.2 | 10.53 | 0.4 | 8.438 | 0.204 | 8.249 | 1 | 8.679 | 0.211 | 9.272 | 1 | 8.568 | 0.471 | 0.201 | 9.558 | 1 | 8.374 | 0.334 | 0.18 | 7.329 | 1 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 8.9 | 0.3 | 0.0 | 0.041 | 4.77 | 8.602 | 0.01 | 0.0 | 0.005 | 8.01 | 0.06 | 7.14 | 7.99 | 7.0 | 2.0 | 0.4 | 1.77 | 0.2 | 2 | 3.77 | 6.41e+25 | 7.69e+26 | -15.98 | -16.46 | -16.63 | -16.7 | -16.77 | -16.73 | -16.15 | 8.207 | 3 | 0.1 | 1.0 | 7.72 | 7.94 | 8.64 | 0.05 | 7.58 | 7.95 | 7.29 | 8.31 | 8.307 | 0.2 | 0.0 | 1.0 | 8.75 | 3.68 | 8.9 | 0.316 | 0.0 | 0.0389 | 3.81 | 8.592 | 4 | 0.125 | 0.035 | 0.034 | 1 | 9.0 | 2.0 | 0.1 | 0.08 | 0.02 | 2 | 3.89 | 4.29e+26 | 7.54e+26 | -15.92 | -16.5 | -16.64 | -16.68 | -16.63 | -16.44 | -15.95 | 7.05 | 2.0 | 0.5 | 7.8 | 0.2 | 2 | 3.77 | 3.25e+25 | 7.27e+26 | -16.01 | -16.47 | -16.66 | -16.74 | -16.82 | -16.71 | -16.04 | 7.0 | 2.0 | 0.45 | 2.26 | 0.2 | 2 | 3.72 | 4.11e+25 | 7.05e+26 | -15.96 | -16.48 | -16.69 | -16.79 | -16.88 | -16.86 | -16.28 | 8.207 | 3 | 0.1 | 1.0 | 8.307 | 0.0 | 0.0 | 0.4 | 8.75 | 3.69 | 8.572 | 0.166 | 0.173 | 1 | 8.567 | 0.203 | 0.254 | 1 | 8.646 | 0.109 | 0.076 | 0.06 | 1 | 8.592 | 0.125 | 0.035 | 0.034 | 1 |
35924 | 8.8 | 0.3 | 0.0 | 1.622 | 2.92 | 8.146 | 0.032 | 0.0 | 0.4 | 8.46 | 0.0 | 8.81 | 9.6 | 9.15 | 9.0 | 0.03 | 2.18 | 0.2 | 2 | 2.03 | 2.23e+28 | 2.49e+28 | -19.59 | -20.24 | -20.38 | -20.45 | -20.53 | -20.57 | -20.26 | 8.457 | 1 | 0.1 | 0.5 | 8.61 | 9.28 | 8.292 | 5.12 | 8.32 | 9.73 | 7.59 | 9.93 | 8.957 | 0.4 | 0.025 | 0.4 | 10.52 | 3.25 | 8.9 | 0.501 | 0.1 | 1.995 | 2.36 | 8.451 | 1 | -99.0 | 0.085 | 3.855 | 1 | 8.5 | 0.1 | 0.0 | 0.83 | 0.2 | 2 | 2.08 | 2.36e+28 | 2.48e+28 | -19.7 | -20.35 | -20.46 | -20.46 | -20.47 | -20.42 | -20.08 | 9.06 | 0.3 | 0.03 | 2.06 | 0.2 | 2 | 2.03 | 2.25e+28 | 2.55e+28 | -19.61 | -20.26 | -20.37 | -20.42 | -20.47 | -20.47 | -20.14 | 9.15 | 15.0 | 0.03 | 2.21 | 0.2 | 2 | 2.04 | 2.24e+28 | 2.47e+28 | -19.56 | -20.19 | -20.32 | -20.38 | -20.45 | -20.49 | -20.17 | 8.457 | 1 | 0.1 | 0.5 | 8.757 | 0.3 | 0.0 | 1.0 | 10.44 | 3.24 | 8.451 | 0.085 | 3.855 | 1 | 8.429 | 0.108 | 5.247 | 1 | 8.454 | 0.473 | 0.094 | 5.245 | 1 | 8.466 | 0.581 | 0.069 | 3.647 | 1 |
35925 | 8.7 | 0.3 | 0.5 | 0.025 | 1.31 | 7.845 | 0.003 | 0.1 | 2.5 | 7.3 | 0.32 | 6.59 | 7.46 | 7.0 | 15.0 | 0.5 | 0.54 | 1.0 | 2 | 1.29 | 4.56e+24 | 1.55e+26 | -14.38 | -14.8 | -15.01 | -15.12 | -15.3 | -15.62 | -15.43 | 8.357 | 3 | 0.1 | 2.0 | 7.04 | 7.47 | 8.294 | 0.08 | 6.53 | 7.79 | 6.05 | 8.06 | 8.004 | 0.3 | 0.125 | 2.5 | 8.39 | 1.45 | 8.7 | 0.398 | 0.6 | 0.0309 | 1.25 | 8.329 | 2 | -99.0 | 0.27 | 0.099 | 1 | 7.4 | 15.0 | 0.35 | 0.15 | 1.0 | 2 | 1.04 | 1.23e+25 | 1.51e+26 | -14.49 | -14.73 | -15.07 | -15.18 | -15.03 | -15.43 | -15.32 | 9.1 | 1.5 | 0.2 | 0.05 | 1.0 | 2 | 1.34 | 3.81e+25 | 1.69e+26 | -14.25 | -14.84 | -15.02 | -15.13 | -15.29 | -15.59 | -15.44 | 7.0 | 3.0 | 0.5 | 0.56 | 1.0 | 2 | 1.27 | 4.64e+24 | 1.58e+26 | -14.39 | -14.81 | -15.02 | -15.12 | -15.29 | -15.57 | -15.35 | 8.357 | 3 | 0.1 | 2.0 | 8.004 | 0.0 | 0.075 | 2.5 | 8.26 | 1.47 | 8.345 | 0.236 | 0.067 | 1 | 8.329 | 0.27 | 0.099 | 1 | 8.334 | 0.81 | 0.261 | 0.097 | 1 | 8.343 | 0.731 | 0.222 | 0.063 | 1 |
35926 | 8.3 | 0.5 | 0.9 | 1.202 | 0.54 | 8.0 | 1.259 | 1.1 | 0.2 | 8.31 | 0.22 | 7.38 | 9.05 | 8.1 | 2.0 | 0.25 | 1.66 | 1.0 | 1 | 0.415 | 1.49e+27 | 3.17e+27 | -17.34 | -17.79 | -17.95 | -18.09 | -18.29 | -18.7 | -18.64 | 8.107 | 3 | 0.1 | 2.0 | 7.98 | 8.5 | 8.132 | 1.36 | 7.49 | 9.04 | 6.58 | 9.26 | 7.699 | 0.1 | 0.25 | 0.4 | 10.22 | 0.598 | 8.4 | 0.316 | 0.8 | 0.912 | 0.612 | 8.354 | 2 | -99.0 | 0.249 | 1.668 | 1 | 8.0 | 15.0 | 0.25 | 1.59 | 1.0 | 1 | 0.404 | 1.45e+27 | 3.14e+27 | -17.56 | -17.87 | -18.13 | -18.25 | -18.22 | -18.63 | -18.57 | 8.6 | 1.0 | 0.25 | 1.75 | 1.0 | 1 | 0.413 | 1.48e+27 | 3.14e+27 | -17.34 | -17.81 | -17.98 | -18.11 | -18.31 | -18.72 | -18.67 | 8.2 | 0.6 | 0.25 | 1.69 | 1.0 | 1 | 0.413 | 1.48e+27 | 3.16e+27 | -17.34 | -17.8 | -17.97 | -18.1 | -18.3 | -18.72 | -18.66 | 8.006 | 3 | 1.0 | 1.0 | 7.398 | 0.0 | 0.225 | 0.4 | 10.08 | 0.592 | 8.338 | 0.216 | 1.135 | 1 | 8.354 | 0.249 | 1.668 | 1 | 8.342 | 0.758 | 0.242 | 1.649 | 1 | 8.328 | 0.753 | 0.204 | 1.074 | 1 |
35927 | 9.2 | 0.5 | 0.0 | 0.048 | 0.631 | 9.544 | 1.995 | 0.1 | 0.2 | 9.3 | 0.06 | 7.2 | 8.87 | 9.0 | 0.3 | 0.1 | 0.05 | 0.02 | 1 | 0.576 | 5.38e+26 | 8.99e+26 | -16.37 | -17.19 | -17.43 | -17.57 | -17.65 | -17.54 | -17.08 | 8.157 | 3 | 0.1 | 0.2 | 7.71 | 8.43 | 8.576 | 0.37 | 7.11 | 8.9 | 6.08 | 9.07 | 8.857 | 0.1 | 0.0 | 0.2 | 9.07 | 0.778 | 9.0 | 0.316 | 0.1 | 0.0525 | 0.95 | 8.428 | 4 | 0.907 | 0.266 | 0.494 | 2 | 9.06 | 0.3 | 0.0 | 0.03 | 0.2 | 2 | 0.583 | 5.36e+26 | 8.15e+26 | -16.34 | -17.19 | -17.47 | -17.56 | -17.64 | -17.68 | -17.37 | 9.16 | 0.2 | 0.0 | 0.03 | 0.2 | 2 | 0.58 | 6.16e+26 | 8.33e+26 | -16.27 | -17.13 | -17.39 | -17.5 | -17.61 | -17.66 | -17.38 | 9.5 | 15.0 | 0.15 | 0.17 | 0.2 | 1 | 0.662 | 5.88e+26 | 8.55e+26 | -16.14 | -16.94 | -17.28 | -17.47 | -17.67 | -17.92 | -17.75 | 8.157 | 3 | 0.1 | 0.2 | 9.057 | 0.3 | 0.0 | 0.2 | 9.11 | 0.78 | 8.388 | 0.29 | 0.542 | 1 | 8.383 | 0.313 | 0.749 | 1 | 8.42 | 0.749 | 0.307 | 0.744 | 1 | 8.428 | 0.907 | 0.266 | 0.494 | 2 |
35928 | 9.4 | 1.3 | 0.5 | 0.2 | 0.675 | 9.255 | 25.119 | 2.9 | 2.5 | 6.0 | 0.3 | 7.43 | 8.85 | 9.0 | 0.3 | 0.0 | 0.04 | 1.0 | 2 | 0.891 | 5.64e+26 | 8.47e+26 | -16.22 | -17.14 | -17.41 | -17.53 | -17.64 | -17.82 | -17.65 | 8.006 | 3 | 0.3 | 2.0 | 7.37 | 8.28 | 8.3 | 0.24 | 7.07 | 9.43 | 6.12 | 9.87 | 9.477 | 1.0 | 0.025 | 1.0 | 9.39 | 1.24 | 9.0 | 0.316 | 0.0 | 0.0437 | 1.47 | 8.358 | 1 | -99.0 | 0.212 | 0.298 | 1 | 7.0 | 15.0 | 0.3 | 1.36 | 0.2 | 1 | 0.747 | 5.37e+26 | 1.01e+27 | -16.54 | -16.89 | -17.32 | -17.29 | -16.91 | -16.94 | -16.65 | 9.4 | 0.4 | 0.0 | 0.04 | 0.2 | 2 | 0.893 | 7.01e+26 | 8.46e+26 | -16.25 | -17.08 | -17.4 | -17.54 | -17.67 | -17.79 | -17.51 | 9.4 | 15.0 | 0.15 | 0.19 | 0.2 | 1 | 0.948 | 6.55e+26 | 9.44e+26 | -16.23 | -17.01 | -17.32 | -17.5 | -17.69 | -17.92 | -17.75 | 9.439 | 3 | 0.1 | 2.0 | 9.544 | 1.0 | 0.0 | 2.5 | 9.39 | 1.2 | 8.358 | 0.212 | 0.298 | 1 | 8.334 | 0.232 | 0.41 | 1 | 8.363 | 0.727 | 0.234 | 0.434 | 1 | 8.354 | 0.807 | 0.193 | 0.276 | 1 |
35929 | 8.7 | 2.0 | 0.0 | 0.209 | 1.18 | 7.079 | 0.002 | 0.2 | 1.0 | 8.46 | 0.0 | 7.23 | 8.12 | 8.6 | 1.0 | 0.0 | 0.21 | 1.0 | 2 | 0.982 | 2.46e+27 | 2.61e+27 | -16.92 | -17.34 | -17.32 | -17.32 | -17.34 | -17.43 | -17.16 | 8.357 | 1 | 0.3 | 1.0 | 7.28 | 7.83 | 8.136 | 0.28 | 7.01 | 8.32 | 6.62 | 8.68 | 8.757 | 0.8 | 0.025 | 0.2 | 9.53 | 1.26 | 8.7 | 1.585 | 0.0 | 0.2042 | 1.28 | 8.257 | 1 | -99.0 | 0.035 | 0.28 | 1 | 8.4 | 15.0 | 0.0 | 0.21 | 1.0 | 2 | 0.895 | 2.47e+27 | 2.59e+27 | -17.05 | -17.24 | -17.27 | -17.21 | -17.07 | -17.15 | -16.86 | 8.95 | 0.5 | 0.0 | 0.22 | 1.0 | 2 | 0.986 | 2.47e+27 | 2.6e+27 | -16.9 | -17.31 | -17.3 | -17.3 | -17.33 | -17.43 | -17.16 | 8.7 | 15.0 | 0.0 | 0.22 | 1.0 | 2 | 0.983 | 2.46e+27 | 2.6e+27 | -16.91 | -17.33 | -17.31 | -17.31 | -17.33 | -17.43 | -17.16 | 8.357 | 1 | 0.3 | 1.0 | 8.456 | 0.6 | 0.025 | 0.2 | 9.53 | 1.25 | 8.257 | 0.035 | 0.28 | 1 | 8.314 | 0.043 | 0.338 | 1 | 8.298 | 0.838 | 0.043 | 0.347 | 1 | 8.228 | 1.0 | 0.035 | 0.284 | 1 |
35930 | 8.3 | 12.6 | 0.4 | 3.981 | 0.963 | 7.544 | 0.005 | 0.3 | 1.0 | 6.96 | 0.1 | 7.94 | 8.89 | 7.6 | 0.3 | 0.15 | 7.17 | 1.0 | 1 | 1.24 | 1.49e+28 | 2.24e+28 | -19.25 | -19.47 | -19.47 | -19.51 | -19.65 | -19.95 | -19.83 | 8.357 | 1 | 0.1 | 2.0 | 8.24 | 8.71 | 7.734 | 5.15 | 7.86 | 9.44 | 7.42 | 9.69 | 8.606 | 1.0 | 0.075 | 1.0 | 10.55 | 0.857 | 7.7 | 10.0 | 0.6 | 7.08 | 1.29 | 8.3 | 1 | -99.0 | 0.066 | 2.623 | 1 | 8.0 | 0.1 | 0.03 | 1.85 | 1.0 | 2 | 1.65 | 1.63e+28 | 2.08e+28 | -19.31 | -19.47 | -19.52 | -19.48 | -19.35 | -19.46 | -19.17 | 8.0 | 0.1 | 0.15 | 7.8 | 1.0 | 1 | 1.25 | 1.49e+28 | 2.23e+28 | -19.25 | -19.48 | -19.48 | -19.52 | -19.64 | -19.91 | -19.77 | 7.4 | 0.1 | 0.15 | 8.45 | 2.5 | 1 | 1.18 | 1.31e+28 | 2.32e+28 | -19.26 | -19.36 | -19.24 | -19.18 | -19.38 | -20.14 | -20.23 | 8.107 | 3 | 0.3 | 2.0 | 8.307 | 0.2 | 0.05 | 2.5 | 10.46 | 0.853 | 8.3 | 0.066 | 2.623 | 1 | 8.372 | 0.083 | 3.337 | 1 | 8.359 | 0.6 | 0.078 | 3.405 | 1 | 8.265 | 0.706 | 0.063 | 2.65 | 1 |
35931 | 7.8 | 0.3 | 0.1 | 2.57 | 1.96 | 8.079 | 0.063 | 0.4 | 0.02 | 7.48 | 0.1 | 7.61 | 8.82 | 7.8 | 0.1 | 0.03 | 2.38 | 0.2 | 2 | 1.76 | 2.23e+28 | 2.06e+28 | -19.05 | -19.33 | -19.25 | -19.22 | -19.2 | -19.18 | -18.7 | 8.006 | 3 | 0.1 | 0.2 | 8.02 | 8.59 | 7.791 | 2.5 | 7.55 | 9.02 | 7.53 | 9.46 | 7.699 | 0.2 | 0.0 | 1.0 | 10.28 | 1.9 | 7.8 | 0.316 | 0.2 | 3.09 | 1.32 | 8.187 | 1 | -99.0 | 0.022 | 2.095 | 1 | 7.9 | 0.1 | 0.03 | 2.02 | 0.02 | 2 | 2.06 | 2.41e+28 | 2.1e+28 | -19.19 | -19.38 | -19.38 | -19.25 | -18.88 | -18.55 | -17.95 | 7.05 | 2.0 | 0.15 | 31.47 | 0.2 | 1 | 1.79 | 2.17e+28 | 2.07e+28 | -19.06 | -19.22 | -19.1 | -19.01 | -18.89 | -18.47 | -17.7 | 8.0 | 15.0 | 0.03 | 2.58 | 0.2 | 2 | 1.78 | 2.24e+28 | 2.08e+28 | -19.08 | -19.38 | -19.31 | -19.27 | -19.24 | -19.2 | -18.7 | 8.006 | 3 | 0.1 | 0.2 | 7.398 | 0.0 | 0.0 | 0.4 | 10.25 | 1.76 | 8.187 | 0.022 | 2.095 | 1 | 8.281 | 0.026 | 2.376 | 1 | 8.255 | 0.838 | 0.026 | 2.421 | 1 | 8.163 | 1.027 | 0.022 | 2.094 | 1 |
35932 | 9.0 | 0.8 | 0.0 | 4.677 | 1.45 | 8.079 | 0.004 | 0.0 | 0.2 | 8.46 | 0.0 | 9.31 | 9.86 | 8.75 | 0.3 | 0.0 | 3.52 | 0.2 | 2 | 0.808 | 6.47e+28 | 6.22e+28 | -20.59 | -21.26 | -21.35 | -21.38 | -21.42 | -21.38 | -21.04 | 8.957 | -99 | 1.0 | 0.5 | 8.83 | 9.53 | 8.232 | 13.01 | 8.67 | 9.9 | 7.97 | 10.15 | 9.006 | 0.4 | 0.0 | 0.2 | 10.87 | 1.1 | 8.9 | 0.501 | 0.0 | 4.571 | 1.15 | 8.487 | 4 | 0.499 | 0.052 | 8.454 | 1 | 8.75 | 0.3 | 0.0 | 3.4 | 0.2 | 2 | 0.837 | 6.49e+28 | 6.41e+28 | -20.72 | -21.31 | -21.44 | -21.43 | -21.41 | -21.37 | -21.03 | 8.75 | 0.1 | 0.0 | 3.15 | 0.2 | 2 | 0.802 | 6.54e+28 | 6.35e+28 | -20.61 | -21.28 | -21.35 | -21.38 | -21.41 | -21.37 | -21.03 | 8.9 | 15.0 | 0.06 | 7.66 | 0.2 | 1 | 0.879 | 6.34e+28 | 6.52e+28 | -20.58 | -21.18 | -21.28 | -21.34 | -21.4 | -21.44 | -21.13 | 8.957 | 1 | 1.0 | 0.5 | 8.707 | 0.3 | 0.0 | 0.2 | 10.87 | 1.1 | 8.493 | 0.066 | 8.984 | 1 | 8.473 | 0.088 | 12.08 | 1 | 8.516 | 0.36 | 0.068 | 11.79 | 1 | 8.487 | 0.499 | 0.052 | 8.454 | 1 |
In case we have to open
a custom file, not supported by Astropy/Numpy, we can create our own reader.
Open the file and browse it, looping through lines to retrieve the required informations.
In this weird example values are enclosed in ***, and we are interested in just the first value of each row.
!cat data/custom.dat
***1*** 12 ***1*** 36 ***2*** 78 ***3*** ***5*** ***7*** ***8*** 23 7 x 7 marco esempio 14 ***13***
tab = []
with open('data/custom.dat', 'r') as custom:
for line in custom:
try:
value = line.split('***')[1]
except:
continue
tab.append(int(value))
print(tab)
[1, 1, 2, 3, 5, 8, 13]
Astropy provides facility to download files from external sites
from astropy.utils.data import download_file
download_file('https://archive.stsci.edu/missions/hlsp/candels/uds/catalogs/v1/hlsp_candels_hst_wfc3_uds_santini_v1_physpar_cat.fits')
columns can not be retrieved by index (it doesn't make sense in this case...).
They can be retrieved by name
physpar[:,1]
physpar['age_2a_tau']
9.1 |
10.0 |
7.6 |
9.1 |
7.6 |
9.1 |
8.3 |
8.5 |
9.5 |
8.6 |
8.7 |
7.6 |
... |
8.6 |
8.7 |
8.9 |
8.8 |
8.7 |
8.3 |
9.2 |
9.4 |
8.7 |
8.3 |
7.8 |
9.0 |
Using the same syntax, we can select a sub catalog (selection by columns in this case)
physpar_sel=physpar[['Seq', 'UMag_6a_tau', 'VMag_6a_tau', 'JMag_6a_tau']]
physpar_sel
Seq | UMag_6a_tau | VMag_6a_tau | JMag_6a_tau |
---|---|---|---|
int32 | float32 | float32 | float32 |
1 | -20.41 | -21.91 | -22.79 |
2 | -12.2 | -13.77 | -14.47 |
3 | -19.43 | -19.12 | -18.34 |
4 | -21.5 | -23.06 | -23.76 |
5 | -24.21 | -25.98 | -26.87 |
6 | -13.36 | -14.62 | -15.18 |
7 | -16.63 | -17.22 | -17.86 |
8 | -18.54 | -19.35 | -20.24 |
9 | -17.96 | -18.75 | -19.57 |
10 | -19.65 | -20.52 | -20.68 |
... | ... | ... | ... |
35923 | -15.98 | -16.63 | -16.73 |
35924 | -19.59 | -20.38 | -20.57 |
35925 | -14.38 | -15.01 | -15.62 |
35926 | -17.34 | -17.95 | -18.7 |
35927 | -16.37 | -17.43 | -17.54 |
35928 | -16.22 | -17.41 | -17.82 |
35929 | -16.92 | -17.32 | -17.43 |
35930 | -19.25 | -19.47 | -19.95 |
35931 | -19.05 | -19.25 | -19.18 |
35932 | -20.59 | -21.35 | -21.38 |
#Read coordinates and masses values
# https://archive.stsci.edu/missions/hlsp/candels/uds/catalogs/v1/
filename = 'data/hlsp_candels_hst_wfc3_uds_santini_v1_mass_cat.fits'
mass = Table.read(filename, format='fits')
mass
Seq | RAdeg | DECdeg | Hmag | H_SNR | PhotFlag | StarFlag | Class_star | AGNFlag | zbest | zspec | q_zspec | r_zspec | zphot | zphot_l68 | zphot_u68 | zphot_l95 | zphot_u95 | M_med | s_med | M_neb_med | s_neb_med | delta_Mz | M_2a_tau | M_2d_tau | M_4b | M_6a_tau | M_10c | M_11a_tau | M_12a | M_13a_tau | M_14a | M_6a_tau^NEB | M_6a_deltau | M_6a_invtau | M_10c^dust | M_12a_tau | M_14a_const | M_14a_lin | M_14a_deltau | M_14a_tau |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int32 | float64 | float64 | float32 | float32 | int16 | int16 | float32 | int16 | float32 | float32 | int16 | bytes39 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | float32 |
1 | 34.2237625 | -5.2780528 | 27.34 | 4.03 | 6 | 0 | 0.52 | 0 | 4.137 | -99.0 | -99 | none | 4.137 | 1.33 | 7.57 | 0.05 | 9.66 | 137000000000.0 | 125000000000.0 | 22000000000.0 | 116000000000.0 | 6.281 | 10.89 | 11.27 | 10.53 | 10.36 | 10.65 | 10.27 | 10.38 | 11.47 | 11.4 | 10.34 | 9.82 | 9.09 | 11.34 | 10.6 | 11.4 | 11.33 | 11.32 | 11.3 |
2 | 34.2239037 | -5.2779489 | 24.81 | 7.41 | 2 | 0 | 0.6 | 0 | 0.252 | -99.0 | -99 | none | 0.252 | 0.06 | 2.13 | 0.01 | 3.87 | 21200000.0 | 21400000.0 | 7270000.0 | 9570000.0 | 0.677 | 7.8 | -99.0 | 6.4 | 7.39 | 6.39 | 7.03 | 7.53 | 6.93 | 6.93 | 7.39 | 7.42 | 7.3 | 6.39 | 7.44 | 6.92 | 6.87 | 6.93 | 6.93 |
3 | 34.2234917 | -5.2779522 | 26.2 | 7.04 | 4 | 0 | 0.0 | 0 | 2.378 | -99.0 | -99 | none | 2.378 | 2.15 | 6.43 | 0.5 | 9.5 | 1940000000.0 | 1250000000.0 | 1360000000.0 | 827000000.0 | 0.915 | 9.22 | 9.25 | 9.48 | 8.12 | 10.09 | 9.13 | 9.4 | 9.59 | 9.3 | 8.05 | 8.16 | 8.11 | 10.15 | 9.22 | 9.3 | 8.94 | 8.65 | 9.0 |
4 | 34.2651062 | -5.2777491 | 99.0 | 0.0 | 2 | 0 | 0.01 | 0 | 2.888 | -99.0 | -99 | none | 2.888 | 2.76 | 3.12 | 1.02 | 8.62 | 118000000000.0 | 25800000000.0 | 114000000000.0 | 49100000000.0 | 0.562 | 11.14 | 11.35 | 11.51 | 10.83 | 10.85 | 11.02 | 11.0 | 11.12 | 11.09 | 10.83 | 10.82 | 11.08 | 10.85 | 11.02 | 11.2 | 11.12 | 11.09 | 11.09 |
5 | 34.2953682 | -5.277648 | 23.89 | 24.33 | 4 | 0 | 0.0 | 0 | 4.6 | -99.0 | -99 | none | 4.6 | 1.23 | 8.11 | 0.03 | 9.73 | 271000000000.0 | 453000000000.0 | 397000000000.0 | 552000000000.0 | 2.995 | 10.63 | 11.51 | 11.52 | 12.08 | 11.88 | 10.71 | 11.7 | 11.48 | 10.4 | 12.07 | 12.06 | 12.04 | 11.88 | 11.93 | 10.4 | 9.98 | 11.26 | 11.86 |
6 | 34.2623291 | -5.2776389 | 23.5 | 29.62 | 0 | 0 | 0.99 | 0 | 0.12 | -99.0 | -99 | none | 0.12 | 0.05 | 0.18 | 0.01 | 0.22 | 20500000.0 | 8010000.0 | 25200000.0 | 9010000.0 | 0.475 | 7.36 | 8.06 | 7.73 | 7.57 | 7.14 | 7.29 | 7.17 | 7.33 | 7.23 | 7.56 | 7.58 | 7.55 | 7.39 | 7.17 | 7.51 | 7.41 | 7.23 | 7.23 |
7 | 34.2735214 | -5.2774611 | 26.34 | 6.46 | 0 | 0 | 0.0 | 0 | 0.905 | -99.0 | -99 | none | 0.905 | 0.85 | 0.98 | 0.77 | 2.62 | 67600000.0 | 33500000.0 | 74500000.0 | 40400000.0 | 0.609 | 7.93 | 8.2 | 7.81 | 8.15 | 7.84 | 7.82 | 7.83 | 7.67 | 7.76 | 8.11 | 8.0 | 7.81 | 7.84 | 7.69 | 7.76 | 7.75 | 7.73 | 7.75 |
8 | 34.2244873 | -5.2773852 | 25.27 | 7.07 | 1 | 0 | 0.36 | 0 | 2.379 | -99.0 | -99 | none | 2.379 | 1.96 | 2.82 | 1.59 | 3.07 | 1090000000.0 | 241000000.0 | 1020000000.0 | 224000000.0 | -99.0 | 9.08 | 9.51 | 9.22 | 9.14 | 9.22 | 8.9 | 8.9 | 9.08 | 9.04 | 9.12 | 9.13 | 9.26 | 8.91 | 8.85 | 9.04 | 9.01 | 8.99 | 9.04 |
9 | 34.2892265 | -5.2773862 | 99.0 | 0.0 | 2 | 0 | 0.91 | 0 | 1.827 | -99.0 | -99 | none | 1.827 | 1.63 | 2.09 | 1.42 | 8.1 | 983000000.0 | 520000000.0 | 816000000.0 | 492000000.0 | 0.543 | 9.13 | 9.38 | 9.26 | 9.06 | 7.29 | 7.55 | 8.66 | 9.11 | 8.91 | 9.04 | 9.02 | 8.85 | 7.29 | 8.46 | 8.91 | 8.67 | 8.63 | 8.71 |
10 | 34.2341118 | -5.2773671 | 24.77 | 13.57 | 0 | 0 | 0.0 | 0 | 2.421 | -99.0 | -99 | none | 2.421 | 2.32 | 2.55 | 2.23 | 2.77 | 2000000000.0 | 343000000.0 | 1820000000.0 | 283000000.0 | 0.306 | 9.33 | 9.41 | 9.39 | 9.34 | 9.29 | 9.26 | 9.21 | 9.41 | 9.26 | 9.32 | 9.34 | 9.36 | 9.29 | 9.17 | 9.22 | 9.21 | 9.23 | 9.26 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 26.33 | 4.58 | 0 | 0 | 0.0 | 0 | 0.759 | -99.0 | -99 | none | 0.759 | 0.71 | 0.81 | 0.65 | 0.87 | 61500000.0 | 27700000.0 | 62900000.0 | 10500000.0 | 1.28 | 7.97 | 8.1 | 7.91 | 7.23 | 7.77 | 7.83 | 7.72 | 7.95 | 7.8 | 7.84 | 7.45 | 7.31 | 7.77 | 7.7 | 7.66 | 7.54 | 7.77 | 7.8 |
35924 | 34.4255409 | -5.130373 | 26.87 | 4.09 | 0 | 0 | 0.54 | 0 | 3.886 | -99.0 | -99 | none | 3.886 | 3.78 | 4.0 | 3.67 | 4.13 | 1530000000.0 | 711000000.0 | 1120000000.0 | 304000000.0 | -99.0 | 9.33 | 9.21 | 9.39 | 9.33 | 9.33 | 8.97 | 9.3 | 9.4 | 8.9 | 9.13 | 9.26 | 9.28 | 9.33 | 9.26 | 8.9 | 8.73 | 8.83 | 9.0 |
35925 | 34.3481674 | -5.1359992 | 27.03 | 5.61 | 0 | 0 | 0.9 | 0 | 0.621 | -99.0 | -99 | none | 0.621 | 0.58 | 3.37 | 0.29 | 3.58 | 13800000.0 | 6670000.0 | 7450000.0 | 6420000.0 | 0.682 | 7.32 | 7.2 | 6.96 | 6.71 | 7.19 | 7.25 | 7.11 | 7.32 | 6.91 | 6.51 | 7.25 | 6.7 | 7.19 | 7.08 | 7.04 | 6.91 | 6.94 | 7.08 |
35926 | 34.3149147 | -5.1336441 | 26.44 | 5.01 | 0 | 0 | 0.15 | 0 | 1.703 | -99.0 | -99 | none | 1.703 | 1.29 | 2.11 | 0.76 | 2.62 | 182000000.0 | 42700000.0 | 147000000.0 | 16800000.0 | 0.55 | 8.34 | 8.47 | 8.43 | 8.23 | 8.22 | 8.22 | 8.17 | 8.4 | 8.16 | 8.11 | 8.29 | 8.26 | 8.11 | 8.13 | 8.26 | 8.16 | 8.18 | 8.29 |
35927 | 34.3862114 | -5.1331072 | 26.86 | 3.93 | 0 | 0 | 0.91 | 0 | 1.68 | -99.0 | -99 | none | 1.68 | 1.21 | 2.2 | 0.54 | 2.79 | 200000000.0 | 84300000.0 | 196000000.0 | 77400000.0 | 0.947 | 8.51 | 8.77 | 8.69 | 8.43 | 7.37 | 8.12 | 8.21 | 8.37 | 8.04 | 8.31 | 8.27 | 8.47 | 7.37 | 8.34 | 7.99 | 7.84 | 7.92 | 8.04 |
35928 | 34.3383026 | -5.1327462 | 27.25 | 4.63 | 0 | 0 | 0.77 | 0 | 2.183 | -99.0 | -99 | none | 2.183 | 1.52 | 2.85 | 0.58 | 9.49 | 235000000.0 | 394000000.0 | 39400000.0 | 28100000.0 | 0.834 | 8.98 | 10.03 | 7.28 | 8.37 | 6.35 | 7.83 | 8.91 | 8.29 | 7.7 | 7.11 | 8.39 | 8.43 | 10.16 | 9.05 | 7.7 | 7.53 | 7.63 | 7.72 |
35929 | 34.4137039 | -5.1306911 | 26.64 | 4.19 | 0 | 0 | 0.68 | 0 | 1.396 | -99.0 | -99 | none | 1.396 | 1.21 | 1.59 | 1.09 | 2.12 | 59200000.0 | 21600000.0 | 39800000.0 | 4330000.0 | -99.0 | 7.92 | 7.36 | 7.9 | 7.87 | 7.91 | 7.55 | 7.82 | 7.92 | 7.58 | 7.6 | 7.89 | 7.88 | 7.91 | 7.79 | 7.58 | 7.43 | 7.46 | 7.59 |
35930 | 34.2911873 | -5.1337609 | 26.61 | 6.47 | 0 | 0 | 0.98 | 0 | 3.357 | -99.0 | -99 | none | 3.357 | 3.25 | 3.45 | 3.0 | 3.55 | 441000000.0 | 165000000.0 | 266000000.0 | 95800000.0 | 0.473 | 8.78 | 8.92 | 8.44 | 8.41 | 9.13 | 8.45 | 8.8 | 8.47 | 8.59 | 8.4 | 8.46 | 8.2 | 8.81 | 8.79 | 8.59 | 8.48 | 8.53 | 8.62 |
35931 | 34.3882599 | -5.1333961 | 26.85 | 4.03 | 0 | 0 | 0.89 | 0 | 3.458 | -99.0 | -99 | none | 3.458 | 3.37 | 3.56 | 3.2 | 3.73 | 187000000.0 | 33800000.0 | 223000000.0 | 34600000.0 | -99.0 | 8.16 | 8.99 | 8.67 | 8.24 | 8.13 | 8.3 | 8.27 | 8.24 | 8.39 | 8.3 | 8.05 | 8.31 | 8.13 | 8.3 | 8.39 | 8.25 | 8.26 | 8.4 |
35932 | 34.4994812 | -5.1331692 | 26.2 | 4.64 | 0 | 0 | 0.93 | 0 | 5.251 | -99.0 | -99 | none | 5.251 | 5.12 | 5.37 | 4.96 | 5.46 | 3820000000.0 | 1760000000.0 | 2740000000.0 | 932000000.0 | -99.0 | 9.79 | 9.7 | 9.75 | 9.6 | 9.8 | 9.22 | 9.58 | 9.76 | 9.41 | 9.58 | 9.56 | 9.6 | 9.8 | 9.52 | 9.3 | 9.13 | 9.29 | 9.41 |
again perform columns selection on this catalog
mass_sel=mass[['Seq', 'RAdeg', 'DECdeg', 'zbest', 'StarFlag', 'AGNFlag', 'M_med']]
mass_sel
Seq | RAdeg | DECdeg | zbest | StarFlag | AGNFlag | M_med |
---|---|---|---|---|---|---|
int32 | float64 | float64 | float32 | int16 | int16 | float32 |
1 | 34.2237625 | -5.2780528 | 4.137 | 0 | 0 | 137000000000.0 |
2 | 34.2239037 | -5.2779489 | 0.252 | 0 | 0 | 21200000.0 |
3 | 34.2234917 | -5.2779522 | 2.378 | 0 | 0 | 1940000000.0 |
4 | 34.2651062 | -5.2777491 | 2.888 | 0 | 0 | 118000000000.0 |
5 | 34.2953682 | -5.277648 | 4.6 | 0 | 0 | 271000000000.0 |
6 | 34.2623291 | -5.2776389 | 0.12 | 0 | 0 | 20500000.0 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0 | 0 | 67600000.0 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0 | 0 | 1090000000.0 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0 | 0 | 983000000.0 |
10 | 34.2341118 | -5.2773671 | 2.421 | 0 | 0 | 2000000000.0 |
... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0 | 0 | 61500000.0 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0 | 0 | 1530000000.0 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0 | 0 | 13800000.0 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0 | 0 | 182000000.0 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 0 | 0 | 200000000.0 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 0 | 0 | 235000000.0 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0 | 0 | 59200000.0 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0 | 0 | 441000000.0 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0 | 0 | 187000000.0 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0 | 0 | 3820000000.0 |
from astropy.table import join
joined = join(mass_sel, physpar_sel, keys='Seq', join_type='inner')
WARNING: MergeConflictWarning: Cannot merge meta key 'DATE-HDU' types <class 'str'> and <class 'str'>, choosing DATE-HDU='2014-11-18T13:05:21' [astropy.utils.metadata]
joined
Seq | RAdeg | DECdeg | zbest | StarFlag | AGNFlag | M_med | UMag_6a_tau | VMag_6a_tau | JMag_6a_tau |
---|---|---|---|---|---|---|---|---|---|
int32 | float64 | float64 | float32 | int16 | int16 | float32 | float32 | float32 | float32 |
1 | 34.2237625 | -5.2780528 | 4.137 | 0 | 0 | 137000000000.0 | -20.41 | -21.91 | -22.79 |
2 | 34.2239037 | -5.2779489 | 0.252 | 0 | 0 | 21200000.0 | -12.2 | -13.77 | -14.47 |
3 | 34.2234917 | -5.2779522 | 2.378 | 0 | 0 | 1940000000.0 | -19.43 | -19.12 | -18.34 |
4 | 34.2651062 | -5.2777491 | 2.888 | 0 | 0 | 118000000000.0 | -21.5 | -23.06 | -23.76 |
5 | 34.2953682 | -5.277648 | 4.6 | 0 | 0 | 271000000000.0 | -24.21 | -25.98 | -26.87 |
6 | 34.2623291 | -5.2776389 | 0.12 | 0 | 0 | 20500000.0 | -13.36 | -14.62 | -15.18 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0 | 0 | 67600000.0 | -16.63 | -17.22 | -17.86 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0 | 0 | 1090000000.0 | -18.54 | -19.35 | -20.24 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0 | 0 | 983000000.0 | -17.96 | -18.75 | -19.57 |
10 | 34.2341118 | -5.2773671 | 2.421 | 0 | 0 | 2000000000.0 | -19.65 | -20.52 | -20.68 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0 | 0 | 61500000.0 | -15.98 | -16.63 | -16.73 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0 | 0 | 1530000000.0 | -19.59 | -20.38 | -20.57 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0 | 0 | 13800000.0 | -14.38 | -15.01 | -15.62 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0 | 0 | 182000000.0 | -17.34 | -17.95 | -18.7 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 0 | 0 | 200000000.0 | -16.37 | -17.43 | -17.54 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 0 | 0 | 235000000.0 | -16.22 | -17.41 | -17.82 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0 | 0 | 59200000.0 | -16.92 | -17.32 | -17.43 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0 | 0 | 441000000.0 | -19.25 | -19.47 | -19.95 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0 | 0 | 187000000.0 | -19.05 | -19.25 | -19.18 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0 | 0 | 3820000000.0 | -20.59 | -21.35 | -21.38 |
from astropy.table import Table, vstack
obs1 = Table.read("data/obs1.dat", format='ascii')
obs1
name | obs_date | mag_b | logLx |
---|---|---|---|
str4 | str10 | float64 | float64 |
M31 | 2012-01-02 | 17.0 | 42.5 |
M82 | 2012-10-29 | 16.2 | 43.5 |
M101 | 2012-10-31 | 15.1 | 44.5 |
obs2 = Table.read("data/obs2.dat", format='ascii')
obs2
name | obs_date | logLx |
---|---|---|
str7 | str10 | float64 |
NGC3516 | 2011-11-11 | 42.1 |
M31 | 1999-01-05 | 43.1 |
M82 | 2012-10-30 | 45.0 |
The obs2
table is missing the mag_b
column, so in the stacked output table those values are marked as missing
#Join type outer
v1=vstack([obs1, obs2])
v1
name | obs_date | mag_b | logLx |
---|---|---|---|
str7 | str10 | float64 | float64 |
M31 | 2012-01-02 | 17.0 | 42.5 |
M82 | 2012-10-29 | 16.2 | 43.5 |
M101 | 2012-10-31 | 15.1 | 44.5 |
NGC3516 | 2011-11-11 | -- | 42.1 |
M31 | 1999-01-05 | -- | 43.1 |
M82 | 2012-10-30 | -- | 45.0 |
v1['mag_b'].data
masked_BaseColumn(data=[17.0, 16.2, 15.1, --, --, --], mask=[False, False, False, True, True, True], fill_value=1e+20)
In the case of join_type='inner'
, only the common columns (the intersection) are present in the output table.
#Join type inner
vstack([obs1, obs2], join_type='inner')
name | obs_date | logLx |
---|---|---|
str7 | str10 | float64 |
M31 | 2012-01-02 | 42.5 |
M82 | 2012-10-29 | 43.5 |
M101 | 2012-10-31 | 44.5 |
NGC3516 | 2011-11-11 | 42.1 |
M31 | 1999-01-05 | 43.1 |
M82 | 2012-10-30 | 45.0 |
In the case of join_type='exact'
, the vstack requires that all the input tables have exactly the same column names.
vstack([obs1, obs2], join_type='exact') #Error!
obs3 = Table.read("""name obs_date mag_b logLx
M45 2012-02-03 15.0 40.5""", format='ascii')
vstack([obs1, obs3], 'exact')
name | obs_date | mag_b | logLx |
---|---|---|---|
str4 | str10 | float64 | float64 |
M31 | 2012-01-02 | 17.0 | 42.5 |
M82 | 2012-10-29 | 16.2 | 43.5 |
M101 | 2012-10-31 | 15.1 | 44.5 |
M45 | 2012-02-03 | 15.0 | 40.5 |
The Table class supports the database join operation. This provides a flexible and powerful way to combine tables based on the values in one or more key columns.
from astropy.table import join
optical = Table.read("data/optical.dat", format='ascii')
optical
name | obs_date | mag_b | mag_v |
---|---|---|---|
str4 | str10 | float64 | float64 |
M31 | 2012-01-02 | 17.0 | 16.0 |
M82 | 2012-10-29 | 16.2 | 15.2 |
M101 | 2012-10-31 | 15.1 | 15.5 |
xray = Table.read("data/xray.dat", format='ascii')
xray
name | obs_date | logLx |
---|---|---|
str7 | str10 | float64 |
NGC3516 | 2011-11-11 | 42.1 |
M31 | 1999-01-05 | 43.1 |
M82 | 2012-10-29 | 45.0 |
Represents the strict intersection of the two tables on the key columns
join(optical, xray)
name | obs_date | mag_b | mag_v | logLx |
---|---|---|---|---|
str7 | str10 | float64 | float64 | float64 |
M82 | 2012-10-29 | 16.2 | 15.2 | 45.0 |
join(optical, xray, keys='name')
name | obs_date_1 | mag_b | mag_v | obs_date_2 | logLx |
---|---|---|---|---|---|
str7 | str10 | float64 | float64 | str10 | float64 |
M31 | 2012-01-02 | 17.0 | 16.0 | 1999-01-05 | 43.1 |
M82 | 2012-10-29 | 16.2 | 15.2 | 2012-10-29 | 45.0 |
The left
join creates a new table which has every row from the left table and includes matching values from the right table when available
join(optical, xray, join_type='left')
name | obs_date | mag_b | mag_v | logLx |
---|---|---|---|---|
str7 | str10 | float64 | float64 | float64 |
M101 | 2012-10-31 | 15.1 | 15.5 | -- |
M31 | 2012-01-02 | 17.0 | 16.0 | -- |
M82 | 2012-10-29 | 16.2 | 15.2 | 45.0 |
join(optical, xray, join_type='left', keys='name')
name | obs_date_1 | mag_b | mag_v | obs_date_2 | logLx |
---|---|---|---|---|---|
str7 | str10 | float64 | float64 | str10 | float64 |
M101 | 2012-10-31 | 15.1 | 15.5 | -- | -- |
M31 | 2012-01-02 | 17.0 | 16.0 | 1999-01-05 | 43.1 |
M82 | 2012-10-29 | 16.2 | 15.2 | 2012-10-29 | 45.0 |
join(optical, xray, join_type='left')
name | obs_date | mag_b | mag_v | logLx |
---|---|---|---|---|
str7 | str10 | float64 | float64 | float64 |
M101 | 2012-10-31 | 15.1 | 15.5 | -- |
M31 | 2012-01-02 | 17.0 | 16.0 | -- |
M82 | 2012-10-29 | 16.2 | 15.2 | 45.0 |
Likewise one can construct a new table with every row of the right table and matching left values (when available) using join_type=right
.
To make a table with the union of rows from both tables do an outer
join
join(optical, xray, join_type='outer')
name | obs_date | mag_b | mag_v | logLx |
---|---|---|---|---|
str7 | str10 | float64 | float64 | float64 |
M101 | 2012-10-31 | 15.1 | 15.5 | -- |
M31 | 1999-01-05 | -- | -- | 43.1 |
M31 | 2012-01-02 | 17.0 | 16.0 | -- |
M82 | 2012-10-29 | 16.2 | 15.2 | 45.0 |
NGC3516 | 2011-11-11 | -- | -- | 42.1 |
join(optical, xray, join_type='outer', keys='name')
name | obs_date_1 | mag_b | mag_v | obs_date_2 | logLx |
---|---|---|---|---|---|
str7 | str10 | float64 | float64 | str10 | float64 |
M101 | 2012-10-31 | 15.1 | 15.5 | -- | -- |
M31 | 2012-01-02 | 17.0 | 16.0 | 1999-01-05 | 43.1 |
M82 | 2012-10-29 | 16.2 | 15.2 | 2012-10-29 | 45.0 |
NGC3516 | -- | -- | -- | 2011-11-11 | 42.1 |
from astropy.table import unique
obs = Table.read("""name obs_date mag_b mag_v
M31 2012-01-02 17.0 17.5
M82 2012-02-14 16.2 14.5
M101 2012-01-02 15.1 13.5
M31 2012-01-02 17.1 17.4
M101 2012-01-02 15.1 13.5
M82 2012-02-14 16.2 14.5
M31 2012-02-14 16.9 17.3
M82 2012-02-14 15.2 15.5
M101 2012-02-14 15.0 13.6
M82 2012-03-26 15.7 16.5
M101 2012-03-26 15.1 13.5
M101 2012-03-26 14.8 14.3""", format='ascii')
unique(obs, keys='name')
name | obs_date | mag_b | mag_v |
---|---|---|---|
str4 | str10 | float64 | float64 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M31 | 2012-01-02 | 17.0 | 17.5 |
M82 | 2012-02-14 | 16.2 | 14.5 |
unique(obs, keys=['name', 'obs_date'])
name | obs_date | mag_b | mag_v |
---|---|---|---|
str4 | str10 | float64 | float64 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M101 | 2012-02-14 | 15.0 | 13.6 |
M101 | 2012-03-26 | 15.1 | 13.5 |
M31 | 2012-01-02 | 17.0 | 17.5 |
M31 | 2012-02-14 | 16.9 | 17.3 |
M82 | 2012-02-14 | 16.2 | 14.5 |
M82 | 2012-03-26 | 15.7 | 16.5 |
obs.sort(['name'])
obs
name | obs_date | mag_b | mag_v |
---|---|---|---|
str4 | str10 | float64 | float64 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M101 | 2012-02-14 | 15.0 | 13.6 |
M101 | 2012-03-26 | 15.1 | 13.5 |
M101 | 2012-03-26 | 14.8 | 14.3 |
M31 | 2012-01-02 | 17.0 | 17.5 |
M31 | 2012-01-02 | 17.1 | 17.4 |
M31 | 2012-02-14 | 16.9 | 17.3 |
M82 | 2012-02-14 | 16.2 | 14.5 |
M82 | 2012-02-14 | 16.2 | 14.5 |
M82 | 2012-02-14 | 15.2 | 15.5 |
M82 | 2012-03-26 | 15.7 | 16.5 |
obs.sort(['name', 'mag_b'])
obs
name | obs_date | mag_b | mag_v |
---|---|---|---|
str4 | str10 | float64 | float64 |
M101 | 2012-03-26 | 14.8 | 14.3 |
M101 | 2012-02-14 | 15.0 | 13.6 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M101 | 2012-01-02 | 15.1 | 13.5 |
M101 | 2012-03-26 | 15.1 | 13.5 |
M31 | 2012-02-14 | 16.9 | 17.3 |
M31 | 2012-01-02 | 17.0 | 17.5 |
M31 | 2012-01-02 | 17.1 | 17.4 |
M82 | 2012-02-14 | 15.2 | 15.5 |
M82 | 2012-03-26 | 15.7 | 16.5 |
M82 | 2012-02-14 | 16.2 | 14.5 |
M82 | 2012-02-14 | 16.2 | 14.5 |
NOTE: unlike the other methods, sort works in place (it modifies the table itself)
joined
Seq | RAdeg | DECdeg | zbest | StarFlag | AGNFlag | M_med | UMag_6a_tau | VMag_6a_tau | JMag_6a_tau |
---|---|---|---|---|---|---|---|---|---|
int32 | float64 | float64 | float32 | int16 | int16 | float32 | float32 | float32 | float32 |
1 | 34.2237625 | -5.2780528 | 4.137 | 0 | 0 | 137000000000.0 | -20.41 | -21.91 | -22.79 |
2 | 34.2239037 | -5.2779489 | 0.252 | 0 | 0 | 21200000.0 | -12.2 | -13.77 | -14.47 |
3 | 34.2234917 | -5.2779522 | 2.378 | 0 | 0 | 1940000000.0 | -19.43 | -19.12 | -18.34 |
4 | 34.2651062 | -5.2777491 | 2.888 | 0 | 0 | 118000000000.0 | -21.5 | -23.06 | -23.76 |
5 | 34.2953682 | -5.277648 | 4.6 | 0 | 0 | 271000000000.0 | -24.21 | -25.98 | -26.87 |
6 | 34.2623291 | -5.2776389 | 0.12 | 0 | 0 | 20500000.0 | -13.36 | -14.62 | -15.18 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0 | 0 | 67600000.0 | -16.63 | -17.22 | -17.86 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0 | 0 | 1090000000.0 | -18.54 | -19.35 | -20.24 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0 | 0 | 983000000.0 | -17.96 | -18.75 | -19.57 |
10 | 34.2341118 | -5.2773671 | 2.421 | 0 | 0 | 2000000000.0 | -19.65 | -20.52 | -20.68 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0 | 0 | 61500000.0 | -15.98 | -16.63 | -16.73 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0 | 0 | 1530000000.0 | -19.59 | -20.38 | -20.57 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0 | 0 | 13800000.0 | -14.38 | -15.01 | -15.62 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0 | 0 | 182000000.0 | -17.34 | -17.95 | -18.7 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 0 | 0 | 200000000.0 | -16.37 | -17.43 | -17.54 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 0 | 0 | 235000000.0 | -16.22 | -17.41 | -17.82 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0 | 0 | 59200000.0 | -16.92 | -17.32 | -17.43 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0 | 0 | 441000000.0 | -19.25 | -19.47 | -19.95 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0 | 0 | 187000000.0 | -19.05 | -19.25 | -19.18 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0 | 0 | 3820000000.0 | -20.59 | -21.35 | -21.38 |
joined.rename_column('M_med', 'M')
joined.rename_column('UMag_6a_tau', 'U')
joined.rename_column('VMag_6a_tau', 'V')
joined.rename_column('JMag_6a_tau', 'J')
joined.rename_column('zbest', 'z')
joined
Seq | RAdeg | DECdeg | z | StarFlag | AGNFlag | M | U | V | J |
---|---|---|---|---|---|---|---|---|---|
int32 | float64 | float64 | float32 | int16 | int16 | float32 | float32 | float32 | float32 |
1 | 34.2237625 | -5.2780528 | 4.137 | 0 | 0 | 137000000000.0 | -20.41 | -21.91 | -22.79 |
2 | 34.2239037 | -5.2779489 | 0.252 | 0 | 0 | 21200000.0 | -12.2 | -13.77 | -14.47 |
3 | 34.2234917 | -5.2779522 | 2.378 | 0 | 0 | 1940000000.0 | -19.43 | -19.12 | -18.34 |
4 | 34.2651062 | -5.2777491 | 2.888 | 0 | 0 | 118000000000.0 | -21.5 | -23.06 | -23.76 |
5 | 34.2953682 | -5.277648 | 4.6 | 0 | 0 | 271000000000.0 | -24.21 | -25.98 | -26.87 |
6 | 34.2623291 | -5.2776389 | 0.12 | 0 | 0 | 20500000.0 | -13.36 | -14.62 | -15.18 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0 | 0 | 67600000.0 | -16.63 | -17.22 | -17.86 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0 | 0 | 1090000000.0 | -18.54 | -19.35 | -20.24 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0 | 0 | 983000000.0 | -17.96 | -18.75 | -19.57 |
10 | 34.2341118 | -5.2773671 | 2.421 | 0 | 0 | 2000000000.0 | -19.65 | -20.52 | -20.68 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0 | 0 | 61500000.0 | -15.98 | -16.63 | -16.73 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0 | 0 | 1530000000.0 | -19.59 | -20.38 | -20.57 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0 | 0 | 13800000.0 | -14.38 | -15.01 | -15.62 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0 | 0 | 182000000.0 | -17.34 | -17.95 | -18.7 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 0 | 0 | 200000000.0 | -16.37 | -17.43 | -17.54 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 0 | 0 | 235000000.0 | -16.22 | -17.41 | -17.82 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0 | 0 | 59200000.0 | -16.92 | -17.32 | -17.43 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0 | 0 | 441000000.0 | -19.25 | -19.47 | -19.95 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0 | 0 | 187000000.0 | -19.05 | -19.25 | -19.18 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0 | 0 | 3820000000.0 | -20.59 | -21.35 | -21.38 |
from astropy import units as u
joined['DECdeg'].unit=u.deg
joined['RAdeg'].unit=u.deg
joined['U'].unit=u.ABmag
joined['V'].unit=u.ABmag
joined['J'].unit=u.ABmag
joined['M'].unit=u.solMass
joined
Seq | RAdeg | DECdeg | z | StarFlag | AGNFlag | M | U | V | J |
---|---|---|---|---|---|---|---|---|---|
deg | deg | solMass | mag(AB) | mag(AB) | mag(AB) | ||||
int32 | float64 | float64 | float32 | int16 | int16 | float32 | float32 | float32 | float32 |
1 | 34.2237625 | -5.2780528 | 4.137 | 0 | 0 | 137000000000.0 | -20.41 | -21.91 | -22.79 |
2 | 34.2239037 | -5.2779489 | 0.252 | 0 | 0 | 21200000.0 | -12.2 | -13.77 | -14.47 |
3 | 34.2234917 | -5.2779522 | 2.378 | 0 | 0 | 1940000000.0 | -19.43 | -19.12 | -18.34 |
4 | 34.2651062 | -5.2777491 | 2.888 | 0 | 0 | 118000000000.0 | -21.5 | -23.06 | -23.76 |
5 | 34.2953682 | -5.277648 | 4.6 | 0 | 0 | 271000000000.0 | -24.21 | -25.98 | -26.87 |
6 | 34.2623291 | -5.2776389 | 0.12 | 0 | 0 | 20500000.0 | -13.36 | -14.62 | -15.18 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0 | 0 | 67600000.0 | -16.63 | -17.22 | -17.86 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0 | 0 | 1090000000.0 | -18.54 | -19.35 | -20.24 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0 | 0 | 983000000.0 | -17.96 | -18.75 | -19.57 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0 | 0 | 61500000.0 | -15.98 | -16.63 | -16.73 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0 | 0 | 1530000000.0 | -19.59 | -20.38 | -20.57 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0 | 0 | 13800000.0 | -14.38 | -15.01 | -15.62 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0 | 0 | 182000000.0 | -17.34 | -17.95 | -18.7 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 0 | 0 | 200000000.0 | -16.37 | -17.43 | -17.54 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 0 | 0 | 235000000.0 | -16.22 | -17.41 | -17.82 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0 | 0 | 59200000.0 | -16.92 | -17.32 | -17.43 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0 | 0 | 441000000.0 | -19.25 | -19.47 | -19.95 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0 | 0 | 187000000.0 | -19.05 | -19.25 | -19.18 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0 | 0 | 3820000000.0 | -20.59 | -21.35 | -21.38 |
astropy.units
handles defining, converting between, and performing arithmetic operations with physical quantities, such as meters, seconds, Hz, etc.
It also handles logarithmic units such as magnitude and decibel.
quantities are the combination of a value and a unit.
The easiest way to create a Quantity
is to simply multiply or divide a value by one of the built-in units
.
It works with scalars, sequences and Numpy arrays
v = 23563.7 * u.kilometer / (1.8 * u.second)
v
v.value
v.unit
x=2.7*u.hour*v
x
x=x.decompose()
x
x=x.to(u.lightyear)
x
no_star = (joined['StarFlag'] == 0)
no_agn = (joined['AGNFlag'] == 0)
just_galaxies = no_star & no_agn
selection = joined[just_galaxies]
Syntax more compact
uds=joined[(joined['StarFlag'] == 0) & (joined['AGNFlag'] == 0)]
len(uds)
35852
numpy.where
returns elements numpy.where(condition[, x, y])
chosen from x or y depending on condition
a=np.arange(10)
np.where(a<5, 2*a, 3.14)
array([0. , 2. , 4. , 6. , 8. , 3.14, 3.14, 3.14, 3.14, 3.14])
np.where(a<5)
(array([0, 1, 2, 3, 4]),)
a<5
array([ True, True, True, True, True, False, False, False, False, False])
NOTE: when only condition is provided, this function is a shorthand for np.nonzero
. Using nonzero directly should be preferred, as it behaves correctly for subclasses.
np.nonzero(a<5)
(array([0, 1, 2, 3, 4]),)
star and ANG flags are no more required now
uds.remove_columns(['StarFlag', 'AGNFlag'])
The selection of the passive galaxies will be performed on the V-J/U-V color/color plane. We want to add these values to the catalog
#Compute colors (add columns like arrays)
uv = uds['U'] - uds['V']
vj = uds['V'] - uds['J']
#Add columns to table
uds.add_column(uv, name='U-V', index=4)
uds.add_column(vj, name='V-J', index=5)
uv = uds['U'] - uds['V']
vj
0.88000107 |
0.6999998 |
-0.7800007 |
0.70000076 |
0.8900013 |
0.5600004 |
0.6400013 |
0.8899994 |
0.8199997 |
0.15999985 |
0.80999947 |
-0.7400017 |
... |
-0.07999992 |
-0.22000027 |
0.10000038 |
0.19000053 |
0.60999966 |
0.75 |
0.11000061 |
0.40999985 |
0.11000061 |
0.48000145 |
-0.069999695 |
0.02999878 |
#%matplotlib qt
%matplotlib notebook
#Import moudules
import matplotlib.pyplot as plt
matplotlib.pyplot
provides a MATLAB-like plotting framework.import pylab
is no longer recommendedSet up matplotlib to work interactively
This function lets you activate matplotlib interactive support at any point during an IPython session. It does not import anything into the interactive namespace.
In this case, where the matplotlib default is TkAgg: %matplotlib
Using matplotlib backend: TkAgg
But you can explicitly request a different GUI backend: %matplotlib qt
You can list the available backends using the -l/–list option: %matplotlib --list
Create a plot grid a 3 different redshift bins: $z<0.5$, $0.5\le z<1.0$, $z\ge1.0$
#Add prepare the layout 2x2
fig = plt.figure("color vs color")
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(222, sharex=ax1, sharey=ax1)
ax3 = fig.add_subplot(223, sharex=ax1, sharey=ax1)
ax1.set_ylabel('U-V')
ax3.set_ylabel('U-V')
ax2.set_xlabel('V-J')
ax3.set_xlabel('V-J')
Text(0.5, 0, 'V-J')
zmask1 = uds['z'] < 0.5
gal1 = uds[zmask1]
ax1.scatter(gal1['V-J'], gal1['U-V'], alpha=0.1)
zmask2= (0.5<= uds['z']) & (uds['z'] <1.0)
gal2 = uds[zmask2]
ax2.scatter(gal2['V-J'], gal2['U-V'], alpha=0.1)
zmask3= uds['z'] >=1
gal3 = uds[zmask3]
ax3.scatter(gal3['V-J'], gal3['U-V'], alpha=0.1)
fig.show() #no interactive mode
gal1
Seq | RAdeg | DECdeg | z | U-V | V-J | M | U | V | J |
---|---|---|---|---|---|---|---|---|---|
deg | deg | mag(AB) | mag(AB) | solMass | mag(AB) | mag(AB) | mag(AB) | ||
int32 | float64 | float64 | float32 | float32 | float32 | float32 | float32 | float32 | float32 |
2 | 34.2239037 | -5.2779489 | 0.252 | 1.5700006 | 0.6999998 | 21200000.0 | -12.2 | -13.77 | -14.47 |
6 | 34.2623291 | -5.2776389 | 0.12 | 1.2600002 | 0.5600004 | 20500000.0 | -13.36 | -14.62 | -15.18 |
34 | 34.3927803 | -5.277133 | 0.043 | 1.0100002 | 0.39999962 | 21000000.0 | -13.33 | -14.34 | -14.74 |
39 | 34.3444824 | -5.2769132 | 0.127 | 1.7799997 | 0.9000006 | 21600000.0 | -11.66 | -13.44 | -14.34 |
78 | 34.3962326 | -5.2765279 | 0.362 | 1.0100002 | 0.34999943 | 51700000.0 | -14.96 | -15.97 | -16.32 |
93 | 34.4087143 | -5.276545 | 0.243 | 1.5699997 | 0.71000004 | 13600000.0 | -12.47 | -14.04 | -14.75 |
94 | 34.5502167 | -5.2763448 | 0.387 | 0.6800003 | 0.059999466 | 85300000.0 | -16.72 | -17.4 | -17.46 |
99 | 34.3584633 | -5.2770748 | 0.323 | 1.0699997 | 0.5300007 | 447000000.0 | -16.84 | -17.91 | -18.44 |
101 | 34.2541275 | -5.2765379 | 0.301 | 1.0699997 | 0.42000008 | 95200000.0 | -15.16 | -16.23 | -16.65 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35766 | 34.5426254 | -5.129426 | 0.361 | 1.2699995 | 0.5500002 | 15100000.0 | -12.93 | -14.2 | -14.75 |
35793 | 34.3453331 | -5.1281471 | 0.458 | 0.7599993 | 0.119999886 | 21100000.0 | -15.02 | -15.78 | -15.9 |
35797 | 34.3776741 | -5.1310401 | 0.124 | 0.75 | 0.14000034 | 1320000.0 | -11.66 | -12.41 | -12.55 |
35822 | 34.3439484 | -5.1306748 | 0.483 | 0.6800003 | -0.11000061 | 14700000.0 | -14.42 | -15.1 | -14.99 |
35835 | 34.3935242 | -5.1312108 | 0.356 | 1.5699997 | 0.7400007 | 27900000.0 | -12.58 | -14.15 | -14.89 |
35848 | 34.3081474 | -5.1303182 | 0.434 | 0.8500004 | 0.23999977 | 13700000.0 | -13.92 | -14.77 | -15.01 |
35855 | 34.4985275 | -5.1279049 | 0.432 | 0.9599991 | 0.4300003 | 15800000.0 | -13.77 | -14.73 | -15.16 |
35882 | 34.4903946 | -5.13311 | 0.032 | 0.8500004 | 0.25 | 110000.0 | -9.11 | -9.96 | -10.21 |
35901 | 34.4618912 | -5.133122 | 0.304 | 1.6199999 | 0.7399998 | 21900000.0 | -12.37 | -13.99 | -14.73 |
35918 | 34.5434418 | -5.1301341 | 0.28 | 0.71000004 | 0.3899994 | 6960000.0 | -13.39 | -14.1 | -14.49 |
#Select all passive galaxies, redshift independet
cmask = (uds['U-V'] > 1.3) & (uds['V-J'] < 1.6)
# z < 0.5 passive galaxies
pmask1 = (uds['U-V']>0.88*uds['V-J']+0.69) & cmask & zmask1
pas1 = uds[pmask1]
ax1.scatter(pas1['V-J'], pas1['U-V'], alpha=0.1, color='orange')
# 0.5 <= z < 1.0 passive galaxies
pmask2 = (uds['U-V']>0.88*uds['V-J']+0.59) & cmask & zmask2
pas2 = uds[pmask2]
ax2.scatter(pas2['V-J'], pas2['U-V'], alpha=0.1, color='orange')
# z >= 1.0 all galaxies
pmask3 = (uds['U-V']>0.88*uds['V-J']+0.49) & cmask & zmask3
pas3 = uds[pmask3]
ax3.scatter(pas3['V-J'], pas3['U-V'], alpha=0.1, color='orange')
plt.show()
plt.close(fig)
fig = plt.figure("paper plot")
fig.set_figwidth(13.0)
fig.set_figheight(9.0)
fig.subplots_adjust(hspace=0, wspace=0)
#0<z<0.5
ax1=fig.add_subplot(221, ylabel='$U-V_{rest}$')
ax1.xaxis.set_visible(False)
ax1.text(2, 0.25, '$0\leq z_{best}\leq 0.5$', horizontalalignment='left', verticalalignment='bottom')
ax1.minorticks_on()
ax1.set_xlim([0.,2.6])
ax1.set_ylim([0.,2.9])
ax1.scatter(gal1['V-J'], gal1['U-V'], alpha=0.1, color='blue', label='all galaxies')
ax1.scatter(pas1['V-J'], pas1['U-V'], alpha=0.1, color='orange', label='passive galaxies')
#ax1.legend()
ax2=fig.add_subplot(222, xlabel='$V-J_{rest}$')
ax2.yaxis.set_visible(False)
ax2.text(2, 0.25, '$0.5 < z_{best} \leq 1.0$', horizontalalignment='left', verticalalignment='bottom')
ax2.minorticks_on()
ax2.set_xlim([0.,2.6])
ax2.set_ylim([0.,2.9])
ax2.scatter(gal2['V-J'], gal2['U-V'], alpha=0.1, color='blue', label='all galaxies')
ax2.scatter(pas2['V-J'], pas2['U-V'], alpha=0.1, color='orange', label='passive galaxies')
#ax2.legend()
ax3=fig.add_subplot(223, xlabel='$V-J_{rest}$', ylabel='$U-V_{rest}$')
ax3.text(2, 0.25, '$z_{best} > 1.0$', horizontalalignment='left', verticalalignment='bottom')
ax3.minorticks_on()
ax3.set_xlim([0.,2.6])
ax3.set_ylim([0.,2.9])
ax3.scatter(gal3['V-J'], gal3['U-V'], alpha=0.1, color='blue', label='all galaxies')
ax3.scatter(pas3['V-J'], pas3['U-V'], alpha=0.1, color='orange', label='passive galaxies')
leg3=ax3.legend()
for lh in leg3.legendHandles: lh.set_alpha(1)
fig.savefig('tmp/paper_plot.png')
plt.close(fig)
passive = Table.Column(data=(pmask1 | pmask2 | pmask3), name="passive")
uds.add_column(passive)
uds.meta['EXTNAME']='UDS GAL'
uds.write('tmp/uds_galaxies.dat', format='ascii', overwrite=True)
uds.write('tmp/uds_galaxies.fits', format='fits', overwrite=True) #ABmag raise an error
BinTableHDU.from_columns
does not convert ABmag
for col in uds.columns:
if uds[col].unit == u.ABmag:
uds[col].unit = u.mag
uds.write('tmp/uds_galaxies.fits', format='fits', overwrite=True)
filename = 'data/uds_3dhst.v4.1_f160w.galfit'
# http://www.mpia-hd.mpg.de/homes/vdwel/allfields.tar
galfit = Table.read(filename, format='ascii')
galfit
NUMBER | RA | DEC | f | mag | dmag | re | dre | n | dn | q | dq | pa | dpa | sn |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int64 | float64 | float64 | int64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 |
1 | 34.446064 | -5.285457 | 2 | 25.2335 | 0.415377 | 0.127038 | 0.112775 | 6.2612 | 9.40253 | 0.05 | 0.500987 | -1.8275 | 58.4025 | 6.41418 |
2 | 34.447491 | -5.284816 | 0 | 21.6693 | 0.0372133 | 0.171324 | 0.0101816 | 2.8908 | 0.352333 | 0.5232 | 0.0476136 | -86.0899 | 4.97807 | 85.0546 |
3 | 34.43383 | -5.285184 | 2 | 26.987 | 0.547064 | 0.018 | 0.0211501 | 0.2 | 0.500774 | 0.5377 | 0.669696 | -28.4017 | 110.96 | 3.352 |
4 | 34.438637 | -5.283363 | 1 | 21.6856 | 0.0604812 | 0.656628 | 0.0322929 | 0.676 | 0.113962 | 0.4777 | 0.0350281 | -82.1219 | 2.56121 | 38.4857 |
5 | 34.443878 | -5.284456 | 0 | 23.8057 | 0.123687 | 0.089574 | 0.0215728 | 6.1666 | 3.25463 | 0.6397 | 0.164918 | 68.7565 | 20.3813 | 24.6858 |
6 | 34.43869 | -5.284338 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
7 | 34.442711 | -5.284338 | 0 | 24.3339 | 0.137039 | 0.194682 | 0.0311516 | 0.498 | 0.377303 | 0.8978 | 0.119152 | 60.0191 | 11.0413 | 14.7184 |
8 | 34.43681 | -5.284299 | 2 | 27.9483 | 0.411477 | 0.018 | 0.0176878 | 1.1548 | 1.96862 | 0.1281 | 0.533146 | -15.0008 | 90.7597 | 4.49085 |
9 | 34.432861 | -5.284348 | 2 | 26.1657 | 0.55178 | 0.144288 | 0.172763 | 4.2987 | 7.56168 | 0.043 | 0.598049 | 70.365 | 83.1026 | 3.9374 |
10 | 34.43959 | -5.282533 | 0 | 21.5697 | 0.0366913 | 0.475422 | 0.021351 | 2.0705 | 0.167854 | 0.7937 | 0.0215431 | 72.8365 | 1.70363 | 83.1543 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
44093 | 34.363277 | -5.12368 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44094 | 34.556057 | -5.123807 | 2 | 26.55 | 0.852434 | 0.342888 | 0.526645 | 4.4074 | 9.35924 | 0.0424 | 0.616694 | 39.9887 | 78.2464 | 2.88182 |
44095 | 34.328003 | -5.122773 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44096 | 34.368511 | -5.12343 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44097 | 34.327488 | -5.123142 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44098 | 34.363106 | -5.122066 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44099 | 34.333569 | -5.123219 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44100 | 34.363682 | -5.123124 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
44101 | 34.556389 | -5.12304 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 7.64875 |
44102 | 34.365097 | -5.121975 | 3 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | -999.0 | 0.0 |
from astropy.coordinates import SkyCoord
galfit_coords=SkyCoord(galfit['RA']*u.deg, galfit['DEC']*u.deg)
uds_coords=SkyCoord(uds['RAdeg'], uds['DECdeg'])
idx, d2d, _ = uds_coords.match_to_catalog_sky(galfit_coords)
idx
: Indexes of galfit_coords objectd2d
: 2d separation of the matchesmatch = galfit[idx]
match = galfit[idx]
new_col1 = Table.Column(idx, name="match_indexs")
new_col2 = Table.Column(data=d2d.arcsec, name="separation", unit=u.arcsec)
match["re"].unit=u.arcsec
uds.add_columns((match["re"], match["q"], new_col1, new_col2))
uds
Seq | RAdeg | DECdeg | z | U-V | V-J | M | U | V | J | passive | re | q | match_indexs | separation |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | solMass | mag | mag | mag | arcsec | arcsec | |||||
int32 | float64 | float64 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | bool | float64 | float64 | int64 | float64 |
1 | 34.2237625 | -5.2780528 | 4.137 | 1.5 | 0.88000107 | 137000000000.0 | -20.41 | -21.91 | -22.79 | True | 0.56814 | 0.1587 | 131 | 0.20622415473116226 |
2 | 34.2239037 | -5.2779489 | 0.252 | 1.5700006 | 0.6999998 | 21200000.0 | -12.2 | -13.77 | -14.47 | True | 0.56814 | 0.1587 | 131 | 0.47447425015165035 |
3 | 34.2234917 | -5.2779522 | 2.378 | -0.30999947 | -0.7800007 | 1940000000.0 | -19.43 | -19.12 | -18.34 | False | 16.4383 | 0.555 | 132 | 0.03549758951776946 |
4 | 34.2651062 | -5.2777491 | 2.888 | 1.5599995 | 0.70000076 | 118000000000.0 | -21.5 | -23.06 | -23.76 | True | 0.23943 | 0.7145 | 154 | 0.22590954165180346 |
5 | 34.2953682 | -5.277648 | 4.6 | 1.7700005 | 0.8900013 | 271000000000.0 | -24.21 | -25.98 | -26.87 | True | 0.379704 | 0.9551 | 168 | 0.19857159952291267 |
6 | 34.2623291 | -5.2776389 | 0.12 | 1.2600002 | 0.5600004 | 20500000.0 | -13.36 | -14.62 | -15.18 | False | 0.018 | 0.05 | 148 | 0.006849387088246349 |
7 | 34.2735214 | -5.2774611 | 0.905 | 0.59000015 | 0.6400013 | 67600000.0 | -16.63 | -17.22 | -17.86 | False | 0.269088 | 0.0581 | 153 | 0.09665923828623986 |
8 | 34.2244873 | -5.2773852 | 2.379 | 0.80999947 | 0.8899994 | 1090000000.0 | -18.54 | -19.35 | -20.24 | False | 24.0 | 0.0137 | 151 | 0.3940623624551962 |
9 | 34.2892265 | -5.2773862 | 1.827 | 0.7900009 | 0.8199997 | 983000000.0 | -17.96 | -18.75 | -19.57 | False | 0.214554 | 0.1732 | 356 | 4.763845787896464 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35923 | 34.4241371 | -5.131937 | 0.759 | 0.6499996 | 0.10000038 | 61500000.0 | -15.98 | -16.63 | -16.73 | False | 0.315984 | 0.1541 | 42474 | 0.020072478348473265 |
35924 | 34.4255409 | -5.130373 | 3.886 | 0.789999 | 0.19000053 | 1530000000.0 | -19.59 | -20.38 | -20.57 | False | 0.132012 | 0.0335 | 42898 | 0.01440446332452097 |
35925 | 34.3481674 | -5.1359992 | 0.621 | 0.6300001 | 0.60999966 | 13800000.0 | -14.38 | -15.01 | -15.62 | False | 0.018 | 0.003878 | 41377 | 0.037092434048780334 |
35926 | 34.3149147 | -5.1336441 | 1.703 | 0.6100006 | 0.75 | 182000000.0 | -17.34 | -17.95 | -18.7 | False | 0.229302 | 0.0402 | 42056 | 0.04357327920768605 |
35927 | 34.3862114 | -5.1331072 | 1.68 | 1.0599995 | 0.11000061 | 200000000.0 | -16.37 | -17.43 | -17.54 | False | 0.129636 | 0.0349 | 42190 | 0.07704229624744328 |
35928 | 34.3383026 | -5.1327462 | 2.183 | 1.1900005 | 0.40999985 | 235000000.0 | -16.22 | -17.41 | -17.82 | False | 0.592056 | 0.1544 | 42125 | 2.171254404698205 |
35929 | 34.4137039 | -5.1306911 | 1.396 | 0.39999962 | 0.11000061 | 59200000.0 | -16.92 | -17.32 | -17.43 | False | 0.176724 | 0.1628 | 42801 | 0.02032822958840174 |
35930 | 34.2911873 | -5.1337609 | 3.357 | 0.21999931 | 0.48000145 | 441000000.0 | -19.25 | -19.47 | -19.95 | False | 0.018 | 0.0745 | 42018 | 0.02134406957436333 |
35931 | 34.3882599 | -5.1333961 | 3.458 | 0.20000076 | -0.069999695 | 187000000.0 | -19.05 | -19.25 | -19.18 | False | 0.043734 | 0.0679 | 42099 | 0.035404743677074774 |
35932 | 34.4994812 | -5.1331692 | 5.251 | 0.7600002 | 0.02999878 | 3820000000.0 | -20.59 | -21.35 | -21.38 | False | 0.052542 | 0.2257 | 42171 | 0.03113385501535447 |
fig = plt.figure("separation")
plt.clf()
_ = plt.hist(uds["separation"], color='red', bins=50)
plt.clf()
_ = plt.hist(uds["separation"][uds["separation"]<0.5], color='orange', bins=50)
plt.close(fig)
good separation flags = uds["separation"] < 0.3
passive flags&= uds["passive"]
suitable z bin flags&= uds["z"]<=0.5
suitable in M flags&= uds["M"]>10**10
and suitable re flags&= uds["re"]>0.03
flags = uds["separation"] < 0.3
flags&= uds["passive"]
flags&= uds["z"]<=0.5
flags&= uds["M"]>10**10
flags&= uds["re"]>0.03
good=uds[flags]
good
Seq | RAdeg | DECdeg | z | U-V | V-J | M | U | V | J | passive | re | q | match_indexs | separation |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | solMass | mag | mag | mag | arcsec | arcsec | |||||
int32 | float64 | float64 | float32 | float32 | float32 | float32 | float32 | float32 | float32 | bool | float64 | float64 | int64 | float64 |
2513 | 34.4621124 | -5.270968 | 0.441 | 2.039999 | 1.1599998 | 84300000000.0 | -20.26 | -22.3 | -23.46 | True | 1.51399 | 0.8304 | 1002 | 0.0710198672830541 |
3854 | 34.4495239 | -5.2601161 | 0.4894 | 2.209999 | 1.4899998 | 35400000000.0 | -18.76 | -20.97 | -22.46 | True | 0.79893 | 0.1946 | 4830 | 0.0075684946179961875 |
4384 | 34.2754097 | -5.2531362 | 0.417 | 1.6499996 | 1.0900002 | 10900000000.0 | -18.61 | -20.26 | -21.35 | True | 0.56469 | 0.4616 | 7490 | 0.028717306350864155 |
4563 | 34.5523758 | -5.2527881 | 0.401 | 2.1900005 | 1.3299999 | 31800000000.0 | -18.35 | -20.54 | -21.87 | True | 0.26733 | 0.6305 | 7815 | 0.015579713810220044 |
8430 | 34.3956871 | -5.2317562 | 0.3505 | 2.1000004 | 1.2399998 | 23700000000.0 | -18.65 | -20.75 | -21.99 | True | 0.420156 | 0.3514 | 13975 | 0.01512424948739272 |
8451 | 34.4872818 | -5.2304268 | 0.3358 | 1.9000015 | 1.289999 | 11900000000.0 | -18.63 | -20.53 | -21.82 | True | 0.281232 | 0.6697 | 14192 | 0.024931136600014097 |
9286 | 34.4395332 | -5.2283368 | 0.2066 | 2.1100006 | 1.2600002 | 19000000000.0 | -17.98 | -20.09 | -21.35 | True | 0.39933 | 0.9479 | 14326 | 0.03168811283711497 |
9334 | 34.3924141 | -5.2275658 | 0.4464 | 2.1099987 | 1.25 | 68700000000.0 | -19.79 | -21.9 | -23.15 | True | 0.647112 | 0.7371 | 14699 | 0.004334849955685843 |
10746 | 34.4451752 | -5.2225771 | 0.293 | 2.1200008 | 1.2399998 | 41200000000.0 | -19.15 | -21.27 | -22.51 | True | 0.567198 | 0.271 | 15502 | 0.01874208646347688 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
20156 | 34.341362 | -5.1667309 | 0.4478 | 1.6599998 | 0.9899998 | 21500000000.0 | -19.59 | -21.25 | -22.24 | True | 0.394974 | 0.6832 | 33317 | 0.07036893885583605 |
20371 | 34.3828239 | -5.165998 | 0.485 | 1.9899998 | 1.2600002 | 68000000000.0 | -19.81 | -21.8 | -23.06 | True | 0.645018 | 0.4405 | 33546 | 0.014438955639872382 |
20840 | 34.4787636 | -5.162735 | 0.448 | 2.1000004 | 1.2399998 | 20400000000.0 | -18.43 | -20.53 | -21.77 | True | 0.225756 | 0.5085 | 34420 | 0.003875152834750343 |
20991 | 34.3604546 | -5.1623321 | 0.4488 | 1.7700005 | 1.0999985 | 27700000000.0 | -19.43 | -21.2 | -22.3 | True | 0.37911 | 0.6195 | 34648 | 0.011251773737363342 |
23416 | 34.3747139 | -5.1456132 | 0.469 | 2.0200005 | 1.1900005 | 21300000000.0 | -18.55 | -20.57 | -21.76 | True | 0.260562 | 0.7008 | 39380 | 0.10512061147457963 |
23557 | 34.4466362 | -5.1462178 | 0.434 | 1.9900017 | 1.1199989 | 10300000000.0 | -18.05 | -20.04 | -21.16 | True | 0.226614 | 0.5166 | 38911 | 0.013698782028896874 |
24167 | 34.5110435 | -5.1499858 | 0.4318 | 2.0600014 | 1.1699982 | 56700000000.0 | -19.73 | -21.79 | -22.96 | True | 0.389448 | 0.4119 | 37903 | 0.0033923876368344924 |
26155 | 34.4003983 | -5.1395898 | 0.194 | 2.039999 | 1.2300014 | 16300000000.0 | -18.43 | -20.47 | -21.7 | True | 0.572724 | 0.3117 | 39931 | 0.0012943877254266156 |
26450 | 34.5186615 | -5.1401339 | 0.403 | 1.8700008 | 1.0300007 | 12300000000.0 | -18.39 | -20.26 | -21.29 | True | 0.115704 | 0.7856 | 40789 | 0.014292350334453705 |
26792 | 34.3735657 | -5.1483412 | 0.496 | 2.0100002 | 1.1399994 | 46500000000.0 | -19.9 | -21.91 | -23.05 | True | 0.573732 | 0.8767 | 37898 | 0.04212181560913217 |
The astropy.cosmology
subpackage contains classes for representing cosmologies, and utility functions for calculating commonly used quantities that depend on a cosmological model: distances, ages and lookback times corresponding to a measured redshift or the transverse separation corresponding to a measured angular separation.
cosmology.parameters.available
Here WMAP9 is a built-in object describing a cosmology with the parameters from the 9-year WMAP results
from astropy.cosmology import parameters
parameters.available
['Planck15', 'Planck13', 'WMAP9', 'WMAP7', 'WMAP5']
from astropy.cosmology import WMAP9
re_arcmin = good["re"].to(u.arcmin)*np.sqrt(good["q"])
re_kpc = WMAP9.kpc_proper_per_arcmin(good["z"])*re_arcmin
#Clear the figure
fig = plt.figure()
plt.clf()
plt.title("Size mass relation")
plt.errorbar(good['M'], re_kpc, fmt='o')#re_kpc)
#Set axis scales
plt.semilogx()
plt.semilogy()
#Set axis labels
plt.xlabel("mass ($M_{\odot}$)")
plt.ylabel("size (kpc)")
#Display dashed grid
plt.grid(which="both", ls='--')
Syntax used to ignore returned function parameters
lines=["2012-01-02 M31 17.0 16.0 16.3", "2012-10-29 M82 16.2 15.2", "2012-10-31 M101"]
for line in lines:
_, name, *_ = line.split()
print(name)
M31 M82 M101
pandas
is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
Python has long been great for data munging and preparation, but less so for data analysis and modeling. pandas helps fill this gap, enabling you to carry out your entire data analysis workflow in Python without having to switch to a more domain specific language like R.
pandas=physpar.to_pandas()
pandas
Seq | age_2a_tau | tau_2a_tau | Av_2a_tau | SFR_2a_tau | chi2_2a_tau | age_2d_tau | tau_2d_tau | Av_2d_tau | met_2d_tau | ... | age_14a_deltau | tau_14a_deltau | EBV_14a_deltau | SFR_14a_deltau | q_14a_deltau | age_14a_tau | tau_14a_tau | EBV_14a_tau | SFR_14a_tau | q_14a_tau | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 9.1 | 0.5 | 0.4 | 21.879999 | 177.000000 | 9.146 | 0.316000 | 0.0 | 0.400 | ... | 9.132 | 0.264 | 0.513 | 39.980000 | 1 | 9.131 | 0.419 | 0.469 | 31.780001 | 1 |
1 | 2 | 10.0 | 7.9 | 0.8 | 0.006000 | 9.040000 | -99.000 | -99.000000 | -99.0 | -99.000 | ... | 9.025 | 0.133 | 0.059 | 0.000000 | 1 | 8.955 | 0.151 | 0.058 | 0.000000 | 1 |
2 | 3 | 7.6 | 0.3 | 1.1 | 46.770000 | 304.000000 | 6.954 | 39.811001 | 1.3 | 5.000 | ... | 8.404 | 1.083 | 0.145 | 4.325000 | 1 | 8.780 | 1.945 | 0.080 | 2.087000 | 1 |
3 | 4 | 9.1 | 0.3 | 1.0 | 13.800000 | 71.900002 | 8.903 | 0.200000 | 1.3 | 0.200 | ... | 9.038 | 0.256 | 0.346 | 48.939999 | 2 | 9.032 | 0.262 | 0.251 | 12.490000 | 1 |
4 | 5 | 7.6 | 12.6 | 0.0 | 1288.000000 | 964000.000000 | 6.845 | 0.010000 | 1.1 | 2.500 | ... | 9.019 | 0.273 | 0.067 | 96.739998 | 1 | 9.068 | 0.234 | 0.100 | 34.290001 | 2 |
5 | 6 | 9.1 | 0.3 | 0.0 | 0.002000 | 41.200001 | 9.845 | 0.032000 | 0.0 | 0.020 | ... | 8.978 | 0.108 | 0.016 | 0.000000 | 1 | 8.912 | 0.115 | 0.016 | 0.000000 | 1 |
6 | 7 | 8.3 | 0.3 | 0.6 | 0.417000 | 14.400000 | 7.903 | 0.008000 | 0.1 | 2.500 | ... | 8.507 | 0.717 | 0.125 | 0.384000 | 1 | 8.327 | 0.724 | 0.113 | 0.313000 | 1 |
7 | 8 | 8.5 | 0.5 | 1.1 | 3.802000 | 2.090000 | 8.699 | 0.079000 | 0.2 | 0.200 | ... | 8.623 | 0.619 | 0.294 | 5.134000 | 1 | 8.475 | 0.501 | 0.269 | 3.774000 | 1 |
8 | 9 | 9.5 | 5.0 | 0.0 | 0.513000 | 3.690000 | 9.301 | 1.259000 | 0.0 | 0.400 | ... | 9.017 | 0.440 | 0.025 | 0.480000 | 1 | 9.035 | 1.257 | 0.023 | 0.467000 | 1 |
9 | 10 | 8.6 | 0.5 | 0.6 | 5.129000 | 2.450000 | 8.146 | 0.001000 | 0.1 | 0.200 | ... | 8.568 | 0.471 | 0.201 | 9.558000 | 1 | 8.374 | 0.334 | 0.180 | 7.329000 | 1 |
10 | 11 | 8.7 | 0.3 | 1.2 | 2.884000 | 1.770000 | 8.146 | 0.032000 | 1.2 | 0.400 | ... | 8.544 | 0.817 | 0.399 | 8.568000 | 1 | 8.449 | 0.855 | 0.375 | 6.363000 | 1 |
11 | 12 | 7.6 | 12.6 | 0.0 | 2.399000 | 123.000000 | 7.602 | 0.003000 | 0.2 | 1.000 | ... | 8.037 | 1.715 | 0.012 | 1.672000 | 1 | 8.028 | 2.275 | 0.012 | 1.371000 | 1 |
12 | 13 | 8.6 | 5.0 | 0.2 | 5.248000 | 3.960000 | 7.079 | 0.025000 | 0.9 | 1.000 | ... | 8.482 | 0.797 | 0.061 | 6.156000 | 1 | 8.315 | 0.728 | 0.048 | 5.025000 | 1 |
13 | 14 | 7.6 | 12.6 | 0.9 | 2.239000 | 50.900002 | 7.602 | 0.001000 | 0.5 | 2.500 | ... | 8.142 | 0.947 | 0.103 | 0.736000 | 1 | 8.119 | 1.184 | 0.076 | 0.519000 | 1 |
14 | 15 | 8.0 | 12.6 | 0.6 | 15.140000 | 18.400000 | 7.000 | 0.013000 | 0.9 | 1.000 | ... | 8.448 | 0.503 | 0.098 | 8.996000 | 1 | 8.164 | 0.495 | 0.099 | 8.422000 | 1 |
15 | 16 | 8.8 | 0.8 | 0.2 | 1.445000 | 2.170000 | 6.699 | 0.013000 | 1.0 | 0.005 | ... | 8.874 | 0.689 | 0.076 | 2.023000 | 1 | 8.690 | 0.946 | 0.066 | 1.725000 | 1 |
16 | 17 | 7.6 | 12.6 | 0.0 | 446.700012 | 146000.000000 | 6.778 | 0.003000 | 0.1 | 5.000 | ... | 9.001 | 0.232 | 0.015 | 37.340000 | 1 | 8.909 | 0.331 | 0.013 | 37.320000 | 1 |
17 | 18 | 9.2 | 0.3 | 0.0 | 0.036000 | 2.390000 | -99.000 | -99.000000 | -99.0 | -99.000 | ... | 8.612 | 0.723 | 0.531 | 2.875000 | 1 | 8.554 | 0.674 | 0.489 | 1.810000 | 1 |
18 | 19 | 9.3 | 12.6 | 0.0 | 0.562000 | 7.060000 | 9.079 | 1.000000 | 0.1 | 0.005 | ... | 8.772 | 0.927 | 0.076 | 1.149000 | 1 | 8.639 | 1.213 | 0.059 | 0.903000 | 1 |
19 | 20 | 9.4 | 3.2 | 0.3 | 3.631000 | 81.900002 | 8.653 | 0.631000 | 0.6 | 2.500 | ... | 9.086 | 0.282 | 0.047 | 1.726000 | 1 | 9.094 | 0.465 | 0.028 | 1.430000 | 1 |
20 | 21 | 8.8 | 1.3 | 0.6 | 12.300000 | 4.290000 | 7.699 | 0.010000 | 0.8 | 0.200 | ... | 8.459 | 0.387 | 0.224 | 25.040001 | 1 | 8.216 | 0.293 | 0.215 | 21.200001 | 1 |
21 | 22 | 8.6 | 3.2 | 0.5 | 8.318000 | 12.100000 | 7.146 | 0.002000 | 1.0 | 0.200 | ... | 8.681 | 0.694 | 0.140 | 9.531000 | 1 | 8.412 | 0.669 | 0.136 | 8.621000 | 1 |
22 | 23 | 8.8 | 0.3 | 0.6 | 0.195000 | 1.590000 | 8.079 | 0.005000 | 0.8 | 0.020 | ... | 8.771 | 0.511 | 0.238 | 0.577000 | 1 | 8.691 | 0.728 | 0.216 | 0.414000 | 1 |
23 | 24 | 8.8 | 0.3 | 0.9 | 0.117000 | 1.280000 | 8.079 | 0.008000 | 0.5 | 2.500 | ... | 8.787 | 0.320 | 0.269 | 0.268000 | 1 | 8.651 | 0.537 | 0.270 | 0.245000 | 1 |
24 | 25 | 8.6 | 0.3 | 0.4 | 0.209000 | 1.780000 | 8.699 | 50.118999 | 0.8 | 0.005 | ... | 8.691 | 0.769 | 0.135 | 0.345000 | 1 | 8.542 | 0.840 | 0.118 | 0.267000 | 1 |
25 | 26 | 8.6 | 0.5 | 2.7 | 257.000000 | 11.700000 | 9.301 | 0.040000 | 0.7 | 0.020 | ... | 8.519 | 0.463 | 0.747 | 528.000000 | 1 | 8.324 | 0.439 | 0.735 | 435.799988 | 1 |
26 | 27 | 8.4 | 0.3 | 0.3 | 0.240000 | 2.180000 | 9.602 | 0.316000 | 3.5 | 1.000 | ... | 8.460 | 0.837 | 0.080 | 0.299000 | 1 | 8.291 | 0.803 | 0.067 | 0.243000 | 1 |
27 | 28 | 8.9 | 1.3 | 0.2 | 1.820000 | 2.090000 | 8.301 | 0.063000 | 0.4 | 0.005 | ... | 8.574 | 0.828 | 0.137 | 4.527000 | 1 | 8.428 | 0.889 | 0.120 | 3.514000 | 1 |
28 | 29 | 8.3 | 0.3 | 0.4 | 2.188000 | 1.970000 | 7.602 | 0.003000 | 0.2 | 1.000 | ... | 8.408 | 0.880 | 0.113 | 2.799000 | 1 | 8.270 | 0.950 | 0.099 | 2.228000 | 1 |
29 | 30 | 9.5 | 5.0 | 0.6 | 0.550000 | 1.170000 | 9.477 | 1.259000 | 0.3 | 1.000 | ... | 8.571 | 0.867 | 0.313 | 2.706000 | 1 | 8.596 | 0.947 | 0.270 | 1.661000 | 1 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
35902 | 35903 | 8.3 | 0.8 | 0.4 | 0.324000 | 1.750000 | 6.845 | 0.010000 | 1.1 | 2.500 | ... | 8.245 | 0.828 | 0.057 | 0.268000 | 1 | 8.171 | 0.971 | 0.043 | 0.209000 | 1 |
35903 | 35904 | 9.1 | 0.3 | 0.0 | 0.002000 | 1.030000 | 9.146 | 0.316000 | 0.0 | 0.400 | ... | 8.415 | 0.431 | 0.325 | 0.076000 | 1 | 8.472 | 0.377 | 0.257 | 0.040000 | 1 |
35904 | 35905 | 8.5 | 0.3 | 0.0 | 0.355000 | 1.790000 | 7.602 | 0.004000 | 0.2 | 0.200 | ... | 8.349 | 0.680 | 0.066 | 0.750000 | 1 | 8.289 | 0.719 | 0.051 | 0.578000 | 1 |
35905 | 35906 | 8.9 | 0.3 | 0.0 | 0.023000 | 5.890000 | 9.079 | 0.398000 | 0.1 | 1.000 | ... | 8.399 | 0.670 | 0.103 | 0.074000 | 1 | 8.385 | 0.721 | 0.068 | 0.049000 | 1 |
35906 | 35907 | 8.6 | 0.3 | 0.5 | 0.251000 | 1.160000 | 8.079 | 0.032000 | 0.3 | 2.500 | ... | 8.435 | 0.500 | 0.178 | 0.534000 | 1 | 8.408 | 0.576 | 0.147 | 0.366000 | 1 |
35907 | 35908 | 9.2 | 0.3 | 0.0 | 0.028000 | 0.826000 | 8.146 | 0.001000 | 0.1 | 0.005 | ... | 8.360 | 0.958 | 0.423 | 1.094000 | 1 | 8.362 | 0.545 | 0.381 | 0.694000 | 1 |
35908 | 35909 | 9.0 | 1.3 | 0.0 | 0.162000 | 0.430000 | 9.204 | 100.000000 | 0.0 | 0.400 | ... | 8.403 | 0.621 | 0.105 | 0.492000 | 1 | 8.374 | 0.773 | 0.082 | 0.351000 | 1 |
35909 | 35910 | 8.7 | 0.3 | 0.0 | 0.282000 | 1.240000 | 8.653 | 0.200000 | 0.0 | 0.400 | ... | 8.340 | 0.698 | 0.088 | 0.786000 | 1 | 8.290 | 0.836 | 0.069 | 0.575000 | 1 |
35910 | 35911 | 8.8 | 0.8 | 0.0 | 2.089000 | 0.950000 | 8.699 | 0.398000 | 0.0 | 0.400 | ... | 8.374 | 0.674 | 0.055 | 4.146000 | 1 | 8.351 | 0.838 | 0.040 | 3.175000 | 1 |
35911 | 35912 | 8.4 | 0.3 | 0.2 | 2.630000 | 0.747000 | 8.146 | 0.032000 | 0.0 | 0.400 | ... | 8.366 | 0.670 | 0.080 | 4.133000 | 1 | 8.340 | 0.665 | 0.060 | 3.114000 | 1 |
35912 | 35913 | 9.1 | 12.6 | 0.5 | 3.890000 | 2.170000 | 7.602 | 0.001000 | 0.5 | 2.500 | ... | 8.412 | 0.602 | 0.188 | 8.321000 | 1 | 8.397 | 0.586 | 0.155 | 5.611000 | 1 |
35913 | 35914 | 9.2 | 0.8 | 0.6 | 3.890000 | 14.600000 | 8.544 | 0.079000 | 0.0 | 2.500 | ... | 8.625 | 0.132 | 0.220 | 6.686000 | 1 | 8.605 | 0.213 | 0.179 | 5.038000 | 1 |
35914 | 35915 | 8.5 | 0.3 | 0.0 | 0.126000 | 33.000000 | 9.602 | 0.316000 | 3.5 | 1.000 | ... | 8.204 | 0.798 | 0.018 | 0.178000 | 1 | 8.099 | 1.095 | 0.016 | 0.149000 | 1 |
35915 | 35916 | 9.0 | 0.3 | 1.7 | 28.840000 | 47.299999 | 9.000 | 0.050000 | 0.2 | 0.400 | ... | 8.413 | 0.530 | 0.877 | 800.000000 | 1 | 8.486 | 0.313 | 0.774 | 350.899994 | 2 |
35916 | 35917 | 8.1 | 0.8 | 0.8 | 2.344000 | 0.758000 | 7.255 | 0.008000 | 1.1 | 0.400 | ... | 8.291 | 0.786 | 0.198 | 2.498000 | 1 | 8.232 | 0.872 | 0.173 | 1.799000 | 1 |
35917 | 35918 | 8.7 | 0.5 | 0.4 | 0.012000 | 2.060000 | 8.204 | 0.040000 | 0.3 | 1.000 | ... | 8.604 | 0.153 | 0.132 | 0.013000 | 1 | 8.542 | 0.199 | 0.105 | 0.009000 | 1 |
35918 | 35919 | 8.9 | 2.0 | 0.0 | 0.347000 | 0.997000 | 8.079 | 0.002000 | 0.0 | 0.005 | ... | 8.419 | 0.633 | 0.059 | 0.665000 | 1 | 8.373 | 0.857 | 0.043 | 0.506000 | 1 |
35919 | 35920 | 8.8 | 0.3 | 0.5 | 0.078000 | 0.286000 | 8.146 | 0.008000 | 0.3 | 1.000 | ... | 8.395 | 0.515 | 0.180 | 0.185000 | 1 | 8.399 | 0.664 | 0.145 | 0.129000 | 1 |
35920 | 35921 | 8.6 | 12.6 | 0.0 | 0.427000 | 2.090000 | 6.903 | 0.002000 | 0.2 | 5.000 | ... | 8.350 | 0.715 | 0.049 | 0.693000 | 1 | 8.267 | 0.832 | 0.038 | 0.552000 | 1 |
35921 | 35922 | 8.7 | 0.3 | 0.0 | 0.024000 | 1.810000 | 8.954 | 0.631000 | 0.0 | 0.020 | ... | 8.482 | 0.421 | 0.107 | 0.075000 | 1 | 8.440 | 0.540 | 0.077 | 0.050000 | 1 |
35922 | 35923 | 8.9 | 0.3 | 0.0 | 0.041000 | 4.770000 | 8.602 | 0.010000 | 0.0 | 0.005 | ... | 8.646 | 0.109 | 0.076 | 0.060000 | 1 | 8.592 | 0.125 | 0.035 | 0.034000 | 1 |
35923 | 35924 | 8.8 | 0.3 | 0.0 | 1.622000 | 2.920000 | 8.146 | 0.032000 | 0.0 | 0.400 | ... | 8.454 | 0.473 | 0.094 | 5.245000 | 1 | 8.466 | 0.581 | 0.069 | 3.647000 | 1 |
35924 | 35925 | 8.7 | 0.3 | 0.5 | 0.025000 | 1.310000 | 7.845 | 0.003000 | 0.1 | 2.500 | ... | 8.334 | 0.810 | 0.261 | 0.097000 | 1 | 8.343 | 0.731 | 0.222 | 0.063000 | 1 |
35925 | 35926 | 8.3 | 0.5 | 0.9 | 1.202000 | 0.540000 | 8.000 | 1.259000 | 1.1 | 0.200 | ... | 8.342 | 0.758 | 0.242 | 1.649000 | 1 | 8.328 | 0.753 | 0.204 | 1.074000 | 1 |
35926 | 35927 | 9.2 | 0.5 | 0.0 | 0.048000 | 0.631000 | 9.544 | 1.995000 | 0.1 | 0.200 | ... | 8.420 | 0.749 | 0.307 | 0.744000 | 1 | 8.428 | 0.907 | 0.266 | 0.494000 | 2 |
35927 | 35928 | 9.4 | 1.3 | 0.5 | 0.200000 | 0.675000 | 9.255 | 25.118999 | 2.9 | 2.500 | ... | 8.363 | 0.727 | 0.234 | 0.434000 | 1 | 8.354 | 0.807 | 0.193 | 0.276000 | 1 |
35928 | 35929 | 8.7 | 2.0 | 0.0 | 0.209000 | 1.180000 | 7.079 | 0.002000 | 0.2 | 1.000 | ... | 8.298 | 0.838 | 0.043 | 0.347000 | 1 | 8.228 | 1.000 | 0.035 | 0.284000 | 1 |
35929 | 35930 | 8.3 | 12.6 | 0.4 | 3.981000 | 0.963000 | 7.544 | 0.005000 | 0.3 | 1.000 | ... | 8.359 | 0.600 | 0.078 | 3.405000 | 1 | 8.265 | 0.706 | 0.063 | 2.650000 | 1 |
35930 | 35931 | 7.8 | 0.3 | 0.1 | 2.570000 | 1.960000 | 8.079 | 0.063000 | 0.4 | 0.020 | ... | 8.255 | 0.838 | 0.026 | 2.421000 | 1 | 8.163 | 1.027 | 0.022 | 2.094000 | 1 |
35931 | 35932 | 9.0 | 0.8 | 0.0 | 4.677000 | 1.450000 | 8.079 | 0.004000 | 0.0 | 0.200 | ... | 8.516 | 0.360 | 0.068 | 11.790000 | 1 | 8.487 | 0.499 | 0.052 | 8.454000 | 1 |
35932 rows × 135 columns
Astroquery is an Astropy affiliated package that contains a collection of tools to access online Astronomical data. Each web service has its own sub-package
Importing astroquery on its own doesn't get you much: you need to import each sub-module specifically
$ conda install -c astropy astroquery
We can obtain Tables instances
from astroquery.esasky import ESASky
# Available catalogs
ESASky.list_catalogs()
#List of tables
results=ESASky.query_object_catalogs("M31","all")
results[2]
or list of HDUImages
from astroquery.ukidss import Ukidss
Ukidss.get_images(SkyCoord(49.489*u.deg, -0.27*u.deg, frame='galactic'), image_width=5 * u.arcmin)