本文整理汇总了Python中lsst.daf.base.PropertySet.exists方法的典型用法代码示例。如果您正苦于以下问题:Python PropertySet.exists方法的具体用法?Python PropertySet.exists怎么用?Python PropertySet.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.daf.base.PropertySet
的用法示例。
在下文中一共展示了PropertySet.exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeit
# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import exists [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 fits.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.getScalar(k))
wcs = afwGeom.makeSkyWcs(md)
naxis1, naxis2 = md.getScalar("NAXIS1"), md.getScalar("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