当前位置: 首页>>代码示例>>Python>>正文


Python AbsComponent.Ref方法代码示例

本文整理汇总了Python中linetools.isgm.abscomponent.AbsComponent.Ref方法的典型用法代码示例。如果您正苦于以下问题:Python AbsComponent.Ref方法的具体用法?Python AbsComponent.Ref怎么用?Python AbsComponent.Ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在linetools.isgm.abscomponent.AbsComponent的用法示例。


在下文中一共展示了AbsComponent.Ref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: p11

# 需要导入模块: from linetools.isgm.abscomponent import AbsComponent [as 别名]
# 或者: from linetools.isgm.abscomponent.AbsComponent import Ref [as 别名]
def p11():
    """ Ingest Prochaska et al. 2011 CGM survey
    """
    # Low z OVI summary
    ovi_file = pyigm.__path__[0] + "/data/CGM/P11/lowovidat.fits"
    ovidat = Table.read(ovi_file)
    qso_radec = SkyCoord(ra=ovidat["QSO_RA"], dec=ovidat["QSO_DEC"], unit=(u.hourangle, u.deg))
    qso_nms = np.array([row["QSO"].strip() for row in ovidat])

    # CGM Survey
    p11 = CGMAbsSurvey(survey="P11", ref="Prochaska+11")

    # Dwarfs
    cgm_dwarf_file = pyigm.__path__[0] + "/data/CGM/P11/dwarf_galabs_strct.fits"
    cgm_dwarfs = Table.read(cgm_dwarf_file)
    # sub L*
    cgm_subls_file = pyigm.__path__[0] + "/data/CGM/P11/subls_galabs_strct.fits"
    cgm_subls = Table.read(cgm_subls_file)
    # L*
    cgm_lstar_file = pyigm.__path__[0] + "/data/CGM/P11/lstar_galabs_strct.fits"
    cgm_lstar = Table.read(cgm_lstar_file)

    # Loop on subsets
    for subset in [cgm_dwarfs, cgm_subls, cgm_lstar]:
        for row in subset:
            # RA, DEC
            # Galaxy
            gal = Galaxy((row["RA"], row["DEC"]), z=row["Z"])
            gal.Lstar = row["DDEC"]
            gal.type = row["GAL_TYPE"]
            # IGMSys
            mtqso = np.where(qso_nms == row["FIELD"].strip())[0]
            if len(mtqso) != 1:
                pdb.set_trace()
                raise ValueError("No Field match")
            igmsys = IGMSystem(qso_radec[mtqso[0]], row["Z"], (-400.0, 400.0) * u.km / u.s)
            # HI
            if row["MAG"][2] > 0.0:
                # Lya
                lya = AbsLine(1215.67 * u.AA, z=float(row["MAG"][3]))
                lya.attrib["EW"] = row["MAG"][4] / 1e3 * u.AA
                if row["MAG"][5] >= 99.0:
                    lya.attrib["flag_EW"] = 3
                else:
                    lya.attrib["flag_EW"] = 1
                lya.attrib["sig_EW"] = row["MAG"][5] / 1e3 * u.AA
                # Ref
                lya.attrib["Ref"] = int(row["MAG"][2])
                # HI component
                if row["MAG"][9] <= 0.0:
                    flagN = 3
                elif row["MAG"][9] > 9.0:
                    flagN = 2
                else:
                    flagN = 1
                HIcomp = AbsComponent(
                    qso_radec[mtqso[0]],
                    (1, 1),
                    float(row["MAG"][3]),
                    (-400, 400) * u.km / u.s,
                    Ntup=(flagN, row["MAG"][8], row["MAG"][9]),
                )
                HIcomp._abslines.append(lya)
                igmsys._components.append(HIcomp)
            # OVI
            if row["MAGERR"][2] > 0.0:
                # OVI 1031
                ovi1031 = None
                if row["MAGERR"][4] > 0.0:
                    ovi1031 = AbsLine(1031.9261 * u.AA, z=float(row["MAGERR"][3]))
                    if row["MAGERR"][5] >= 99.0:
                        ovi1031.attrib["flag_EW"] = 3
                    else:
                        ovi1031.attrib["flag_EW"] = 1
                    ovi1031.attrib["EW"] = row["MAGERR"][4] / 1e3 * u.AA
                    ovi1031.attrib["sig_EW"] = row["MAGERR"][5] / 1e3 * u.AA
                # OVI component
                if row["MAGERR"][9] <= 0.0:
                    flagN = 3
                elif row["MAGERR"][9] > 9.0:
                    flagN = 2
                else:
                    flagN = 1
                OVIcomp = AbsComponent(
                    qso_radec[mtqso[0]],
                    (8, 6),
                    float(row["MAGERR"][3]),
                    (-400, 400) * u.km / u.s,
                    Ntup=(flagN, row["MAGERR"][8], row["MAGERR"][9]),
                )
                if ovi1031 is not None:
                    OVIcomp._abslines.append(ovi1031)
                # Ref
                OVIcomp.Ref = int(row["MAG"][2])
                igmsys._components.append(OVIcomp)
            # CGM
            cgmabs = CGMAbsSys(gal, igmsys, chk_lowz=False)
            p11.cgm_abs.append(cgmabs)
    # Write tarball
    out_file = pyigm.__path__[0] + "/data/CGM/P11/P11_sys.tar"
#.........这里部分代码省略.........
开发者ID:pyigm,项目名称:pyigm,代码行数:103,代码来源:ingest_lit.py


注:本文中的linetools.isgm.abscomponent.AbsComponent.Ref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。