Git Product home page Git Product logo

oriel-cornerstone-260's Introduction

Oriel Cornerstone 260

A library allowing easy control over an Oriel Cornerstone 260 monochromator with an RS-232C port.

Install with python -m pip install oriel-cornerstone-260

NOTE: For newer models with a USB connection, see the USB Connection section at the bottom of this page.

Monochromator

Represents a monochromator.

  • Monochromator( port, timeout = 5 ): Creates a new monochromator for the device at the specificed port, with the provided communication timeout.

Methods

Low Level

Low level methods allows reading and writing to the device.

  • connect(): Connects to the device.

  • disconnect(): Disconnects from the device.

  • write( msg ): Writes a message to the device. Termination characters are added.

  • read(): Reads a single response from the device.

  • command( cmd, *args ): Sends a command to the device with the given arguments. Returns the command.

  • query( msg ): Queries the device. Returns a Response object.

High Level

High level methods are convenience methods used for commonly needed functions.

  • goto( wavelength ): Goes to the given wavelength.

  • abort(): Starts the given channel.

  • set_grating( grating ): Sets the grating to the given number.

  • set_filter( filter ): Sets the filter to the given position.

  • filter_label(filter, label = None ): Gets or sets a filter's label.

  • shutter( close = True ): Open or close the shutter.

  • set_outport( port ): Sets the output port.

  • slit_width( slit, width = None ): Gets or sets the slit width.

Properties

  • _com: Serial connection from pyserial.
  • connected: Whether the device is connected or not.
  • port: Device port.
  • term_chars: Termination characters used for reading and writing. [Default: '\r\n']
  • info: Device info.
  • position: Wavelength position.
  • grating: Current grating and its properties. Returns a dictionary with number, lines, and label.
  • filter: Current filter position.
  • shuttered: Whether the shutter is closed or open.
  • outport: The output port.

Response

A namedtuple with properties statement which represents the command, and response.

Example

A basic example for using a Monochromator.

from oriel_cornerstone_260 import Monochromator

# create device
mono = Monochromator( 'COM9' )

# print monochromator info
print( mono.info )

# go to 600 nm
mono.goto( 600 )

Note

A Monochromator is a ultimately a Serial object from pyserial, so you can call any functions on a Monochromator that you would on a Serial object.


USB Connection

The USB Newport/Oriel Cornerstone 260 works differently, and can not utilize this package. It is Windows only and requires two proprietary .NET .DLLs from Newport. The Python interface is through the package pythonnet. As of late 2020, these are 32 bit DLL's that require a 32-bit (not AMD64) version of python.

import clr
clr.AddReference( 'Cornerstone' )
import CornerstoneDll

mono = CornerstoneDll.Cornerstone( True )
if not mono.connect():
  raise IOError( 'Monochromator not found' )

The mono object will control the monochromator using methods documented in the Cornerstone 260 manual.

oriel-cornerstone-260's People

Contributors

bicarlsen avatar pdksu avatar

Watchers

 avatar  avatar

oriel-cornerstone-260's Issues

USB: Available commands/functions

The commands from the cornerstone manual or the listed commands here are not available via the USB connection.
Instead write 'mono.' and press 'tab' - then a list of available commands pops up. Or have a look at the cornerstone.dll file after the installation via running 'pip install oriel-cornerstone-260' in the command prompt. - There is also a list of the available functions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.