本文整理汇总了Python中lsst.daf.base.PropertySet.add方法的典型用法代码示例。如果您正苦于以下问题:Python PropertySet.add方法的具体用法?Python PropertySet.add怎么用?Python PropertySet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.daf.base.PropertySet
的用法示例。
在下文中一共展示了PropertySet.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testProcessDataEvent
# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import add [as 别名]
def testProcessDataEvent(self):
with self.joboffice.bb.queues:
self.assertEquals(self.joboffice.bb.queues.dataAvailable.length(), 0)
ps = PropertySet()
ps.set("pipelineName", "PostISR")
ps.set("STATUS", "available")
ds = self.testDatasetFromProperty()
ps.add("dataset", serializePolicy(ds.toPolicy()))
for i in xrange(1,4):
ds = copy.deepcopy(ds)
ds.ids["ampid"] += 1
ps.add("dataset", serializePolicy(ds.toPolicy()))
devent = StatusEvent("testing", originatorId, ps)
# pdb.set_trace()
self.joboffice.processDataEvent(devent)
with self.joboffice.bb.queues:
self.assertEquals(self.joboffice.bb.queues.dataAvailable.length(), 4)
self.assertEquals(self.joboffice.bb.queues.jobsPossible.length(), 1)
job = self.joboffice.bb.queues.jobsPossible.get(0)
self.assertEquals(job.getName(), "Job-1")
self.assertEquals(job.triggerHandler.getNeededDatasetCount(), 12)
示例2: makeJobCommandEvent
# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import add [as 别名]
def makeJobCommandEvent(self, job, pipeline, runId=""):
"""
create a CommandEvent to send to a pipeline instructing it to
commence working on the given job.
"""
props = PropertySet()
for ds in job.getInputDatasets():
props.add("inputs", serializePolicy(ds.toPolicy()))
for ds in job.getOutputDatasets():
props.add("outputs", serializePolicy(ds.toPolicy()))
props.set("identity", serializePolicy(job.getJobIdentity().toPolicy()))
props.set("STATUS", "job:assign")
props.set("name", job.getName())
return CommandEvent(runId, self.originatorId, pipeline, props)
示例3: _EventFactory
# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import add [as 别名]
class _EventFactory(object):
def __init__(self, runid, props=None):
"""
create a generic event factor
"""
self.runid = runid
if isinstance(props, PropertySet):
self.props = props
else:
self.props = PropertySet()
if isinstance(props, dict):
for key in props.keys():
self.props.set(key, props[key])
def create(self):
"""create a new instance of the event"""
return ev.Event(self.runid, self.props)
def setRunId(self, id):
"""set the Run ID"""
self.runid = runid
def getRunId(self):
"""set the Run ID"""
return self.runid
def setProperty(self, name, val):
"""set the value of a named property"""
self.props.set(name, val)
def getProperty(self, name):
"""get the value of a named property"""
return self.props.getString(name)
def addDataset(self, propname, ds):
"""add a dataset to the event"""
self.props.add(propname, serializeDataset(ds))
def getDatasets(self, propname):
"""return the datasets attached to the event"""
return unserializeDatasetList(self.props.getArrayString(propname))
示例4: makeWcs
# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import add [as 别名]
def makeWcs(pixelScale, crPixPos, crValCoord, posAng=afwGeom.Angle(0.0), doFlipX=False, projection="TAN",
radDecCSys="ICRS", equinox=2000):
"""Make a Wcs
@param[in] pixelScale: desired scale, as sky/pixel, an afwGeom.Angle
@param[in] crPixPos: crPix for WCS, using the LSST standard; a pair of floats
@param[in] crValCoord: crVal for WCS (afwCoord.Coord)
@param[in] posAng: position angle (afwGeom.Angle)
@param[in] doFlipX: flip X axis?
@param[in] projection: WCS projection (e.g. "TAN" or "STG")
"""
if len(projection) != 3:
raise RuntimeError("projection=%r; must have length 3" % (projection,))
ctypeList = [("%-5s%3s" % (("RA", "DEC")[i], projection)).replace(" ", "-")
for i in range(2)]
ps = PropertySet()
crPixFits = [ind + 1.0 for ind in crPixPos] # convert pix position to FITS standard
crValDeg = crValCoord.getPosition(afwGeom.degrees)
posAngRad = posAng.asRadians()
pixelScaleDeg = pixelScale.asDegrees()
print("pixelScale = %s deg = %s rad" % (pixelScale.asDegrees(), pixelScale.asRadians()))
print("crPixPos = ", crPixPos)
print("crVal = %s deg = %s rad" % (crValCoord.getPosition(afwGeom.degrees),
crValCoord.getPosition(afwGeom.radians)))
cdMat = np.array([[ math.cos(posAngRad), math.sin(posAngRad)],
[-math.sin(posAngRad), math.cos(posAngRad)]], dtype=float) * pixelScaleDeg
if doFlipX:
cdMat[:,0] = -cdMat[:,0]
for i in range(2):
ip1 = i + 1
ps.add("CTYPE%1d" % (ip1,), ctypeList[i])
ps.add("CRPIX%1d" % (ip1,), crPixFits[i])
ps.add("CRVAL%1d" % (ip1,), crValDeg[i])
ps.add("RADESYS", radDecCSys)
ps.add("EQUINOX", equinox)
ps.add("CD1_1", cdMat[0, 0])
ps.add("CD2_1", cdMat[1, 0])
ps.add("CD1_2", cdMat[0, 1])
ps.add("CD2_2", cdMat[1, 1])
return afwImage.makeWcs(ps)