In [1]:
# This changes the current directory to the base saga directory - make sure to run this first!
# This is necessary to be able to import the py files and use the right directories,
# while keeping all the notebooks in their own directory.
import os
import sys
import numpy as np

if 'saga_base_dir' not in locals():
    saga_base_dir = os.path.abspath('..')
if saga_base_dir not in sys.path:
    os.chdir(saga_base_dir)

In [18]:
%matplotlib inline
from matplotlib import pyplot as plt
from matplotlib import rcParams

rcParams['image.interpolation'] = 'none'
rcParams['figure.figsize'] = (16, 10)

In [3]:
import targeting

In [4]:
from astropy import units as u
from astropy.table import Table
from astropy.coordinates import SkyCoord, Latitude, Longitude

In [5]:
k15_tab2_colnames = 'Name,RA(2000.0)Dec,T,B,a,SB,rp,Rp,M_B,A,comments'.split(',')
k15_tab2_colunits = [None, None, None, u.mag, u.arcmin, None, u.arcmin, u.kpc, u.mag, u.kpc,None]
k15_tab2_data = r"""
\begin{table}
\begin{tabular}{ccccccccccc}
NGC\,672\,dwB   & 014711.1+274100 & Ir-VL  &  21.0 &  0.20 & 25.8 & 17.7~~ & 37  & $-8.6$  & 0.42 & \\
NGC\,672\,dwA   & 014719.1+271516 & Ir-L   &  19.8 &  0.26 & 25.2 & 13.1~~ & 27  & $-9.8$  & 0.54 & GALEX\\
NGC\,672\,dwC   & 014720.4+274324 & Sph-L  &  18.7 &  0.40 & 25.0 & 18.9~~ & 39  & $-10.9$ & 0.83 & \\
NGC\,891\,dwA   & 022112.4+422150 & Tr-L   &  17.9 &  0.76 & 25.7 & 14.9~~ & 43  & $-12.3$ & 2.20 & [TT09]25\\
NGC\,891\,dwB   & 022254.7+424245 & Ir-VL  &  18.9 &  1.16 & 27.6 & 22.4~~ & 65  & $-11.3$ & 3.36 & [TT09]30\\
NGC\,1156\,dw1  & 030018.2+251456 & Ir-L   &  19.6 &  0.38 & 25.2 & 8.1~~  & 18  & $-10.8$ & 0.86 & \\
NGC\,1156\,dw2  & 030028.0+251817 & Ir-VL  &  20.0 &  0.38 & 25.6 & 11.1~~ & 25  & $-10.4$ & 0.86 & GALEX\\
NGC\,2683\,dw1  & 085326.8+331820 & Ir-L   &  19.0 &  0.40 & 25.5 & 11.7~~ & 32  & $-11.0$ & 1.09 & GALEX\\
NGC\,2683\,dw2  & 085420.5+331458 & Sph-VL &  19.6 &  0.40 & 26.1 & 23.1~~ & 63  & $-10.4$ & 1.09 & \\
NGC\,3344\,dw1  & 104244.0+250130 & Ir-VL  &  20.0 &  0.30 & 26.0 & 11.9~~ & 34  & $-10.1$ & 0.86 & \\
NGC\,4258\,dwC  & 121026.8+464449 & Sph-L  &  19.0 &  0.27 & 24.7 & 93.3~~ & 212 & $-10.5$ & 0.61 & \\
NGC\,4258\,dwA  & 121551.0+473256 & Ir-L   &  19.0 &  0.43 & 25.7 & 34.8~~ & 79  & $-10.5$ & 0.98 & \\
NGC\,4258\,dwB  & 122410.9+470723 & Sph-L  &  18.3 &  0.45 & 25.1 & 54.6~~ & 124 & $-11.2$ & 1.02 & BTS134\\
NGC\,4631\,dw1  & 124057.0+324733 & Ir-VL  &  16.1 &  2.20 & 26.4 & 21.3~~ & 46  & $-13.3$ & 4.72 & GALEX\\
NGC\,4631\,dw2  & 124206.8+323715 & Ir-VL  &  18.5 &  0.90 & 26.8 & 4.8~~  & 10  & $-10.9$ & 1.93 & GALEX\\
NGC\,4625\,A    & 124211.0+411510 & Tr-L   &  18.6 &  0.45 & 25.4 & 9.4~~  & 22  & $-11.0$ & 1.03 & \\
NGC\,4631\,dw3  & 124252.5+322735 & Sph-VL &  19.7 &  0.60 & 27.1 & 10.6~~ & 23  & $-9.7$  & 1.29 & \\
M\,101\,DF3     & 140305.7+533656 & Sph-VL &  17.9 &  1.00 & 26.5 & 44.1~~ & 95  & $-11.5$ & 2.15 & \\
M\,101\,DF1     & 140345.0+535640 & Ir-L   &  18.9 &  0.47 & 25.8 & 23.9~~ & 51  & $-10.5$ & 1.01 & \\
M\,101\,dwD     & 140424.6+531619 & Sph-VL &  19.2 &  0.38 & 25.7 & 65.6~~ & 141 & $-10.2$ & 0.81 & \\
M\,101\,dwC     & 140518.0+545356 & Tr-VL  &  20.2 &  0.30 & 26.2 & 37.6~~ & 81  & $-9.2$  & 0.64 & \\
M\,101\,DF7     & 140548.3+550758 & Sph-XL &  20.4 &  0.67 & 28.1 & 52.0~~ & 117 & $-9.0$  & 1.44 & \\
M\,101\,dwA     & 140650.2+534432 & Sph-L  &  19.2 &  0.36 & 25.6 & 45.3~~ & 97  & $-10.2$ & 0.77 & \\
M\,101\,DF4     & 140733.4+544236 & Ir-XL  &  18.8 &  0.93 & 27.2 & 43.5~~ & 93  & $-10.6$ & 1.99 & \\
M\,101\,DF6     & 140819.0+551124 & Ir-XL  &  20.1 &  0.73 & 28.0 & 67.2~~ & 144 & $-9.3$  & 1.57 & \\
M\,101\,DF2     & 140837.5+541931 & Sph-L  &  19.8 &  0.33 & 26.0 & 47.1~~ & 101 & $-9.6$  & 0.71 & \\
M\,101\,dwB     & 140843.1+550957 & Sph-VL &  20.1 &  0.30 & 26.1 & 68.0~~ & 146 & $-9.3$  & 0.64 & \\
\end{tabular}
\end{table}
""".replace('~','').replace('\,', '').replace('$', '')

k15_tab2 = Table.read(k15_tab2_data.split('\n'), format='latex', names=k15_tab2_colnames, guess=False)
k15_tab2


Out[5]:
<Table masked=True length=26>
NameRA(2000.0)DecTBaSBrpRpM_BAcomments
string80string120string48float64float64float64float64int64float64float64string64
NGC672dwA014719.1+271516Ir-L19.80.2625.213.127-9.80.54GALEX
NGC672dwC014720.4+274324Sph-L18.70.425.018.939-10.90.83--
NGC891dwA022112.4+422150Tr-L17.90.7625.714.943-12.32.2[TT09]25
NGC891dwB022254.7+424245Ir-VL18.91.1627.622.465-11.33.36[TT09]30
NGC1156dw1030018.2+251456Ir-L19.60.3825.28.118-10.80.86--
NGC1156dw2030028.0+251817Ir-VL20.00.3825.611.125-10.40.86GALEX
NGC2683dw1085326.8+331820Ir-L19.00.425.511.732-11.01.09GALEX
NGC2683dw2085420.5+331458Sph-VL19.60.426.123.163-10.41.09--
NGC3344dw1104244.0+250130Ir-VL20.00.326.011.934-10.10.86--
NGC4258dwC121026.8+464449Sph-L19.00.2724.793.3212-10.50.61--
.................................
M101DF3140305.7+533656Sph-VL17.91.026.544.195-11.52.15--
M101DF1140345.0+535640Ir-L18.90.4725.823.951-10.51.01--
M101dwD140424.6+531619Sph-VL19.20.3825.765.6141-10.20.81--
M101dwC140518.0+545356Tr-VL20.20.326.237.681-9.20.64--
M101DF7140548.3+550758Sph-XL20.40.6728.152.0117-9.01.44--
M101dwA140650.2+534432Sph-L19.20.3625.645.397-10.20.77--
M101DF4140733.4+544236Ir-XL18.80.9327.243.593-10.61.99--
M101DF6140819.0+551124Ir-XL20.10.7328.067.2144-9.31.57--
M101DF2140837.5+541931Sph-L19.80.3326.047.1101-9.60.71--
M101dwB140843.1+550957Sph-VL20.10.326.168.0146-9.30.64--

In [6]:
k15_dw_radecs = [radec.split('+') for radec in k15_tab2['RA(2000.0)Dec']]
k15_dw_ras = [Longitude((int(s[:2]), int(s[2:4]), float(s[4:8])), unit=u.hourangle) for s in k15_tab2['RA(2000.0)Dec']]
k15_dw_decs = [Latitude((int(s[8:11]), int(s[11:13]), float(s[13:])), unit=u.deg) for s in k15_tab2['RA(2000.0)Dec']]
k15_dw_scs = SkyCoord(k15_dw_ras, k15_dw_decs)

In [7]:
targeting.sampled_imagelist(k15_dw_scs, None, 100, names=['{}_B={}_SB={}'.format(e['Name'], e['B'], e['SB']) for e in k15_tab2])


Out[7]:
'name ra dec\nNGC672dwA_B=19.8_SB=25.2 26.8295833333 27.2544444444\nNGC672dwC_B=18.7_SB=25.0 26.835 27.7233333333\nNGC891dwA_B=17.9_SB=25.7 35.3016666667 42.3638888889\nNGC891dwB_B=18.9_SB=27.6 35.7279166667 42.7125\nNGC1156dw1_B=19.6_SB=25.2 45.0758333333 25.2488888889\nNGC1156dw2_B=20.0_SB=25.6 45.1166666667 25.3047222222\nNGC2683dw1_B=19.0_SB=25.5 133.361666667 33.3055555556\nNGC2683dw2_B=19.6_SB=26.1 133.585416667 33.2494444444\nNGC3344dw1_B=20.0_SB=26.0 160.683333333 25.025\nNGC4258dwC_B=19.0_SB=24.7 182.611666667 46.7469444444\nNGC4258dwA_B=19.0_SB=25.7 183.9625 47.5488888889\nNGC4258dwB_B=18.3_SB=25.1 186.045416667 47.1230555556\nNGC4631dw1_B=16.1_SB=26.4 190.2375 32.7925\nNGC4631dw2_B=18.5_SB=26.8 190.528333333 32.6208333333\nNGC4625A_B=18.6_SB=25.4 190.545833333 41.2527777778\nNGC4631dw3_B=19.7_SB=27.1 190.71875 32.4597222222\nM101DF3_B=17.9_SB=26.5 210.77375 53.6155555556\nM101DF1_B=18.9_SB=25.8 210.9375 53.9444444444\nM101dwD_B=19.2_SB=25.7 211.1025 53.2719444444\nM101dwC_B=20.2_SB=26.2 211.325 54.8988888889\nM101DF7_B=20.4_SB=28.1 211.45125 55.1327777778\nM101dwA_B=19.2_SB=25.6 211.709166667 53.7422222222\nM101DF4_B=18.8_SB=27.2 211.889166667 54.71\nM101DF6_B=20.1_SB=28.0 212.079166667 55.19\nM101DF2_B=19.8_SB=26.0 212.15625 54.3252777778\nM101dwB_B=20.1_SB=26.1 212.179583333 55.1658333333'

See if they are in ML


In [8]:
mlpred = Table.read('catalogs/SAGA.ALL.objid_rescaledrobs_pred.Oct28_SDSS_nopreclean.csv.fits.gz')
mlpred


Out[8]:
<Table masked=False length=4950412>
OBJIDRADECDERED_RPROBABILITY_CLASS_1RESCALED_PROBABILITY_CLASS_1BEST_GUESS_CLASS
int64float64float64float64float64float64int64
123764594182435644040.2877964113-0.73564706094916.75940.001571683161970.0003458591989810
123764594182435644240.2745834514-0.73301406347817.45140.0003724938366918.19307625291e-050
123764594182435648140.2721052363-0.64251025320416.79110.001785145754540.0003587940248090
123764594182435648340.2712777717-0.64072529300120.98940.0002404548112865.13915737065e-050
123764594182435648440.2783697699-0.64121250744521.28840.0002708648099025.63874521068e-050
123764594182435648540.2826647047-0.64289294706122.49263.61806080935e-050.00
123764594182435649740.2846730128-0.81718021579914.86280.0003631305597288.19307625291e-050
123764594182435650040.2881452154-0.80504550894814.38260.0004886749827388.85746681048e-050
123764594182435650140.2854134086-0.80410047343220.24540.0007633014669820.0001623265034840
123764594182435650240.2864321267-0.80552497416121.61140.001126225175560.0002451935992030
.....................
12376802972817173381.4432989565121.63946437822.71047.69491488335e-059.35409943407e-060
12376802972817173411.4447360295721.625112294922.88140.0001025784870331.57161308307e-050
12376802972817173521.4632599319321.634553337622.59710.0002013463964885.13915737065e-050
12376802972817173531.4632834494321.645956298722.90920.0001263621986112.22024770719e-050
12376802972817173591.4802799969121.635139295422.54780.0001183507286521.57161308307e-050
12376802972817819001.4985220800521.631728324318.11390.0005650325313860.0001131620175110
12376802972817822141.4973308890721.623954531721.40330.000301649239245.77062812064e-050
12376802972817822271.5043843701621.626287124120.44810.0002287081377545.13915737065e-050
12376802972817822711.514854296721.626998974822.12510.0001093436167261.57161308307e-050
12376802972817826831.5089864409321.625326628622.52630.0001041810475841.57161308307e-050

In [24]:
mlsc = SkyCoord(mlpred['RA'], mlpred['DEC'], unit=u.deg)
idx, d2d, _ = k15_dw_scs.match_to_catalog_sky(mlsc)
plt.hist(d2d.deg,bins=100)


Out[24]:
(array([ 2.,  2.,  3.,  0.,  3.,  3.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,
         0.,  0.,  1.,  0.,  0.,  0.,  0.,  3.,  2.,  2.,  0.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  2.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
         0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  1.]),
 array([  1.87624035,   2.13026146,   2.38428258,   2.6383037 ,
          2.89232482,   3.14634594,   3.40036706,   3.65438818,
          3.9084093 ,   4.16243042,   4.41645154,   4.67047266,
          4.92449378,   5.1785149 ,   5.43253602,   5.68655713,
          5.94057825,   6.19459937,   6.44862049,   6.70264161,
          6.95666273,   7.21068385,   7.46470497,   7.71872609,
          7.97274721,   8.22676833,   8.48078945,   8.73481057,
          8.98883169,   9.2428528 ,   9.49687392,   9.75089504,
         10.00491616,  10.25893728,  10.5129584 ,  10.76697952,
         11.02100064,  11.27502176,  11.52904288,  11.783064  ,
         12.03708512,  12.29110624,  12.54512736,  12.79914847,
         13.05316959,  13.30719071,  13.56121183,  13.81523295,
         14.06925407,  14.32327519,  14.57729631,  14.83131743,
         15.08533855,  15.33935967,  15.59338079,  15.84740191,
         16.10142303,  16.35544414,  16.60946526,  16.86348638,
         17.1175075 ,  17.37152862,  17.62554974,  17.87957086,
         18.13359198,  18.3876131 ,  18.64163422,  18.89565534,
         19.14967646,  19.40369758,  19.6577187 ,  19.91173981,
         20.16576093,  20.41978205,  20.67380317,  20.92782429,
         21.18184541,  21.43586653,  21.68988765,  21.94390877,
         22.19792989,  22.45195101,  22.70597213,  22.95999325,
         23.21401437,  23.46803548,  23.7220566 ,  23.97607772,
         24.23009884,  24.48411996,  24.73814108,  24.9921622 ,
         25.24618332,  25.50020444,  25.75422556,  26.00824668,
         26.2622678 ,  26.51628892,  26.77031004,  27.02433115,  27.27835227]),
 <a list of 100 Patch objects>)

Looks like the mlpred file only has saga hosts


In [ ]: