综合量子技术实验 ================ 量子信息的前沿技术 样品标定(Lab平板操作) ~~~~~~~~~~~~~~~~~~~~~ 样品标定流程 综合量子技术实验模块具有特殊性,需要针对不同的样品进行精确标定才能确保实验结果的准确性。标定流程如下: 1. **样品选择**:在实验设置界面中,选择特定样品 - 水样品 (H₂O) - 亚磷酸二甲酯样品 (CH₃PO(CH₂CH₃)₂) 2. **标定操作**: - 点击"标定"按钮 - 选择"开始标定" - 耐心等待标定过程完成 - 系统提示标定完成 3. **远程实验**:标定完成后,即可进行远程量子实验 **注意**:若未进行样品标定,实验运行过程中将会出现"未进行标定"的错误提示,导致实验无法正常进行。 自旋回波 ~~~~~~~~ 延长自旋量子相干时间的脉冲计数 .. code-block:: python from spinqlablink import SpinQLabLink, ExperimentType, Pulse from spinqlablink import print_graph def main(): # Create connection spinqlablink = SpinQLabLink("192.168.15.4", 8181, "anyword", "anyword") spinqlablink.connect() if not spinqlablink.wait_for_login(): print("Login failed") return # Register Spin Echo experiment # Spin Echo is a technique to reverse the dephasing of spins caused by inhomogeneities # in the magnetic field, allowing measurement of the true T2 relaxation time _, exp_spinecho_para = spinqlablink.register_experiment(ExperimentType.SPIN_ECHO) # Define the pulse sequence for the spin echo experiment # Typically consists of a π/2 pulse followed by a π pulse after a delay # The π/2 pulse rotates the magnetization into the transverse plane # The π pulse inverts the spins, causing them to refocus and form an echo exp_spinecho_para.pulses = [Pulse(path=0,width=40, amplitude=100, phase=90, detuning=0)] # Set experiment parameters # Sampling parameters exp_spinecho_para.sampleCount = 16000 # Number of data points to collect exp_spinecho_para.sampleFre = 10000 # Sampling frequency in Hz exp_spinecho_para.sampleDelay = 40 # Delay before sampling starts (in microseconds) # This delay is important to capture the echo signal # Frequency parameters exp_spinecho_para.h_freShift = 0 # Hydrogen frequency shift in Hz exp_spinecho_para.h_freDemo = 0 # Hydrogen frequency demodulation in Hz # Channel selection exp_spinecho_para.samplePath = 0 # Sampling path: 0=Hydrogen channel # Run the experiment spinqlablink.run_experiment() print("Waiting for experiment completion") spinqlablink.wait_for_experiment_completion() # Get the results exp_info = spinqlablink.get_experiment_result() spinqlablink.disconnect() # Display the results # The spin echo signal should show a characteristic peak (the "echo") # after the refocusing pulse if "result" in exp_info: exp_result = exp_info["result"] for key, value in exp_result.items(): if key != "graph": print(f"{key}: {value}") print_graph(exp_info["result"]) else: print("Experiment failed") if __name__ == "__main__": main() 实验参数解析 ^^^^^^^^^^^^ - **sample_type**: 样品类型,默认水(H₂O) - **ExperimentType**: 实验类型,选择SPIN_ECHO,设置实验类型(详情参阅 :class:`spinqlablink.ExperimentType` 类) - **Pulse**: 定义脉冲序列,设置脉冲的路径、宽度、振幅、相位和频率偏移(详情参阅 :class:`spinqlablink.Pulse` 类) - **samplePath**: 采样路径,0=氢通道,1=磷通道 [0-1] - **sampleCount**: 采样点数 [4000-16000] - **sampleFre**: 采样频率 [10000-100000] - **sampleDelay**: 采样延迟(us) [0-20000000] - **h_freShift**: 氢频率偏移(hz) [0-10000] - **h_freDemo**: 氢频率解调(hz) [0-10000] 实验结果解析 ^^^^^^^^^^^^ .. code-block:: { "result":{ "graph":[ { # step 0 "fidRe": [[x,y],...], "fidIm":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "lorenz":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "fftMod":[[x,y],...], "fidMod":[[x,y],...], "fftFit":[[x,y],...] }, { # step 1}, ... ] "coordinate":{ "x":0, "y":0 }, "phase":0 } } - **graph**: 图表数据,包含实部和虚部,graph中包含1个step - **coordinate**: 自旋相位坐标 - **phase**: 相位,角度制 动力学解耦 ~~~~~~~~~~ 解除自旋动力学耦合的技术 .. code-block:: python from spinqlablink import SpinQLabLink, ExperimentType, Pulse from spinqlablink import print_graph def main(): # Create connection spinqlablink = SpinQLabLink("192.168.15.4", 8181, "anyword", "anyword") spinqlablink.connect() if not spinqlablink.wait_for_login(): print("Login failed") return # Register Dynamic Decoupling experiment # Dynamic Decoupling is a technique to suppress decoherence in quantum systems # by applying a sequence of control pulses that effectively "undo" the # environmental noise effects, extending coherence times _, exp_dydeco_para = spinqlablink.register_experiment(ExperimentType.DYNAMIC_DECOUPLING) # Define the pulse sequence for the dynamic decoupling # This is typically a series of π pulses that periodically flip the qubits # Common sequences include CPMG (Carr-Purcell-Meiboom-Gill) and XY4/XY8 exp_dydeco_para.pulses = [Pulse(path=0,width=40, amplitude=100, phase=90, detuning=0)] # Set experiment parameters # Sampling parameters exp_dydeco_para.sampleCount = 16000 # Number of data points to collect exp_dydeco_para.sampleFre = 10000 # Sampling frequency in Hz exp_dydeco_para.sampleDelay = 0 # Delay before sampling starts (in microseconds) # Frequency parameters exp_dydeco_para.h_freShift = 0 # Hydrogen frequency shift in Hz exp_dydeco_para.p_freShift = 0 # Phosphorus frequency shift in Hz exp_dydeco_para.h_freDemo = 0 # Hydrogen frequency demodulation in Hz exp_dydeco_para.p_freDemo = 0 # Phosphorus frequency demodulation in Hz # Channel selection exp_dydeco_para.samplePath = 0 # Sampling path: 0=Hydrogen channel, 1=Phosphorus channel # Run the experiment spinqlablink.run_experiment() print("Waiting for experiment completion") spinqlablink.wait_for_experiment_completion() # Get the results exp_info = spinqlablink.get_experiment_result() spinqlablink.disconnect() # Display the results # The results should show improved coherence compared to standard T2 measurements if "result" in exp_info: exp_result = exp_info["result"] for key, value in exp_result.items(): if key != "graph": print(f"{key}: {value}") print_graph(exp_info["result"]) else: print("Experiment failed") if __name__ == "__main__": main() 实验参数解析 ^^^^^^^^^^^^ - **sample_type**: 样品类型,默认亚磷酸二甲酯(CH₃PO(CH₂CH₃)₂) - **ExperimentType**: 实验类型,选择DYNAMIC_DECOUPLING,设置实验类型(详情参阅 :class:`spinqlablink.ExperimentType` 类) - **Pulse**: 定义脉冲序列,设置脉冲的路径、宽度、振幅、相位和频率偏移(详情参阅 :class:`spinqlablink.Pulse` 类) - **samplePath**: 采样路径,0=氢通道,1=磷通道 [0-1] - **sampleCount**: 采样点数 [4000-16000] - **sampleFre**: 采样频率 [10000-100000] - **sampleDelay**: 采样延迟(us) [0-20000000] - **h_freShift**: 氢频率偏移(hz) [0-10000] - **p_freShift**: 磷频率偏移(hz) [0-10000] - **h_freDemo**: 氢频率解调(hz) [0-10000] - **p_freDemo**: 磷频率解调(hz) [0-10000] 实验结果解析 ^^^^^^^^^^^^ .. code-block:: { "result":{ "graph":[ { # step 0 "fidRe": [[x,y],...], "fidIm":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "lorenz":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "fftMod":[[x,y],...], "fidMod":[[x,y],...], "fftFit":[[x,y],...] }, { # step 1}, ... ] "up_state_coupling":{ "x":0, "y":0 }, "no_coupling":{ "x":0, "y":0 }, "down_state_coupling":{ "x":0, "y":0 } } } - **graph**: 图表数据,包含实部和虚部,graph中包含1个step - **up_state_coupling**: 上态耦合 - **no_coupling**: 无耦合 - **down_state_coupling**: 下态耦合 形状脉冲 ~~~~~~~~ 调制射频场包络的脉冲技术 .. code-block:: python from spinqlablink import SpinQLabLink, ExperimentType from spinqlablink import print_graph, WaveformGenerator, pulse_domain_analysis def main(): # Create connection spinqlablink = SpinQLabLink("192.168.15.4", 8181, "anyword", "anyword") spinqlablink.connect() if not spinqlablink.wait_for_login(): print("Login failed") return # Register Shape Pulse experiment _, exp_shape_pulse_para = spinqlablink.register_experiment(ExperimentType.SHAPE_PULSE) # Generate a shaped pulse using the WaveformGenerator # Parameters: # - channel: 0 for hydrogen channel, 1 for phosphorus channel # - wave_type: Type of waveform (GAUSSIAN, SQUARE, SINC, etc.) # - samplePoint: Number of discrete points in the waveform # - timeLength: Total duration of the pulse in nanoseconds # - phase: Phase of the pulse in degrees # - amplitude: Amplitude of the pulse (percentage, 0-100) # - detuning: Frequency detuning in Hz pulses = WaveformGenerator.generate(channel=0, wave_type=WaveformGenerator.GAUSSIAN, samplePoint=64, timeLength=10000, phase=0, amplitude=100, detuning=0) exp_shape_pulse_para.pulses = pulses pulse_domain_analysis(pulses) # Set experiment parameters exp_shape_pulse_para.calibrate_sample = 0 # Sample type: 0 for dimethyl phosphite (CH₃PO(CH₂CH₃)₂), 1 for water (H₂O) # Sampling parameters exp_shape_pulse_para.sampleCount = 16000 # Number of data points to sample exp_shape_pulse_para.sampleFre = 10000 # Sampling frequency in Hz exp_shape_pulse_para.sampleDelay = 0 # Delay before sampling starts (in microseconds) # Frequency parameters exp_shape_pulse_para.h_freShift = 0 # Hydrogen frequency shift in Hz exp_shape_pulse_para.p_freShift = 0 # Phosphorus frequency shift in Hz exp_shape_pulse_para.h_freDemo = 0 # Hydrogen frequency demodulation in Hz exp_shape_pulse_para.p_freDemo = 0 # Phosphorus frequency demodulation in Hz # Channel selection: 0=Hydrogen, Only channel 0 is supported, which corresponds to Hydrogen exp_shape_pulse_para.samplePath = 0 # Run the experiment spinqlablink.run_experiment() print("Waiting for experiment completion") spinqlablink.wait_for_experiment_completion() # Get the results exp_info = spinqlablink.get_experiment_result() spinqlablink.disconnect() # Display the results if "result" in exp_info: exp_result = exp_info["result"] for key, value in exp_result.items(): if key != "graph": print(f"{key}: {value}") print_graph(exp_info["result"]) else: print("Experiment failed") if __name__ == "__main__": main() 实验参数解析 ^^^^^^^^^^^^ - **WaveformGenerator.generate()**: 生成脉冲序列,详情参阅 :class:`spinqlablink.WaveformGenerator` 类 - **sample_type**: 样品类型,0=亚磷酸二甲酯(CH₃PO(CH₂CH₃)₂),1=水(H₂O) - **ExperimentType**: 实验类型,选择SHAPE_PULSE,设置实验类型(详情参阅 :class:`spinqlablink.ExperimentType` 类) - **Pulse**: 定义脉冲序列,设置脉冲的路径、宽度、振幅、相位和频率偏移(详情参阅 :class:`spinqlablink.Pulse` 类) - **samplePath**: 采样路径,0=氢通道,1=磷通道 [0,1] - **sampleCount**: 采样点数 [4000-16000] - **sampleFre**: 采样频率 [10000-100000] - **sampleDelay**: 采样延迟(us) [0-20000000] - **h_freShift**: 氢频率偏移(hz) [0-10000] - **p_freShift**: 磷频率偏移(hz) [0-10000] - **h_freDemo**: 氢频率解调(hz) [0-10000] - **p_freDemo**: 磷频率解调(hz) [0-10000] 实验结果解析 ^^^^^^^^^^^^ .. code-block:: { "result":{ "graph":[ { # step 0 "fidRe": [[x,y],...], "fidIm":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "lorenz":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "fftMod":[[x,y],...], "fidMod":[[x,y],...], "fftFit":[[x,y],...] }, { # step 1}, ... ] "coordinate":{ "x":0, "y":0, "z":1 }, "matrix": { # The density matrix of a quantum state, including its real and imaginary parts "real": [[0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25]], "imag": [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] }, "probability": [0.25, 0.25, 0.25, 0.25], # Probability distribution of measurement results } } - **graph**: 图表数据,包含实部和虚部,graph中包含2个step - **coordinate**: 单比特布洛赫球坐标 - **matrix**: 量子态的密度矩阵,包含实部和虚部 - **real**: 实部 - **imag**: 虚部 - **probability**: 测量结果的概率分布 数值脉冲优化 ~~~~~~~~~~~~~ 基于优化算法的脉冲技术 .. code-block:: python from spinqlablink import SpinQLabLink, ExperimentType from spinqlablink import print_graph, WaveformGenerator, pulse_domain_analysis def main(): # Create connection spinqlablink = SpinQLabLink("192.168.15.4", 8181, "anyword", "anyword") spinqlablink.connect() if not spinqlablink.wait_for_login(): print("Login failed") return # Register Numerical Optimization Pulse experiment # This experiment uses numerical optimization techniques to find optimal pulse shapes # for quantum control operations, improving gate fidelity and reducing errors _, exp_nopti_para = spinqlablink.register_experiment(ExperimentType.NUMERICAL_OPTIMIZATION_PULSE) # Generate a Gaussian pulse shape using the WaveformGenerator # Parameters: # - channel: 0 for hydrogen channel # - wave_type: GAUSSIAN creates a bell-shaped pulse with smooth transitions # - samplePoint: 64 discrete points for the waveform # - timeLength: 10000 microseconds total duration # - phase: 0 degrees phase angle # - amplitude: 100% of maximum amplitude # - detuning: 0 Hz frequency offset pulses = WaveformGenerator.generate(channel=0, wave_type=WaveformGenerator.GAUSSIAN, samplePoint=64, timeLength=10000, phase=0, amplitude=100, detuning=0) exp_nopti_para.pulses = pulses pulse_domain_analysis(pulses) # Set experiment parameters # Sample calibration exp_nopti_para.calibrate_sample = 0 # 0 for CH₃PO(CH₂CH₃)₂, 1 for H₂O # Different samples require different calibration settings # Sampling parameters exp_nopti_para.sampleCount = 16000 # Number of data points to collect exp_nopti_para.sampleFre = 10000 # Sampling frequency in Hz exp_nopti_para.sampleDelay = 0 # Delay before sampling starts (in microseconds) # Frequency parameters exp_nopti_para.h_freShift = 0 # Hydrogen frequency shift in Hz exp_nopti_para.p_freShift = 0 # Phosphorus frequency shift in Hz exp_nopti_para.h_freDemo = 0 # Hydrogen frequency demodulation in Hz exp_nopti_para.p_freDemo = 0 # Phosphorus frequency demodulation in Hz # Channel selection exp_nopti_para.samplePath = -1 # Sampling path: 0=Hydrogen channel, 1=Phosphorus channel, -1=both channels # Using both channels allows comparing the effects on different nuclei # Run the experiment spinqlablink.run_experiment() print("Waiting for experiment completion") spinqlablink.wait_for_experiment_completion() # Get the results exp_info = spinqlablink.get_experiment_result() spinqlablink.disconnect() # Display the results # The results should show the system response to the optimized pulse shape if "result" in exp_info: exp_result = exp_info["result"] for key, value in exp_result.items(): if key != "graph": print(f"{key}: {value}") print_graph(exp_info["result"]) else: print("Experiment failed") if __name__ == "__main__": main() 实验参数解析 ^^^^^^^^^^^^ - **WaveformGenerator.generate()**: 生成脉冲序列,详情参阅 :class:`spinqlablink.WaveformGenerator` 类 - **sample_type**: 样品类型,0=亚磷酸二甲酯(CH₃PO(CH₂CH₃)₂),1=水(H₂O) - **ExperimentType**: 实验类型,选择NUMERICAL_OPTIMIZATION_PULSE,设置实验类型(详情参阅 :class:`spinqlablink.ExperimentType` 类) - **Pulse**: 定义脉冲序列,设置脉冲的路径、宽度、振幅、相位和频率偏移(详情参阅 :class:`spinqlablink.Pulse` 类) - **samplePath**: 采样路径,-1=所有通道,0=氢通道,1=磷通道 [-1,0,1] - **sampleCount**: 采样点数 [4000-16000] - **sampleFre**: 采样频率 [10000-100000] - **sampleDelay**: 采样延迟(us) [0-20000000] - **h_freShift**: 氢频率偏移(hz) [0-10000] - **p_freShift**: 磷频率偏移(hz) [0-10000] - **h_freDemo**: 氢频率解调(hz) [0-10000] - **p_freDemo**: 磷频率解调(hz) [0-10000] 实验结果解析 ^^^^^^^^^^^^ .. code-block:: { "result":{ "graph":[ { # step 0 "fidRe": [[x,y],...], "fidIm":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "lorenz":[[x,y],...], "fftRe":[[x,y],...], "fftIm":[[x,y],...], "fftMod":[[x,y],...], "fidMod":[[x,y],...], "fftFit":[[x,y],...] }, { # step 1}, ... ] "coordinate":{ "x":0, "y":0, "z":1 }, "matrix": { # The density matrix of a quantum state, including its real and imaginary parts "real": [[0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25], [0.25, 0.25, 0.25, 0.25]], "imag": [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] }, "probability": [0.25, 0.25, 0.25, 0.25], # Probability distribution of measurement results } } - **graph**: 图表数据,包含实部和虚部,graph中包含2/6个step - **coordinate**: 单比特布洛赫球坐标(双比特实验无数据) - **matrix**: 量子态的密度矩阵,包含实部和虚部 - **real**: 实部 - **imag**: 虚部 - **probability**: 测量结果的概率分布