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


Python base.PropertySet類代碼示例

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


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

示例1: makeit

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,代碼行數:57,代碼來源:psfex.py

示例2: stopWorkflow

    def stopWorkflow(self, urgency):
        log.debug("VanillaCondorWorkflowMonitor:stopWorkflow")
        transmit = events.EventTransmitter(self._eventBrokerHost, self._shutdownTopic)
        
        root = PropertySet()
        root.setInt("level",urgency)
        root.setString("STATUS","shut things down")

        event = events.CommandEvent(self.runid, self.originatorId, 0, root)
        transmit.publishEvent(event)
開發者ID:jonathansick-shadow,項目名稱:ctrl_orca,代碼行數:10,代碼來源:VanillaCondorWorkflowMonitor.py

示例3: testProcessDataEvent

    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,代碼行數:26,代碼來源:testJobOffice.py

示例4: finalMessageReceived

    def finalMessageReceived(self, propSet):
        log = propSet.get("LOGGER")
        if log != "orca.control":
            return False
        status = propSet.get("STATUS")
        if status != "eol":
            return False

        eventSystem = events.EventSystem.getDefaultEventSystem()
        id = eventSystem.createOriginatorId()
        root = PropertySet()
        root.setString("logger.status", "done")
        root.setInt("logger.pid", os.getpid())
        event = events.StatusEvent(self.runid, id, root)
        self.transmitter.publishEvent(event)
        return True
開發者ID:jonathansick-shadow,項目名稱:ctrl_orca,代碼行數:16,代碼來源:Logger.py

示例5: testReceiveReadyPipelines

    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,代碼行數:17,代碼來源:testJobOffice.py

示例6: process

    def process(self):
        clipboard = self.inputQueue.getNextDataset()

        eventName = self._policy.get("inputEvent")
        event = clipboard.get(eventName)
        visitId = event.get("visitId")
        exposureId = event.get("exposureId")

        ccdId = clipboard.get("ccdId")
        ampId = clipboard.get("ampId")

        fpaExposureId = (long(visitId) << 1) + exposureId
        ccdExposureId = (fpaExposureId << 8) + ccdId
        ampExposureId = (ccdExposureId << 6) + ampId

        clipboard.put("visitId", visitId)

        exposureMetadata = PropertySet()
        exposureMetadata.setInt("filterId",
                self.lookupFilterId(event.get("filter")))
        exposureMetadata.setLongLong("fpaExposureId", fpaExposureId)
        exposureMetadata.setLongLong("ccdExposureId", ccdExposureId)
        exposureMetadata.setLongLong("ampExposureId", ampExposureId)
        clipboard.put("exposureMetadata" + str(exposureId), exposureMetadata)

        self.outputQueue.addDataset(clipboard)
開發者ID:jonathansick-shadow,項目名稱:ctrl_dc3pipe,代碼行數:26,代碼來源:ExposureMetadataStage.py

示例7: testSubst

    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,代碼行數:20,代碼來源:LogicalLocation.py

示例8: sendEvent

 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,代碼行數:17,代碼來源:CombinedReceive.py

示例9: __init__

    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])
開發者ID:jonathansick-shadow,項目名稱:ctrl_sched,代碼行數:13,代碼來源:utils.py

示例10: testToPipelineQueueItem

    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,代碼行數:12,代碼來源:testJobOffice.py

示例11: _EventFactory

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,代碼行數:40,代碼來源:utils.py

示例12: testProcessJobDoneEvents

    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,代碼行數:23,代碼來源:testJobOffice.py

示例13: testProcessJobDoneEvent

    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,代碼行數:24,代碼來源:testJobOffice.py

示例14: preprocess

    def preprocess(self):
        self.activeClipboard = self.inputQueue.getNextDataset()

        eventName = self._policy.get("inputEvent")
        event = self.activeClipboard.get(eventName)
        visitId = event.get("visitId")
        exposureId = event.get("exposureId")

        fpaExposureId = (long(visitId) << 1) + exposureId

        visit = PropertySet()
        visit.setInt("visitId", visitId)
        visit.setLongLong("exposureId", fpaExposureId)
        self.activeClipboard.put("visit" + str(exposureId), visit)

        rawFpaExposure = PropertySet()
        rawFpaExposure.setLongLong("rawFPAExposureId", fpaExposureId)
        rawFpaExposure.set("ra", event.get("ra"))
        rawFpaExposure.set("decl", event.get("decl"))
        rawFpaExposure.set("filterId",
                self.lookupFilterId(event.get("filter")))
        rawFpaExposure.set("equinox", event.get("equinox"))
        rawFpaExposure.set("dateObs", DateTime(event.get("dateObs")))
        rawFpaExposure.set("mjdObs", DateTime(event.get("dateObs")).mjd())
        rawFpaExposure.set("expTime", event.get("expTime"))
        rawFpaExposure.set("airmass", event.get("airmass"))
        self.activeClipboard.put("fpaExposure" + str(exposureId), rawFpaExposure)
開發者ID:jonathansick-shadow,項目名稱:ctrl_dc3pipe,代碼行數:27,代碼來源:ExposureMetadataStage.py

示例15: sendFilterableStatusEvent

    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,代碼行數:18,代碼來源:ComplexData.py


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