示例#1
0
文件: tlk_qpq.py 项目: profxj/talks
def fig_qpq_sample(qpq7=None, outfil=None):

    # Load QPQ7
    if qpq7 is None:
        qpq7 = equ.load_qpq(7)
    bg_coord = SkyCoord(ra=qpq7['RAD_BG'], dec=qpq7['DECD_BG'], unit=u.deg)
    fg_coord = SkyCoord(ra=qpq7['RAD'], dec=qpq7['DECD'], unit=u.deg)

    # Small sep
    gdsep = np.where(qpq7['R_PHYS'] < 300.)[0]
    ngd = len(gdsep)
    print('Nclose = {:d}'.format(ngd))

    # Get PA, x, y
    PA = []
    for ii, gds in enumerate(gdsep):
        PA.append(fg_coord[gds].position_angle(bg_coord[gds]))
    PA = Quantity(PA)
    x = qpq7['R_PHYS'][gdsep] * np.cos(PA)
    y = qpq7['R_PHYS'][gdsep] * np.sin(PA)

    if outfil is None:
        outfil = 'fig_qpq_sample.pdf'
    pp = PdfPages(outfil)

    fig = plt.figure(figsize=(6.5, 5))
    plt.clf()
    gs = gridspec.GridSpec(1, 1)
    xpsimp.dark_bkgd(plt)

    jet = cm = plt.get_cmap('jet')

    ax = plt.subplot(gs[0, 0])
    ax.set_frame_on(False)
    #ax.xaxis.set_minor_locator(plt.MultipleLocator(0.5))
    #ax.xaxis.set_major_locator(plt.MultipleLocator(1.))
    #ax.get_xaxis().get_major_formatter().set_useOffset(False)
    ax.set_xlim(-300, 300)
    ax.set_ylim(-300, 300)
    #ax.set_xlabel('Relative Velocity (km/s)')
    #ax.set_ylabel('Normalized Flux')
    ax.get_xaxis().set_ticks([])
    ax.get_yaxis().set_ticks([])

    mplt = ax.scatter(x, y, c=qpq7['L_BOL'][gdsep], cmap=jet, edgecolor='none')

    mplt.set_clim(vmin=45, vmax=47.)
    cb = fig.colorbar(mplt)
    cb.set_label(r'$\log \; L_{\rm Bol}$')

    # Fonts

    # Write
    plt.tight_layout(pad=0.2, h_pad=0., w_pad=0.1)
    pp.savefig()
    pp.close()
    plt.close()
    print('Genereated {:s}'.format(outfil))
示例#2
0
def fig_cos_dwarfs_images(outfil=None):

    from xastropy.obs import x_getsdssimg as xgs

    # Init COS-Dwarfs, COS-Halos 
    cos_dwarfs = COSDwarfs()
    cos_dwarfs.load_mega(skip_ions=True)
    cos_halos = COSHalos()
    cos_halos.load_mega(skip_ions=True)

    # Start the plot
    if outfil is None:
        outfil='fig_cos_dwarfs_images.pdf'
    pp = PdfPages(outfil)

    dx = 0.2
    dy = 0.40

    fig = plt.figure(figsize=(8, 5))
    fig.clf()
    # Setup for dark
    xpsimp.dark_bkgd(plt)
    gs = gridspec.GridSpec(1, 1)

    # Axes
    ax = plt.subplot(gs[0,0])
    ax.set_xlim(8.0, 11.7) 
    #ax.xaxis.set_major_locator(plt.MultipleLocator(300.))
    ax.set_ylim(-13,-8.2)
    ax.set_ylabel('sSFR')
    ax.set_xlabel('log M*')

    iend = -1
    #iend = 5
    imsize = 0.3 # arcmin
    for cgm_abs in cos_halos.cgm_abs[0:iend]:
        img, oBW = xgs.getimg(cgm_abs.galaxy.coord.ra.deg, 
            cgm_abs.galaxy.coord.dec.deg, imsize=imsize)
        # Figure out placement
        ximg = cgm_abs.galaxy.stellar_mass
        yimg = np.log10(cgm_abs.galaxy.sfr[1])-cgm_abs.galaxy.stellar_mass
        # Show
        scl=2.
        ax.imshow(img,extent=(ximg-dx/scl, ximg+dx/scl, yimg-dy/scl, yimg+dy/scl),aspect=dx/dy)

    iend = -1
    #iend = 5
    imsize = 0.8 # arcmin
    for cgm_abs in cos_dwarfs.cgm_abs[0:iend]:
        img, oBW = xgs.getimg(cgm_abs.galaxy.coord.ra.deg, 
            cgm_abs.galaxy.coord.dec.deg, imsize=imsize)
        # Figure out placement
        ximg = cgm_abs.galaxy.stellar_mass
        yimg = np.log10(cgm_abs.galaxy.sfr[1])-cgm_abs.galaxy.stellar_mass
        # Show
        scl=2.
        ax.imshow(img,extent=(ximg-dx/scl, ximg+dx/scl, yimg-dy/scl, yimg+dy/scl),aspect=dx/dy)



    xputils.set_fontsize(ax,17.)
    # Write
    fig.tight_layout(pad=0.2,h_pad=0.,w_pad=0.1)
    pp.savefig()
    plt.close()

    # Finish
    print('tlk_coshalos: Wrote {:s}'.format(outfil))
    pp.close()
示例#3
0
def fig_images(outfil=None):

    from xastropy.obs import x_getsdssimg as xgs

    # Init COS-Halos sightline
    cos_halos = COSHalos()
    cos_halos.load_mega(skip_ions=True)
    #xdb.set_trace()

    # Start the plot
    if outfil is None:
        outfil = 'fig_coshalo_images.pdf'
    pp = PdfPages(outfil)

    dx = 0.2
    dy = 0.55
    imsize = 1.2

    for ss in range(5):
        fig = plt.figure(figsize=(8, 5))
        fig.clf()
        # Setup for dark
        xpsimp.dark_bkgd(plt)
        gs = gridspec.GridSpec(1, 1)

        # Axes
        ax = plt.subplot(gs[0, 0])
        ax.set_xlim(9.4, 11.7)
        #ax.xaxis.set_major_locator(plt.MultipleLocator(300.))
        ax.set_ylim(-13, -9)
        ax.set_ylabel('sSFR')
        ax.set_xlabel('log M*')

        # Plot
        if ss == 0:
            mstar = [
                cgm_abs.galaxy.stellar_mass for cgm_abs in cos_halos.cgm_abs
            ]
            sSFR = [
                np.log10(cgm_abs.galaxy.sfr[1]) - cgm_abs.galaxy.stellar_mass
                for cgm_abs in cos_halos.cgm_abs
            ]
            ax.scatter(mstar, sSFR)
        elif ss == 1:  # Show our first one
            cgm_abs = cos_halos[('J0950+4831', '177_27')]
            img, oBW = xgs.getimg(cgm_abs.galaxy.coord.ra.deg,
                                  cgm_abs.galaxy.coord.dec.deg,
                                  imsize=imsize)
            # Figure out placement
            ximg = cgm_abs.galaxy.stellar_mass
            yimg = np.log10(
                cgm_abs.galaxy.sfr[1]) - cgm_abs.galaxy.stellar_mass
            # Show
            ax.imshow(img,
                      extent=(ximg - dx, ximg + dx, yimg - dy, yimg + dy),
                      aspect=dx / dy)
        elif ss == 2:  # Show two
            cgm_list = [('J0950+4831', '177_27'), ('J1245+3356', '236_36')]
            for icgm in cgm_list:
                cgm_abs = cos_halos[icgm]
                img, oBW = xgs.getimg(cgm_abs.galaxy.coord.ra.deg,
                                      cgm_abs.galaxy.coord.dec.deg,
                                      imsize=imsize)
                # Figure out placement
                ximg = cgm_abs.galaxy.stellar_mass
                yimg = np.log10(
                    cgm_abs.galaxy.sfr[1]) - cgm_abs.galaxy.stellar_mass
                # Show
                ax.imshow(img,
                          extent=(ximg - dx, ximg + dx, yimg - dy, yimg + dy),
                          aspect=dx / dy)
        elif ss >= 3:  # Show half
            if ss == 3:
                iend = 20
            else:
                iend = -1
            for cgm_abs in cos_halos.cgm_abs[0:iend]:
                img, oBW = xgs.getimg(cgm_abs.galaxy.coord.ra.deg,
                                      cgm_abs.galaxy.coord.dec.deg,
                                      imsize=1.2)
                # Figure out placement
                ximg = cgm_abs.galaxy.stellar_mass
                yimg = np.log10(
                    cgm_abs.galaxy.sfr[1]) - cgm_abs.galaxy.stellar_mass
                # Show
                scl = 2.
                ax.imshow(img,
                          extent=(ximg - dx / scl, ximg + dx / scl,
                                  yimg - dy / scl, yimg + dy / scl),
                          aspect=dx / dy)

        xputils.set_fontsize(ax, 17.)
        # Write
        fig.tight_layout(pad=0.2, h_pad=0., w_pad=0.1)
        pp.savefig()
        plt.close()

    # Finish
    print('tlk_coshalos: Wrote {:s}'.format(outfil))
    pp.close()
示例#4
0
def fig_kin_measures(outfil=None):

    # Init COS-Halos sightline
    cos_halos = COSHalos()
    cos_halos.load_single( ('J1220+3853', '225_38') )
    cgm_abs = cos_halos.cgm_abs[0]
    #print('zem = {:g}'.format(cgm_abs.abs_sys.zem))

    HI = 972.5368*u.AA

    # ########################################
    # Finder (out of order to avoid PDF issues)
    #finder.main([cgm_abs.name, cgm_abs.galaxy.coord], imsize=2.*u.arcmin, show_circ=False)

    # Start the plot
    if outfil is None:
        outfil='fig_kin_measures.pdf'
    pp = PdfPages(outfil)

    # dv
    lclr = 'cyan'
    vmnx = np.array([-350.,200.])*u.km/u.s
    ymnx = (-0.05, 1.4)
    for ss in range(2):
        plt.figure(figsize=(5, 5))
        plt.clf()
        gs = gridspec.GridSpec(1, 1)
        xpsimp.dark_bkgd(plt)

        # Axes
        spec = cos_halos.load_bg_cos_spec(0, HI)

        ax = plt.subplot(gs[0,0])
        #ax.xaxis.set_minor_locator(plt.MultipleLocator(0.5))
        #ax.xaxis.set_major_locator(plt.MultipleLocator(1.))
        #ax.get_xaxis().get_major_formatter().set_useOffset(False)
        ax.set_xlim(vmnx.value)
        ax.set_ylim(ymnx)
        ax.set_xlabel('Relative Velocity (km/s)')
        ax.set_ylabel('Normalized Flux')

        # Zero line
        ax.plot(vmnx.value, (0.,0.), ':', color='lightgreen')
        ax.plot((0.,0.), ymnx, '--', color='lightgray')

        # Data
        velo = spec.relative_vel(HI*(cgm_abs.galaxy.z+1))
        ax.plot(velo, spec.flux, color='white', drawstyle='steps')

        # Label
        if ss == 0:
            ax.plot((-95,-95), ymnx, '--', color='cyan')
            ax.text(-50., 1.2, r'$\delta v$', ha='center', fontsize=21., color=lclr)
        elif ss == 1:
            ax.plot((-170,-170), ymnx, '-', color='cyan')
            ax.plot((60,60), ymnx, '-', color='cyan')
            ax.text(-50., 1.2, r'$\Delta v$', ha='center', fontsize=21., color=lclr)
        # Fonts
        xputils.set_fontsize(ax,17.)

        # Write
        plt.tight_layout(pad=0.2,h_pad=0.,w_pad=0.1)
        pp.savefig()
        plt.close()


    # ########################################
    # Simple HI stack plot
    trans = np.array([HI.value, 1031.9261])*u.AA
    lbls = [r'HI Ly$\gamma$', 'OVI 1031']

    plt.figure(figsize=(8, 5))
    plt.clf()
    gs = gridspec.GridSpec(2, 1)

    for qq,itran,lbl in zip(range(len(trans)),trans,lbls):
        # Load
        spec = cos_halos.load_bg_cos_spec(0, itran)
        # Axes
        ax = plt.subplot(gs[qq,0])
        ax.set_xlim(-500., 500.)
        ax.set_ylim(-0.1, 1.3)
        ax.set_ylabel('Normalized Flux')
        if qq == 0:
            ax.xaxis.set_ticklabels([])
        else:
            ax.set_xlabel('Relative Velocity (km/s)')
        # Velo
        velo = spec.relative_vel(itran*(cgm_abs.galaxy.z+1))
        ax.plot(velo, spec.flux, color='white', drawstyle='steps', lw=1.3)
        # Label
        ax.text(-400., 0.2, lbl, ha='left', fontsize=21., color=lclr)
        # Fonts
        xputils.set_fontsize(ax,17.)
    # Write
    plt.tight_layout(pad=0.2,h_pad=0.,w_pad=0.1)
    pp.savefig()
    plt.close()


    # Finish
    print('tlk_coshalos: Wrote {:s}'.format(outfil))
    pp.close()
示例#5
0
def fig_cosdwarf_hist(outfil=None, cos_dwarfs=None):

    # Init COS-Halos sightline
    if cos_dwarfs is None:
        cos_dwarfs = COSDwarfs()
        cos_dwarfs.load_mega(skip_ions=True)
        cos_dwarfs.load_abskin(flg=1)

    # ########################################
    # Finder (out of order to avoid PDF issues)
    #finder.main([cgm_abs.name, cgm_abs.galaxy.coord], imsize=2.*u.arcmin, show_circ=False)

    # Start the plot
    if outfil is None:
        outfil='fig_cosdwarf_kin_hist.pdf'
    pp = PdfPages(outfil)

    # dv
    lclr = 'yellow'
    plt.figure(figsize=(8, 4))
    plt.clf()
    xpsimp.dark_bkgd(plt)
    gs = gridspec.GridSpec(1, 2)

    for ss in range(2):
        ax = plt.subplot(gs[ss])
        #ax.xaxis.set_minor_locator(plt.MultipleLocator(0.5))
        #ax.get_xaxis().get_major_formatter().set_useOffset(False)
        if ss == 0:
            xmnx = [-400., 400.] # km/s
            ymnx = (0, 10)
            ax.set_xlabel(r'$\delta v$ (km/s)')
            binsz = 25.
            gdk = cos_dwarfs.abs_kin('HI')['flg'] > 0
            val = cos_dwarfs.abs_kin('HI')['delta_v'][gdk]
            ax.text(-200., 8, 'HI', ha='left', fontsize=21., color=lclr)
            ax.xaxis.set_major_locator(plt.MultipleLocator(200.))
        elif ss == 1:
            xmnx = [0., 400.] # km/s
            ymnx = (0, 10)
            ax.set_xlabel(r'$\Delta v$ (km/s)')
            val = cos_dwarfs.abs_kin('HI')['Dv'][gdk]
            ax.xaxis.set_major_locator(plt.MultipleLocator(100.))
        ax.set_ylabel('N')
        ax.set_xlim(xmnx)
        ax.set_ylim(ymnx)
        ax.minorticks_on()

        # Zero line
        #ax.plot(vmnx.value, (0.,0.), ':', color='lightgreen')
        #ax.plot((0.,0.), ymnx, '--', color='lightgray')

        # Histogram
        bins = np.arange(xmnx[0], xmnx[1] + binsz, binsz)
        ax.hist(val, bins=bins, color='yellow', histtype='stepfilled', 
            edgecolor='white')

        # Labels
        #ax.text(-50., 1.2, r'$\Delta v$', ha='center', fontsize=21., color=lclr)
        # Fonts
        xputils.set_fontsize(ax,17.)

    # Write
    plt.tight_layout(pad=0.2,h_pad=0.,w_pad=0.1)
    pp.savefig()
    plt.close()

    # Finish
    print('tlk_cgm_kin: Wrote {:s}'.format(outfil))
    pp.close()
示例#6
0
def fig_coshalo_corr(outfil=None, cos_halos=None):

    # Init COS-Halos sightline
    if cos_halos is None:
        cos_halos = COSHalos()
        cos_halos.load_mega(skip_ions=True)
        cos_halos.load_abskin(flg=1)

    # ########################################
    # Finder (out of order to avoid PDF issues)
    #finder.main([cgm_abs.name, cgm_abs.galaxy.coord], imsize=2.*u.arcmin, show_circ=False)

    # Start the plot
    if outfil is None:
        outfil='fig_coshalo_kin_corr.pdf'
    pp = PdfPages(outfil)

    # dv
    lclr = 'cyan'
    plt.figure(figsize=(8, 4))
    plt.clf()
    xpsimp.dark_bkgd(plt)
    gs = gridspec.GridSpec(2, 3)

    dv_ymnx = [-300., 290.] # km/s
    Dv_ymnx = [0., 410.] # km/s
    gdk = cos_halos.abs_kin('Metal')['flg'] > 0

    for ss in range(6):
        ax = plt.subplot(gs[ss%2,ss/2])
        #ax.xaxis.set_minor_locator(plt.MultipleLocator(0.5))
        #ax.get_xaxis().get_major_formatter().set_useOffset(False)
        if (ss/2) == 0: # dv vs. rho
            xmnx = (0, 150.)
            xlbl = r'$\rho$ (kpc)'
            xval = cos_halos.rho.value[gdk]
        elif (ss/2) == 1:
            xmnx = (9, 12.)
            xlbl = r'$\log M*$'
            xval = cos_halos.stellar_mass[gdk]
        elif (ss/2) == 2:
            xmnx = (-13., -8)
            xlbl = 'sSFR'
            sfr = [float(sfr[1]) for sfr in cos_halos.sfr]
            xval = (np.log10(sfr)-cos_halos.stellar_mass)[gdk]
        #
        ax.set_xlim(xmnx)
        if ss == 0:
            ax.set_ylabel(r'$\delta v$ (km/s)')
        elif ss == 1:
            ax.set_ylabel(r'$\Delta v$ (km/s)')

        if (ss%2) == 0:
            ax.xaxis.set_ticklabels([])
            ymnx = dv_ymnx
            yval = cos_halos.abs_kin('Metal')['delta_v'][gdk]
        else:
            ymnx = Dv_ymnx
            yval = cos_halos.abs_kin('Metal')['Dv'][gdk]
            ax.set_xlabel(xlbl)
        ax.set_ylim(ymnx)
        ax.minorticks_on()
        #ax.xaxis.set_major_locator(plt.MultipleLocator(100.))

        # Zero line
        #ax.plot(vmnx.value, (0.,0.), ':', color='lightgreen')
        #ax.plot((0.,0.), ymnx, '--', color='lightgray')

        # Scatter plot
        ax.scatter(xval, yval, marker='o', color='cyan')

        # Labels
        #ax.text(-50., 1.2, r'$\Delta v$', ha='center', fontsize=21., color=lclr)
        # Fonts
        xputils.set_fontsize(ax,13.)

    # Write
    plt.tight_layout(pad=0.2,h_pad=0.,w_pad=0.1)
    pp.savefig()
    plt.close()

    # Finish
    print('tlk_coshalos: Wrote {:s}'.format(outfil))
    pp.close()
示例#7
0
文件: tlk_qpq.py 项目: profxj/talks
def fig_cii_star(qpq7=None, outfil=None):
    """ Simple CII* plot for two systemsj
    """
    # Spec files

    # Load QPQ7
    #if qpq7 is None:
    #    qpq7 = equ.load_qpq(7)

    if outfil is None:
        outfil = 'fig_qpq_ciistar.pdf'
    pp = PdfPages(outfil)

    fig = plt.figure(figsize=(6.5, 5))
    plt.clf()
    gs = gridspec.GridSpec(2, 2)
    xpsimp.dark_bkgd(plt)

    qpq8_sys = ['J142758.73-012136.1', 'J120416.68+022110.9']
    #qpq8_sys = ['J120416.68+022110.9']
    qpq8_zfg = [2.2736, 2.4358]
    qpq8_vmnx = [(700, 880), (600, 770)]
    trans = [1334.5323, 1335.7077]
    lbls = ['CII 1334', 'CII* 1335']

    for qq, qsys in enumerate(qpq8_sys):
        # Load spectrum
        sdict = eqs.spec_wvobs(qsys,
                               trans[0] * (1 + qpq8_zfg[qq]) * u.AA,
                               high_res=2)
        spec = sdict['spec']
        spec.normalize(sdict['conti'])
        # Loop on transitions
        for jj, itrans in enumerate(trans):

            ax = plt.subplot(gs[jj, qq])
            ax.set_xlim(qpq8_vmnx[qq])
            ax.xaxis.set_major_locator(plt.MultipleLocator(50.))
            ax.set_ylim(-0.1, 1.2)
            ax.set_ylabel('Normalized Flux')
            if jj == 1:
                ax.set_xlabel('Relative Velocity (km/s)')
            else:
                ax.get_xaxis().set_ticks([])

            # Plot
            velo = spec.relative_vel(itrans * u.AA * (1 + qpq8_zfg[qq]))
            ax.plot(velo, spec.flux, color='white', drawstyle='steps')
            ax.plot(qpq8_vmnx[qq], [1.] * 2, '--', color='cyan')
            # Label
            ax.text(0.80,
                    0.10,
                    lbls[jj],
                    transform=ax.transAxes,
                    size='large',
                    ha='center',
                    color='yellow')

    # Write
    plt.tight_layout(pad=0.2, h_pad=0., w_pad=0.1)
    pp.savefig()
    pp.close()
    plt.close()
    print('Genereated {:s}'.format(outfil))
示例#8
0
文件: tlk_qpq.py 项目: profxj/talks
def fig_molecules():
    """ H2, Lya, CII plots
    """
    # Spec files

    # Load QPQ7
    #if qpq7 is None:
    #    qpq7 = equ.load_qpq(7)

    # LineList
    H2 = LineList('H2')
    CO_waves = [1447.3521, 1477.5649, 1509.7480]
    CO_lbls = ['CO 2-0', 'CO 1-0', 'CO 0-0']

    outfil = 'fig_qpq_molecules.pdf'
    pp = PdfPages(outfil)

    fig = plt.figure(figsize=(8.5, 4))
    plt.clf()
    gs = gridspec.GridSpec(2, 5)
    xpsimp.dark_bkgd(plt)

    qpq8_sys = ['J114436.65+095904.9', 'J142758.73-012136.1']
    qpq8_yrng = [(0., 1.2), (0., 1.2)]
    wvobs = [(4160, 4240.), (4735, 4950)]  # Lyman-Werner, CO
    #qpq8_sys = ['J120416.68+022110.9']
    qpq8_zfg = [2.973, 2.27616]
    trans = [1215.6701, 1334.5323]
    tvmnx = [(-400, 400), (-200, 200)]
    lbls = ['HI Lya', 'CII 1334']

    for qq, qsys in enumerate(qpq8_sys):
        # Load spectrum
        sdict = eqs.spec_wvobs(qsys, wvobs[qq][0] * u.AA, high_res=2)
        spec = sdict['spec']
        spec.normalize(sdict['conti'])
        if qq == 1:  # Smooth for presentation
            tmpspec = XSpectrum1D.from_tuple((spec.wavelength, spec.flux))
            spec = tmpspec.box_smooth(3)

        # Loop on standard transitions
        for jj, itrans in enumerate(trans):

            ax = plt.subplot(gs[qq, jj])
            ax.set_xlim(tvmnx[jj])
            ax.xaxis.set_major_locator(plt.MultipleLocator(200.))
            ax.set_ylim(-0.05, 1.2)
            if jj == 0:
                ax.set_ylabel('Flux')
            ax.set_xlabel('Velocity (km/s)')

            # Plot
            velo = spec.relative_vel(itrans * u.AA * (1 + qpq8_zfg[qq]))
            ax.plot(velo, spec.flux, color='white', drawstyle='steps')
            ax.plot(tvmnx[jj], [1.] * 2, '--', color='lightgreen')
            # Label
            ax.text(0.50,
                    0.90,
                    lbls[jj],
                    transform=ax.transAxes,
                    size='large',
                    ha='center',
                    color='yellow')
        # Molecules
        ax = plt.subplot(gs[qq, len(trans):])
        ax.set_xlim(wvobs[qq])
        ax.set_ylim(qpq8_yrng[qq])
        ax.set_xlabel('Wavelength (Angstroms)')
        ax.plot(spec.wavelength, spec.flux, color='white', drawstyle='steps')
        if qq == 0:  # Lyman-Werner
            wrlim = [iwv * u.AA / (1 + qpq8_zfg[qq]) for iwv in wvobs[qq]]
            gdlin = np.where((H2._fulltable['Jk'] < 7)
                             & (H2._fulltable['wrest'] > wrlim[0])
                             & (H2._fulltable['wrest'] < wrlim[1]))[0]
            for igd in gdlin:
                if H2._fulltable['Jk'][igd] <= 2:
                    clr = 'cyan'
                    do_lbl = True
                else:
                    clr = 'gray'
                    do_lbl = False
                ax.plot(
                    [H2._fulltable['wrest'][igd].value *
                     (1 + qpq8_zfg[qq])] * 2,
                    qpq8_yrng[qq],
                    '--',
                    color=clr)
                if do_lbl:
                    ax.text(H2._fulltable['wrest'][igd].value *
                            (1 + qpq8_zfg[qq]),
                            0.4,
                            H2._fulltable['name'][igd],
                            rotation=90.,
                            color=clr,
                            size=12)
        else:  # CO
            for jj, CO_wave in enumerate(CO_waves):
                ax.plot([CO_wave * (1 + qpq8_zfg[qq])] * 2,
                        qpq8_yrng[qq],
                        '--',
                        color='cyan')
                ax.text(CO_wave * (1 + qpq8_zfg[qq]),
                        0.4,
                        CO_lbls[jj],
                        rotation=90,
                        color='cyan',
                        size=12)

    # Write
    plt.tight_layout(pad=0.2, h_pad=0., w_pad=0.1)
    pp.savefig()
    pp.close()
    plt.close()
    print('Genereated {:s}'.format(outfil))