def _create_mw_pulses(msmt,Gate): Gate.mw_X = ps.X_pulse(msmt) Gate.mw_pi2 = ps.Xpi2_pulse(msmt) Gate.mw_mpi2 = ps.mXpi2_pulse(msmt) if msmt.params['do_calc_theta'] > 0 or msmt.params['general_sweep_name'] == 'sin2_theta': fit_a = msmt.params['sin2_theta_fit_a'] fit_x0 = msmt.params['sin2_theta_fit_x0'] fit_of = msmt.params['sin2_theta_fit_of'] p0 = msmt.params['sin2_theta'] msmt.params['mw_first_pulse_amp'] = fit_x0 - np.sqrt((p0-1+fit_of)/fit_a) ### calc right pulse amp from theta calibration Gate.mw_first_pulse = pulse.cp(ps.X_pulse(msmt),amplitude = msmt.params['mw_first_pulse_amp'],length = msmt.params['mw_first_pulse_length'],phase = msmt.params['mw_first_pulse_phase']) if msmt.params['first_mw_pulse_is_pi2'] > 0 and hasattr(Gate,'first_mw_pulse_phase'): Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = Gate.first_mw_pulse_phase) elif msmt.params['first_mw_pulse_is_pi2']: Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = msmt.params['mw_first_pulse_phase']) if hasattr(Gate,'no_first_pulse'): if Gate.no_first_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) if hasattr(Gate,'no_mw_pulse') or msmt.params['do_only_opt_pi'] >0: if Gate.no_mw_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_pi2 = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_mpi2 = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_X = pulse.cp(Gate.mw_X,amplitude = 0) if msmt.params['do_only_opt_pi'] >0: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_pi2 = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_mpi2 = pulse.cp(Gate.mw_X,amplitude = 0) Gate.mw_X = pulse.cp(Gate.mw_X,amplitude = 0)
def _create_mw_pulses(msmt,Gate): Gate.mw_X = ps.X_pulse(msmt) Gate.mw_pi2 = ps.Xpi2_pulse(msmt) Gate.mw_mpi2 = ps.mXpi2_pulse(msmt) Gate.mw_first_pulse = pulse.cp(ps.Xpi2_pulse(msmt),amplitude = msmt.params['mw_first_pulse_amp'],length = msmt.params['mw_first_pulse_length'],phase = msmt.params['mw_first_pulse_phase']) if hasattr(Gate,'first_pulse_is_pi2') and hasattr(Gate,'first_mw_pulse_phase'): if Gate.first_pulse_is_pi2: Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = Gate.first_mw_pulse_phase) elif hasattr(Gate,'first_pulse_is_pi2'): if Gate.first_pulse_is_pi2: Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = msmt.params['mw_first_pulse_phase']) if hasattr(Gate,'no_first_pulse'): if Gate.no_first_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) if hasattr(Gate,'no_mw_pulse'): if Gate.no_mw_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0,length = 1e-9) Gate.mw_pi2 = pulse.cp(Gate.mw_X,amplitude = 0,length = 1e-9) Gate.mw_mpi2 = pulse.cp(Gate.mw_X,amplitude = 0,length = 1e-9) Gate.mw_X = pulse.cp(Gate.mw_X,amplitude = 0,length = 1e-9)
def _create_mw_pulses(msmt,Gate): Gate.mw_X = ps.X_pulse(msmt) Gate.mw_pi2 = ps.Xpi2_pulse(msmt) Gate.mw_mpi2 = ps.mXpi2_pulse(msmt) Gate.mw_first_pulse = pulse.cp(ps.Xpi2_pulse(msmt),amplitude = msmt.params['mw_first_pulse_amp'],length = msmt.params['mw_first_pulse_length'],phase = msmt.params['mw_first_pulse_phase']) if 'first_mw_pulse_type' in msmt.params: if msmt.params['first_mw_pulse_type'] == 'pi': Gate.mw_first_pulse = pulse.cp(Gate.mw_X, phase = msmt.params['mw_first_pulse_phase']) elif msmt.params['first_mw_pulse_type'] == 'pi2': Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = msmt.params['mw_first_pulse_phase']) elif msmt.params['first_mw_pulse_type'] == 'none': Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) elif msmt.params['first_mw_pulse_type'] == 'square': msmt.params['pulse_shape'] = 'Square' Gate.mw_first_pulse = ps.X_pulse(msmt) msmt.params['pulse_shape'] = 'Hermite' else: raise ValueError("What are you doing first_mw_pulse_type does not make sense.") else: if hasattr(Gate,'first_pulse_is_pi2') and hasattr(Gate,'first_mw_pulse_phase'): if Gate.first_pulse_is_pi2: Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = Gate.first_mw_pulse_phase) elif hasattr(Gate,'first_pulse_is_pi2'): if Gate.first_pulse_is_pi2: Gate.mw_first_pulse = pulse.cp(Gate.mw_pi2, phase = msmt.params['mw_first_pulse_phase']) if hasattr(Gate,'no_first_pulse'): if Gate.no_first_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0) if hasattr(Gate,'no_mw_pulse'): if Gate.no_mw_pulse: Gate.mw_first_pulse = pulse.cp(Gate.mw_X,amplitude = 0, length = 0) Gate.mw_pi2 = pulse.cp(Gate.mw_X,amplitude = 0, length = 0) Gate.mw_mpi2 = pulse.cp(Gate.mw_X,amplitude = 0, length = 0) Gate.mw_X = pulse.cp(Gate.mw_X,amplitude = 0, length = 0)
def gateset(m, debug=False, decoupling=True, multiple=False, pi=True, single_decoupling=False, last_seq=False, fid_1=['e'], fid_2=['e'], sequence_type='all', germ=['e'], germ_position=[1, 3], N_decoupling=[4], run_numbers=[1, 2, 3]): """ Function used to run GST on the individual experiment level. """ if sequence_type == 'specific_germ_position': m = pulsar_delay.GateSetWithDecoupling(name) mbi_funcs.prepare(m) # load msmt params #from mbi_funcs.py m.params['E_RO_durations'] = [m.params['SSRO_duration']] m.params['E_RO_amplitudes'] = [m.params['Ex_RO_amplitude']] m.params['send_AWG_start'] = [1] m.params['sequence_wait_time'] = [0] #Specific to make it work on LT2 m.params['initial_msmt_delay'] = 5000.0e-9 #The total number of sequence repetitions m.params['reps_per_ROsequence'] = 5000 m.params['fid_1'] = fid_1 m.params['fid_2'] = fid_2 m.params['sequence_type'] = sequence_type m.params['germ'] = germ m.params['germ_position'] = germ_position m.params['N_decoupling'] = N_decoupling m.params['run_numbers'] = run_numbers #Muss auch nicht imer definiert werden #Calculae the larmor frequency, since we want to sit on larmor revival points for this experiment tau_larmor = np.round(1 / m.params['C1_freq_0'], 9) m.params['tau_larmor'] = tau_larmor if decoupling: #The spacing in between germ pulses t_bw_germs = 50e-9 m.params['wait_time'] = t_bw_germs #We need to check that our germ / fiducial pulses fit between two larmor times, and otherwise make it an #integer multiple of the initial value. Strictly the fiducial does not go in here. In the end this is probably not necessary since #our sequences are very short. sequence_length = max(len(max(fid_1, key=len)), len(max( fid_2, key=len)), len(max(germ, key=len))) * ( m.params['Hermite_pi2_length'] + t_bw_germs) + t_bw_germs if 2 * tau_larmor <= sequence_length: tau_larmor *= np.ceil(sequence_length / (2 * tau_larmor)) print "Adjusted larmor frequency to multiple", tau_larmor # tau_larmor *= 4 # print tau_larmor m.params['tau_larmor'] = tau_larmor m.params['sweep_name'] = 'Total evolution time [ms]' m.params['sweep_pts'] = run_numbers * np.ones( len(run_numbers)) * tau_larmor * 1.e3 else: m.params['sweep_name'] = 'Germ repetitions' m.params['sweep_pts'] = run_numbers #Set up the pulses we want to use in the experiment. First all the pi2 pulses. X_pi2 = ps.Xpi2_pulse(m) Y_pi2 = ps.Ypi2_pulse(m) mX_pi2 = ps.mXpi2_pulse(m) mY_pi2 = ps.mYpi2_pulse(m) #Set up all the pi pulses. X_pi = ps.X_pulse(m) Y_pi = ps.Y_pulse(m) mX_pi = ps.mX_pulse(m) mY_pi = ps.mY_pulse(m) # for the autoanalysis # m.params['sweep_name'] = 'Run number' # m.params['sweep_pts'] = 1 # Now calculate how many sweeps we want to do. For now we want to put a germ pulse at different subsequent # locations. Later, we want to make this random if sequence_type == "all": if len(fid_1) == len(fid_2) == len(germ) == len(N_decoupling) == len( run_numbers): m.params['pts'] = len(fid_1) else: sys.exit( "A mistake happened. Check your fiducials and germ lists have the same length." ) else: m.params['pts'] = len(germ_position) # Start measurement m.autoconfig() m.generate_sequence(pi=pi, decoupling=decoupling, upload=True, single_decoupling=single_decoupling, x_pulse_pi2=X_pi2, y_pulse_pi2=Y_pi2, x_pulse_mpi2=mX_pi2, y_pulse_mpi2=mY_pi2, x_pulse_pi=X_pi, y_pulse_pi=Y_pi, x_pulse_mpi=mX_pi, y_pulse_mpi=mY_pi) if not debug: m.run(autoconfig=False) if multiple: print run_numbers[0] m.save(name='Start_run%d' % run_numbers[0]) else: m.save() if not multiple: m.finish() else: if last_seq == True: m.finish()
def gateset_NoTriggers(name, debug=False, fid_1=['e'], fid_2=['e'], sequence_type='specific_germ_position', germ=['e'], germ_position=[1, 3], N_decoupling=[4], run_numbers=[1, 2, 3]): m = pulsar_delay.GateSetNoTriggers(name) m.params.from_dict(qt.exp_params['samples'][SAMPLE]) m.params.from_dict(qt.exp_params['protocols']['AdwinSSRO']) m.params.from_dict(qt.exp_params['protocols'][SAMPLE_CFG]['AdwinSSRO']) m.params.from_dict( qt.exp_params['protocols'][SAMPLE_CFG]['AdwinSSRO-integrated']) m.params.from_dict(qt.exp_params['protocols']['AdwinSSRO+espin']) m.params.from_dict(qt.exp_params['protocols']['cr_mod']) m.params.from_dict(qt.exp_params['protocols'][SAMPLE_CFG]['pulses']) m.params['pulse_type'] = 'Hermite' m.params['Ex_SP_amplitude'] = 0 m.params[ 'AWG_to_adwin_ttl_trigger_duration'] = 3e-6 # commenting this out gives an erro m.params['wait_for_AWG_done'] = 1 # m.params['sequence_wait_time']=0 # m.params['evolution_times'] = 0 m.params['fid_1'] = fid_1 m.params['fid_2'] = fid_2 m.params['sequence_type'] = sequence_type m.params['germ'] = germ m.params['germ_position'] = germ_position m.params['N_decoupling'] = N_decoupling m.params['run_numbers'] = run_numbers m.params['initial_msmt_delay'] = 000.0e-9 #Calculae the larmor frequency, since we want to sit on larmor revival points for this experiment tau_larmor = np.round(1 / m.params['C1_freq_0'], 9) #The spacing in between germ pulses t_bw_germs = 50e-9 X_pi2 = ps.Xpi2_pulse(m) Y_pi2 = ps.Ypi2_pulse(m) mX_pi2 = ps.mXpi2_pulse(m) mY_pi2 = ps.mYpi2_pulse(m) #We need to check that our germ / fiducial pulses fit between two larmor times, and otherwise make it an #integer multiple of the initial value. Strictly the fiducial does not go in here, so EASY WAY TO IMPROVE THE CODE #CAN BE FOUND HERE sequence_length = max(len(fid_1), len(fid_2), len(germ)) * ( m.params['Hermite_pi2_length'] + t_bw_germs) + t_bw_germs if 2 * tau_larmor <= sequence_length: tau_larmor *= np.ceil(sequence_length / (2 * tau_larmor)) m.params['tau_larmor'] = tau_larmor m.params['wait_time'] = t_bw_germs #The total number of sequence repetitions m.params['repetitions'] = 10000 # for the autoanalysis # m.params['sweep_name'] = 'Run number' # m.params['sweep_pts'] = 1 # Now calculate how many sweeps we want to do. For now we want to put a germ pulse at different subsequent # locations. Later, we want to make this random if sequence_type == "all": if len(fid_1) == len(fid_2) == len(germ) == len(N_decoupling) == len( run_numbers): m.params['pts'] = len(fid_1) else: print "A mistake happened. Check your fiducials and germ lists have the same length." return else: m.params['pts'] = len(germ_position) m.params['sweep_name'] = 'Run number' m.params['sweep_pts'] = run_numbers # for the self-triggering through the delay line # m.params['self_trigger_delay'] = 500e-9 # 0.5 us # m.params['self_trigger_duration'] = 100e-9 # Start measurement m.autoconfig() m.generate_sequence(upload=True, x_pulse_pi2=X_pi2, y_pulse_pi2=Y_pi2, x_pulse_mpi2=mX_pi2, y_pulse_mpi2=mY_pi2) if not debug: m.run(autoconfig=False) m.save() m.finish()