Skip to main content

This library was developed for control Optiscan2 (automated stage for microscopes).

Project description

StageControl

This Python library was developed for control PRIOR Optiscan2 (automated microscope stage) via serial communication (RS-232C/USB). This is supporting Spiral search in addition to the simple zigzag search.

Main features

  • Easy connection: Safe serial port control by the syntax with.
  • Two types of algorithm to search:
    • simple_search: Search in the set grid(number_of_points_x * number_of_points_y).
    • spiral_search: Spiral search from the initial location (points_number has to be a square number!).
  • Accurate time management: Users can set the time of interval/shooting.

Install

pip install prior_optiscan2_control

Example

import time
from datetime import datetime
from prior_optiscan2_control.stage_controller import StageControl

port = 'COM1'
baudrate = 9600
interval = 60 # second # one cycle to stop all the observation points
start = "2000-01-01-01-01" # YYYY-mm-dd-HH-MM
step = 100 # μm
x = 5 # number of points on x axis
y = 5 # number of points on y axis
processing_time = 2 # second

cycle = 30

with StageControl(port, baudrate, interval, step) as stage:

    stage.initialize_origin()

    start_time = datetime.strptime(start, "%Y-%m-%d-%H-%M")

    while True:
        now = datetime.now().replace(second = 0, microsecond = 0)

        if now == start_time:
            print("Observation started.")
            break

        elif now > start_time:
            raise RuntimeError("Do not set start time earlier than now.")


        time.sleep(0.5)
    
    try:
        for i in range(cycle):

            stage.simple_search(x, y, processing_time)
            print(f"{i + 1} cycles are finighed.")
    
    except KeyboardInterrupt:
        print("Observation is interrupted.")
    
    else:
        print("Observation finished properly.")

    finally:
        print("Program terminated: ", datetime.now())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prior_optiscan2_control-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prior_optiscan2_control-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file prior_optiscan2_control-0.1.1.tar.gz.

File metadata

  • Download URL: prior_optiscan2_control-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for prior_optiscan2_control-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e1c986b306564f085cc6d230c9e323230115f8059f1ceee5423d2e500e913c6a
MD5 d52244d32e54e9e67f1b0c138a1469ad
BLAKE2b-256 188fb7f253fcc0514a1ae96b86c1302e7202d5e01b176999e5e71593a678e44a

See more details on using hashes here.

File details

Details for the file prior_optiscan2_control-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prior_optiscan2_control-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e20880d0e48238ec61c56645da5b63018c6bee8f13fd9e8048b682aa9a9c3684
MD5 4a52bd074b0f70d0ebf7d505717332eb
BLAKE2b-256 a80beba4d2e71a7a7e11c82953e5490dd3deeb27c74a67686f7b5430a699583f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page