Exemplo n.º 1
0
    def update(self):
        active, retCount = daq.AdcTransferGetStat(handle)
        bufCTR0 = self.readbuffer.reshape(-1, self.CHANCOUNT)[:, 0]
        self.curve1.setData(self.curvetime[:retCount], bufCTR0[:retCount])
        self.curve2.setData(self.Vt[:retCount], bufCTR0[:retCount])
        if retCount >= self.SCANS:  # For some reason if retCount is self.SCANS: doesn't work ???
            self.timer.stop()
            # Disarm when completed - placed inside this to avoid possible disarming even before acquiring desired data
            daq.AdcDisarm(handle)
            daq.DacWaveDisarm(handle, daqh.DddtLocal)
            print "Scan Completed\n"

            # buffer data format [CTR0, CTR1, CTR0, CTR1, CTR0, CTR1, ...]
            bufCTR0 = self.readbuffer.reshape(-1, self.CHANCOUNT)[:, 0]
            bufCTR1 = self.readbuffer.reshape(-1, self.CHANCOUNT)[:, 1]

            print "bufCTR0 (photon counts)", bufCTR0
            print "bufCTR1 (SYNC   counts)", bufCTR1
            np.savetxt("PhotonCounts.csv",
                       np.column_stack((bufCTR0, bufCTR1, self.DACwave)),
                       delimiter=",",
                       header="Photon Counts, SYNC, Voltage",
                       comments=" ")
Exemplo n.º 2
0
#Set to trigger immediatly
daq.SetTriggerEvent(handle, STARTSOURCE, DetsRisingEdge, channels[0], gains[0],
                    flags[0], DaqTypeAnalogLocal, 0, 0, DaqStartEvent)
#Set to stop when the requested number of scans is completed
daq.SetTriggerEvent(handle, STOPSOURCE, DetsRisingEdge, channels[0], gains[0],
                    flags[0], DaqTypeAnalogLocal, 0, 0, DaqStopEvent)
#begin data acquisition
print "Scanning...\n"
daq.AdcTransferStart(handle)
daq.AdcArm(handle)

active = 1
while not msvcrt.kbhit() and (active & DaafAcqActive):
    time.sleep(1)
    #transfer data into computer memory and halt acquisition when done
    active, retCount = daq.AdcTransferGetStat(handle)
    print active, retCount

daq.AdcDisarm(handle)
print "Scan Completed\n"

#close device connections
daq.Close(handle)

#convert the data to volts:
#DaqBoards convert all data to an unsigned, 16-bit number (range 0 to 65535).  Zero corresponds
#to the minimum voltage, which is -maxVolt if in bipolar mode, or zero if unipolar.
#65535 corresponds to maxVolt if bipolar, or 2 * maxVolt if unipolar.  Note that a voltage
#higher than the device's absolute range (+/-10V for DaqBoard3000 , +/-5V for other Daq* devices)
#can damage the device.  Setting flags and gain settings which indicate a voltage higher than
#the device's max, such as an unipolar, unscaled scan will result in an error before the scan