Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
  • Home
  • Moku:Lab
  • Software integrations
  • Python examples

Python: Laser Lock Box

Written by Paul Cracknell

Updated at December 22nd, 2020

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Go
    Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Lock-in Amplifier
  • Moku:Lab
    Windows Moku:Lab general Moku:Lab Instruments iPad app Software integrations
  • Moku:Pro
    Moku:Pro Instruments
+ More

Example Python script to implement the Laser Lock Box

# pymoku example: Basic Laser Lock Box
# 
# This example demonstrates how you can configure the laser lock box
# instrument
# 
# (c) 2019 Liquid Instruments Pty. Ltd.
# 

from pymoku import Moku
from pymoku.instruments import LaserLockBox

from scipy import signal


def gen_butterworth(corner_frequency):
 """
 Generate coefficients for a second order butterworth low-pass filter.

 Corner frequencies for laser lock box second harmonic filtering should be
 in the range: 1 kHz < corner frequency < 31.25 MHz.
 """
 sample_rate = 31.25e6
 normalised_corner = corner_frequency / (sample_rate / 2)
 b, a = signal.butter(2, normalised_corner, 'low', analog=False)

 coefficient_array = [[1.0, b[0], b[1], b[2], -a[1], -a[2]],
 [1.0, 1.0, 0.0, 0.0, 0.0, 0.0]]
 return coefficient_array


# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku.get_by_name('Moku')

try:
 i = m.deploy_or_connect(LaserLockBox)

 # set local oscillator, auxiliary and scan generators
 i.set_local_oscillator(source='internal', frequency=0, phase=90,
 pll_auto_acq=False)
 i.set_aux_sine(amplitude=1.0, frequency=10e3, phase=0, sync_to_lo=False,
 output='out1')
 i.set_scan(frequency=1e3, phase=0, output='out2', amplitude=1.0,
 waveform='triangle')

 # configure PIDs:
 i.set_pid_by_gain(1, g=1, kp=1)
 i.set_pid_by_gain(2, g=1, kp=1)

 # configure second harmonic rejection low pass filter
 coef_array = gen_butterworth(1e4)
 i.set_custom_filter(coef_array)

finally:
 # Close the connection to the Moku device
 # This ensures network resources and released correctly
 m.close()
moku:lab

Was this article helpful?

Yes
No

Related Articles

  • Python: Frequency Response Analyzer (basic)
  • Python: IIR Filter Box (plotting)
  • Moku:Lab - a capacitance meter
  • Python: Frequency Response Analyzer (plotting)

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
740 Lomas Santa Fe Dr
Suite 102
Solana Beach, CA 92075

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2021 Liquid Instruments. All rights reserved.

Definition by Author

0
0
Expand