Using FRBGalaxy objects

v1 - Repeater only so far
v2 - 180924 (Bannister+2019)

In [1]:
#%matplotlib notebook

In [8]:
# imports
from pkg_resources import resource_filename
from matplotlib import pyplot as plt
import numpy as np

from frb.galaxies import frbgalaxy
from frb import frb
from frb.figures import galaxies as ffgal
from frb.figures import utils as ffutils

Load a Host galaxy by FRB


In [3]:
host121102 = frbgalaxy.FRBHost.by_name('121102')

Inspect it


In [4]:
host121102.z


Out[4]:
0.19273

In [5]:
host121102.morphology


Out[5]:
{'b/a': 0.25,
 'b/a_err': 0.13,
 'n': 2.2,
 'n_err': 1.5,
 'reff_ang': 0.41,
 'reff_ang_err': 0.06}

In [6]:
host121102.neb_lines


Out[6]:
{'Halpha': 2.6082162461507154e-16,
 'Halpha_err': 3.600298499287797e-18,
 'Hbeta': 9.611031647379592e-17,
 'Hbeta_err': 8.959436281455551e-18,
 '[NII] 6584': 1.192101555659964e-17,
 '[NII] 6584_err': -999.0,
 '[OIII] 5007': 4.3804209229532963e-16,
 '[OIII] 5007_err': 8.379935678693262e-18}

Let's use it on a plot

e.g. BPT


In [9]:
ffutils.set_mplrc()
plt.clf()
ax = plt.gca()
ffgal.sub_bpt(ax, [host121102], ['b'], ['*'], show_kewley=True)
plt.show()


/home/xavier/Projects/FRB/frb/figures/galaxies.py:59: RuntimeWarning: divide by zero encountered in true_divide
  select[line] = bptdat[line] / bptdat[err] >= 5
/home/xavier/Projects/FRB/frb/figures/galaxies.py:59: RuntimeWarning: invalid value encountered in true_divide
  select[line] = bptdat[line] / bptdat[err] >= 5
/home/xavier/Projects/FRB/frb/figures/galaxies.py:59: RuntimeWarning: invalid value encountered in greater_equal
  select[line] = bptdat[line] / bptdat[err] >= 5
/home/xavier/Projects/FRB/frb/figures/galaxies.py:71: RuntimeWarning: divide by zero encountered in log10
  mplt = ax_BPT.pcolormesh(xedges, yedges, np.log10(counts.transpose()), cmap=cm)
/home/xavier/local/Python/linetools/linetools/lists/linelist.py:379: UserWarning: Not implemented: will not set relative strength for LineList: Galaxy.
  warnings.warn('Not implemented: will not set relative strength for LineList: {}.'.format(self.list))
Not making a dust correction of the SFR.  Set AV_nebular to do so or input AV to this method
Not making a dust correction of the SFR.  Set AV_nebular to do so or input AV to this method
/home/xavier/local/Python/linetools/linetools/lists/linelist.py:379: UserWarning: Not implemented: will not set relative strength for LineList: Galaxy.
  warnings.warn('Not implemented: will not set relative strength for LineList: {}.'.format(self.list))
Not making a dust correction of the SFR.  Set AV_nebular to do so or input AV to this method
/home/xavier/local/Python/linetools/linetools/lists/linelist.py:379: UserWarning: Not implemented: will not set relative strength for LineList: Galaxy.
  warnings.warn('Not implemented: will not set relative strength for LineList: {}.'.format(self.list))
/home/xavier/local/Python/linetools/linetools/lists/linelist.py:379: UserWarning: Not implemented: will not set relative strength for LineList: Galaxy.
  warnings.warn('Not implemented: will not set relative strength for LineList: {}.'.format(self.list))
Not making a dust correction of the SFR.  Set AV_nebular to do so or input AV to this method

Let's play with FRB 180924

Load the FRB


In [10]:
frb180924 = frb.FRB.by_name('FRB180924')

Host galaxy


In [11]:
hg180924 = frb180924.grab_host()

Derived properties


In [12]:
hg180924.derived


Out[12]:
{'AV_nebular': 1.0045498154718946,
 'EBV_photom': 0.26696021019289895,
 'EBV_photom_err': 0.11409651615769302,
 'EBV_spec': 0.17217024497708244,
 'Lnu_r': 8.832473807459252e+21,
 'Lnu_r_err': 4.416236903729626e+20,
 'M_r': -20.765205895540973,
 'M_r_err': 0.05428681023790647,
 'Mstar': 22454584690.16538,
 'Mstar_err': 7114264761.28221,
 'Mstar_spec': 12560336857.112703,
 'SFR_nebular': 1.68933090286253,
 'SFR_nebular_err': -999.0,
 'SFR_photom': 2.9199953061580506,
 'SFR_photom_err': 3.9101845793972356,
 'Z_photom': 0.012670477657916993,
 'Z_photom_err': 0.014291544504794269,
 'Z_spec': -0.07485665291622498,
 'f_AGN': 0.2379513222257412,
 'f_AGN_err': 0.2072343379515631,
 'u-r': 1.74720683809408,
 'u-r_err': 0.1627709656798918}

How about a spectrum?


In [14]:
meta, spec = hg180924.get_metaspec()


Loading spectra from /u/xavier/SPECDB/FRB_specDB_CRAFT.hdf5
Database is FRB
Created on 2019-Jun-28
Version: v0.1
Your search yielded 1 match[es] within radius=0.5 arcsec
Staged 1 spectra totalling 6.4e-05 Gb
Loaded spectra
Staged 1 spectra totalling 6.4e-05 Gb
Loaded spectra
/home/xavier/anaconda3/lib/python3.7/site-packages/h5py/_hl/dataset.py:313: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.
  "Use dataset[()] instead.", H5pyDeprecationWarning)
/home/xavier/local/Python/linetools/linetools/spectra/xspectrum1d.py:222: RuntimeWarning: invalid value encountered in greater
  gdsigval = np.where(self.data['sig'][kk].data > 0.)[0]
/home/xavier/local/Python/linetools/linetools/spectra/xspectrum1d.py:223: RuntimeWarning: invalid value encountered in less_equal
  badsigval = self.data['sig'][kk].data <= 0.
/home/xavier/local/Python/linetools/linetools/spectra/xspectrum1d.py:253: UserWarning: No unit given to wavelength, assuming Angstroms.
  warnings.warn("No unit given to wavelength, assuming Angstroms.")
/home/xavier/Projects/FRB/frb/galaxies/frbgalaxy.py:340: UserWarning: Multiple spectra returned for this galaxy.  Taking the first, but you may wish to specify your instrument
  warnings.warn("Multiple spectra returned for this galaxy.  Taking the first, but you may wish to specify your instrument")

In [15]:
meta


Out[15]:
Table length=1
RA_GROUPDEC_GROUPzem_GROUPsig_zemZQREPOCHGROUP_IDFRB_IDNPIXWV_MINWV_MAXSTYPEflag_zemSPEC_FILEDATE-OBSDISPERSERINSTRTELESCOPERefGROUP
float64float64float64float64int64float64float64int64int64int64float64float64str3str8str92str10str4str4str6str13str4
326.10521-40.900220.3210.042000.02000.01537214700.99352.1GALHAND/home/xavier/Projects/FRB/Galaxy_DB/CRAFT/Bannister2019/J214425.25-405400.8_MUSE_A_spec.fits2018-11-05VPHGMUSEVLTBannister2019MUSE

Plot


In [16]:
spec.plot()



In [ ]: