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


Python PropertySet.set方法代码示例

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


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

示例1: testProcessDataEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [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)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:28,代码来源:testJobOffice.py

示例2: makeit

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [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
开发者ID:HyperSuprime-Cam,项目名称:meas_extensions_psfex,代码行数:59,代码来源:psfex.py

示例3: sendEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
 def sendEvent(self, brokerName, topic):
     """Send an Event."""
     trans = events.EventTransmitter(brokerName, topic)
     
     root = PropertySet()
     root.set(events.Event.TOPIC, topic)
     root.set("myname","myname")
     root.set(events.StatusEvent.STATUS, "my special status")
     root.set(events.StatusEvent.RUNID,"srptestrun")
     root.set("bazinga", "sheldon")
     
     originatorId = events.LocationId()
     event = events.StatusEvent("srptestrun", originatorId, root)
 
     # ok...now publish it
     trans.publishEvent(event)
开发者ID:jonathansick-shadow,项目名称:ctrl_events,代码行数:18,代码来源:StatusEventOriginator.py

示例4: testProcessDataEvents

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testProcessDataEvents(self):
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.dataAvailable.length(), 0)

        trx = EventTransmitter(brokerhost, "PostISRAvailable")

        ps = PropertySet()
        ps.set("pipelineName", "PostISR")
        ps.set("STATUS", "available")

        ds = self.testDatasetFromProperty()
        ds.ids["ampid"] = 0;
        ps.set("dataset", serializePolicy(ds.toPolicy()))
        for i in xrange(15):
            ps.set("dataset", serializePolicy(ds.toPolicy()))
            devent = StatusEvent("testing", originatorId, ps)

            trx.publishEvent(devent);

            ds = copy.deepcopy(ds)
            ds.ids["ampid"] += 1

        # Wait for events
        time.sleep(2.0)

        # pdb.set_trace()
        self.joboffice.processDataEvents()
        
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.dataAvailable.length(),15)
          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(), 1)

        ps.set("dataset", serializePolicy(ds.toPolicy()))
        devent = StatusEvent("testing", originatorId, ps)
        trx.publishEvent(devent);
        time.sleep(2.0)
        self.joboffice.processDataEvents()
        
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.dataAvailable.length(),16)
          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(), 0)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:49,代码来源:testJobOffice.py

示例5: testReceiveReadyPipelines

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testReceiveReadyPipelines(self):
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.pipelinesReady.length(),0)

        ps = PropertySet()
        ps.set("pipelineName", "PostISR")
        ps.set("STATUS", "job:ready")
        pevent = StatusEvent("testing", originatorId, ps)
        
        trx = EventTransmitter(brokerhost, "CcdAssemblyJob")
        trx.publishEvent(pevent)
        time.sleep(2.0)

        self.joboffice.receiveReadyPipelines()

        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.pipelinesReady.length(),1)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:19,代码来源:testJobOffice.py

示例6: sendFilterableStatusEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def sendFilterableStatusEvent(self, broker, topic):
        trans = events.EventTransmitter(broker, topic)

        root = PropertySet()
        root.set(events.Event.TOPIC, topic)
        root.set("myname","myname")
        root.set(events.Event.STATUS, "my special status")

        filter = PropertySet()
        filter.set("FOO", "bar")
        filter.set("PLOUGH", 123)

        eventSystem = events.EventSystem.getDefaultEventSystem();
        locationID = eventSystem.createOriginatorId()
        event = events.StatusEvent(locationID, root, filter)

        # ok...now publish it
        trans.publishEvent(event)
开发者ID:jonathansick-shadow,项目名称:ctrl_events,代码行数:20,代码来源:ComplexData.py

示例7: sendPlainStatusEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def sendPlainStatusEvent(self, broker, topic, runID=None):
        trans = events.EventTransmitter(broker, topic)
        
        root = PropertySet()
        root.set(events.Event.TOPIC, topic)
        root.set("myname","myname")
        root.set(events.Event.STATUS, "my special status")
        root.set("logger.status", "my logger special status")
        root.set("logger.pid", "1")
        
        eventSystem = events.EventSystem.getDefaultEventSystem();
        locationID = eventSystem.createOriginatorId()
        if runID is None:
            event = events.StatusEvent(locationID, root)
        else:
            event = events.StatusEvent(runID, locationID, root)

        # ok...now publish it
        trans.publishEvent(event)
开发者ID:jonathansick-shadow,项目名称:ctrl_events,代码行数:21,代码来源:StatusEvent.py

示例8: createWcs

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
 def createWcs():
     metadata = PropertySet()
     metadata.set("SIMPLE", "T")
     metadata.set("BITPIX", -32)
     metadata.set("NAXIS", 2)
     metadata.set("NAXIS1", 1024)
     metadata.set("NAXIS2", 1153)
     metadata.set("RADESYS", 'FK5')
     metadata.set("EQUINOX", 2000.)
     metadata.setDouble("CRVAL1", 215.604025685476)
     metadata.setDouble("CRVAL2", 53.1595451514076)
     metadata.setDouble("CRPIX1", 1109.99981456774)
     metadata.setDouble("CRPIX2", 560.018167811613)
     metadata.set("CTYPE1", 'RA---SIN')
     metadata.set("CTYPE2", 'DEC--SIN')
     metadata.setDouble("CD1_1", 5.10808596133527E-05)
     metadata.setDouble("CD1_2", 1.85579539217196E-07)
     metadata.setDouble("CD2_2", -5.10281493481982E-05)
     metadata.setDouble("CD2_1", -8.27440751733828E-07)
     return makeSkyWcs(metadata)
开发者ID:HyperSuprime-Cam,项目名称:afw,代码行数:22,代码来源:test_exposureTable.py

示例9: testSubst

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testSubst(self):
        ad = PropertySet()
        ad.set("foo", "bar")
        ad.setInt("x", 3)
        LogicalLocation.setLocationMap(ad)
        l = LogicalLocation("%(foo)xx")
        self.assertEqual(l.locString(), "barxx")
        l = LogicalLocation("%(x)foo")
        self.assertEqual(l.locString(), "3foo")
        l = LogicalLocation("yy%04d(x)yy")
        self.assertEqual(l.locString(), "yy0003yy")

        ad2 = PropertySet()
        ad2.set("foo", "baz")
        ad2.setInt("y", 2009)
        l = LogicalLocation("%(foo)%(x)%(y)", ad2)
        self.assertEqual(l.locString(), "bar32009")
        LogicalLocation.setLocationMap(PropertySet())
        l = LogicalLocation("%(foo)%3d(y)", ad2)
        self.assertEqual(l.locString(), "baz2009")
开发者ID:lsst-dm,项目名称:bp,代码行数:22,代码来源:LogicalLocation.py

示例10: _EventFactory

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [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))
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:42,代码来源:utils.py

示例11: sendEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
 def sendEvent(self, broker, topic):
     trans = events.EventTransmitter(broker, topic)
     
     root = PropertySet()
     root.set(events.Event.TOPIC,topic)
     root.set("myname","myname")
     root.set(events.Event.STATUS, "my special status")
     root.set(events.Event.RUNID,"srptestrun")
     
     event = events.Event("srptestrun", root)
 
     # wait a short time so we can see the difference between the time 
     # the event is created and the time it is published
     time.sleep(2)
 
     # ok...now publish it
     trans.publishEvent(event)
开发者ID:jonathansick-shadow,项目名称:ctrl_events,代码行数:19,代码来源:CombinedReceive.py

示例12: testToPipelineQueueItem

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testToPipelineQueueItem(self):
        pipelineName = "ccdassembly"
        ps = PropertySet()
        ps.set("pipelineName", pipelineName)
        ps.set("STATUS", "done")
        ps.set("RUNID", "testing")
        pevent = StatusEvent("testing", originatorId, ps)

        item = self.joboffice.toPipelineQueueItem(pevent)
        self.assertEquals(item.getName(), pipelineName)
        self.assertEquals(item.getProperty("status"), "done")
        self.assertEquals(item.getRunId(), "testing")
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:14,代码来源:testJobOffice.py

示例13: makeJobCommandEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [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)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:16,代码来源:jobOffice.py

示例14: testProcessJobDoneEvents

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testProcessJobDoneEvents(self):
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),0)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),0)

        self.testAllocateJobs()
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),1)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),0)

        ps = PropertySet()
        ps.set("pipelineName", "PostISR")
        ps.set("STATUS", "job:done")
        ps.set("success", True)
        pevent = StatusEvent("testing", originatorId, ps)
        trx = EventTransmitter(brokerhost, "CcdAssemblyJob")
        trx.publishEvent(pevent)
        time.sleep(2.0)

        self.joboffice.processDoneJobs()
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),0)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),1)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:25,代码来源:testJobOffice.py

示例15: testProcessJobDoneEvent

# 需要导入模块: from lsst.daf.base import PropertySet [as 别名]
# 或者: from lsst.daf.base.PropertySet import set [as 别名]
    def testProcessJobDoneEvent(self):
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),0)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),0)

        ps = PropertySet()
        ps.set("pipelineName", "PostISR")
        ps.set("STATUS", "job:done")
        ps.set("success", True)
        pevent = StatusEvent("testing", originatorId, ps)

        self.assert_(not self.joboffice.processJobDoneEvent(pevent))

        self.testAllocateJobs()
        
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),1)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),0)

        # pdb.set_trace()
        self.assert_(self.joboffice.processJobDoneEvent(pevent))
        with self.joboffice.bb.queues:
          self.assertEquals(self.joboffice.bb.queues.jobsInProgress.length(),0)
          self.assertEquals(self.joboffice.bb.queues.jobsDone.length(),1)
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:26,代码来源:testJobOffice.py


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