コード例 #1
0
    def initialize(self):
        self.dirappend = time.strftime("%Y%m%d_%H%M_%S", time.localtime())
        self.topdirectory = time.strftime("%Y%m%d", time.localtime())
        self.setupLogic()
        self.programPulser()

        totalBinningTime = self.seqP.recordTime + self.seqP.recoolTime + self.seqP.darkTime
        self.Binner = Binner(totalBinningTime, self.expP.binTime)
コード例 #2
0
 def initialize(self):
     self.dirappend = time.strftime("%Y%m%d_%H%M_%S",time.localtime())
     self.topdirectory = time.strftime("%Y%m%d",time.localtime())
     self.setupLogic()
     self.programPulser()
     
     totalBinningTime = 5e-3 + self.seqP.bufferTime + self.seqP.excitationTime
     self.Binner = Binner(totalBinningTime, self.expP.binTime)
コード例 #3
0
 def initialize(self):
     self.dirappend = time.strftime("%Y%m%d_%H%M_%S",time.localtime())
     self.topdirectory = time.strftime("%Y%m%d",time.localtime())
     self.setupLogic()
     self.programPulser()
     
     totalBinningTime = self.seqP.recordTime + self.seqP.recoolTime + self.seqP.darkTime
     self.Binner = Binner(totalBinningTime, self.expP.binTime)
コード例 #4
0
ファイル: ionSwapExperiment.py プロジェクト: HaeffnerLab/sqip
 def initialize(self):
     #get initialize count for crystallization
     self.xtal.get_initial_rate()
     #directory name and initial variables
     self.dirappend = time.strftime("%Y%b%d_%H%M_%S", time.localtime())
     self.topdirectory = time.strftime("%Y%b%d", time.localtime())
     self.setupLogic()
     #get the count rate for the crystal at the same parameters as crystallization
     self.pulser.select_dds_channel('110DP')
     self.pulser.frequency(self.seqP.xtal_freq_397)
     self.pulser.amplitude(self.seqP.xtal_ampl_397)
     self.pulser.select_dds_channel('866DP')
     self.pulser.amplitude(self.seqP.xtal_ampl_866)
     self.programPulser()
     #data processing setup
     self.Binner = Binner(self.seqP.recordTime, self.expP.binTime)
     self.Splicer = Splicer(self.seqP.startReadout, self.seqP.endReadout)
コード例 #5
0
ファイル: ionSwapExperiment.py プロジェクト: HaeffnerLab/sqip
 def initialize(self):
     #get initialize count for crystallization
     self.xtal.get_initial_rate()
     #directory name and initial variables
     self.dirappend = time.strftime("%Y%b%d_%H%M_%S",time.localtime())
     self.topdirectory = time.strftime("%Y%b%d",time.localtime())
     self.setupLogic()
     #get the count rate for the crystal at the same parameters as crystallization
     self.pulser.select_dds_channel('110DP')
     self.pulser.frequency(self.seqP.xtal_freq_397)
     self.pulser.amplitude(self.seqP.xtal_ampl_397)
     self.pulser.select_dds_channel('866DP')
     self.pulser.amplitude(self.seqP.xtal_ampl_866)
     self.programPulser()
     #data processing setup
     self.Binner = Binner(self.seqP.recordTime, self.expP.binTime)
     self.Splicer = Splicer(self.seqP.startReadout, self.seqP.endReadout)
コード例 #6
0
class DopplerRecooling():
    experimentName = 'Heating_rate_doppler'

    def __init__(self, seqParams, exprmtParams):
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49') # labwide network
        
        self.dv = self.cxn.data_vault
        self.pulser = self.cxn.pulser
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.Binner = None

    def initialize(self):
        self.dirappend = time.strftime("%Y%m%d_%H%M_%S",time.localtime())
        self.topdirectory = time.strftime("%Y%m%d",time.localtime())
        self.setupLogic()
        self.programPulser()
        
        totalBinningTime = self.seqP.recordTime + self.seqP.recoolTime + self.seqP.darkTime
        self.Binner = Binner(totalBinningTime, self.expP.binTime)

    def setupLogic(self):
        self.pulser.switch_auto('397sw', True) # High TTL corresponds to light ON

    def programPulser(self):
        seq = DopplerRecool(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['recordTime'] = seq.parameters.recordTime
        self.seqP['darkTime'] = seq.parameters.darkTime
        self.seqP['recoolTime'] = seq.parameters.recoolTime

    def run(self):
        self.initialize()
        self.sequence()
        self.finalize()
        print "done"

    def sequence(self):

        sP = self.seqP
        xP = self.expP

        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend], True)
        self.dv.new('binned_timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        self.dv.add_parameter('Window',['Binned Fluorescence'])
        self.dv.add_parameter('plotLive', True)        

        for iteration in range(xP.iterations):
            self.pulser.reset_timetags()
            self.pulser.start_single()
            self.pulser.wait_sequence_done()
            self.pulser.stop_sequence()

            timetags = self.pulser.get_timetags().asarray
            #print len(timetags)
            print len(timetags)
            self.Binner.add(timetags)

        # Recording data

        binX, binY = self.Binner.getBinned()
        data = numpy.vstack((binX,binY)).transpose()
        self.dv.add(data)
        print sum(binY)

        measureList = ['cavity397', 'cavity866', 'multiplexer397', 'multiplexer866', 'pulser']
        measureDict = dvParameters.measureParameters(self.cxn, self.cxnlab, measureList)

        dvParameters.saveParameters(self.dv, measureDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())


    def finalize(self):
        self.pulser.switch_auto('397sw')

    def __del__(self):
        self.cxn.disconnect()
コード例 #7
0
class WireVoltageModulation(SemaphoreExperiment):
    experimentName = 'Wire_Voltage_Modulation'

    def __init__(self, seqParams, exprmtParams):
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49') # labwide network
        
        self.dv = self.cxn.data_vault
        self.pulser = self.cxn.pulser
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.Binner = None

        self.experimentPath = ['Wire', 'WireVoltageModulation']
        self.experimentLabel = 'WireVoltageModulation'
        
        
    def initialize(self):
        self.dirappend = time.strftime("%Y%m%d_%H%M_%S",time.localtime())
        self.topdirectory = time.strftime("%Y%m%d",time.localtime())
        self.setupLogic()
        self.programPulser()
        
        totalBinningTime = 5e-3 + self.seqP.bufferTime + self.seqP.excitationTime
        self.Binner = Binner(totalBinningTime, self.expP.binTime)

    def setupLogic(self):
        self.pulser.switch_auto('wireVoltage', False)

    def programPulser(self):
        seq = wireVoltage(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['excitationTime'] = seq.parameters.excitationTime
        self.seqP['bufferTime'] = seq.parameters.bufferTime


    def setup_sequence_parameters(self):
        sequence_parameters = {}.fromkeys(sample_parameters.parameters)
        check = self.check_parameter

        sequence_paremters.update(common_values)

        sequence_parameters['excitationTime'] = self.check_parameter(self.p.excitationTime)
        sequence_parameters['bufferTime'] = self.check_parameter(self.p.bufferTime)

    def run(self):
        self.initialize()
        self.sequence()
        self.finalize()
        print "done"

    def sequence(self):

        sP = self.seqP
        xP = self.expP
        
        now = datetime.datetime.now()
        date = now.strftime("%Y%m%d")
        ti = now.strftime('%H%M%S')

        timetag_context = self.dv.context()
        self.dv.cd(['',date, self.experimentName, ti, 'binned'], True)
        self.dv.cd(['',date, self.experimentName, ti, 'timetags'], True, context = timetag_context)
        #self.dv.new('binned_timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        self.dv.new('timetags',[('Time', 'sec')], [('Iteration', 'Arb','Arb')] , context = timetag_context )

        numUpdates = 1

        for n in range(numUpdates):
            for iteration in range(xP.iterations / numUpdates):

                self.pulser.reset_timetags()
                self.pulser.start_single()
                self.pulser.wait_sequence_done()
                self.pulser.stop_sequence()
                timetags = self.pulser.get_timetags().asarray
                iterationUmber = (n*(xP.iterations/numUpdates) + iteration) * numpy.ones(len(timetags))
                timetag_raw = numpy.vstack((iterationUmber,timetags)).transpose()
                self.dv.add( timetag_raw, context=timetag_context)
                print n*(xP.iterations/numUpdates) + iteration
                self.Binner.add(timetags)
            
            self.dv.new('binned_timetags_' + str(n+1) + '_of_' + str(numUpdates),[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
            self.dv.add_parameter('Window',['Binned Fluorescence'])
            self.dv.add_parameter('plotLive', True)
            binX, binY = self.Binner.getBinned()
            data = numpy.vstack((binX,binY)).transpose()
            self.dv.add(data)
            
        measureList = ['cavity397', 'cavity866', 'multiplexer397', 'multiplexer866', 'pulser']
        measureDict = dvParameters.measureParameters(self.cxn, self.cxnlab, measureList)

        dvParameters.saveParameters(self.dv, measureDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())


    def finalize(self):
        self.pulser.switch_manual('wireVoltage',False)

    def __del__(self):
        self.cxn.disconnect()
コード例 #8
0
ファイル: ionSwapExperiment.py プロジェクト: HaeffnerLab/sqip
class IonSwap():
    ''''
    This experiment examines the probability of ions swapping places during heating. 
    After all cooling lights are switched off, the crystal is heated with far blue light for a variable time. Readout is meant to be done with a near resonant light.
    Typically vary:
        axial_heat
        heating delay
    Features:
        729nm used to tag one of the ions to detect position swapping. 854nm used to rebrigthen all the ions.
        866 is switched off together with 397 to prevent cooling when it's not intended
        automatic crystallization routine to reduce necessary time to crystallize the ions
    
    '''
    experimentName = 'IonSwap'
    
    def __init__(self, seqParams, exprtParams):
       #connect and define servers we'll be using
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49') #connection to labwide network
        self.dv = self.cxn.data_vault
        self.rf = self.cxn.trap_drive
        self.pulser = self.cxn.pulser
        self.pmt = self.cxn.normalpmtflow
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.xtal = Crystallizer(self.pulser, self.pmt, self.rf)
        self.Binner = None
        
    def initialize(self):
        #get initialize count for crystallization
        self.xtal.get_initial_rate()
        #directory name and initial variables
        self.dirappend = time.strftime("%Y%b%d_%H%M_%S",time.localtime())
        self.topdirectory = time.strftime("%Y%b%d",time.localtime())
        self.setupLogic()
        #get the count rate for the crystal at the same parameters as crystallization
        self.pulser.select_dds_channel('110DP')
        self.pulser.frequency(self.seqP.xtal_freq_397)
        self.pulser.amplitude(self.seqP.xtal_ampl_397)
        self.pulser.select_dds_channel('866DP')
        self.pulser.amplitude(self.seqP.xtal_ampl_866)
        self.programPulser()
        #data processing setup
        self.Binner = Binner(self.seqP.recordTime, self.expP.binTime)
        self.Splicer = Splicer(self.seqP.startReadout, self.seqP.endReadout)
        
    def setupCamera(self):
        # tell the camera to start waiting for data
        
        # height, width, iterations, numAnalyzedImages
        self.cxn.andor_ion_count.collect_data((self.expP.vend - self.expP.vstart + 1), (self.expP.hend - self.expP.hstart + 1), self.expP.iterations, self.expP.numAnalyzedImages)

    
    def setupLogic(self):
        self.pulser.switch_auto('axial',  True) #axial needs to be inverted, so that high TTL corresponds to light ON
        self.pulser.switch_auto('110DP',  False) #high TTL corresponds to light OFF
        self.pulser.switch_auto('866DP', False) #high TTL corresponds to light OFF
        self.pulser.switch_manual('crystallization',  False)
    
    def programPulser(self):
        seq = IonSwapBackground(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['recordTime'] = seq.parameters.recordTime
        self.seqP['startReadout'] = seq.parameters.startReadout
        self.seqP['endReadout'] = seq.parameters.endReadout
    
    def run(self):
        sP = self.seqP
        xP = self.expP
        initpower = self.rf.amplitude()
        self.rf.amplitude(xP.rf_power)
        time.sleep(xP.rf_settling_time)
        self.setupCamera()
        self.initialize()
        self.sequence()
        self.finalize()
        self.rf.amplitude(initpower)
        print 'DONE {}'.format(self.dirappend)

    def sequence(self):
        sP = self.seqP
        xP = self.expP
        #saving timetags
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend], True)
        self.dv.new('timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        #do iterations
        for iteration in range(xP.iterations):
            print 'recording trace {0} out of {1}'.format(iteration+1, xP.iterations)
            self.pulser.reset_timetags()
            self.pulser.start_single()
            self.pulser.wait_sequence_done()
            self.pulser.stop_sequence()
            timetags = self.pulser.get_timetags().asarray
            iters = iteration * numpy.ones_like(timetags) 
            self.dv.add(numpy.vstack((iters,timetags)).transpose())
            #add to binning of the entire sequence
            self.Binner.add(timetags)
            self.Splicer.add(timetags)
            #auto crystallization
            if xP.auto_crystal:
                success = self.xtal.auto_crystallize()
                if not success: break
        #adding readout counts to data vault:
        readout = self.Splicer.getList()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('readout',[('Iter', 'Number')], [('PMT counts','Counts/Sec','Counts/Sec')] )
        self.dv.add(readout)
        #adding binned fluorescence to data vault:
        binX, binY = self.Binner.getBinned()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('binned',[('Time', 'sec')], [('PMT counts','Arb','Arb')] )
        data = numpy.vstack((binX, binY)).transpose()
        self.dv.add(data)
        self.dv.add_parameter('Window',['Binned Fluorescence'])
        self.dv.add_parameter('plotLive',True)
        #adding histogram of counts to data vault
        binX, binY = self.Splicer.getHistogram()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('histogram',[('Time', 'sec')], [('PMT counts','Arb','Arb')] )
        data = numpy.vstack((binX, binY)).transpose()
        self.dv.add(data)
        self.dv.add_parameter('Window',['Histogram'])
#        self.dv.add_parameter('plotLive',True)
        # gathering parameters and adding them to data vault
        measureList = ['trapdrive','endcaps','compensation','dcoffsetonrf','cavity397','cavity866','multiplexer397','multiplexer866','axialDP', 'pulser']
        measuredDict = dvParameters.measureParameters(self.cxn, self.cxnlab, measureList)
        dvParameters.saveParameters(self.dv, measuredDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())
    
    def finalize(self):
        for name in ['axial', '110DP']:
            self.pulser.switch_manual(name)
        below, above = self.Splicer.getPercentage(self.expP.threshold)
        print '{0:.1f}% of samples are Melted, below threshold of {1} '.format(100 * below, self.expP.threshold)
        print '{0:.1f}% of samples are Crystallized, above threshold of {1} '.format(100 * above, self.expP.threshold)
    
    def __del__(self):
        self.cxn.disconnect()
コード例 #9
0
class WireVoltageModulation():
    experimentName = 'Wire_Voltage_Modulation'

    def __init__(self, seqParams, exprmtParams):
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49') # labwide network
        
        self.dv = self.cxn.data_vault
        self.pulser = self.cxn.pulser
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.Binner = None

    def initialize(self):
        self.dirappend = time.strftime("%Y%m%d_%H%M_%S",time.localtime())
        self.topdirectory = time.strftime("%Y%m%d",time.localtime())
        self.setupLogic()
        self.programPulser()
        
        totalBinningTime = 2*self.seqP.bufferTime + self.seqP.excitationTime
        self.Binner = Binner(totalBinningTime, self.expP.binTime)

    def setupLogic(self):
        self.pulser.switch_auto('wireVoltage', True)

    def programPulser(self):
        seq = wireVoltage(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['excitationTime'] = seq.parameters.excitationTime
        self.seqP['bufferTime'] = seq.parameters.bufferTime

    def run(self):
        self.initialize()
        self.sequence()
        self.finalize()
        print "done"

    def sequence(self):

        sP = self.seqP
        xP = self.expP
        
        now = datetime.datetime.now()
        date = now.strftime("%Y%m%d")
        ti = now.strftime('%H%M%S')
        print ti
        timetag_context = self.dv.context()
        self.dv.cd(['',date, self.experimentName, ti, 'binned'], True)
        self.dv.cd(['',date, self.experimentName, ti, 'timetags'], True, context = timetag_context)
        #self.dv.new('binned_timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        self.dv.new('timetags',[('Time', 'sec')], [('Iteration', 'Arb','Arb')] , context = timetag_context )

        timetags = []
        numUpdates = xP.iterations
        self.pulser.reset_timetags()
        for n in range(numUpdates):
            print n
            for iteration in range(xP.iterations / numUpdates):
                self.pulser.start_single()
                self.pulser.wait_sequence_done()
                self.pulser.stop_sequence()

            timetags.extend(self.pulser.get_timetags().asarray)
            self.pulser.reset_timetags()
    
        timetag_raw = numpy.vstack( ( numpy.ones(len(timetags)),timetags ) ).transpose()
        self.dv.add( timetag_raw, context=timetag_context )
        self.Binner.add(timetags, xP.iterations)
            
        self.dv.new('binned_timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        self.dv.add_parameter('Window',['Binned Fluorescence'])
        self.dv.add_parameter('plotLive', True)
        binX, binY = self.Binner.getBinned()
        data = numpy.vstack((binX,binY)).transpose()
        self.dv.add(data)
            
        measureList = ['cavity397', 'cavity866', 'multiplexer397', 'multiplexer866', 'pulser']
        measureDict = dvParameters.measureParameters(self.cxn, self.cxnlab, measureList)

        dvParameters.saveParameters(self.dv, measureDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())


    def finalize(self):
        self.pulser.switch_manual('wireVoltage',False)

    def __del__(self):
        self.cxn.disconnect()
コード例 #10
0
class LatentHeat():
    ''''
    This experiment involves studying the sharpness of crystal to cloud phase transition. 
    After all cooling lights are switched off, the crystal is heated with far blue light for a variable time. Readout is meant to be done with a near resonant light.
    Typically vary:
        axial_heat
        heating delay
    Features:
        independent control of hearing duration and waiting time afterwards
        866 is switched off together with 397 to prevent cooling when it's not intended
        automatic crystallization routine to reduce necessary time to crystallize the ions
        frequency switching during the sequence with the RS list mode
    '''
    experimentName = 'LatentHeat_Auto'
    
    def __init__(self, seqParams, exprtParams):
        #connect and define servers we'll be using
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49') #connection to labwide network
        self.dv = self.cxn.data_vault
        self.rf = self.cxn.trap_drive
        self.pulser = self.cxn.pulser
        self.pmt = self.cxn.normalpmtflow
        self.laserdac = self.cxn.laserdac
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.xtal = Crystallizer(self.pulser, self.pmt, self.rf)
        self.freqCorrect = FrequencyCorrector(self.pmt, self.laserdac)
        self.Binner = None
        
    def initialize(self):
        #get initialize count for crystallization
        self.xtal.get_initial_rate()
        #get initial count for frequency correction
        self.freqCorrect.get_initial_rate()
        #directory name and initial variables
        self.dirappend = time.strftime("%Y%b%d_%H%M_%S",time.localtime())
        self.topdirectory = time.strftime("%Y%b%d",time.localtime())
        self.setupLogic()
        #get the count rate for the crystal at the same parameters as crystallization
        self.pulser.select_dds_channel('110DP')
        self.pulser.frequency(T.Value(self.seqP.xtal_freq_397, 'MHz'))
        self.pulser.amplitude(T.Value(self.seqP.xtal_ampl_397, 'dBm'))
        self.pulser.select_dds_channel('866DP')
        self.pulser.amplitude(T.Value(self.seqP.xtal_ampl_866,'dBm'))
        self.programPulser()
        #data processing setup
        self.Binner = Binner(self.seqP.recordTime, self.expP.binTime)
        self.Splicer = Splicer(self.seqP.startReadout, self.seqP.endReadout)
        
    def setupLogic(self):
        self.pulser.switch_auto('axial',  True) #axial needs to be inverted, so that high TTL corresponds to light ON
        self.pulser.switch_auto('110DP',  False) #high TTL corresponds to light OFF
        self.pulser.switch_auto('866DP', False) #high TTL corresponds to light OFF
        self.pulser.switch_manual('crystallization',  False)
    
    def programPulser(self):
        seq = LatentHeatBackground(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['recordTime'] = seq.parameters.recordTime
        self.seqP['startReadout'] = seq.parameters.startReadout
        self.seqP['endReadout'] = seq.parameters.endReadout
    
    def run(self):
        sP = self.seqP
        xP = self.expP
        initpower = self.rf.amplitude()
        self.rf.amplitude(xP.rf_power)
        time.sleep(xP.rf_settling_time)
        self.initialize()
        self.sequence()
        self.finalize()
        self.rf.amplitude(initpower)
        print 'DONE {}'.format(self.dirappend)

    def sequence(self):
        sP = self.seqP
        xP = self.expP
        #saving timetags
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend], True)
        self.dv.new('timetags',[('Time', 'sec')],[('PMT counts','Arb','Arb')] )
        #do iterations
        for iteration in range(xP.iterations):
            print 'recording trace {0} out of {1}'.format(iteration+1, xP.iterations)
            self.pulser.reset_timetags()
            self.pulser.start_single()
            self.pulser.wait_sequence_done()
            self.pulser.stop_sequence()
            timetags = self.pulser.get_timetags().asarray
            iters = iteration * numpy.ones_like(timetags) 
            self.dv.add(numpy.vstack((iters,timetags)).transpose())
            #add to binning of the entire sequence
            self.Binner.add(timetags)
            self.Splicer.add(timetags)
            #auto crystallization
            if xP.auto_crystal:
                success = self.xtal.auto_crystallize()
                if not success: break
            #auto frequency correct
            if xP.freq_correct:
                if (xP.iterations % xP.freq_correct_interval == 0):
                    success = self.freqCorrect.auto_correct()
                    if not success: print 'Cant the drift, Boss'
            
        #adding readout counts to data vault:
        readout = self.Splicer.getList()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('readout',[('Iter', 'Number')], [('PMT counts','Counts/Sec','Counts/Sec')] )
        self.dv.add(readout)
        #adding binned fluorescence to data vault:
        binX, binY = self.Binner.getBinned()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('binned',[('Time', 'sec')], [('PMT counts','Arb','Arb')] )
        data = numpy.vstack((binX, binY)).transpose()
        self.dv.add(data)
        self.dv.add_parameter('Window',['Binned Fluorescence'])
        self.dv.add_parameter('plotLive',True)
        #adding histogram of counts to data vault
        binX, binY = self.Splicer.getHistogram()
        self.dv.cd(['','Experiments', self.experimentName, self.topdirectory, self.dirappend])
        self.dv.new('histogram',[('Time', 'sec')], [('PMT counts','Arb','Arb')] )
        data = numpy.vstack((binX, binY)).transpose()
        self.dv.add(data)
        self.dv.add_parameter('Window',['Histogram'])
        self.dv.add_parameter('plotLive',True)
        # gathering parameters and adding them to data vault
        measureList = ['trapdrive','endcaps','compensation','dcoffsetonrf','cavity397','cavity866','multiplexer397','multiplexer866','axialDP', 'pulser']
        measuredDict = dvParameters.measureParameters(self.cxn, self.cxnlab, measureList)
        dvParameters.saveParameters(self.dv, measuredDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())
    
    def finalize(self):
        for name in ['axial', '110DP']:
            self.pulser.switch_manual(name)
        below, above = self.Splicer.getPercentage(self.expP.threshold)
        print '{0:.1f}% of samples are Melted, below threshold of {1} '.format(100 * below, self.expP.threshold)
        print '{0:.1f}% of samples are Crystallized, above threshold of {1} '.format(100 * above, self.expP.threshold)
    
    def __del__(self):
        self.cxn.disconnect()
コード例 #11
0
class DopplerRecooling():
    experimentName = 'Heating_rate_doppler'

    def __init__(self, seqParams, exprmtParams):
        self.cxn = labrad.connect()
        self.cxnlab = labrad.connect('192.168.169.49')  # labwide network

        self.dv = self.cxn.data_vault
        self.pulser = self.cxn.pulser
        self.seqP = Bunch(**seqParams)
        self.expP = Bunch(**exprtParams)
        self.Binner = None

    def initialize(self):
        self.dirappend = time.strftime("%Y%m%d_%H%M_%S", time.localtime())
        self.topdirectory = time.strftime("%Y%m%d", time.localtime())
        self.setupLogic()
        self.programPulser()

        totalBinningTime = self.seqP.recordTime + self.seqP.recoolTime + self.seqP.darkTime
        self.Binner = Binner(totalBinningTime, self.expP.binTime)

    def setupLogic(self):
        self.pulser.switch_auto('397sw',
                                True)  # High TTL corresponds to light ON

    def programPulser(self):
        seq = DopplerRecool(self.pulser)
        self.pulser.new_sequence()
        seq.setVariables(**self.seqP.toDict())
        seq.defineSequence()
        self.pulser.program_sequence()
        self.seqP['recordTime'] = seq.parameters.recordTime
        self.seqP['darkTime'] = seq.parameters.darkTime
        self.seqP['recoolTime'] = seq.parameters.recoolTime

    def run(self):
        self.initialize()
        self.sequence()
        self.finalize()
        print "done"

    def sequence(self):

        sP = self.seqP
        xP = self.expP

        self.dv.cd([
            '', 'Experiments', self.experimentName, self.topdirectory,
            self.dirappend
        ], True)
        self.dv.new('binned_timetags', [('Time', 'sec')],
                    [('PMT counts', 'Arb', 'Arb')])
        self.dv.add_parameter('Window', ['Binned Fluorescence'])
        self.dv.add_parameter('plotLive', True)

        for iteration in range(xP.iterations):
            self.pulser.reset_timetags()
            self.pulser.start_single()
            self.pulser.wait_sequence_done()
            self.pulser.stop_sequence()

            timetags = self.pulser.get_timetags().asarray
            #print len(timetags)
            print len(timetags)
            self.Binner.add(timetags)

        # Recording data

        binX, binY = self.Binner.getBinned()
        data = numpy.vstack((binX, binY)).transpose()
        self.dv.add(data)
        print sum(binY)

        measureList = [
            'cavity397', 'cavity866', 'multiplexer397', 'multiplexer866',
            'pulser'
        ]
        measureDict = dvParameters.measureParameters(self.cxn, self.cxnlab,
                                                     measureList)

        dvParameters.saveParameters(self.dv, measureDict)
        dvParameters.saveParameters(self.dv, sP.toDict())
        dvParameters.saveParameters(self.dv, xP.toDict())

    def finalize(self):
        self.pulser.switch_auto('397sw')

    def __del__(self):
        self.cxn.disconnect()