Python interface to Optotune focus-tunable lenses
Project description
opto is a Python module that allows you to control Optotune focus tunable lenses using the Optotune Lens Driver 4. Tested with an Optotune EL-10-30.
Examples
Opens the serial port, connects to the Optotune, sets the lens current to 50 mA, and closes the serial port, gently returning the lens to 0 mA current:
from opto import Opto
o = Opto(port='/dev/cu.usbmodem1411')
o.connect()
o.current(50.0)
o.close(soft_close=True)
Alternatively, here we use the with statement to create a sinusoidal transition from minimum to maximum current and back:
from opto import Opto
import numpy as np
import time
with Opto(port='/dev/cu.usbmodem1411') as o:
current_low = o.current_lower()
current_high = o.current_upper()
current_delta = current_high-current_low
for i in np.linspace(0, 2*np.pi, 1000):
o.current(np.sin(i)*current_delta+current_low)
time.sleep(0.01)
Installation
Use pip to install from github:
pip install git+https://github.com/OrganicIrradiation/opto.git
or clone the package using git:
git clone https://github.com/OrganicIrradiation/opto.git
Requirements
Requires pySerial
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opto-0.1.tar.gz
.
File metadata
- Download URL: opto-0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41152d84af1943c9ade02b09d162d4f691f0b26a243c2e34c05cee63d1578928 |
|
MD5 | b49580266d93e2b1e43edcdd1dde8f1a |
|
BLAKE2b-256 | d7a7d16e603b7b973e78fe04a20592e982623357a1e4571f007c505cbc4b2b15 |
File details
Details for the file opto-0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: opto-0.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321557fc36ec99cc570248b15a3d0996ffbd23ce42b788eb33ab664364791178 |
|
MD5 | 316de7bd8e3a90259eda6b5bac0893c5 |
|
BLAKE2b-256 | 00c674ade62215dfddb182d134c3a29c01c192c2d7b105fef221fae34ae21fc9 |