def run_finally(cls, cxn, parameters_dict, all_data, freq_data): # print "switching the 866 back to ON" cxn.pulser.switch_manual('866DP', True) # print " running finally the CalibLine1 !!!!" # print " sequence ident" , int(cxn.scriptscanner.get_running()[0][0]) # Should find a better way to do this global carr_1_global # for the multiple case we summ the probabilities, this also # reduces the dimension to 1 for single ion case try: all_data = all_data.sum(1) except ValueError: print "error with the data" return peak_fit = cls.gaussian_fit(freq_data, all_data) # print " this is the peak " # print peak_fit if not peak_fit: carr_1_global = None print "4321" ident = int(cxn.scriptscanner.get_running()[-1][0]) print "stoping the sequence ident", ident cxn.scriptscanner.stop_sequence(ident) return peak_fit = U(peak_fit, "MHz") carr_1 = peak_fit line_1 = parameters_dict.DriftTracker.line_selection_1 #print " peak 1 {}", carr_1 #print " peak 2 {}", carr_2 if parameters_dict.Display.relative_frequencies: #print "using relative units" carr_1 = carr_1 + parameters_dict.Carriers[ carrier_translation[line_1]] return 0.8
def sequence(self): p = self.parameters extra_935 = U(100.0, 'us') self.addDDS('OpticalPumpingSP', self.start, p.OpticalPumping.duration, U(110.0 + 4.0, 'MHz'), U(-15.9, 'dBm')) self.addDDS( '369DP', self.start, p.OpticalPumping.duration, p.Transitions.main_cooling_369 / 2 + U(200.0 - 4.0 / 2.0, 'MHz') + p.OpticalPumping.detuning / 2.0, p.OpticalPumping.power) self.addDDS('935SP', self.start, p.OpticalPumping.duration + extra_935, U(320.0, 'MHz'), p.OpticalPumping.repump_power) self.addDDS('760SP', self.start, p.OpticalPumping.duration, U(320.0, 'MHz'), U(-2.0, 'dBm')) self.end = self.start + p.OpticalPumping.duration + extra_935
def sequence(self): p = self.parameters pi_time_plus = p.Pi_times.qubit_plus DDS_plus = p.ddsDefaults.qubit_dds_freq - p.Transitions.qubit_plus ttl_delay = p.MicrowaveInterrogation.ttl_switch_delay self.addTTL('MicrowaveTTL', self.start + ttl_delay, pi_time_plus) self.addDDS('Microwave_qubit', self.start, pi_time_plus + ttl_delay, DDS_plus, p.MicrowaveInterrogation.power, U(0.0, 'deg')) self.end = self.start + pi_time_plus + ttl_delay
def run(self, cxn, context): self.p['Modes.state_detection_mode'] = 'Standard' self.p['MicrowaveInterrogation.duration'] = self.p.Pi_times.qubit_0 self.setup_datavault( 'time', 'probability') # gives the x and y names to Data Vault self.setup_grapher('Quadrupole Rabi Flopping') self.times = self.get_scan_list(self.p.QuadrupoleRabiFlopping.scan, 'us') for i, duration in enumerate(self.times): should_break = self.update_progress(i / float(len(self.times))) if should_break: break self.p['QuadrupoleInterrogation.duration'] = U(duration, 'us') self.program_pulser(sequence) [counts] = self.run_sequence(max_runs=1000, num=1) hist = self.process_data(counts) self.plot_hist(hist) pop = self.get_pop(counts) self.dv.add(duration, pop)
def on_minmax_change(self): sender = self.sender() idx = 0 if sender.objectName() == "min" else 1 self.item[1][idx] = U(sender.value(), self.units) r = self.cxn.registry p = self.cxn.parametervault r.cd("", "Servers", "Parameter Vault", self.collection) for region_index in [0, 1]: try: widget = self.parent.param_widget_items[region_index][ self.collection, self.name] widget.min_ = self.item[1][ 0] #U(float(self.item[1][0]), self.units) widget.max_ = self.item[1][ 1] #U(float(self.item[1][1]), self.units) widget.state = self.item[1] except KeyError: pass r.set(self.name, self.item) p.set_parameter(self.collection, self.name, self.item, True)
def run(self, cxn, context): qubit = self.p.Line_Selection.qubit reps = self.p.MicrowaveInterrogation.repetitions if qubit == 'qubit_0': pi_time = self.p.Pi_times.qubit_0 elif qubit == 'qubit_plus': pi_time = self.p.Pi_times.qubit_plus elif qubit == 'qubit_minus': pi_time = self.p.Pi_times.qubit_minus self.p['MicrowaveInterrogation.duration'] = reps * pi_time self.p['MicrowaveInterrogation.detuning'] = U(0.0, 'kHz') self.p['Modes.state_detection_mode'] = 'Standard' self.setup_prob_datavault() i = 0 self.program_pulser(sequence) while True: i += 1 points_per_hist = self.p.StandardStateDetection.points_per_histogram [counts_bright, counts_dark] = self.run_sequence(max_runs=500, num=2) if i % points_per_hist == 0: hist_bright = self.process_data(counts_bright) hist_dark = self.process_data(counts_dark) self.plot_hist(hist_bright) self.plot_hist(hist_dark) self.plot_prob(i, counts_bright, counts_dark) should_break = self.update_progress(np.random.random()) old_params = dict(self.p.iteritems()) if should_break: break self.reload_all_parameters() self.p = self.parameters if self.p != old_params: self.program_pulser(sequence)
def run_finally(cls, cxn, parameters_dict, data, x): print "switching the 866 back to ON" cxn.pulser.switch_manual('866DP', True) data = data.mean(axis=1) for i, p in enumerate(data): if p > 0.5: ind1 = i - 1 ind2 = i p1 = data[ind1] p2 = data[ind2] x1 = x[ind1] x2 = x[ind2] break pi_time = (x1 + (0.5 - p1) * (x2 - x1) / (p2 - p1)) * 2 pi_time = U(pi_time, 'us') print "line_2_pi_time = ", pi_time cxn.scriptscanner.set_parameter('DriftTrackerRamsey', 'line_2_pi_time', pi_time) return pi_time
def run(self, cxn, context): self.p['Modes.state_detection_mode'] = 'Shelving' self.setup_datavault('time', 'probability') self.setup_grapher('Shelving') self.times = self.get_scan_list(self.p.DeshelvingRate.scan, 'ms') for i, duration in enumerate(self.times): should_break = self.update_progress(i / float(len(self.times))) if should_break: break self.p['VariableDeshelving.duration'] = U(duration, 'ms') self.program_pulser(sequence) [doppler_counts, detection_counts] = self.run_sequence(num=2, max_runs=500) deshelving_errors = np.where( doppler_counts <= self.p.Shelving_Doppler_Cooling.doppler_counts_threshold) detection_counts = np.delete(detection_counts, deshelving_errors) hist = self.process_data(detection_counts) self.plot_hist(hist, folder_name='Shelving_Histogram') pop = self.get_pop(detection_counts) self.dv.add(duration, 1 - pop)
def sequence(self): from StatePreparation import StatePreparation from subsequences.RabiExcitation_2ions import RabiExcitation_2ions from subsequences.StateReadout import StateReadout from subsequences.TurnOffAll import TurnOffAll ## calculate the scan params # rf = self.parameters.RabiFlopping #freq_729=self.calc_freq(rf.line_selection) # freq_729=self.calc_freq(rf.line_selection , rf.selection_sideband , rf.order) #print "Rabi flopping 729 freq is {}".format(freq_729) #print "Rabi flopping duration is {}".format(rf.duration) # building the sequence self.end = U(10., 'us') #self.addSequence(TurnOffAll) self.addSequence(TurnOffAll) self.addSequence(StatePreparation) self.addSequence(RabiExcitation_2ions) self.addSequence(StateReadout)
def main_loop(self): self.current_voltage = self.pzt.set_voltage(2)[1] i = 0 self.arduino.flushInput() val = self.arduino.readline()[0:-2] for i in range(64): milli_volts = 0 k = 0 if val: milli_volts += 5 * int(1000 * int(val) / (2**10 - 1)) k += 1 else: continue if k != 0: milli_volts = milli_volts / float(k) self.lcdwidget.display(milli_volts) error = int(self.lock_set.value()) - int(val) to_write = 0.0001 * error + float(self.current_voltage) if ((0 < to_write < 50) and self.lock): self.pzt.set_voltage(2, U(to_write, 'V'))
def run_finally(cls,cxn, parameters_dict, all_data, freq_data): global carr_1_global try: all_data = all_data.sum(1) except ValueError: print "error with the data" return peak_fit = cls.gaussian_fit(freq_data, all_data) if not peak_fit: carr_1_global = None ident = int(cxn.scriptscanner.get_running()[0][0]) print "Can't fit peak, stopping sequence {}".format(ident) cxn.scriptscanner.stop_sequence(ident) return print "peak_fit{}".format(peak_fit) peak_fit = U(peak_fit,'MHz') carr_1_global = peak_fit
def initServer(self): try: rm = visa.ResourceManager() self.dev = rm.open_resource(rm.list_resources()[0]) print "Successfully connected" print "Device is", self.dev.query('*IDN?') except: print "Could not connect" #initialize off self.dev.write('OUTPut OFF') self.dev.output = False self.dev.write('FUNCtion Square') self.dev.frequency = U( float(self.dev.query('FREQuency?')) * 10**-6, 'MHz') # setting the amplitude units to dBm self.dev.write('VOLTage:UNIT DBM') # self.lock = DeferredLock() self.set_TTL()
def sequence(self): from StatePreparation import StatePreparation from subsequences.OpticalPumping import OpticalPumping from subsequences.MotionAnalysis import MotionAnalysis from subsequences.StateReadout import StateReadout from subsequences.TurnOffAll import TurnOffAll from subsequences.RabiExcitation import RabiExcitation # additional optical pumping duratrion duration_op = self.parameters.SidebandCooling.sideband_cooling_optical_pumping_duration ## calculate the final diagnosis params rf = self.parameters.RabiFlopping #freq_729=self.calc_freq(rf.line_selection) freq_729 = self.calc_freq(rf.line_selection, rf.selection_sideband, rf.order) self.end = U(10., 'us') self.addSequence(TurnOffAll) self.addSequence(StatePreparation) # 397 excitation self.addSequence(MotionAnalysis) # small optical pumping after the motion excitation self.addSequence( OpticalPumping, { 'OpticalPumpingContinuous.optical_pumping_continuous_duration': duration_op }) # 729 excitation to transfer the motional DOF to the electronic DOF # running the excitation from the Rabi flopping self.addSequence( RabiExcitation, { 'Excitation_729.rabi_excitation_frequency': freq_729, 'Excitation_729.rabi_excitation_amplitude': rf.rabi_amplitude_729, 'Excitation_729.rabi_excitation_duration': rf.duration }) self.addSequence(StateReadout)
def run(self, cxn, context): if self.p.MicrowaveInterrogation.AC_line_trigger == 'On': self.pulser.line_trigger_state(True) self.pulser.line_trigger_duration( self.p.MicrowaveInterrogation.delay_from_line_trigger) scan_parameter = self.p.MicrowaveRamsey.scan_type mode = self.p.Modes.state_detection_mode if mode == 'Shelving': self.setup_coherence_shelving_datavault() self.setup_datavault( 'time', 'probability') # gives the x and y names to Data Vault self.setup_grapher('Microwave Ramsey Experiment') self.dark_time = self.get_scan_list( self.p.CoherenceMeasurement.delay_times, 'ms') for i, dark_time in enumerate(self.dark_time): should_break = self.update_progress(i / float(len(self.dark_time))) if should_break: break self.p['EmptySequence.duration'] = U(dark_time, 'ms') self.program_pulser(sequence) if mode == 'Shelving': [doppler_counts, detection_counts] = self.run_sequence(max_runs=500, num=2) self.dv.add(np.column_stack( (np.arange(len(doppler_counts)), np.array(detection_counts), np.array(doppler_counts))), context=self.counts_context) errors = np.where( doppler_counts <= self.p.Shelving_Doppler_Cooling.doppler_counts_threshold) counts = np.delete(detection_counts, errors) else: [counts] = self.run_sequence() if i % self.p.StandardStateDetection.points_per_histogram == 0: hist = self.process_data(counts) self.plot_hist(hist) pop = self.get_pop(counts) self.dv.add(dark_time, pop)
def run(self, cxn, context): self.setup_datavault('time', 'probability') self.setup_grapher('DeshelvingRate') self.times = self.get_scan_list(self.p.DeshelvingRate.scan, 'ms') for i, duration in enumerate(self.times): should_break = self.update_progress(i / float(len(self.times))) if should_break: break self.p['VariableDeshelving.duration'] = U(duration, 'ms') self.program_pulser(sequence) [doppler_counts, detection_counts] = self.run_sequence(num=2, max_runs=500) deshelving_errors = np.where( doppler_counts <= self.p.ShelvingDopplerCooling.doppler_counts_threshold) print deshelving_errors detection_counts = np.delete(detection_counts, deshelving_errors) if i % self.p.StandardStateDetection.points_per_histogram == 0: hist = self.process_data(detection_counts) self.plot_hist(hist) pop = self.get_pop(detection_counts) self.dv.add(duration, 1 - pop)
def sequence(self): from StatePreparation import StatePreparation from subsequences.RabiExcitation import RabiExcitation from subsequences.StateReadout import StateReadout p = self.parameters line2 = p.DriftTracker.line_selection_2 freq729 = self.calc_freq(line2) freq729 = freq729 + p.Excitation729.frequency729 amp729 = p.CalibrateLines.amplitude729_line2 channel729 = p.CalibrateLines.channel_729 dur729 = p.CalibrateLines.duration729 self.addSequence(StatePreparation,{'StatePreparation.sideband_cooling_enable': False, 'Heating.background_heating_time':U(0,'ms')}) self.addSequence(RabiExcitation,{'Excitation_729.rabi_excitation_frequency': freq729, 'Excitation_729.rabi_excitation_amplitude': amp729, 'Excitation_729.rabi_excitation_duration': dur729, 'Excitation_729.channel_729': channel729 }) self.addSequence(StateReadout)
def discriminator_level(self, c, value=None): ''' Sets or queries the discriminator level. ".discriminator_level(x)" sets the discriminator level to x (number with voltage unit). Acceptable range: [U(-0.300,'V'),U(0.300,'V')] ".discriminator_level()" queries. This is used with .update_settings() Equivalent to DCLV. ''' dev = self.selectedDevice(c) notified = self.getOtherListeners(c) if value == None: yield dev.write('DCLV?') message = yield dev.read() voltage = U(float(message), 'V') self.dlsignal(voltage['mV'], notified) returnValue(message) else: if value['V'] > 0.300 or value['V'] < -0.300: message = "Input out of range. Acceptable range: [-0.300,0.300]" returnValue(message) elif value['V'] <= 0.300 and value['V'] >= -0.300: yield dev.write('DCLV ' + str(value['V'])) returnValue('Success')
def run_finally(cls, cxn, parameters_dict, all_data, det): print "switching the 866 back to ON" cxn.pulser.switch_manual('866DP', True) ident = int(cxn.scriptscanner.get_running()[-1][0]) print " sequence ident" , ident all_data = np.array(all_data) try: all_data = all_data.sum(1) except ValueError: return p = parameters_dict duration = p.DriftTrackerRabi.line_1_pi_time freq = np.pi/duration ind1 = np.where(det == -1) ind2 = np.where(det == 1) det1 = det[ind1][0] * 2.39122444/p.DriftTrackerRabi.line_1_pi_time det2 = det[ind2][0] * 2.39122444/p.DriftTrackerRabi.line_1_pi_time p1 = all_data[ind1][0] p2 = all_data[ind2][0] print "at ",det1, " the pop is", p1 print "at ",det2, " the pop is", p2 from sympy import sin, symbols, nsolve x = symbol('x') relative_det_1 = nsolve(freq**2 / (freq**2 + (x + det1)**2) * (sin((freq**2 + (x - det1)**2)**0.5 * duration / 2))**2 - p1, 0) relative_det_2 = nsolve(freq**2 / (freq**2 + (x + det2)**2) * (sin((freq**2 + (x - det2)**2)**0.5 * duration / 2))**2 - p2, 0) global detuning_1_global detuning_1_global = U((relative_det_1 + relative_det_2)/2, 'kHz') print "detuning 1", (relative_det_1 + relative_det_2)/2
def sequence(self): p = self.parameters # select which zeeman level to prepare if p.Line_Selection.qubit == 'qubit_0': center = p.Transitions.qubit_0 elif p.Line_Selection.qubit == 'qubit_plus': center = p.Transitions.qubit_plus elif p.Line_Selection.qubit == 'qubit_minus': center = p.Transitions.qubit_minus DDS_freq = p.ddsDefaults.qubit_dds_freq - (p.MicrowaveInterogation.detuning + center) ramp_rate = (46.0 + p.MicrowaveInterogation.power['dBm'])/(p.MicrowaveInterogation.duration['ms']/2.0) # accumulate the phase of the DDS and set the correct phase to match the phase at the end of the # first part of the ramp phase_ramp_down = DDS_freq['MHz']*p.MicrowaveInterogation.duration['us']/2.0 # ramp up from off to the max power in half the allocated interrogation time self.addDDS('Microwave_qubit', self.start, p.MicrowaveInterogation.duration/2.0, DDS_freq, U(-46.0, 'dBm'), U(0.0, 'rad'), U(0.0, 'MHz'), U(ramp_rate, 'dB')) # ramp down from max power to off in half the allocated interrogation time self.addDDS('Microwave_qubit', self.start + p.MicrowaveInterogation.duration/2.0, p.MicrowaveInterogation.duration/2.0, DDS_freq, p.MicrowaveInterogation.power, U(0.0, 'rad'), U(0.0, 'MHz'), U(-ramp_rate, 'dB')) self.end = self.start + p.MicrowaveInterogation.duration
def run_initial(cls, cxn, parameters_dict): e = parameters_dict.Spectrum ###### add shift for spectra purposes carrier_translation = { 'S+1/2D-3/2': 'c0', 'S-1/2D-5/2': 'c1', 'S+1/2D-1/2': 'c2', 'S-1/2D-3/2': 'c3', 'S+1/2D+1/2': 'c4', 'S-1/2D-1/2': 'c5', 'S+1/2D+3/2': 'c6', 'S-1/2D+1/2': 'c7', 'S+1/2D+5/2': 'c8', 'S-1/2D+3/2': 'c9', } trapfreq = parameters_dict.TrapFrequencies # sideband_frequencies = [trapfreq.radial_frequency_1, trapfreq.radial_frequency_2, trapfreq.axial_frequency, trapfreq.rf_drive_frequency] shift = U(0., 'MHz') # print "this is the sideband: ",trapfreq[e.selection_sideband] if parameters_dict.Display.relative_frequencies: # shift by sideband only (spectrum "0" will be carrier frequency) shift += e.order * trapfreq[e.selection_sideband] else: #shift by sideband + carrier (spectrum "0" will be AO center frequency) shift += parameters_dict.Carriers[carrier_translation[ e.line_selection]] shift += e.order * trapfreq[e.selection_sideband] # for order,sideband_frequency in zip([sb*e.invert_sb for sb in e.sideband_selection], sideband_frequencies): # shift += order * sideband_frequency pv = cxn.parametervault # print '1234 shifting in progress' # print shift pv.set_parameter('Display', 'shift', shift)
def sequence(self): p = self.parameters mode = p.Modes.state_detection_mode self.end = U(10.0, 'us') self.addSequence(turn_off_all) if mode == 'Shelving': self.addSequence(shelving_doppler_cooling) else: self.addSequence(doppler_cooling) self.addSequence(optical_pumping) for i in range(int(p.MicrowaveInterogation.repititions)): self.addSequence(microwave_interogation) if mode == 'Shelving': self.addSequence(shelving) self.addSequence(shelving_state_detection) elif mode == 'Standard': self.addSequence(standard_state_detection) elif mode == 'ML': self.addSequence(ml_state_detection)
def correct_cavity_drift(self): self.current_fluorescence, counts = self.get_average_counts(100) delta = self.current_fluorescence - self.fluorescence j = 0 print("checking cavity drift") while np.abs(delta) > 0.2: if j > 10 or (self.cavity_voltage < self.cavity_rails[0], self.cavity_voltage > self.cavity_rails[1]): return False should_break = self.update_progress(0.5) if should_break: return False # take advantage of the fact that +voltage=red, -voltage=blue if we're red of the line new_cavity_voltage = self.cavity_voltage + 0.01 * np.sign(delta) print('Moving cavity from {} V to {} V'.format( self.cavity_voltage, new_cavity_voltage)) self.pzt_server.set_voltage(self.cavity_chan, U(new_cavity_voltage, 'V')) self.cavity_voltage = new_cavity_voltage self.current_fluorescence, counts = self.get_average_counts(100) delta = self.current_fluorescence - self.fluorescence # time.sleep(0.5) return True
def run_finally(cls,cxn, parameters_dict, all_data, freq_data): global carr_1_global carr_1 = carr_1_global if not carr_1: return try: all_data = all_data.sum(1) except ValueError: print "ValueError" return peak_fit = cls.gaussian_fit(freq_data, all_data) if not peak_fit: print "peak fitting did not work" return peak_fit = U(peak_fit, "MHz") carr_2 = peak_fit line_1 = parameters_dict.DriftTracker.line_selection_1 line_2 = parameters_dict.DriftTracker.line_selection_2 submission = [(line_1, carr_1), (line_2, carr_2)] #cxn.sd_tracker.set_measurements(submission) import labrad global_sd_cxn = labrad.connect(cl.global_address, password = cl.global_password,tls_mode='off') print cl.client_name , "is sub lines to global SD" , print submission global_sd_cxn.sd_tracker_global.set_measurements(submission,cl.client_name) global_sd_cxn.disconnect()
def sequence(self): p = self.parameters self.addDDS('DopplerCoolingSP', self.start, p.DopplerCooling.duration, U(110.0, 'MHz'), U(-20.8, 'dBm')) self.addDDS( '369DP', self.start, p.DopplerCooling.duration, p.Transitions.main_cooling_369 / 2.0 + U(200.0, 'MHz') + p.DopplerCooling.detuning / 2.0, p.DopplerCooling.cooling_power) self.addDDS('935SP', self.start, p.DopplerCooling.duration, U(320.0, 'MHz'), p.DopplerCooling.repump_power) self.addDDS('760SP', self.start, p.DopplerCooling.duration, U(320.0, 'MHz'), U(-2.0, 'dBm')) self.end = self.start + p.DopplerCooling.duration
def sequence(self): p = self.parameters #select which zeeman level to prepare if p.Line_Selection.qubit == 'qubit_0': center = p.Transitions.qubit_0 elif p.Line_Selection.qubit == 'qubit_plus': center = p.Transitions.qubit_plus elif p.Line_Selection.qubit == 'qubit_minus': center = p.Transitions.qubit_minus DDS_freq = U(197.188, 'MHz') - (p.MicrowaveInterogation.detuning + center) #decide if you want to use the Knill sequence or just standard microwave interrogation if p.MicrowaveInterogation.knill_sequence == 'off': self.addDDS('Microwave_qubit', self.start, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power) self.end = self.start + p.MicrowaveInterogation.duration elif p.MicrowaveInterogation.knill_sequence == 'on': self.addDDS('Microwave_qubit', self.start, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power, U(30.0, 'deg')) self.addDDS('Microwave_qubit', self.start + p.MicrowaveInterogation.duration, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power, U(0.0, 'deg')) self.addDDS('Microwave_qubit', self.start + 2 * p.MicrowaveInterogation.duration, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power, U(90.0, 'deg')) self.addDDS('Microwave_qubit', self.start + 3 * p.MicrowaveInterogation.duration, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power, U(0.0, 'deg')) self.addDDS('Microwave_qubit', self.start + 4 * p.MicrowaveInterogation.duration, p.MicrowaveInterogation.duration, DDS_freq, p.MicrowaveInterogation.power, U(30.0, 'deg')) self.end = self.start + 5 * p.MicrowaveInterogation.duration
def run_finally(self): x = self.data.CalibSideband.x y = self.data.CalibSideband.y[-1] print("x: ", x) global_max = x[np.argmax(y)] try: popt, pcov = curve_fit(gaussian, x, y, p0=[0.5, global_max, 2e-3]) except: raise FitError if self.p.Display.relative_frequencies: peak = popt[1] + self.p["TrapFrequencies"][ self.p.CalibrationScans.selection_sideband] else: line = self.carrier_values[self.carrier_dict[ self.p.CalibrationScans.sideband_calibration_line]] peak = popt[1] - (line + self.p["TrapFrequencies"][ self.p.CalibrationScans.selection_sideband]) cxn = labrad.connect() p = cxn.parametervault p.set_parameter("TrapFrequencies", self.p.CalibrationScans.selection_sideband, U(peak * 1e-6, "MHz")) cxn.disconnect()
def run(self, cxn, context): self.cavity_voltage = self.pzt_server.get_voltage(self.cavity_chan) self.setup_sf_datavault() previous_exp_mean = 0.0 i = 0 while True: i += 1 should_break = self.update_progress(np.random.random()) if should_break: break self.program_pulser(sequence) [counts] = self.run_sequence(max_runs=1000, num=1) if (np.mean(counts) < 0.9 * previous_exp_mean) and i != 1: break previous_exp_mean = np.mean(counts) print('Mean counts on last experiment = ' + str(np.mean(counts))) self.save_data(counts) if i == 1: self.counts_track_mean = np.mean(counts) print('mean counts on first experiment is = ' + str(self.counts_track_mean)) elif i > 1: diff = np.mean(counts) - self.counts_track_mean if np.abs(diff) > 2.0: self.cavity_voltage = self.cavity_voltage + np.sign( diff) * 0.005 if np.sign(diff) * 0.005 < 0.2: self.pzt_server.set_voltage( self.cavity_chan, U(self.cavity_voltage, 'V')) print('Updated cavity voltage to ' + str(self.cavity_voltage) + ' V') else: pass
def run(self, cxn, context): self.setup_datavault('time', 'probability') # gives the x and y names to Data Vault self.setup_grapher('Metastable Qubit Rabi Flopping') self.p['Line_Selection.qubit'] = 'qubit_0' # define the bright state prep as qubit_0 self.p['Modes.state_detection_mode'] = 'Shelving' self.p['MicrowaveInterrogation.duration'] = self.p.Pi_times.qubit_0 self.number_exps = [] self.times = self.get_scan_list(self.p.MetastableMicrowaveRabiFlopping.scan, 'us') for i, duration in enumerate(self.times): should_break = self.update_progress(i/float(len(self.times))) if should_break: break self.p['MetastableMicrowaveInterrogation.duration'] = U(duration, 'us') self.program_pulser(sequence) [doppler_counts, herald_counts, qnd_counts, detection_counts] = self.run_sequence(max_runs=250, num=4) failed_heralding = np.where(herald_counts >= self.p.ShelvingStateDetection.state_readout_threshold) doppler_errors = np.where(doppler_counts <= self.p.Shelving_Doppler_Cooling.doppler_counts_threshold) qnd_to_ground_state = np.where(qnd_counts >= self.p.ShelvingStateDetection.state_readout_threshold) # this will combine all errors into one array and delete repeats (error on both doppler and herald) all_errors = np.unique(np.concatenate((failed_heralding[0], doppler_errors[0], qnd_to_ground_state[0]))) counts = np.delete(detection_counts, all_errors) self.number_exps.append(len(counts)) print(self.number_exps) hist = self.process_data(counts) self.plot_hist(hist) pop = self.get_pop(counts) self.dv.add(duration, pop)
def sequence(self): from StatePreparation import StatePreparation from subsequences.RabiExcitation import RabiExcitation from subsequences.StateReadout import StateReadout from subsequences.TurnOffAll import TurnOffAll ## calculate the scan params rf = self.parameters.RabiFlopping freq_729 = self.calc_freq(rf.line_selection, rf.selection_sideband, rf.order) # print "321321" # print "freq 729", freq_729 self.end = U(10., 'us') self.addSequence(TurnOffAll) self.addSequence(StatePreparation) self.addSequence( RabiExcitation, { 'Excitation_729.rabi_excitation_frequency': freq_729, 'Excitation_729.rabi_excitation_amplitude': rf.rabi_amplitude_729, 'Excitation_729.rabi_excitation_duration': rf.duration }) self.addSequence(StateReadout)
def sequence(self): p = self.parameters # select which zeeman level to prepare if p.Line_Selection.qubit == 'qubit_0': center = p.Transitions.qubit_0 elif p.Line_Selection.qubit == 'qubit_plus': center = p.Transitions.qubit_plus elif p.Line_Selection.qubit == 'qubit_minus': center = p.Transitions.qubit_minus DDS_freq = p.ddsDefaults.qubit_dds_freq - ( p.MicrowaveInterrogation.detuning + center) phase = 360.0 * np.random.rand() pulse_delay = p.MicrowaveInterrogation.ttl_switch_delay self.addTTL('MicrowaveTTL', self.start + pulse_delay, p.MicrowaveInterrogation.duration) self.addDDS('Microwave_qubit', self.start, p.MicrowaveInterrogation.duration + pulse_delay, DDS_freq, p.MicrowaveInterrogation.power, U(phase, 'deg')) print(phase) self.end = self.start + p.MicrowaveInterrogation.duration + pulse_delay