def _run(self): file_pos = 'D:/data/protonNMR/quardrople_dec/search/x_24_34_y_26_36/NV2' file_name = file_pos os.path.exists(file_pos) power = 9 freq_center = 1.76e9 fstart = 1.476e9 fend = 1.490e9 self._odmr(fstart, fend) time.sleep(1.0) from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = power self.psawg.measurement.freq_center = freq_center self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 1.0e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.auto_focus.periodic_focus = True time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/Odmr' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) freq = sum(self.odmr.fit_frequencies) / len(self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = freq #self.psawg.measurement.load() self.psawg.fit = RabiFit_phase() time.sleep(5.0) rabi_flag = True if np.isnan(power): power = 9 while rabi_flag: self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if (self.psawg.fit.contrast[0] < 18): continue half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] if pi < 80.5 and pi > 79.8: rabi_flag = False else: amp = 80.0 / pi #amp^2 = power/power_next power = power - 10 * np.log10(amp**2) if np.isnan(power): power = 9 file_rabi = file_name + '/Rabi' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] from measurements.shallow_NV import XY8_Ref self.pdawg.measurement = XY8_Ref() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.pulse_num = 12 self.pdawg.measurement.tau_begin = 60 self.pdawg.measurement.tau_end = 110 self.pdawg.measurement.tau_delta = 2 self.pdawg.measurement.sweeps = 4.0e5 self.pdawg.measurement.load() time.sleep(100.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/dynamics_XY8_' + str( self.pdawg.measurement.pulse_num) + '_' + str(int(pi)) + 'ns' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) from measurements.shallow_NV import Hahn self.pdawg.measurement = Hahn() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 15000 self.pdawg.measurement.tau_delta = 600 self.pdawg.measurement.sweeps = 2.0e5 self.pdawg.measurement.load() time.sleep(20.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/T2' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) from measurements.shallow_NV import T1 self.pdawg.measurement = T1() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 1000000 self.pdawg.measurement.tau_delta = 60000 self.pdawg.measurement.sweeps = 1.0e5 self.pdawg.measurement.load() time.sleep(15.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/T1' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) x_last = self.confocal.x y_last = self.confocal.y self.auto_focus.periodic_focus = False
def _run(self): file_path ='D:/data/protonNMR/membrane_2/micelle3/L11-13/direction1/' os.path.exists(file_path) self.confocal.resolution = 150 from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 0.5e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) distance = [11.5, 11.8, 12.0, 12.2, 12.35] fstart = [1.369e9, 1.264e9,1.188e9, 1.107e9, 1.045e9] fend = [1.389e9, 1.284e9, 1.208e9, 1.128e9, 1.065e9] tpi = [1150, 1690, 1000, 1180, 1473] power = [2, 9, 1 , 7 , 11] vpp = [1, 0.8, 0.6, 0.75, 1] freq_center = [1.28e9, 1.17e9, 1.10e9, 1.02e9, 0.95e9] Nrep = [8, 8, 10, 42] file_list = ['532 Gauss H1, F19', '570 Gauss H1, F19', '597 Gauss H1, F19', '626 Gauss H1, F19', '648 Gauss H1, F19'] # from measurements.shallow_NV import Hahn # self.pdawg.measurement = Hahn() # self.pdawg.measurement.power = power # self.pdawg.measurement.freq_center = freq_center # self.pdawg.measurement.vpp = 0.6 # self.pdawg.measurement.tau_begin = 300 # self.pdawg.measurement.tau_end = 8000 # self.pdawg.measurement.tau_delta = 300 # self.pdawg.measurement.sweeps = 3.0e5 # from measurements.shallow_NV import T1 # self.pdawg2.measurement = T1() # self.pdawg2.measurement.power = power # self.pdawg2.measurement.vpp = 0.6 # self.pdawg2.measurement.freq_center = freq_center # self.pdawg2.measurement.tau_begin = 300 # self.pdawg2.measurement.tau_end = 600000 # self.pdawg2.measurement.tau_delta = 50000 # self.pdawg2.measurement.sweeps = 2.0e5 from measurements.shallow_NV import XY8_Ref self.pdawg3.measurement = XY8_Ref() self.pdawg3.measurement.tau_begin = 40 self.pdawg3.measurement.tau_end = 64 self.pdawg3.measurement.tau_delta = 1 self.pdawg3.measurement.sweeps = 5.0e5 self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() x_shift = 0 y_shift = 0 index = [22, 23, 26, 36] Ymax_ref =7.5744 Xmax_ref=11.2122 # Magnet.move_absolute(1, Xmax_ref) # time.sleep(12.0) # Magnet.move_absolute(2, Ymax_ref) # time.sleep(12.0) for nfield in range(4): self.psawg.measurement.vpp = vpp[nfield] self.psawg.measurement.power = power[nfield] self.psawg.measurement.freq_center = freq_center[nfield] self.pdawg3.measurement.vpp = vpp[nfield] self.pdawg3.measurement.power = power[nfield] self.pdawg3.measurement.freq_center = freq_center[nfield] for nind, ncenter in enumerate(index): ncenter = int(ncenter) self.auto_focus.target_name = 'NV'+str(nind+1) time.sleep(1.0) self.auto_focus.periodic_focus = False self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] X0=self.confocal.x Y0=self.confocal.y if (self.confocal.y > 50 or self.confocal.y < 0 or self.confocal.x > 50 or self.confocal.x < 0): continue self.auto_focus.submit() time.sleep(12.0) self.auto_focus.submit() time.sleep(12.0) file_name = file_path + file_list[nfield] + '/NV' + str(nind+1) if not os.path.isdir(file_name): os.mkdir(file_name) #else: #continue # confocal scan ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ self.confocal.resolution = 100 self.confocal.submit() time.sleep(82) file_nv = file_name + '/image.png' self.confocal.save_image(file_nv) ''' self.auto_focus.submit() time.sleep(12.0) self.auto_focus.periodic_focus = True # pulsed odmr -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- time.sleep(1.0) self._odmr_pulsed() time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/odmr' self.odmr.save_all(file_odmr) time.sleep(5.0) if(len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): continue freq = self.odmr.fit_frequencies[0] if(np.isnan(freq)): continue ''' self.auto_focus.periodic_focus = False self.auto_focus.submit() time.sleep(12.0) Magnet.move_absolute(3, distance[nfield]) time.sleep(10.0) self.auto_focus.submit() time.sleep(12.0) Magnet.move_absolute(1, Xmax_ref) time.sleep(12.0) Magnet.move_absolute(2, Ymax_ref) time.sleep(12.0) self._magnet_alignment('y') time.sleep(1.0) Magnet.move_absolute(2, self.magnet_control.start_positionY) time.sleep(12.0) self.magnet_control.submit() time.sleep(3.0) if self.magnet_control.state == 'error': time.sleep(3.0) self.magnet_control.submit() while self.magnet_control.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break #time.sleep(self.magnet_control.expected_duration+30) self.magnet_control.perform_fit=True time.sleep(1.0) self.magnet_control.perform_fit=False time.sleep(1.0) self.magnet_control.perform_fit=True Magnet.move_absolute(2, self.magnet_control.Ymax) ''' if not np.isnan(self.magnet_control.Ymax): if abs(Ymax_ref - self.magnet_control.Ymax) < 0.2: Magnet.move_absolute(2, self.magnet_control.Ymax) Ymax_ref = self.magnet_control.Ymax ''' time.sleep(10) self.magnet_control.save_fluor_y_plot(file_name+'/y') self.auto_focus.submit() time.sleep(12.0) self._magnet_alignment('x') time.sleep(1.0) Magnet.move_absolute(1, self.magnet_control.start_positionX) time.sleep(10.0) self.magnet_control.submit() time.sleep(3.0) if self.magnet_control.state == 'error': time.sleep(3.0) self.magnet_control.submit() while self.magnet_control.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break #time.sleep(self.magnet_control.expected_duration+30) self.magnet_control.perform_fit=True time.sleep(1.0) self.magnet_control.perform_fit=False time.sleep(1.0) self.magnet_control.perform_fit=True ''' if not np.isnan(self.magnet_control.Xmax): if abs(Xmax_ref - self.magnet_control.Xmax) < 0.2: Magnet.move_absolute(1, self.magnet_control.Xmax) Xmax_ref = self.magnet_control.Xmax ''' Magnet.move_absolute(1, self.magnet_control.Xmax) time.sleep(10) self.magnet_control.save_fluor_x_plot(file_name+'/x') ''' self._magnet_alignment('y') time.sleep(1.0) Magnet.move_absolute(2, self.magnet_control.start_positionY) time.sleep(10.0) self.magnet_control.submit() time.sleep(3.0) if self.magnet_control.state == 'error': time.sleep(3.0) self.magnet_control.submit() while self.magnet_control.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break #time.sleep(self.magnet_control.expected_duration+30) self.magnet_control.perform_fit=True time.sleep(1.0) self.magnet_control.perform_fit=False time.sleep(1.0) self.magnet_control.perform_fit=True if not np.isnan(self.magnet_control.Ymax): if abs(Ymax_ref - self.magnet_control.Ymax) < 0.2: Magnet.move_absolute(2, self.magnet_control.Ymax) Ymax_ref = self.magnet_control.Ymax time.sleep(10) self.magnet_control.save_fluor_y_plot(file_name+'/y') self.auto_focus.submit() time.sleep(12.0) self._magnet_alignment('x') time.sleep(1.0) Magnet.move_absolute(1, self.magnet_control.start_positionX) time.sleep(10.0) self.magnet_control.submit() time.sleep(3.0) if self.magnet_control.state == 'error': time.sleep(3.0) self.magnet_control.submit() while self.magnet_control.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break #time.sleep(self.magnet_control.expected_duration+30) self.magnet_control.perform_fit=True time.sleep(1.0) self.magnet_control.perform_fit=False time.sleep(1.0) self.magnet_control.perform_fit=True if not np.isnan(self.magnet_control.Xmax): if abs(Xmax_ref - self.magnet_control.Xmax) < 0.2: Magnet.move_absolute(1, self.magnet_control.Xmax) Xmax_ref = self.magnet_control.Xmax time.sleep(10) self.magnet_control.save_fluor_x_plot(file_name+'/x') ''' # pulsed odmr -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- time.sleep(1.0) self._odmr_pulsed(fstart[nfield], fend[nfield], tpi[nfield]) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/odmr' self.odmr.save_all(file_odmr) time.sleep(5.0) if(len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): continue freq = self.odmr.fit_frequencies[0] if(np.isnan(freq)): continue # Rabi ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- self.auto_focus.periodic_focus = True self.psawg.measurement.freq = freq self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg.measurement.progress = 0 self.psawg.measurement.elapsed_sweeps = 0 file_rabi = file_name + '/Rabi' + '_power_' + str(power) + '_contrast_' + string.replace(str(self.psawg.fit.contrast[0])[0:4], '.', 'd') self.psawg.save_all(file_rabi) time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] condition = np.isnan(half_pi) or self.psawg.fit.contrast[0] < 15 if condition: continue # self.pdawg.measurement.freq = freq # self.pdawg.measurement.pi2_1 = half_pi # self.pdawg.measurement.pi_1 = pi # self.pdawg.measurement.load() # time.sleep(20.0) # while self.pdawg.measurement.reload == True: # threading.currentThread().stop_request.wait(1.0) # self.pdawg.measurement.submit() # while self.pdawg.measurement.state != 'done': # threading.currentThread().stop_request.wait(1.0) # if threading.currentThread().stop_request.isSet(): # break # if self.pdawg.measurement.state == 'error': # time.sleep(4) # self.pdawg.measurement.resubmit() # self.pdawg.measurement.progress = 0 # self.pdawg.measurement.elapsed_sweeps = 0 # file_hahn = file_name + '/T2' # self.pdawg.save_line_plot(file_hahn + '.png') # self.pdawg.save(file_hahn + '.pyd') # time.sleep(5.0) # self.pdawg.measurement.remove() # self.pdawg.measurement.state = 'idle' # time.sleep(5.0) # self.pdawg2.measurement.freq = freq # self.pdawg2.measurement.pi_1 = pi # self.pdawg2.measurement.load() # time.sleep(15.0) # while self.pdawg2.measurement.reload == True: # threading.currentThread().stop_request.wait(1.0) # self.pdawg2.measurement.submit() # while self.pdawg2.measurement.state != 'done': # threading.currentThread().stop_request.wait(1.0) # if threading.currentThread().stop_request.isSet(): # break # if self.pdawg2.measurement.state == 'error': # time.sleep(4) # self.pdawg2.measurement.resubmit() # self.pdawg2.measurement.progress = 0 # self.pdawg2.measurement.elapsed_sweeps = 0 # file_T1 = file_name + '/T1' # self.pdawg2.save_line_plot(file_T1 + '.png') # self.pdawg2.save(file_T1 + '.pyd') # time.sleep(10.0) # self.pdawg2.measurement.remove() # self.pdawg2.measurement.state = 'idle' # time.sleep(10.0) self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.pulse_num = Nrep[nind] self.pdawg3.measurement.load() time.sleep(50.0) while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg3.measurement.state == 'error': time.sleep(4) self.pdawg3.measurement.resubmit() self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_XY = file_name + '/xy8-' + str(Nrep[nind]) self.pdawg3.save_line_plot(file_XY + '.png') self.pdawg3.save(file_XY + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(10.0) self.auto_focus.periodic_focus = False # x_shift = self.confocal.x - self.sf.Centroids[ncenter][1] # y_shift = self.confocal.y - self.sf.Centroids[ncenter][0] self.auto_focus.submit() time.sleep(12.0) x_shift= self.confocal.x - X0 y_shift= self.confocal.y - Y0 for Ncent in index: self.sf.Centroids[Ncent][0] = self.sf.Centroids[Ncent][0] + y_shift self.sf.Centroids[Ncent][1] = self.sf.Centroids[Ncent][1] + x_shift
def _run(self): file_name = self.file_name if not os.path.isdir(file_name): os.mkdir(file_name) self.auto_focus.submit() time.sleep(8.0) file_nv = file_name + '/image.png' self.confocal.save_image(file_nv) time.sleep(8.0) self.auto_focus.periodic_focus = True fstart = 2.951e9 fend = 2.965e9 self._odmr(fstart, fend) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv1_high' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) fhigh1 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### from measurements.pair_search import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = 16 self.psawg.measurement.freq_center = 2.71e9 self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 500 self.psawg.measurement.tau_delta = 5 self.psawg.measurement.sweeps = 3e5 self.psawg.measurement.freq = fhigh1 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv1_high' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi_nv1 = self.psawg.fit.t_pi2[0] condition = np.isnan(half_pi_nv1) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: sys.exit(0) fstart = 2.784e9 fend = 2.798e9 self.odmr.frequency_begin_p = fstart self.odmr.frequency_end_p = fend time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv1_low' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) flow1 = sum(self.odmr.fit_frequencies) / len(self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = flow1 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv1_low' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) pi_p_nv1 = self.psawg.fit.t_pi[0] condition = np.isnan(pi_p_nv1) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: sys.exit(0) # odmr self.odmr.frequency_begin_p = 2.918e9 self.odmr.frequency_end_p = 2.934e9 self.odmr.submit() time.sleep(10) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv2_high' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(10) fhigh2 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = fhigh2 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv2_high' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi_nv2 = self.psawg.fit.t_pi2[0] condition = np.isnan(half_pi_nv2) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: sys.exit(0) self.odmr.frequency_begin_p = 2.820e9 self.odmr.frequency_end_p = 2.837e9 time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv2_low' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) flow2 = sum(self.odmr.fit_frequencies) / len(self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = flow2 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv2_low' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) pi_p_nv2 = self.psawg.fit.t_pi[0] condition = np.isnan(pi_p_nv2) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: sys.exit(0) from measurements.pair_search import HahnPair self.pair.measurement = HahnPair() self.pair.measurement.power = 16 self.pair.measurement.freq_center = 2.71e9 self.pair.measurement.multihahn = True self.pair.measurement.freq = fhigh1 self.pair.measurement.freq_4 = flow1 self.pair.measurement.ffreq = fhigh2 self.pair.measurement.ffreq_4 = flow2 self.pair.measurement.pi2_1 = half_pi_nv1 self.pair.measurement.pi2_2 = half_pi_nv2 self.pair.measurement.pi_1_p = half_pi_nv1 * 2 self.pair.measurement.pi_2_p = half_pi_nv2 * 2 self.pair.measurement.pi_1_m = pi_p_nv1 self.pair.measurement.pi_2_m = pi_p_nv2 self.pair.measurement.tau_begin = 300 self.pair.measurement.tau_end = 50000 self.pair.measurement.tau_delta = 1000 self.pair.measurement.sweeps = 3.0e5 self.pair.measurement.load() time.sleep(35.0) while self.pair.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pair.measurement.submit() while self.pair.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/hahnpair_double' self.pair.save_line_plot(file_hahn + '.png') self.pair.save(file_hahn + '.pyd') time.sleep(10.0) self.pair.measurement.remove() self.pair.measurement.state = 'idle' time.sleep(20.0)
def _run(self): #file_path = 'D:/data/protonNMR/membrane_2/scan/L11/11' #file_path = 'D:/data/protonNMR/membrane_2/scan/L11/22' file_path = 'D:/data/protonNMR/membrane_2/scan/M12(dirty)/13' os.path.exists(file_path) self.confocal.resolution = 150 power = 16 freq_center = 2.7e9 #req = 1.49347e9 #fstart= 1.532e9 #fend= 1.542e9 from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = power self.psawg.measurement.vpp = 1.2 #self.psawg.measurement.freq_center = freq_center self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 400 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 1.0e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) from measurements.shallow_NV import Hahn self.pdawg.measurement = Hahn() self.pdawg.measurement.power = power self.pdawg.measurement.vpp = 1.2 self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 8000 self.pdawg.measurement.tau_delta = 300 self.pdawg.measurement.sweeps = 3.0e5 from measurements.shallow_NV import T1 self.pdawg2.measurement = T1() self.pdawg2.measurement.power = power self.pdawg2.measurement.vpp = 1.2 self.pdawg2.measurement.tau_begin = 300 self.pdawg2.measurement.tau_end = 1000000 self.pdawg2.measurement.tau_delta = 100000 self.pdawg2.measurement.sweeps = 1.0e5 self.auto_focus.periodic_focus = False #if os.path.isfile(file_image1): #self.confocal.load(file_image1) #time.sleep(1.0) #else: self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() x_shift = 0 y_shift = 0 index = np.linspace(2, 31, 30) for ncenter in index: ncenter = int(ncenter) self.auto_focus.periodic_focus = False self.auto_focus.target_name = 'NV' + str(ncenter) time.sleep(1.0) self.confocal.y = self.sf.Centroids[ncenter][0] + y_shift self.confocal.x = self.sf.Centroids[ncenter][1] + x_shift if (self.confocal.y > 50 or self.confocal.y < 0 or self.confocal.x > 50 or self.confocal.x < 0): continue self.auto_focus.submit() time.sleep(12.0) file_name = file_path + '/NV' + str(ncenter) #file_name = file_path if not os.path.isdir(file_name): os.mkdir(file_name) #else: #continue self.confocal.resolution = 150 self.confocal.submit() time.sleep(155) file_nv = file_name + '/nv' + str(ncenter) + '_image.png' self.confocal.save_image(file_nv) self.auto_focus.submit() time.sleep(16.0) self.auto_focus.periodic_focus = True time.sleep(1.0) self._odmr_cw() time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/Odmr_cw' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) if (len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): continue freq = self.odmr.fit_frequencies[0] if (np.isnan(freq)): continue ''' self.psrabi.measurement.freq = freq-1.5e6 self.psrabi.measurement.power = -20 self.psrabi.measurement.sweeps = 1.0e5 self.psrabi.measurement.fit = RabiFit_phase() time.sleep(1.0) self.psrabi.submit() while self.psrabi.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psrabi.measurement.remove() self.psrabi.measurement.state = 'idle' file_rabi = file_name + '/Rabi_pulsed' self.psrabi.save_line_plot(file_rabi + '.png') self.psrabi.save(file_rabi + '.pyd') time.sleep(5.0) t_pulse_pi = 1300 fst= 1.532e9 fend= 1.544e9 self._odmr_pulsed(fst,fend,t_pulse_pi) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/Odmr_pulsed' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) if(len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 6 or self.odmr.fit_contrast.max() > 43): continue freq = sum(self.odmr.fit_frequencies)/len(self.odmr.fit_frequencies) if(np.isnan(freq)): continue ''' # Rabi ##################### self.psawg.measurement.freq = freq freq_center = freq - 100e6 self.psawg.measurement.freq_center = freq_center ''' rabi_flag = True if np.isnan(power): power = 12 while rabi_flag: self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] if pi < 96 and pi > 72: rabi_flag = False else: amp = 85.0/pi #amp^2 = power/power_next power = power - 10*np.log10(amp**2) if power > 16 or power < 0: rabi_flag=False if self.psawg.fit.contrast[0] < 10: rabi_flag=False if np.isnan(power): power = 12 ''' #self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg.measurement.progress = 0 self.psawg.measurement.elapsed_sweeps = 0 file_rabi = file_name + '/Rabi' + '_power_' + str(power) self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] condition = np.isnan(half_pi) or self.psawg.fit.contrast[0] < 12 if condition: continue self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.load() time.sleep(20.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.pdawg.measurement.progress = 0 self.pdawg.measurement.elapsed_sweeps = 0 file_hahn = file_name + '/T2' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(5.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(5.0) self.pdawg2.measurement.freq_center = freq_center self.pdawg2.measurement.freq = freq self.pdawg2.measurement.pi_1 = pi self.pdawg2.measurement.load() time.sleep(15.0) while self.pdawg2.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg2.measurement.submit() while self.pdawg2.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.pdawg2.measurement.progress = 0 self.pdawg2.measurement.elapsed_sweeps = 0 file_T1 = file_name + '/T1' self.pdawg2.save_line_plot(file_T1 + '.png') self.pdawg2.save(file_T1 + '.pyd') time.sleep(10.0) self.pdawg2.measurement.remove() self.pdawg2.measurement.state = 'idle' time.sleep(10.0) ''' from measurements.shallow_NV import XY8_Ref self.pdawg3.measurement = XY8_Ref() self.pdawg3.measurement.power = power self.pdawg3.measurement.freq_center = freq_center self.pdawg3.measurement.pulse_num = 16 self.pdawg3.measurement.tau_delta = 1.0 self.pdawg3.measurement.sweeps = 0.5e6 bfield = (2870 - self.psawg.measurement.freq/1.0e6)/2.8 tau_s = int(1000000 / bfield / 4.255 / 4.0 - half_pi) self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.tau_begin = tau_s - 8 self.pdawg3.measurement.tau_end = tau_s + 8 self.pdawg3.measurement.load() time.sleep(100.0) while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_hahn = file_name + '/dynamics_XY8_' + str(self.pdawg3.measurement.pulse_num) + '_' + 'ns_30_60ns' + str(int(pi)) + 'ns' self.pdawg3.save_line_plot(file_hahn + '.png') self.pdawg3.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(20.0) ntau = [1,16,32] tau_end = [1500, 500, 400] tau_delta = [40, 15, 10] for k in range(3): self.pdawg3.measurement.pulse_num = ntau[k] self.pdawg3.measurement.tau_begin = 20 self.pdawg3.measurement.tau_end = tau_end[k] self.pdawg3.measurement.tau_delta = tau_delta[k] self.pdawg3.measurement.sweeps = 0.8e6 self.pdawg3.measurement.load() time.sleep(100.0) while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_hahn = file_name + '/dynamics_XY8_' + str(self.pdawg3.measurement.pulse_num) + '_' + 'full' self.pdawg3.save_line_plot(file_hahn + '.png') self.pdawg3.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(20.0) ''' ''' self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.tau_begin = tau_s - 15 self.pdawg.measurement.tau_end = tau_s + 15 self.pdawg.measurement.load() time.sleep(100.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/dynamics_XY8_' + str(self.pdawg.measurement.pulse_num) + '_' + 'ns_30_60ns' + str(int(pi)) + 'ns' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) ''' self.auto_focus.periodic_focus = False x_shift = self.confocal.x - self.sf.Centroids[ncenter][1] y_shift = self.confocal.y - self.sf.Centroids[ncenter][0] '''
def _run(self): file_pos = 'D:/data/ProgGate/Images/pair_search/01-10(search)/x_4_y_4' os.path.exists(file_pos) for nk in range(10): for nl in range(10): if nk % 2 == 1: nl = 9 - nl x1 = (nk + 0) * 5 x2 = (nk + 1) * 5 y1 = (nl + 0) * 5 y2 = (nl + 1) * 5 file_path = file_pos + '/x_' + str(x1) + '_' + str( x2) + '_y_' + str(y1) + '_' + str(y2) if not os.path.isdir(file_path): os.mkdir(file_path) else: continue self.confocal.x1 = x1 self.confocal.x2 = x2 self.confocal.y1 = y1 self.confocal.y2 = y2 self.confocal.resolution = 150 self.auto_focus.periodic_focus = False file_image1 = file_path + '/image.pyd' if os.path.isfile(file_image1): self.confocal.load(file_image1) time.sleep(1.0) else: self.confocal.submit() time.sleep(140) self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 110 self.sf.SpotMaxInt = 240 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() file_image = file_path + '/image.png' self.sf.confocal.save_image(file_image) #file_image1 = file_path + '/image.pyd' self.sf.confocal.save(file_image1) for ncenter in range(len(self.sf.Centroids)): self.auto_focus.periodic_focus = False self.auto_focus.target_name = 'nv' + str(ncenter) time.sleep(1.0) self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] self.auto_focus.submit() time.sleep(8.0) z_axis = np.sort(self.auto_focus.Z) zlen = (z_axis[-1] - z_axis[0]) / self.auto_focus.step_z zpos = (self.auto_focus.zfit - z_axis[0]) / self.auto_focus.step_z zcondition = float( zpos / zlen) > 0.4 and float(zpos) / zlen for nfocus in range(25): if zcondition and self.auto_focus.data_z.max( ) - self.auto_focus.data_z.min() > 70: break else: self.auto_focus.submit() time.sleep(8.0) z_axis = np.sort(self.auto_focus.Z) zlen = (z_axis[-1] - z_axis[0]) / self.auto_focus.step_z zpos = (self.auto_focus.zfit - z_axis[0]) / self.auto_focus.step_z zcondition = float(zpos / zlen) > 0.4 and float( zpos / zlen) < 0.6 self.auto_focus.fit_xy() time.sleep(1.0) if self.auto_focus.xfit - 0.25 < 0: self.confocal.x1 = 0 self.confocal.x2 = 2 * self.auto_focus.xfit self.confocal.y1 = self.auto_focus.yfit - self.auto_focus.xfit self.confocal.y2 = self.auto_focus.yfit + self.auto_focus.xfit elif self.auto_focus.yfit - 0.25 < 0: self.auto_focus.y1 = 0 self.auto_focus.y2 = 2 * self.auto_focus.yfit self.confocal.x1 = self.auto_focus.xfit - self.auto_focus.yfit self.confocal.x2 = self.auto_focus.xfit + self.auto_focus.yfit elif self.auto_focus.xfit + 0.25 > 50: self.confocal.x2 = 50 self.confocal.x1 = 2 * self.auto_focus.xfit - 50 self.confocal.y1 = self.auto_focus.yfit + self.auto_focus.xfit - 50 self.confocal.y2 = self.auto_focus.yfit + 50 - self.auto_focus.xfit elif self.auto_focus.yfit + 0.25 > 50: self.confocal.y2 = 50 self.confocal.y1 = 2 * self.auto_focus.yfit - 50 self.confocal.x1 = self.auto_focus.xfit + self.auto_focus.yfit - 50 self.confocal.x2 = self.auto_focus.xfit + 50 - self.auto_focus.yfit else: self.confocal.x1 = self.auto_focus.xfit - 0.25 self.confocal.x2 = self.auto_focus.xfit + 0.25 self.confocal.y1 = self.auto_focus.yfit - 0.25 self.confocal.y2 = self.auto_focus.yfit + 0.25 self.confocal.submit() time.sleep(140) self.gs._ImportImage_fired() time.sleep(2.0) self.gs._Getfitimage_fired() file_image = file_path + '/nv' + str(ncenter) + '.png' self.gs.save_image(file_image) fitx = abs(self.gs.fitparemeter[4]) fity = abs(self.gs.fitparemeter[3]) spotcondition = fitx > 0.125 or fity > 0.125 or fitx > 1.3 * fity or fity > 1.3 * fitx if spotcondition: continue file_name = file_path + '/nv' + str(ncenter) if not os.path.isdir(file_name): os.mkdir(file_name) else: continue self.auto_focus.submit() time.sleep(8.0) self.confocal.load(file_image1) time.sleep(1.0) self.confocal.x = self.auto_focus.xfit self.confocal.y = self.auto_focus.yfit file_nv = file_name + '/image.png' self.sf.confocal.save_image(file_nv) time.sleep(8.0) self.auto_focus.periodic_focus = True fstart = 2.951e9 fend = 2.965e9 self._odmr(fstart, fend) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv1_high' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) fhigh1 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### from measurements.pair_search import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = 16 self.psawg.measurement.freq_center = 2.71e9 self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 500 self.psawg.measurement.tau_delta = 5 self.psawg.measurement.sweeps = 2e5 self.psawg.measurement.freq = fhigh1 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv1_high' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi_nv1 = self.psawg.fit.t_pi2[0] condition = np.isnan( half_pi_nv1) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: continue fstart = 2.784e9 fend = 2.798e9 self.odmr.frequency_begin_p = fstart self.odmr.frequency_end_p = fend time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv1_low' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) flow1 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = flow1 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv1_low' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) pi_p_nv1 = self.psawg.fit.t_pi[0] condition = np.isnan(pi_p_nv1) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: continue # odmr self.odmr.frequency_begin_p = 2.918e9 self.odmr.frequency_end_p = 2.934e9 self.odmr.submit() time.sleep(10) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv2_high' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(10) fhigh2 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = fhigh2 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv2_high' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi_nv2 = self.psawg.fit.t_pi2[0] condition = np.isnan( half_pi_nv2) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: continue self.odmr.frequency_begin_p = 2.820e9 self.odmr.frequency_end_p = 2.837e9 time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/odmr_nv2_low' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) flow2 = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = flow2 self.psawg.measurement.load() time.sleep(15.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() time.sleep(5.0) self.psawg.fit = RabiFit_phase() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/rabi_nv2_low' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) pi_p_nv2 = self.psawg.fit.t_pi[0] condition = np.isnan(pi_p_nv2) or self.psawg.fit.contrast[ 0] < 7 or self.psawg.fit.contrast[0] > 25 if condition: continue from measurements.pair_search import HahnPair self.pair.measurement = HahnPair() self.pair.measurement.power = 16 self.pair.measurement.freq_center = 2.71e9 self.pair.measurement.multihahn = True self.pair.measurement.freq = fhigh1 self.pair.measurement.freq_4 = flow1 self.pair.measurement.ffreq = fhigh2 self.pair.measurement.ffreq_4 = flow2 self.pair.measurement.pi2_1 = half_pi_nv1 self.pair.measurement.pi2_2 = half_pi_nv2 self.pair.measurement.pi_1_p = half_pi_nv1 * 2 self.pair.measurement.pi_2_p = half_pi_nv2 * 2 self.pair.measurement.pi_1_m = pi_p_nv1 self.pair.measurement.pi_2_m = pi_p_nv2 self.pair.measurement.tau_begin = 300 self.pair.measurement.tau_end = 40000 self.pair.measurement.tau_delta = 1000 self.pair.measurement.sweeps = 2.0e5 self.pair.measurement.load() time.sleep(35.0) while self.pair.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pair.measurement.submit() while self.pair.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/hahnpair_double' self.pair.save_line_plot(file_hahn + '.png') self.pair.save(file_hahn + '.pyd') time.sleep(10.0) self.pair.measurement.remove() self.pair.measurement.state = 'idle' time.sleep(20.0) if len(self.sf.Centroids) == 0: self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 10 self.sf.SpotMaxInt = 250 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() if len(self.sf.Centroids) > 0: self.confocal.y = self.sf.Centroids[-1][0] self.confocal.x = self.sf.Centroids[-1][1] x_last = self.confocal.x y_last = self.confocal.y else: self.confocal.y = y_last self.confocal.x = x_last self.auto_focus.submit() time.sleep(8.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1 = (z_axis1[-1] - z_axis1[0]) / self.auto_focus.step_z zpos1 = (self.auto_focus.zfit - z_axis1[0]) / self.auto_focus.step_z zcondition1 = float( zpos1 / zlen1) > 0.4 and float(zpos1) / zlen1 for nfocus in range(25): if zcondition1 and self.auto_focus.data_z.max( ) - self.auto_focus.data_z.min() > 70: break else: self.auto_focus.submit() time.sleep(8.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1 = (z_axis1[-1] - z_axis1[0]) / self.auto_focus.step_z zpos1 = (self.auto_focus.zfit - z_axis1[0]) / self.auto_focus.step_z zcondition1 = float(zpos1 / zlen1) > 0.4 and float( zpos1 / zlen1) < 0.6
def _run(self): file_pos = 'D:/data/protonNMR/NV search_Oxygen_etching4(T2rou)/search' os.path.exists(file_pos) self.confocal.resolution = 110 power = 16 freq_center = 1.57e9 #fstart= 1.322e9 #fend= 1.350e9 from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = power self.psawg.measurement.freq_center = freq_center self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 2.0e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.sf.BWimageMeth = 'advanced' self.sf.size = 4 for nk in range(8): for nl in range(8): if nk%2==1: nl=8-nl x1 = 5 + (nk+0) * 5 x2 = 5 + (nk+1) * 5 y1 = 5 + (nl+0) * 5 y2 = 5 + (nl+1) * 5 file_path = file_pos + '/x_' + str(x1) + '_' + str(x2) + '_y_' + str(y1) + '_' + str(y2) if not os.path.isdir(file_path): os.mkdir(file_path) else: continue self.confocal.x1 = x1 self.confocal.x2 = x2 self.confocal.y1 = y1 self.confocal.y2 = y2 self.auto_focus.periodic_focus = False file_image1 = file_path + '/image.pyd' #if os.path.isfile(file_image1): #self.confocal.load(file_image1) #time.sleep(1.0) #else: self.confocal.resolution = 150 self.confocal.submit() time.sleep(160) self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 100 self.sf.SpotMaxInt = 280 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() file_image = file_path + '/image.png' self.sf.confocal.save_image(file_image) file_image1 = file_path + '/image.pyd' self.sf.confocal.save(file_image1) for ncenter in range(0,len(self.sf.Centroids)): self.auto_focus.periodic_focus = False self.auto_focus.target_name = 'NV'+str(ncenter) time.sleep(1.0) self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] self.auto_focus.submit() time.sleep(15.0) self.auto_focus.submit() time.sleep(15.0) #self.auto_focus.submit() #time.sleep(16.0) z_axis = np.sort(self.auto_focus.Z) zlen=(z_axis[-1]-z_axis[0])/self.auto_focus.step_z zpos=(self.auto_focus.zfit-z_axis[0])/self.auto_focus.step_z zcondition = float(zpos/zlen)>0.4 and float(zpos)/zlen <0.6 for nfocus in range(4): if zcondition and self.auto_focus.data_z.max()-self.auto_focus.data_z.min()>70: break else: self.auto_focus.submit() time.sleep(15.0) z_axis = np.sort(self.auto_focus.Z) zlen=(z_axis[-1]-z_axis[0])/self.auto_focus.step_z zpos=(self.auto_focus.zfit-z_axis[0])/self.auto_focus.step_z zcondition = float(zpos/zlen)>0.4 and float(zpos/zlen)<0.6 self.auto_focus.fit_xy() time.sleep(1.0) cond1 = self.auto_focus.data_z.max() < 70 or self.auto_focus.xfit - 0.25<0 or self.auto_focus.yfit - 0.25<0 or self.auto_focus.xfit + 0.25>50 or self.auto_focus.yfit + 0.25>50 if cond1: continue else: self.confocal.x1=self.auto_focus.xfit - 0.25 self.confocal.x2=self.auto_focus.xfit + 0.25 self.confocal.y1=self.auto_focus.yfit - 0.25 self.confocal.y2=self.auto_focus.yfit + 0.25 self.confocal.resolution = 110 self.confocal.submit() time.sleep(88) self.gs._ImportImage_fired() time.sleep(2.0) self.gs._Getfitimage_fired() file_image = file_path + '/NV' + str(ncenter) + '.png' self.gs.save_image(file_image) fitx=abs(self.gs.fitparemeter[4]) fity=abs(self.gs.fitparemeter[3]) spotcondition = fitx>0.25 or fity>0.25 or fitx > 1.6*fity or fity>1.6*fitx if spotcondition: continue file_name = file_path + '/NV' + str(ncenter) if not os.path.isdir(file_name): os.mkdir(file_name) else: continue self.auto_focus.submit() time.sleep(15.0) self.confocal.x1 = x1 self.confocal.x2 = x2 self.confocal.y1 = y1 self.confocal.y2 = y2 self.confocal.resolution = 110 self.confocal.submit() time.sleep(88) self.confocal.x = self.auto_focus.xfit self.confocal.y = self.auto_focus.yfit file_nv = file_name + '/image.png' self.sf.confocal.save_image(file_nv) time.sleep(16.0) self.auto_focus.periodic_focus = True ''' self._odmr_cw() time.sleep(1.0) self.odmr.submit() time.sleep(1.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/Odmr_cw' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(2.0) if(len(self.odmr.fit_frequencies) > 3 or self.odmr.fit_contrast.max() < 14 or self.odmr.fit_contrast.max() > 40): continue freq = sum(self.odmr.fit_frequencies)/len(self.odmr.fit_frequencies) if(np.isnan(freq)): continue ''' fst = 1.486e9 fend = 1.496e9 self._odmr_pulsed(fst,fend) time.sleep(1.0) self.odmr.submit() time.sleep(1.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/Odmr_pulsed' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(2.0) if(len(self.odmr.fit_frequencies) > 3 or self.odmr.fit_contrast.max() < 8 or self.odmr.fit_contrast.max() > 40): continue freq = sum(self.odmr.fit_frequencies)/len(self.odmr.fit_frequencies) if(np.isnan(freq)): continue # Rabi ##################### self.psawg.measurement.freq = freq self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(2.0) self.psawg.fit = RabiFit_phase() time.sleep(2.0) ''' rabi_flag = True if np.isnan(power): power = 6 while rabi_flag: self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if(self.psawg.fit.contrast[0] < 18): continue half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] if pi < 90 and pi > 72: rabi_flag = False else: amp = 82.0/pi #amp^2 = power/power_next power = power - 10*np.log10(amp**2) if power > 16 or power < 0: rabi_flag=False if np.isnan(power): power = 9 ''' while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg.measurement.progress = 0 self.psawg.measurement.elapsed_sweeps = 0 half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] file_rabi = file_name + '/Rabi' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) #half_pi = self.psawg.fit.t_pi2[0] #pi = self.psawg.fit.t_pi[0] condition = np.isnan(half_pi) or self.psawg.fit.contrast[0] < 18 if condition: continue ''' from measurements.shallow_NV import XY8_Ref self.pdawg.measurement = XY8_Ref() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.pulse_num = 10 self.pdawg.measurement.tau_begin = 50 self.pdawg.measurement.tau_end = 85 self.pdawg.measurement.tau_delta = 1.5 self.pdawg.measurement.sweeps = 3.5e5 self.pdawg.measurement.load() time.sleep(100.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/dynamics_XY8_' + str(self.pdawg.measurement.pulse_num) + '_' + str(int(pi)) + 'ns_65_95ns' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) ''' from measurements.shallow_NV import Hahn self.pdawg.measurement = Hahn() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 10000 self.pdawg.measurement.tau_delta = 300 self.pdawg.measurement.sweeps = 3.0e5 self.pdawg.measurement.load() time.sleep(20.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/T2' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) from measurements.shallow_NV import T1 self.pdawg.measurement = T1() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 600000 self.pdawg.measurement.tau_delta = 40000 self.pdawg.measurement.sweeps = 1.0e5 self.pdawg.measurement.load() time.sleep(15.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/T1' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') time.sleep(10.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(20.0) x_last = self.confocal.x y_last = self.confocal.y self.confocal.x1 = x1 self.confocal.x2 = x2 self.confocal.y1 = y1 self.confocal.y2 = y2 self.auto_focus.periodic_focus = False self.confocal.resolution = 150 self.confocal.submit() time.sleep(200) self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() file_image = file_path + '/image1.png' self.sf.confocal.save_image(file_image) file_image1 = file_path + '/image1.pyd' self.sf.confocal.save(file_image1) if len(self.sf.Centroids)==0: self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 10 self.sf.SpotMaxInt = 180 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() inde = -1 if len(self.sf.Centroids)>0: for nscan in (range(len(self.sf.Centroids))): self.confocal.y = self.sf.Centroids[inde][0] self.confocal.x = self.sf.Centroids[inde][1] x_last = self.confocal.x y_last = self.confocal.y self.auto_focus.submit() time.sleep(16.0) self.auto_focus.submit() time.sleep(16.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1=(z_axis1[-1]-z_axis1[0])/self.auto_focus.step_z zpos1=(self.auto_focus.zfit-z_axis1[0])/self.auto_focus.step_z zcondition1 = float(zpos1/zlen1)>0.4 and float(zpos1)/zlen1 for nfocus in range(3): if zcondition1 and self.auto_focus.data_z.max()-self.auto_focus.data_z.min()>70: break else: self.auto_focus.submit() time.sleep(16.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1=(z_axis1[-1]-z_axis1[0])/self.auto_focus.step_z zpos1=(self.auto_focus.zfit-z_axis1[0])/self.auto_focus.step_z zcondition1 = float(zpos1/zlen1)>0.4 and float(zpos1/zlen1)<0.6 if zcondition1 and self.auto_focus.data_z.max()-self.auto_focus.data_z.min()>70: self.auto_focus.save('defaults/auto_focus.pyd') break inde = inde - 1 else: self.confocal.y = y_last self.confocal.x = x_last
def _run(self): file_path = 'D:/data/sample #100/D1 Ar_SF6 p+/autopilot' os.path.exists(file_path) self.confocal.resolution = 200 power = -3 vpp = 0.6 from measurements.pulsed_awg import Rabi self.psawg2.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg2.fit = RabiFit_phase() self.psawg2.measurement.tau_begin = 300 self.psawg2.measurement.tau_end = 1000 self.psawg2.measurement.tau_delta = 10 self.psawg2.measurement.sweeps = 0.6e5 self.psawg2.measurement.power = power self.psawg2.measurement.vpp = vpp #self.psawg.measurement.freq_center = freq_center self.psawg2.fit = RabiFit_phase() time.sleep(5.0) from measurements.shallow_NV import Hahn self.pdawg.measurement = Hahn() self.pdawg.measurement.power = power #self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.vpp = 0.6 self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 6000 self.pdawg.measurement.tau_delta = 250 self.pdawg.measurement.sweeps = 8.0e5 from measurements.shallow_NV import T1 self.pdawg2.measurement = T1() self.pdawg2.measurement.power = power self.pdawg2.measurement.vpp = 0.6 #self.pdawg2.measurement.freq_center = freq_center self.pdawg2.measurement.tau_begin = 300 self.pdawg2.measurement.tau_end = 1000000 self.pdawg2.measurement.tau_delta = 100000 self.pdawg2.measurement.sweeps = 0.4e+6 from measurements.shallow_NV import XY8_Ref self.pdawg3.measurement = XY8_Ref() self.pdawg3.measurement.tau_begin = 40 self.pdawg3.measurement.tau_end = 71 self.pdawg3.measurement.tau_delta = 1 self.pdawg3.measurement.sweeps = 2.1e5 self.pdawg3.measurement.vpp = vpp self.pdawg3.measurement.power = power #self.pdawg3.measurement.freq_center = freq_center self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() x_shift = 0 y_shift = 0 index = [ 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 31 ] # Ymax_ref =9.1472 # Xmax_ref=15.8024 # Magnet.move_absolute(1, Xmax_ref) # time.sleep(12.0) # Magnet.move_absolute(2, Ymax_ref) # time.sleep(12.0) for nind, ncenter in enumerate(index): ncenter = int(ncenter) self.auto_focus.target_name = 'NV' + str(nind + 1) time.sleep(1.0) self.auto_focus.periodic_focus = False self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] X0 = self.confocal.x Y0 = self.confocal.y if (self.confocal.y > 50 or self.confocal.y < 0 or self.confocal.x > 50 or self.confocal.x < 0): continue self.auto_focus.submit() time.sleep(12.0) self.auto_focus.submit() time.sleep(12.0) file_name = file_path + '/NV' + str(nind + 1) if not os.path.isdir(file_name): os.mkdir(file_name) else: continue # confocal scan ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ self.confocal.submit() time.sleep(220) file_nv = file_name + '/image.png' self.confocal.save_image(file_nv) self.auto_focus.submit() time.sleep(12.0) self.auto_focus.submit() time.sleep(12.0) # # magnet alignment ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # self.auto_focus.periodic_focus = False # self.auto_focus.submit() # time.sleep(12.0) # # Magnet.move_absolute(3, distance[nfield]) # # time.sleep(10.0) # # self.auto_focus.submit() # # time.sleep(12.0) # Magnet.move_absolute(1, Xmax_ref) # time.sleep(12.0) # Magnet.move_absolute(2, Ymax_ref) # time.sleep(12.0) # self._magnet_alignment('y') # time.sleep(1.0) # Magnet.move_absolute(2, self.magnet_control.start_positionY) # time.sleep(12.0) # self.magnet_control.submit() # time.sleep(3.0) # if self.magnet_control.state == 'error': # time.sleep(3.0) # self.magnet_control.submit() # while self.magnet_control.state != 'done': # threading.currentThread().stop_request.wait(1.0) # if threading.currentThread().stop_request.isSet(): # break # #time.sleep(self.magnet_control.expected_duration+30) # self.magnet_control.perform_fit=True # time.sleep(1.0) # self.magnet_control.perform_fit=False # time.sleep(1.0) # self.magnet_control.perform_fit=True # Magnet.move_absolute(2, self.magnet_control.Ymax) # if not np.isnan(self.magnet_control.Ymax): # if abs(Ymax_ref - self.magnet_control.Ymax) < 0.2: # Magnet.move_absolute(2, self.magnet_control.Ymax) # Ymax_ref = self.magnet_control.Ymax # time.sleep(10) # self.magnet_control.save_fluor_y_plot(file_name+'/y') # self.auto_focus.submit() # time.sleep(12.0) # self._magnet_alignment('x') # time.sleep(1.0) # Magnet.move_absolute(1, self.magnet_control.start_positionX) # time.sleep(10.0) # self.magnet_control.submit() # time.sleep(3.0) # if self.magnet_control.state == 'error': # time.sleep(3.0) # self.magnet_control.submit() # while self.magnet_control.state != 'done': # threading.currentThread().stop_request.wait(1.0) # if threading.currentThread().stop_request.isSet(): # break # #time.sleep(self.magnet_control.expected_duration+30) # self.magnet_control.perform_fit=True # time.sleep(1.0) # self.magnet_control.perform_fit=False # time.sleep(1.0) # self.magnet_control.perform_fit=True # if not np.isnan(self.magnet_control.Xmax): # if abs(Xmax_ref - self.magnet_control.Xmax) < 0.2: # Magnet.move_absolute(1, self.magnet_control.Xmax) # Xmax_ref = self.magnet_control.Xmax # Magnet.move_absolute(1, self.magnet_control.Xmax) # time.sleep(10) # self.magnet_control.save_fluor_x_plot(file_name+'/x') # # pulsed odmr -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- time.sleep(1.0) self._odmr_cw() time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' if (self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): continue freq = self.odmr.fit_frequencies[0] if (np.isnan(freq)): continue time.sleep(1.0) self._odmr_pulsed(freq) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/odmr_' + string.replace( str(self.odmr.magnetic_field)[0:5], '.', 'd') + 'G' self.odmr.save_all(file_odmr) time.sleep(5.0) self.auto_focus.periodic_focus = True if (len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): continue freq = self.odmr.fit_frequencies[0] freq_center = freq - 0.1e+9 if (np.isnan(freq)): continue # # Rabi ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- self.auto_focus.periodic_focus = True self.auto_focus.focus_interval = 3 self.psawg2.measurement.freq = freq self.psawg2.measurement.freq_center = freq_center self.psawg2.measurement.load() time.sleep(5.0) self.psawg2.fit = RabiFit_phase() time.sleep(5.0) while self.psawg2.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg2.measurement.submit() while self.psawg2.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg2.measurement.progress = 0 self.psawg2.measurement.elapsed_sweeps = 0 file_rabi = file_name + '/Rabi' + '_power_' + str( power) + '_contrast_' + string.replace( str(self.psawg2.fit.contrast[0])[0:4], '.', 'd') self.psawg2.save_all(file_rabi) time.sleep(10.0) self.psawg2.measurement.remove() self.psawg2.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg2.fit.t_pi2[0] pi = self.psawg2.fit.t_pi[0] condition = np.isnan(half_pi) or self.psawg2.fit.contrast[0] < 15 if condition: continue self.pdawg.measurement.freq = freq self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.rabi_contrast = self.psawg2.fit.contrast[0] self.pdawg.measurement.load() time.sleep(20.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg.measurement.state == 'error': time.sleep(4) self.pdawg.measurement.resubmit() self.pdawg.measurement.progress = 0 self.pdawg.measurement.elapsed_sweeps = 0 file_hahn = file_name + '/T2' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') self.pdawg.save_processed_plot(file_hahn + '_ProcPlot.png') time.sleep(5.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(5.0) self.pdawg2.measurement.freq = freq self.pdawg2.measurement.freq_center = freq_center self.pdawg2.measurement.pi_1 = pi self.pdawg2.measurement.rabi_contrast = self.psawg2.fit.contrast[0] self.pdawg2.measurement.load() time.sleep(15.0) self.auto_focus.focus_interval = 5 while self.pdawg2.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg2.measurement.submit() while self.pdawg2.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg2.measurement.state == 'error': time.sleep(4) self.pdawg2.measurement.resubmit() self.pdawg2.measurement.progress = 0 self.pdawg2.measurement.elapsed_sweeps = 0 file_T1 = file_name + '/T1' self.pdawg2.save_line_plot(file_T1 + '.png') self.pdawg2.save(file_T1 + '.pyd') self.pdawg2.save_processed_plot(file_T1 + '_ProcPlot.png') time.sleep(10.0) self.pdawg2.measurement.remove() self.pdawg2.measurement.state = 'idle' time.sleep(10.0) #============================================================================================================================================================================================================ self.pdawg3.measurement.freq_center = freq_center self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.pulse_num = 12 self.pdawg3.measurement.rabi_contrast = self.psawg2.fit.contrast[0] self.pdawg3.measurement.load() time.sleep(50.0) self.auto_focus.focus_interval = 2 while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg3.measurement.state == 'error': time.sleep(4) self.pdawg3.measurement.resubmit() self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_XY = file_name + '/xy8-' + str( self.pdawg3.measurement.pulse_num) self.pdawg3.save_line_plot(file_XY + '.png') self.pdawg3.save_processed_plot(file_XY + '_ProcPlot.png') self.pdawg3.save(file_XY + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(10.0) #=============================================================================================================================================================================================================== self.pdawg3.measurement.freq_center = freq_center self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.pulse_num = 24 self.pdawg3.measurement.rabi_contrast = self.psawg2.fit.contrast[0] self.pdawg3.measurement.load() time.sleep(50.0) self.auto_focus.focus_interval = 2 while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg3.measurement.state == 'error': time.sleep(4) self.pdawg3.measurement.resubmit() self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_XY = file_name + '/xy8-' + str( self.pdawg3.measurement.pulse_num) self.pdawg3.save_line_plot(file_XY + '.png') self.pdawg3.save_processed_plot(file_XY + '_ProcPlot.png') self.pdawg3.save(file_XY + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(10.0) #=============================================================================================================================================================================================================== self.pdawg3.measurement.freq_center = freq_center self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.pulse_num = 30 self.pdawg3.measurement.rabi_contrast = self.psawg2.fit.contrast[0] self.pdawg3.measurement.load() time.sleep(50.0) self.auto_focus.focus_interval = 2 while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg3.measurement.state == 'error': time.sleep(4) self.pdawg3.measurement.resubmit() self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_XY = file_name + '/xy8-' + str( self.pdawg3.measurement.pulse_num) self.pdawg3.save_line_plot(file_XY + '.png') self.pdawg3.save_processed_plot(file_XY + '_ProcPlot.png') self.pdawg3.save(file_XY + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(10.0) #=============================================================================================================================================================================================================== self.auto_focus.periodic_focus = False self.auto_focus.submit() time.sleep(12.0) x_shift = self.confocal.x - X0 y_shift = self.confocal.y - Y0 for Ncent in index: self.sf.Centroids[Ncent][ 0] = self.sf.Centroids[Ncent][0] + y_shift self.sf.Centroids[Ncent][ 1] = self.sf.Centroids[Ncent][1] + x_shift self.auto_focus.periodic_focus = False pg.Night() print 'I have finished'
def _run(self): file_name = 'D:/data/protonNMR/NV search_Oxygen_etching2/x_13_18_y_30_40/NV2/corr' os.path.exists(file_name) power = 1.8 freq_center = 1.76e9 fstart = 1.587e9 fend = 1.597e9 self._odmr(fstart, fend) time.sleep(1.0) from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = power self.psawg.measurement.freq_center = freq_center self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 1.0e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) self.confocal.x1 = 14.8 self.confocal.x2 = 16.8 self.confocal.y1 = 35.1 self.confocal.y2 = 37.1 self.sf.BWimageMeth = 'advanced' self.sf.size = 7 #t_corr = [8000, 9000, 11000, 14000, 17000, 20000, 25000, 30000, 40000, 60000, 100000, 150000, 180000, 200000, 220000, 320000, 260000, 290000, 420000, 520000, 720000, 820000, 920000] t_corr = [300000] for nl in range(len(t_corr)): from measurements.shallow_NV import Correlation_Spec_XY8 self.sensing.fit = RabiFit_phase() self.sensing.measurement = Correlation_Spec_XY8() self.sensing.measurement.freq_center = freq_center self.sensing.measurement.pulse_num = 4 self.sensing.measurement.tau_inte = 89.0 self.sensing.measurement.dbtau_flag = True self.sensing.measurement.tau_begin1 = 3000 self.sensing.measurement.tau_end1 = 40000 self.sensing.measurement.tau_delta1 = 1555 self.sensing.measurement.tau_begin = 44000 self.sensing.measurement.tau_end = 300000 self.sensing.measurement.tau_delta = 7259 for nk in range(5): self.auto_focus.periodic_focus = False file_image = file_name + '/image_' + str( t_corr[nl]) + '_' + str(nk) + '.png' if os.path.isfile(file_image): continue self.confocal.submit() time.sleep(88) #file_image = file_name + '/image_' + str(t_corr[nk]) + '.pyd' self.confocal.save_image(file_image) time.sleep(1.0) self.auto_focus.periodic_focus = True self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/Odmr_' + str( t_corr[nl]) + '_' + str(nk) self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) if (len(self.odmr.fit_frequencies) > 3 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 40): continue freq = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) if (np.isnan(freq)): continue # Rabi ##################### self.psawg.measurement.freq = freq self.psawg.fit = RabiFit_phase() time.sleep(2.0) rabi_flag = True if np.isnan(power): power = 1.8 while rabi_flag: self.psawg.measurement.power = power self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] if pi < 80.5 and pi > 79.8: rabi_flag = False else: amp = 80.0 / pi #amp^2 = power/power_next power = power - 10 * np.log10(amp**2) if np.isnan(power): power = 1.8 file_rabi = file_name + '/Rabi_' + str( t_corr[nl]) + '_' + str(nk) self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) self.sensing.measurement.power = power self.sensing.measurement.freq = freq self.sensing.measurement.pi2_1 = half_pi self.sensing.measurement.pi_1 = pi self.sensing.measurement.sweeps = (nk + 1) * 1.0e6 self.sensing.measurement.load() time.sleep(100.0) while self.sensing.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) if nk == 0: self.sensing.measurement.submit() else: self.sensing.measurement.resubmit() self.sensing.fit = RabiFit_phase() while self.sensing.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_corr = file_name + '/correlation_XY8_' + str( self.sensing.measurement.pulse_num) + '_' + str( 80) + 'ns' + '_' + str( t_corr[nl] / 1000) + '_' + str(t_corr[nl] / 1000 + 1) + 'us_' + str(nk) self.sensing.save_line_plot(file_corr + '.png') self.sensing.save(file_corr + '.pyd') time.sleep(10.0) self.sensing.measurement.remove() self.sensing.measurement.state = 'idle' time.sleep(20.0) self.auto_focus.submit() time.sleep(16.0) self.auto_focus.submit() time.sleep(16.0) self.auto_focus.submit() time.sleep(16.0) cond1 = self.auto_focus.data_z.max() < 30 if cond1: pg = ha.PulseGenerator() pg.Light() self.auto_focus.submit() time.sleep(16.0) self.auto_focus.submit() time.sleep(16.0) self.auto_focus.submit() time.sleep(16.0)
def _run(self): file_path = 'D:/data/protonNMR/mebrane/scan/nanoparticle_test/D_3_R_area(np_PFI)/odmr_scan' os.path.exists(file_path) #x_coil = ha.Coil()('x') #y_coil = ha.Coil()('y') self.confocal.resolution = 150 power = 16 freq_center = 2.76e9 fstart = 2.83e9 fend = 2.91e9 from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = power self.psawg.measurement.freq_center = freq_center self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 1.5e5 self.psawg.fit = RabiFit_phase() time.sleep(2.0) from measurements.shallow_NV import FID_Db self.pdawg.measurement = FID_Db() self.pdawg.measurement.power = power self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.tau_begin = 100 self.pdawg.measurement.tau_end = 2000 self.pdawg.measurement.tau_delta = 30 self.pdawg.measurement.sweeps = 2.0e5 from measurements.shallow_NV import Hahn self.pdawg2.measurement = Hahn() self.pdawg2.measurement.power = power self.pdawg2.measurement.freq_center = freq_center self.pdawg2.measurement.tau_begin = 300 self.pdawg2.measurement.tau_end = 10000 self.pdawg2.measurement.tau_delta = 210 self.pdawg2.measurement.sweeps = 2.0e5 from measurements.shallow_NV import T1 self.pdawg3.measurement = T1() self.pdawg3.measurement.power = power self.pdawg3.measurement.freq_center = freq_center self.pdawg3.measurement.tau_begin = 300 self.pdawg3.measurement.tau_end = 150000 self.pdawg3.measurement.tau_delta = 8000 self.pdawg3.measurement.sweeps = 3.0e5 self.auto_focus.periodic_focus = False #if os.path.isfile(file_image1): #self.confocal.load(file_image1) #time.sleep(1.0) #else: self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self._odmr_cw() time.sleep(1.0) index = np.linspace(0, 47, 48) #index = [1,2,3,4,7,13,15,17,19,26,27,28,31,39,40,43,48,50,51,56] for ncenter in index: ''' x_coil._set_current(0.5) time.sleep(1.0) y_coil._set_current(0.5) time.sleep(1.0) ''' ncenter = int(ncenter) self.auto_focus.periodic_focus = False self.auto_focus.target_name = 'NV' + str(ncenter) time.sleep(1.0) self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] self.auto_focus.submit() time.sleep(16.0) ''' self.confocal.resolution = 120 self.confocal.submit() time.sleep(90) file_nv = file_path + '/NV_' + str(ncenter) + '_image.png' self.confocal.save_image(file_nv) ''' self.auto_focus.submit() time.sleep(16.0) self.auto_focus.periodic_focus = True time.sleep(1.0) #self._odmr(fstart,fend) #time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_path + '/NV_' + str(ncenter) + 'Odmr' self.odmr.save_line_plot(file_odmr + '.png') time.sleep(1.0) self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) self.auto_focus.periodic_focus = False """
def _run(self): file_path = 'D:/data/BN_NMR/Isoya sample/before etching/reference 5 keV lowest dose/autopilot' self.confocal.resolution = 200 power = -4 vpp = 0.6 from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.tau_begin = 300 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 0.8e5 self.psawg.measurement.power = power self.psawg.measurement.vpp = vpp self.psawg.fit = RabiFit_phase() time.sleep(5.0) from measurements.shallow_NV import Hahn self.pdawg.measurement = Hahn() self.pdawg.measurement.power = power self.pdawg.measurement.vpp = 0.6 self.pdawg.measurement.tau_begin = 300 self.pdawg.measurement.tau_end = 20000 self.pdawg.measurement.tau_delta = 1000 self.pdawg.measurement.sweeps = 1.00e6 from measurements.shallow_NV import T1 self.pdawg2.measurement = T1() self.pdawg2.measurement.power = power self.pdawg2.measurement.vpp = 0.6 self.pdawg2.measurement.tau_begin = 300 self.pdawg2.measurement.tau_end = 1000000 self.pdawg2.measurement.tau_delta = 50000 self.pdawg2.measurement.sweeps = 0.5e6 from measurements.shallow_NV import XY16_Ref self.pdawg3.measurement = XY16_Ref() self.pdawg3.measurement.tau_delta = 1 self.pdawg3.measurement.sweeps = 1.0e6 self.pdawg3.measurement.vpp = vpp self.pdawg3.measurement.power = power #self.pdawg3.measurement.pulse_num = 5 # from measurements.shallow_NV import XY8_Ref # self.pdawg2.measurement = XY8_Ref() # self.pdawg2.measurement.tau_delta = 1 # self.pdawg2.measurement.sweeps = 1.0e6 # self.pdawg2.measurement.vpp = vpp # self.pdawg2.measurement.power = power # self.pdawg2.measurement.pulse_num = 2*self.pdawg.measurement.pulse_num self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() x_shift = 0 y_shift = 0 index = [ 7, 8, 11, 14, 17, 19, 27, 30, 36, 38, 39, 40, 44, 47, 48, 53, 55, 57, 58, 60, 61, 63, 67, 69 ] Ymax_ref = 6.4624 Xmax_ref = 6.0913 # Magnet.move_absolute(1, Xmax_ref) # time.sleep(12.0) # Magnet.move_absolute(2, Ymax_ref) # time.sleep(12.0) for nind, ncenter in enumerate(index): ncenter = int(ncenter) self.auto_focus.target_name = 'NV' + str(nind + 1) time.sleep(1.0) self.auto_focus.periodic_focus = False self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] X0 = self.confocal.x Y0 = self.confocal.y if (self.confocal.y > 50 or self.confocal.y < 0 or self.confocal.x > 50 or self.confocal.x < 0): continue self.auto_focus.submit() time.sleep(12.0) self.auto_focus.submit() time.sleep(12.0) file_name = file_path + '/NV' + str(nind + 1) if not os.path.isdir(file_name): os.mkdir(file_name) #else: #continue # confocal scan ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ self.confocal.submit() time.sleep(230) file_nv = file_name + '/image.png' self.confocal.save_image(file_nv) self.auto_focus.submit() time.sleep(12.0) self.auto_focus.submit() time.sleep(12.0) # magnet alignment -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #Xmax_ref, Ymax_ref = alignment_xy(Xmax_ref, Ymax_ref) # pulsed odmr & Rabi ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- freq, freq_center, half_pi, pi, contrast = self._odmr_rabi( file_name) self.pdawg.measurement.freq_center = freq_center self.pdawg.measurement.freq = freq self.pdawg.measurement.pi2_1 = half_pi self.pdawg.measurement.pi_1 = pi self.pdawg.measurement.rabi_contrast = self.psawg.fit.contrast[0] self.pdawg.measurement.load() time.sleep(20.0) while self.pdawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg.measurement.submit() while self.pdawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg.measurement.state == 'error': time.sleep(4) self.pdawg.measurement.resubmit() self.pdawg.measurement.progress = 0 self.pdawg.measurement.elapsed_sweeps = 0 file_hahn = file_name + '/T2' self.pdawg.save_line_plot(file_hahn + '.png') self.pdawg.save(file_hahn + '.pyd') self.pdawg.save_processed_plot(file_hahn + '_ProcPlot.png') time.sleep(5.0) self.pdawg.measurement.remove() self.pdawg.measurement.state = 'idle' time.sleep(5.0) self.pdawg2.measurement.freq_center = freq_center self.pdawg2.measurement.freq = freq self.pdawg2.measurement.pi_1 = pi self.pdawg2.measurement.rabi_contrast = self.psawg.fit.contrast[0] self.pdawg2.measurement.load() time.sleep(15.0) while self.pdawg2.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg2.measurement.submit() while self.pdawg2.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg2.measurement.state == 'error': time.sleep(4) self.pdawg2.measurement.resubmit() self.pdawg2.measurement.progress = 0 self.pdawg2.measurement.elapsed_sweeps = 0 file_T1 = file_name + '/T1' self.pdawg2.save_line_plot(file_T1 + '.png') self.pdawg2.save(file_T1 + '.pyd') self.pdawg2.save_processed_plot(file_T1 + '_ProcPlot.png') time.sleep(10.0) self.pdawg2.measurement.remove() self.pdawg2.measurement.state = 'idle' time.sleep(10.0) t1 = 57 for m in range(1): self.auto_focus.periodic_focus = True self._apply_parameters_XY16(t1, freq_center) self.pdawg3.measurement.freq = freq self.pdawg3.measurement.pi2_1 = half_pi self.pdawg3.measurement.pi_1 = pi self.pdawg3.measurement.rabi_contrast = self.psawg.fit.contrast[ 0] self.pdawg3.measurement.pulse_num = 20 + m self.pdawg3.measurement.load() time.sleep(50.0) while self.pdawg3.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.pdawg3.measurement.submit() while self.pdawg3.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break if self.pdawg3.measurement.state == 'error': time.sleep(4) self.pdawg3.measurement.resubmit() self.pdawg3.measurement.progress = 0 self.pdawg3.measurement.elapsed_sweeps = 0 file_XY = file_name + '/xy16-' + str( self.pdawg3.measurement.pulse_num) + '_' + str( t1) + '-' + str(t1 + 20) + 'ns' self.pdawg3.save_line_plot(file_XY + '.png') self.pdawg3.save_processed_plot(file_XY + '_ProcPlot.png') self.pdawg3.save(file_XY + '.pyd') time.sleep(10.0) self.pdawg3.measurement.remove() self.pdawg3.measurement.state = 'idle' time.sleep(10.0) # self._apply_parameters_XY8(t1, freq_center) # self.pdawg2.measurement.freq = freq # self.pdawg2.measurement.pi2_1 = half_pi # self.pdawg2.measurement.pi_1 = pi # self.pdawg2.measurement.rabi_contrast=self.psawg.fit.contrast[0] # self.pdawg2.measurement.load() # time.sleep(50.0) # while self.pdawg2.measurement.reload == True: # threading.currentThread().stop_request.wait(1.0) # self.pdawg2.measurement.submit() # while self.pdawg2.measurement.state != 'done': # threading.currentThread().stop_request.wait(1.0) # if threading.currentThread().stop_request.isSet(): # break # if self.pdawg2.measurement.state == 'error': # time.sleep(4) # self.pdawg2.measurement.resubmit() # self.pdawg2.measurement.progress = 0 # self.pdawg2.measurement.elapsed_sweeps = 0 # file_XY = file_name + '/xy8-' + str(self.pdawg2.measurement.pulse_num)+'_'+str(t1)+'-'+str(t1+20)+'ns' # self.pdawg2.save_line_plot(file_XY + '.png') # self.pdawg2.save_processed_plot(file_XY + '_ProcPlot.png') # self.pdawg2.save(file_XY + '.pyd') # time.sleep(10.0) # self.pdawg2.measurement.remove() # self.pdawg2.measurement.state = 'idle' # time.sleep(10.0) # Check contrast self.psawg.measurement.load() time.sleep(5.0) self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg.measurement.progress = 0 self.psawg.measurement.elapsed_sweeps = 0 time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) contrast2 = self.psawg.fit.contrast[0] self.auto_focus.periodic_focus = False if contrast - contrast2 < 5: print 'Yahoo!' #t1=t1+20 else: Xmax_ref, Ymax_ref = self._alignment_xy( Xmax_ref, Ymax_ref, file_name) freq, freq_center, half_pi, pi, contrast = self._odmr_rabi( file_name) t1 = t1 + 20 self.auto_focus.periodic_focus = False self.auto_focus.submit() time.sleep(12.0) x_shift = self.confocal.x - X0 y_shift = self.confocal.y - Y0 for Ncent in index: self.sf.Centroids[Ncent][ 0] = self.sf.Centroids[Ncent][0] + y_shift self.sf.Centroids[Ncent][ 1] = self.sf.Centroids[Ncent][1] + x_shift self.auto_focus.periodic_focus = False pg.Night() print 'I have finished'
def _odmr_rabi(self, file_name): time.sleep(1.0) self._odmr_cw() time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' # if(self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): # continue freq = self.odmr.fit_frequencies[0] if (np.isnan(freq)): continue time.sleep(1.0) self._odmr_pulsed(freq) time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.odmr.remove() self.odmr.state = 'idle' file_odmr = file_name + '/odmr_' + string.replace( str(self.odmr.magnetic_field)[0:5], '.', 'd') + 'G' self.odmr.save_all(file_odmr) time.sleep(5.0) self.auto_focus.periodic_focus = True # if(len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 5 or self.odmr.fit_contrast.max() > 43): # continue freq = self.odmr.fit_frequencies[0] # if(np.isnan(freq)): # continue self.auto_focus.periodic_focus = True self.psawg.measurement.freq = freq freq_center = freq - 0.1e+9 self.psawg.measurement.freq_center = freq_center self.psawg.measurement.load() time.sleep(5.0) from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() time.sleep(5.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break self.psawg.measurement.progress = 0 self.psawg.measurement.elapsed_sweeps = 0 file_rabi = file_name + '/Rabi' + '_power_' + str( self.psawg.measurement.power) + '_contrast_' + string.replace( str(self.psawg.fit.contrast[0])[0:4], '.', 'd') self.psawg.save_all(file_rabi) time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] contrast = self.psawg.fit.contrast[0] # condition = np.isnan(half_pi) or self.psawg.fit.contrast[0] < 15 # if condition: # continue return freq, freq_center, half_pi, pi, contrast
def _run(self): file_pos = 'D:/data/protonNMR/NV search' os.path.exists(file_pos) self.confocal.resolution = 150 fstart = 1.668e9 fend = 1.678e9 self._odmr(fstart, fend) time.sleep(1.0) from measurements.pulsed_awg import Rabi self.psawg.measurement = Rabi() from analysis.pulsedawgan import RabiFit_phase self.psawg.fit = RabiFit_phase() self.psawg.measurement.power = 12 self.psawg.measurement.freq_center = 1.86e9 self.psawg.measurement.tau_begin = 10 self.psawg.measurement.tau_end = 1000 self.psawg.measurement.tau_delta = 10 self.psawg.measurement.sweeps = 2e5 self.psawg.fit = RabiFit_phase() time.sleep(5.0) for nk in range(5): for nl in range(5): if nk % 2 == 1: nl = 4 - nl x1 = (nk + 1) * 10 x2 = (nk + 2) * 10 y1 = (nl + 0) * 10 y2 = (nl + 1) * 10 file_path = file_pos + '/x_' + str(x1) + '_' + str( x2) + '_y_' + str(y1) + '_' + str(y2) if not os.path.isdir(file_path): os.mkdir(file_path) else: continue self.confocal.x1 = x1 self.confocal.x2 = x2 self.confocal.y1 = y1 self.confocal.y2 = y2 self.auto_focus.periodic_focus = False file_image1 = file_path + '/image.pyd' if os.path.isfile(file_image1): self.confocal.load(file_image1) time.sleep(1.0) else: self.confocal.submit() time.sleep(140) self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 40 self.sf.SpotMaxInt = 160 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() file_image = file_path + '/image.png' self.sf.confocal.save_image(file_image) #file_image1 = file_path + '/image.pyd' self.sf.confocal.save(file_image1) for ncenter in range(len(self.sf.Centroids)): self.auto_focus.periodic_focus = False self.auto_focus.target_name = 'NV' + str(ncenter) time.sleep(1.0) self.confocal.y = self.sf.Centroids[ncenter][0] self.confocal.x = self.sf.Centroids[ncenter][1] self.auto_focus.submit() time.sleep(8.0) z_axis = np.sort(self.auto_focus.Z) zlen = (z_axis[-1] - z_axis[0]) / self.auto_focus.step_z zpos = (self.auto_focus.zfit - z_axis[0]) / self.auto_focus.step_z zcondition = float( zpos / zlen) > 0.4 and float(zpos) / zlen for nfocus in range(25): if zcondition and self.auto_focus.data_z.max( ) - self.auto_focus.data_z.min() > 70: break else: self.auto_focus.submit() time.sleep(8.0) z_axis = np.sort(self.auto_focus.Z) zlen = (z_axis[-1] - z_axis[0]) / self.auto_focus.step_z zpos = (self.auto_focus.zfit - z_axis[0]) / self.auto_focus.step_z zcondition = float(zpos / zlen) > 0.4 and float( zpos / zlen) < 0.6 self.auto_focus.fit_xy() time.sleep(1.0) if self.auto_focus.xfit - 0.25 < 0: self.confocal.x1 = 0 self.confocal.x2 = 2 * self.auto_focus.xfit self.confocal.y1 = self.auto_focus.yfit - self.auto_focus.xfit self.confocal.y2 = self.auto_focus.yfit + self.auto_focus.xfit elif self.auto_focus.yfit - 0.25 < 0: self.auto_focus.y1 = 0 self.auto_focus.y2 = 2 * self.auto_focus.yfit self.confocal.x1 = self.auto_focus.xfit - self.auto_focus.yfit self.confocal.x2 = self.auto_focus.xfit + self.auto_focus.yfit elif self.auto_focus.xfit + 0.25 > 50: self.confocal.x2 = 50 self.confocal.x1 = 2 * self.auto_focus.xfit - 50 self.confocal.y1 = self.auto_focus.yfit + self.auto_focus.xfit - 50 self.confocal.y2 = self.auto_focus.yfit + 50 - self.auto_focus.xfit elif self.auto_focus.yfit + 0.25 > 50: self.confocal.y2 = 50 self.confocal.y1 = 2 * self.auto_focus.yfit - 50 self.confocal.x1 = self.auto_focus.xfit + self.auto_focus.yfit - 50 self.confocal.x2 = self.auto_focus.xfit + 50 - self.auto_focus.yfit else: self.confocal.x1 = self.auto_focus.xfit - 0.25 self.confocal.x2 = self.auto_focus.xfit + 0.25 self.confocal.y1 = self.auto_focus.yfit - 0.25 self.confocal.y2 = self.auto_focus.yfit + 0.25 self.confocal.submit() time.sleep(140) self.gs._ImportImage_fired() time.sleep(2.0) self.gs._Getfitimage_fired() file_image = file_path + '/NV' + str(ncenter) + '.png' self.gs.save_image(file_image) fitx = abs(self.gs.fitparemeter[4]) fity = abs(self.gs.fitparemeter[3]) spotcondition = fitx > 0.125 or fity > 0.125 or fitx > 1.3 * fity or fity > 1.3 * fitx if spotcondition: continue file_name = file_path + '/NV' + str(ncenter) if not os.path.isdir(file_name): os.mkdir(file_name) else: continue self.auto_focus.submit() time.sleep(8.0) self.confocal.load(file_image1) time.sleep(1.0) self.confocal.x = self.auto_focus.xfit self.confocal.y = self.auto_focus.yfit file_nv = file_name + '/image.png' self.sf.confocal.save_image(file_nv) time.sleep(8.0) self.auto_focus.periodic_focus = True time.sleep(1.0) self.odmr.submit() time.sleep(2.0) while self.odmr.state != 'done': #print threading.currentThread().getName() threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_odmr = file_name + '/Odmr' self.odmr.save_line_plot(file_odmr + '.png') self.odmr.save(file_odmr + '.pyd') time.sleep(5.0) if (len(self.odmr.fit_frequencies) > 2 or self.odmr.fit_contrast.max() < 8): continue freq = sum(self.odmr.fit_frequencies) / len( self.odmr.fit_frequencies) # Rabi ##################### self.psawg.measurement.freq = freq self.psawg.measurement.load() time.sleep(10.0) while self.psawg.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.psawg.measurement.submit() while self.psawg.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_rabi = file_name + '/Rabi' self.psawg.save_line_plot(file_rabi + '.png') self.psawg.save(file_rabi + '.pyd') time.sleep(10.0) self.psawg.measurement.remove() self.psawg.measurement.state = 'idle' time.sleep(5.0) half_pi = self.psawg.fit.t_pi2[0] pi = self.psawg.fit.t_pi[0] condition = np.isnan( half_pi) or self.psawg.fit.contrast[0] < 20 if condition: continue from measurements.shallow_NV import XY8 self.sensing.measurement = XY8() self.sensing.measurement.power = 12 self.sensing.measurement.freq_center = 1.86e9 self.sensing.measurement.freq = freq self.sensing.measurement.pi2_1 = half_pi self.sensing.measurement.pi_1 = pi self.sensing.measurement.pulse_num = 12 self.sensing.measurement.tau_begin = 60 self.sensing.measurement.tau_end = 180 self.sensing.measurement.tau_delta = 4 self.sensing.measurement.sweeps = 5.0e5 self.sensing.measurement.load() time.sleep(100.0) while self.sensing.measurement.reload == True: threading.currentThread().stop_request.wait(1.0) self.sensing.measurement.submit() while self.sensing.measurement.state != 'done': threading.currentThread().stop_request.wait(1.0) if threading.currentThread().stop_request.isSet(): break file_hahn = file_name + '/dynamics_XY8_' + str( self.sensing.measurement.pulse_num) + '_' + str( int(pi)) + 'ns' self.sensing.save_line_plot(file_hahn + '.png') self.sensing.save(file_hahn + '.pyd') time.sleep(10.0) self.sensing.measurement.remove() self.sensing.measurement.state = 'idle' time.sleep(20.0) if len(self.sf.Centroids) == 0: self.auto_focus.periodic_focus = False self.confocal.remove_all_labels() self.auto_focus.remove_all_targets() self.sf._ImportImage_fired() time.sleep(2.0) self.sf.SpotMinInt = 10 self.sf.SpotMaxInt = 250 self.sf._ProcessBWimage_fired() time.sleep(15.0) self.sf._ExportButton_fired() if len(self.sf.Centroids) > 0: self.confocal.y = self.sf.Centroids[-1][0] self.confocal.x = self.sf.Centroids[-1][1] x_last = self.confocal.x y_last = self.confocal.y else: self.confocal.y = y_last self.confocal.x = x_last self.auto_focus.submit() time.sleep(8.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1 = (z_axis1[-1] - z_axis1[0]) / self.auto_focus.step_z zpos1 = (self.auto_focus.zfit - z_axis1[0]) / self.auto_focus.step_z zcondition1 = float( zpos1 / zlen1) > 0.4 and float(zpos1) / zlen1 for nfocus in range(25): if zcondition1 and self.auto_focus.data_z.max( ) - self.auto_focus.data_z.min() > 70: break else: self.auto_focus.submit() time.sleep(8.0) z_axis1 = np.sort(self.auto_focus.Z) zlen1 = (z_axis1[-1] - z_axis1[0]) / self.auto_focus.step_z zpos1 = (self.auto_focus.zfit - z_axis1[0]) / self.auto_focus.step_z zcondition1 = float(zpos1 / zlen1) > 0.4 and float( zpos1 / zlen1) < 0.6