Exemplo n.º 1
0
 def PH_run(self):
     """Runs in own thread - reads data via Picoharp counters"""
     self.measure_data = pl.zeros((50, ))
     try:
         self.ph = ph.PicoHarp()
         if self.dt < 0.1:
             print "Integration time too short! Changed to 0.1s"
             self.dt = 0.1
             self.time.setValue(0.1)
         while self.running:
             nbOfIntegrations = self.dt / 100
             newCount = 0
             for i in range(nbOfIntegrations):
                 time.sleep(0.1)  # 100 ms gate time on PicoHarp counters
                 rates = self.ph.getCountRates()
                 if self.detID == 0:
                     newCount += rates[
                         0] * 0.1  # counts on 100 ms integration bin
                 elif self.detID == 1:
                     newCount += rates[
                         1] * 0.1  # counts on 100 ms integration bin
                 else:
                     newCount += sum(
                         rates) * 0.1  # counts on 100 ms integration bin
             self.measure_data[0] = newCount / (float(self.dt) / 1000)
             self.measure_data = pl.roll(self.measure_data, -1)
             #print self.measure_data
             self.gotdata = True
     finally:
         self.running = False
         self.ph.close()
         self.btn.setEnabled(True)
 def PH_run(self):   
     """Runs in own thread - reads data via Picoharp counters"""
     
     self.v_step = pl.array([pl.linspace(self.v_i, self.v_f, self.no_of_steps) for i in range(self.repeats)]).flatten()
     try:
         self.ph = ph.PicoHarp()
         for v in self.v_step:
             if self.running:
                 self.voltT.setDACvoltage(voltage=float(v) / 1000, outputId=2)
                 
                 nbOfIntegrations = self.dt / 100
                 newCount = 0
                 for i in range(nbOfIntegrations):
                     time.sleep(0.1)  # 100 ms gate time on PicoHarp counters
                     rates = self.ph.getCountRates()
                     newCount += sum(rates) * 0.1  # counts on 100 ms integration bin
                 
                 self.buff.append(newCount / (float(self.dt) / 1000))
                 self.gotdata = True
             else:
                 break
                 
     finally:
         self.running = False
         self.ph.close()
         self.voltT.close()
 def startSelectedInstrument(self, counterDevice):
     if counterDevice == self.NI_BOX:
         self.NI_init_ctr(intTime=self.dt)
     elif counterDevice == self.MULTIMETER:
         self.multi = AgilentMultimeter(r'GPIB0::23::INSTR')
     elif counterDevice == self.PICOHARP:
         self.ph = ph.PicoHarp()
     else:
         self.tag = createTimeTagger()
         self.tag.setTriggerLevel(0, 0.1)
         self.tag.setTriggerLevel(1, 0.1)
         self.tag.autoCalibration()