def run(self, cxn, context):
        scan_param = self.parameters.CalibrationScans.heating_rate_scan_interval
        self.scan = scan_methods.simple_scan(scan_param, 'us')

        times = []
        ts = []
        ps = []

        for i, heat_time in enumerate(self.scan):
            times.append(heat_time)
            replace = TreeDict.fromdict({
                'Heating.background_heating_time':
                heat_time,
            })
            self.rabi_flopping.set_parameters(replace)
            t, ex = self.rabi_flopping.run(cxn, context)
            t = np.array(t)
            ex = np.array(ex)
            ex = ex.flatten()
            ts.append(t)
            ps.append(ex)
            if heat_time == 0:
                time_2pi = self.fitter.calc_2pitime(t, ex)
            self.rabi_flopping.finalize(cxn, context)

        trap_freq = self.parameters.TrapFrequencies.axial_frequency['Hz']
        rate = self.fitter.fit(times, ts, ps, trap_freq, time_2pi)
        print 'here is the rate'
        print rate
Ejemplo n.º 2
0
    def run(self, cxn, context):
        scan_param = self.parameters.CalibrationScans.heating_rate_scan_interval
        self.scan = scan_methods.simple_scan(scan_param, 'us')

        for i, heat_time in enumerate(self.scan):
            replace = TreeDict.fromdict({
                'Heating.background_heating_time':
                heat_time,
            })
            self.rabi_flopping.set_parameters(replace)
            self.rabi_flopping.run(cxn, context)
            self.rabi_flopping.finalize(cxn, context)
Ejemplo n.º 3
0
    def run(self, cxn, context):

        dv_args = {
            'output_size': 1,
            'experiment_name': self.name,
            'window_name': 'current',
            'dataset_name': 'Heating_Rate'
        }

        scan_methods.setup_data_vault(cxn, self.save_context, dv_args)

        scan_param = self.parameters.CalibrationScans.heating_rate_scan_interval

        self.scan = scan_methods.simple_scan(scan_param, 'us')

        for i, heat_time in enumerate(self.scan):
            #should_stop = self.pause_or_stop()
            #if should_stop: break

            replace = TreeDict.fromdict({
                'Heating.background_heating_time':
                heat_time,
                'Documentation.sequence':
                'calibrate_heating_rates',
            })

            self.calibrate_temp.set_parameters(replace)
            #self.calibrate_temp.set_progress_limits(0, 33.0)

            (rsb_ex, bsb_ex) = self.calibrate_temp.run(cxn, context)

            #This only works for 1st order sideband
            #fac = rsb_ex/bsb_ex

            #correction for higher order sidebands
            #k=abs(self.parameters.Spectrum.sideband_selection[2])
            #print "sideband order:",k
            #fac= (rsb_ex/bsb_ex)**(1./k)

            nbar = fac / (1.0 - fac)

            submission = [heat_time['us']]
            submission.extend([nbar])
            #print nbar
            self.dv.add(submission, context=self.save_context)
Ejemplo n.º 4
0
    def run(self, cxn, context):	
        scan_param = self.parameters.CalibrationScans.heating_rate_scan_interval
        self.scan = scan_methods.simple_scan(scan_param, 'us')
	
	##parameters needed for fitting
	trap_freq = self.parameters.TrapFrequencies.axial_frequency *1e6 #in Hz	
	nbar = 10 #guess for nbar
	excitation_scaling=1.0 #change this if OP not working
	plot_flops=True #set to true to plot the flops
	theta=11.5 #the0 angle of the laser with the trap axis
	time_2pi=40 #guess for 2pi time in microseconds
	etas = [fitter.calc_eta(trap_freq,theta)]
	print etas
	delta={}
	
        for i,heat_time in enumerate(self.scan):
            replace = TreeDict.fromdict({
                                    'Heating.background_heating_time':heat_time,
                                       })
            self.rabi_flopping.set_parameters(replace)
            self.rabi_flopping.run(cxn, context)
	    self.rabi_flopping.finalize(cxn, context)
Ejemplo n.º 5
0
    def run(self, cxn, context):

        dv_args = {'output_size': 2,
                    'experiment_name' : self.name,
                    'window_name': 'heatingrate',
                    'dataset_name' : 'Heating_Rate'
                    }

        scan_methods.setup_data_vault(cxn, self.save_context, dv_args)

        scan_param = self.parameters.CalibrationScans.heating_rate_scan_interval

        self.scan = scan_methods.simple_scan(scan_param, 'us')

        nbarlist=[]
        nbarerrlist=[]
        heattimes=[]
        for i,heat_time in enumerate(self.scan):
            #should_stop = self.pause_or_stop()
            #if should_stop: break
            
            #####
            #figure out how to put a caliballlines in here with 0 heating time
            #replace = TreeDict.fromdict({
             #                       'Heating.background_heating_time':WithUnit(0.0, 'ms')
              #                         })
            #self.calib_all_lines.set_parameters(replace)
            #self.calib_all_lines.run(cxn, context)


            ####
            
            replace = TreeDict.fromdict({
                                    'Heating.background_heating_time':heat_time,
                                    'Documentation.sequence':'calibrate_heating_rates',
                                       })
            self.rabi_flopping.set_parameters(replace)
            

            t,ex = self.rabi_flopping.run(cxn, context)
            t = np.array(t)
            ex = np.array(ex)
            ex = ex.flatten()
            trap_freq = self.parameters.TrapFrequencies.axial_frequency['Hz']
            
            
            if heat_time == 0:
                time_2pi = self.fitter.calc_2pitime(t,ex)
                excitation_scaling = 0.99
                nbar,nbarerr,time_2pi,excitation_scaling = self.fitter.fit_single_flop(heat_time,t,ex,trap_freq,time_2pi,excitation_scaling)
            else:
                nbar,nbarerr,temp,temp1 = self.fitter.fit_single_flop(heat_time,t,ex,trap_freq,time_2pi,excitation_scaling)

            
            #submission is for the data vault for grapher. not sure how to add the error in

            
            submission = [heat_time['ms']]
            submission.extend([nbar,nbarerr])
    
            if not math.isnan(nbarerr):
                self.dv.add(submission, context = self.save_context)
                heattimes.append(heat_time['ms'])
                nbarlist.append(nbar)
                nbarerrlist.append(nbarerr)
            
            self.rabi_flopping.finalize(cxn, context)
        print 'here are the results'
        print nbarlist
        print nbarerrlist
        rate, stderr = self.fitter.fit_heating_rate(heattimes, nbarlist, nbarerrlist)

        try:
            f = open('/home/sqip/HeatingRateData/rates' + datetime.date.today().strftime('%d_%m_%y')+'.txt','a')
        except IOError:
            print 'creating new file'
            f = open('/home/sqip/HeatingRateData/rates' + datetime.date.today().strftime('%d_%m_%y')+'.txt','w')
            

        f.write("%.2f" % rate + ',' + "%.2f" % stderr + ',' + datetime.datetime.now().strftime("%X")+"\n")
        print f
        f.close()