In [17]:
# imports
import numpy as np
import os, sys
from linetools.utils import dv_from_z
from dla_cnn.io import load_ml_dr7, load_ml_dr12, load_garnett16
from dla_cnn.catalogs import match_boss_catalogs
sys.path.append(os.path.abspath("../Analysis/py"))
import defs as analy_defs
In [2]:
g16_pcut = analy_defs.g16_pcut
dztoler = 0.015
g16_pcut
Out[2]:
In [3]:
# Load BOSS ML
_, dr12_abs = load_ml_dr12()
# Cut on DLA
dlas = dr12_abs['NHI'] >= 20.3
no_bals = dr12_abs['flg_BAL'] == 0
high_conf = dr12_abs['conf'] > 0.9
#
zem = (dr12_abs['zem'] > dr12_abs['zabs']) & (dr12_abs['zem'] > 2.15) # G16 cut on zem
zcut = dr12_abs['zabs'] > 2.15
zprox = dr12_abs['zabs'] < (dr12_abs['zem'] - 3000./3e5)
# cut
dr12_cut = dlas & no_bals & high_conf & zem & zcut & zprox
dr12_dla = dr12_abs[dr12_cut]
len(dr12_dla)
Out[3]:
In [4]:
g16_abs = load_garnett16()
g_dlas = g16_abs['log.NHI'] >= 20.3
g_conf = g16_abs['pDLAD'] >= g16_pcut
# Cut
g_cut = g_dlas & g_conf
g16_dlas = g16_abs[g_cut]
len(g16_dlas)
Out[4]:
In [5]:
dr12_to_g16 = match_boss_catalogs(dr12_dla, g16_dlas, dztoler=dztoler)
matched = dr12_to_g16 >= 0
g16_idx = dr12_to_g16[matched]
print("We matched {:d} of {:d} DLAs between high quality ML and G16 within dz={:g}".format(
np.sum(matched), np.sum(dr12_cut), dztoler))
high_conf = (dr12_dla['conf'][matched] > 0.9) & (g16_dlas['pDLAD'][g16_idx] > analy_defs.g16_pcut)
print("Of these, {:d} are high confidence in both".format(np.sum(high_conf)))
In [6]:
NHI = dr12_dla['NHI'][matched]
dNHI = dr12_dla['NHI'][matched] - g16_dlas['log.NHI'][g16_idx]
In [7]:
large_dNHI = np.abs(dNHI) > 0.5
np.sum(large_dNHI)
Out[7]:
In [27]:
not_matched = dr12_to_g16 < 0
np.sum(not_matched)
#
not_idx = np.where(not_matched)[0]
In [29]:
jj = not_idx[0]
dr12_dla[jj]
Out[29]:
In [30]:
jj
Out[30]:
In [33]:
jj1 = match_boss_catalogs(dr12_dla[jj:jj+2], g16_abs, dztoler=1.) # Needed 2 for the code to run
jj1
Out[33]:
In [34]:
g16_abs[9039]
Out[34]:
In [19]:
dv_from_z(2.956255, 2.8347)
Out[19]:
In [16]:
g16_to_dr12 = match_boss_catalogs(g16_dlas, dr12_dla, dztoler=dztoler, reverse=True)
matched2 = g16_to_dr12 >= 0
dr12_idx = g16_to_dr12[matched2]
print("We matched {:d} of {:d} DLAs between high quality ML and G16 within dz={:g}".format(
np.sum(matched2), np.sum(g_cut), dztoler))
In [15]:
matched2
Out[15]:
In [ ]: