Mokuロックインアンプの復調信号の位相を変更する方法
Mokuロックイン アンプの復調信号の位相を調整して、信号処理を最適化し、より正確な測定を実現する方法を学びます。
- Moku:Lab
 - Moku:Go
 - 
                        Moku:Pro
                        
                        
                            Moku:Proに関するよくある質問 Moku:Pro波形発生器 Moku:Proタイム&周波数アナライザ Moku:Proロジックアナライザ/パターンジェネレーター Moku:Proレレーザーロックボックス Moku:Proロックインアンプ Moku:Proスペクトラムアナライザ Moku:Proデータロガー Moku:Pro任意波形発生器 Moku:Proマルチ機器モード Moku:Pro位相計 Moku:Pro FIRフィルタービルダー Moku:Pro PIDコントローラー Moku:Proオシロスコープ Moku:Pro周波数応答アナライザ Moku:Proデジタルフィルターボックス
 - Python API
 - MATLAB API
 - 任意波形発生器
 - データロガー
 - デジタルフィルターボックス
 - FIR フィルタ ビルダー
 - 周波数応答アナライザー
 - レーザーロックボックス
 - ロックインアンプ
 - オシロスコープ
 - 位相計
 - PIDコントローラー
 - スペクトラムアナライザー
 - 時間と周波数アナライザー
 - 波形発生器
 - ロジックアナライザ/パターンジェネレーター
 - マルチ機器モード
 - Mokuクラウドコンパイル
 - Mokuに関するよくある質問
 - LabVIEW API
 
Mokuロックイン アンプは、デュアル位相復調を使用して信号の X 成分と Y 成分を決定します。復調信号の位相は、復調信号のプロパティを調整することで Python でシフトできます。
この例では、復調信号の位相を調整する方法を示します。
#
# Moku example: Phase change in Moku Lock-In Amplifier
#
# This example demonstrates how you can shift the phase of the demodulation signal
# in the Lock-In Amplifier instrument
#
# (c) 2024 Liquid Pty. Ltd.
#
# This is configured for Moku:Lab and is compatible with Moku:Go and Moku:Pro
#
# Setup : loopback Moku output 2 to input 1 with a BNC cable.
#
# The phase of the demodulation signal is then swept
# a full 360 degrees and the resulting LIA output DC signal 
# reflects the phase offset between the PLL and input 1.
#
from moku.instruments import LockInAmp
import statistics
import matplotlib.pyplot as plt
# Launch Lock In Amplifier and connect to your device via IP
i = LockInAmp('192.168.2.74', force_connect=True)
try:
   # Configure analog input port 1 as 50 Ohm and 0 dB attenuation
   i.set_frontend(1, coupling='DC', impedance='50Ohm', attenuation='0dB')   
   # Output a 1MHz sine wave and demodulate at same
   i.set_demodulation(mode='Internal', frequency=1e6)
   i.set_filter(corner_frequency=1e1, slope="Slope6dB")
   # Output the 'X' (I) signal and the local-oscillator sine wave on the two
   # DAC channels. 
   i.set_aux_output(frequency=1e6, amplitude=1)
   i.set_outputs(main='X', aux='Aux', main_offset=0, aux_offset=0)
   
   i.use_pid("Off")
   i.set_gain(main=0, aux=0)
   # Monitor the I and Q signals from the mixer, before filtering
   i.set_monitor(1, 'Input1')
   i.set_monitor(2, 'MainOutput')
   # Trigger on Monitor 'B' ('I' signal), rising edge, 0V with 0.1V hysteresis
   i.set_trigger(source='ProbeB', edge='Rising', hysteresis=0.1)
   # View +- 0.1 second, ie trigger in the centre
   i.set_timebase(-2e-6, 2e-6)
   
   # Set up the plotting parameters
   plt.figure(num="Moku Lock-in Amplifier")
   plt.ylabel("Voltage (V)")
   plt.xlabel("Time [s]")
   line1, = plt.plot([], label='Input 1')
   line2, = plt.plot([], label='LIA X out')
   # Configure labels for axes
   ax = plt.gca()
   plt.pause(1)
   # This loops through a phase range of 0 to 350 degrees with a step size of 10
   for a in range(0, 351, 10):
       # Set a demodulation phase
       i.set_demodulation(mode='Internal', phase=a)
       data = i.get_data(wait_complete=True, wait_reacquire=True)
       dc2 = data['ch2']
       # Print out the demodulation phase and mean value of the output
       print(f'New Phase: {a}')
       print(f'Mean: {statistics.mean(dc2)}')
       # Update the Plotting
       line1.set_ydata(data['ch1'])
       line1.set_xdata(data['time'])
       
       line2.set_ydata(data['ch2'])
       line2.set_xdata(data['time'])
       
       plt.pause(0.1)
       plt.legend(loc='upper left')
       # Ensure frequency axis is a tight fit
       ax.relim()
       ax.autoscale_view()
finally:
   # Close the connection to the Moku device
   # This ensures network resources and released correctly
   i.relinquish_ownership()