Esempio n. 1
0
    def get_mca(self, mca=1, with_rois=True):
        if self._xsp3 is None:
            self.connect()
            time.sleep(0.5)

        emca = self._xsp3.mcas[mca - 1]
        if with_rois:
            emca.get_rois()

        counts = self.get_array(mca=mca)
        if max(counts) < 1.0:
            counts = 0.5 * np.ones(len(counts))
            counts[0] = 2.0

        thismca = MCA(counts=counts, offset=0.0, slope=0.01)
        thismca.energy = self.get_energy()
        thismca.counts = counts
        thismca.quad = 0.0
        thismca.rois = []
        if with_rois:
            for eroi in emca.rois:
                thismca.rois.append(
                    ROI(name=eroi.name,
                        address=eroi._prefix,
                        left=eroi.left,
                        right=eroi.right))
        return thismca
Esempio n. 2
0
    def get_mca(self, mca=1, with_rois=True):
        if self._xsp3 is None:
            self.connect()
            time.sleep(0.5)

        emca = self._xsp3.mcas[mca-1]
        if with_rois:
            emca.get_rois()

        counts = self.get_array(mca=mca)
        if max(counts) < 1.0:
            counts    = 0.5*np.ones(len(counts))
            counts[0] = 2.0

        thismca = MCA(counts=counts, offset=0.0, slope=0.01)
        thismca.energy = self.get_energy()
        thismca.counts = counts
        thismca.quad   = 0.0
        thismca.rois = []
        if with_rois:
            for eroi in emca.rois:
                thismca.rois.append(ROI(name=eroi.name, address=eroi._prefix,
                                        left=eroi.left, right=eroi.right))
        return thismca