當前位置: 首頁>>代碼示例>>Python>>正文


Python PropertySet.get方法代碼示例

本文整理匯總了Python中lsst.daf.base.PropertySet.get方法的典型用法代碼示例。如果您正苦於以下問題:Python PropertySet.get方法的具體用法?Python PropertySet.get怎麽用?Python PropertySet.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lsst.daf.base.PropertySet的用法示例。


在下文中一共展示了PropertySet.get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makeit

# 需要導入模塊: from lsst.daf.base import PropertySet [as 別名]
# 或者: from lsst.daf.base.PropertySet import get [as 別名]
def makeit(prefs, context, saveWcs=False, plot=dict()):
    """This is the python wrapper for the original psfex that reads SExtractor outputs"""
    # Create an array of PSFs (one PSF for each extension)
    if prefs.getVerboseType() != prefs.QUIET:
        print("----- %d input catalogues:" % prefs.getNcat())

    if saveWcs:                         # only needed for making plots
        wcssList = []

    fields = psfexLib.vectorField()
    for cat in prefs.getCatalogs():
        field = psfexLib.Field(cat)
        wcss = []
        wcssList.append(wcss)
        with pyfits.open(cat) as pf:
            for hdu in pf:
                if hdu.name == "PRIMARY":
                    pass
                elif hdu.name == "LDAC_IMHEAD":
                    hdr = hdu.data[0][0]    # the fits header from the original fits image
                    md = PropertySet()
                    for line in hdr:
                        try:
                            md.set(*splitFitsCard(line))
                        except AttributeError:
                            continue

                    if not md.exists("CRPIX1"):  # no WCS; try WCSA
                        for k in md.names():
                            if re.search(r"A$", k):
                                md.set(k[:-1], md.get(k))
                    wcs = afwImage.makeWcs(md)
                    naxis1, naxis2 = md.get("NAXIS1"), md.get("NAXIS2")
                elif hdu.name == "LDAC_OBJECTS":
                    nobj = len(hdu.data)

                    assert wcs, "LDAC_OBJECTS comes after LDAC_IMHEAD"
                    field.addExt(wcs, naxis1, naxis2, nobj)
                    if saveWcs:
                        wcss.append((wcs, naxis1, naxis2))
                    wcs = None

        field.finalize()
        fields.append(field)

    sets = psfexLib.vectorSet()
    for set in load_samples(prefs, context, plot=plot):
        sets.append(set)

    psfexLib.makeit(fields, sets)

    ret = [[f.getPsfs() for f in fields], sets]
    if saveWcs:
        ret.append(wcssList)

    return ret
開發者ID:lsst,項目名稱:meas_extensions_psfex,代碼行數:58,代碼來源:psfex.py


注:本文中的lsst.daf.base.PropertySet.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。