Skip to content

MartinHjelmare/leicacam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leicacam

build-badge pypi-version wheel Documentation Status

Overview

Control Leica microscopes with python

Installation

  • The latest version of leicacam requires Python 3.8+
  • If you need to keep using Python 2.7, pin your version of leicacam to 0.3.0.

Install using pip:

pip3 install leicacam

Example

Communicate with microscope

from leicacam import CAM

cam = CAM()   # initiate and connect, default localhost:8895

# some commands are created as short hands
# start matrix scan
response = cam.start_scan()
print(response)

# but you could also create your own command with a list of tuples
command = [('cmd', 'enableall'),
           ('value', 'true')]
response = cam.send(command)
print(response)

# or even send it as a bytes string (note the b)
command = b'/cmd:enableall /value:true'
response = cam.send(command)
print(response)

Documentation

See available commands in the API reference: http://leicacam.rtfd.org.

Development

Install dependencies and link development version of leicacam to pip:

pip install -r requirements_dev.txt

Code formatting

We use black code formatter to automatically format the code.

black ./

Testing

tox

Build documentation locally

To build the documentation:

pip install -r docs/requirements.txt
make docs