def start(self, value=1): """triggers detector""" self.done = False self.runtime = -1 self._t0 = time.time() if value is None: value = self._val self.pv.put(value, callback=self.__onComplete) time.sleep(0.001) poll()
def __init__( self, prefix, mcs=None, outpvs=None, nmcas=4, nrois=4, rois=None, nscas=1, nmcs=4, use_unlabeled=False, use_full=False, ): if not prefix.endswith(":"): prefix = "%s:" % prefix self.nmcas, self.nrois = int(nmcas), int(nrois) self.nmcs, self.nscas = int(nmcs), int(nscas) self.use_full = use_full self.use_unlabeled = False DeviceCounter.__init__(self, prefix, rtype=None, outpvs=outpvs) prefix = self.prefix self._fields = [] self.extra_pvs = [] pvs = self._pvs = {} self._xsp3 = Xspress3(prefix) if rois is not None: self._xsp3.select_rois_to_save(rois) for imca in range(1, nmcas + 1): for iroi in range(1, nrois + 1): rhipv = "%sC%i_MCA_ROI%i_HLM" % (prefix, imca, iroi) rarpv = "%sC%i_ROI%i:ArrayData_RBV" % (prefix, imca, iroi) pvs[namepv] = PV(namepv) pvs[rhipv] = PV(rhipv) pvs[rarpv] = PV(rarpv) for isca in range(nscas): # these start counting at 0!! scapv = "%sC%i_SCA%i:Value_RBV" % (prefix, imca, isca) pvs[scapv] = PV(scapv) self.mcs_prefix = mcs if mcs is not None: for imcs in range(nmcs): # MCA arrays from MCS mcapv = "%smca%i.VAL" % (mcs, 1 + imcs) pvs[mcapv] = PV(mcapv) poll() time.sleep(0.01) self._get_counters()
def start(self, value=None): """triggers MCS in internal mode to trigger Xspress3""" self.done = False runtime = -1 self._t0 = time.time() self.xsp3_erase.put(1) if value is None: value = self._val self.xsp3_start.put(value) time.sleep(0.010) count = 0 while self.xsp3_ison.get() != 1 and count < 100: time.sleep(0.010) self.mcs_start.put(1, callback=self.__onComplete) time.sleep(0.001) poll()
def __init__(self, prefix, outpvs=None, nmcas=4, nrois=32, rois=None, search_all=False, use_net=False, use_unlabeled=False, use_full=False): if not prefix.endswith(':'): prefix = "%s:" % prefix # use roilist to limit ROI to those listed: roilist = None if rois is not None: roilist = [s.lower().strip() for s in rois] nmcas, nrois = int(nmcas), int(nrois) DeviceCounter.__init__(self, prefix, rtype=None, outpvs=outpvs) prefix = self.prefix fields = [] extras = [] for imca in range(1, nmcas+1): mca = 'mca%i' % imca dxp = 'dxp%i' % imca extras.extend([ ("%s.Calib_Offset" % mca, "%s%s.CALO" % (prefix, mca)), ("%s.Calib_Slope" % mca, "%s%s.CALS" % (prefix, mca)), ("%s.Calib_Quad" % mca, "%s%s.CALQ" % (prefix, mca)), ("%s.Peaking_Time" % dxp, "%s%s:PeakingTime" % (prefix, dxp)) ]) pvs = {} t0 = time.time() for imca in range(1, nmcas+1): mca = 'mca%i' % imca for i in range(nrois): for suf in ('NM', 'HI'): pvname = '%s%s.R%i%s' % (prefix, mca, i, suf) pvs[pvname] = PV(pvname) poll() time.sleep(0.001) for i in range(nrois): should_break = False for imca in range(1, nmcas+1): mca = 'mca%i' % imca namepv = '%s%s.R%iNM' % (prefix, mca, i) rhipv = '%s%s.R%iHI' % (prefix, mca, i) roi = pvs[namepv].get() if roilist is not None and roi.lower().strip() not in roilist: continue roi_hi = pvs[rhipv].get() label = '%s %s'% (roi, mca) if (roi is not None and (len(roi) > 0 and roi_hi > 0) or use_unlabeled): suff = '%s.R%i' % (mca, i) if use_net: suff = '%s.R%iN' % (mca, i) fields.append((suff, label)) if roi_hi < 1 and not search_all: should_break = True break if should_break: break for dsuff, dname in self._dxp_fields: for imca in range(1, nmcas +1): suff = 'dxp%i:%s' % (imca, dsuff) label = '%s%i' % (dname, imca) fields.append((suff, label)) if use_full: for imca in range(1, nmcas+1): mca = 'mca%i.VAL' % imca fields.append((mca, 'spectra%i' % imca)) self.extra_pvs = extras self.set_counters(fields)