本文整理匯總了Python中lsst.daf.base.PropertySet.getScalar方法的典型用法代碼示例。如果您正苦於以下問題:Python PropertySet.getScalar方法的具體用法?Python PropertySet.getScalar怎麽用?Python PropertySet.getScalar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lsst.daf.base.PropertySet
的用法示例。
在下文中一共展示了PropertySet.getScalar方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: makeit
# 需要導入模塊: from lsst.daf.base import PropertySet [as 別名]
# 或者: from lsst.daf.base.PropertySet import getScalar [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