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 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.0.tar.gz (3.9 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.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prior_optiscan2_control-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 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.0.tar.gz
Algorithm Hash digest
SHA256 3caafe34baf01493f224ba34ede104746db8391d63c3e42446783773afb71b8c
MD5 5e5d3168cbfc4070720f699c82d940da
BLAKE2b-256 a2737ee35bb9f7fc0ea7447a311c3f65fe3d3f038d7a119e0c23d3ac6296ff13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prior_optiscan2_control-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 701566fd2368d4820e3bd638a2581f9f83b61cbd316dc74038e48dcad476391f
MD5 a2fdb0127c7fbed164b13e3288a75de0
BLAKE2b-256 0fbcb1a4e4f8234b3d2ca0151d1a76e8ebc783b395e8319b3b3f07683b91ca1d

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