matisse-controller

A Python package to control the Matisse 2 TS laser for the University of Washington’s Optical Spintronics and Sensing Lab.

Requirements: Python 3.7+, NI VISA, PyVISA, pySerial, SciPy, matplotlib, PyQt5

Tested on Windows 7 and 10 (x64).

Contents

Installation

$ pip install matisse-controller

If you plan on using PLE features with Andor instruments, copy the required DLL files from the Andor SDK into [package install dir]/shamrock_ple/lib (see the README in that directory for more details)

Usage

To launch the GUI, connect the Matisse and a supported wavemeter, and then run:

$ matisse-controller

The GUI uses a Python API to control the Matisse. If you’re writing a Python program, just import the subpackages that contain the APIs you want. The matisse subpackage contains Matisse-related components, the config subpackage contains configuration functionality, etc.

To configure the behavior of the program using a GUI, click the ‘Configuration’ menu option from the main GUI, or run:

$ matisse-config

Hovering over most fields in this configuration dialog will reveal tooltips with more information about what the options do.

API Documentation

API documentation for this project can be found at https://0xSiO.github.io/matisse-controller/docs/.

Changelog

The changelog for this project can be found at https://0xSiO.github.io/matisse-controller/CHANGELOG.

Terminology

There are a few important bits of terminology that may be confusing:

Pickled Data

PLE data from this application is stored in text files as a list of counts separated by newlines, as well as a .pickle file, which is an efficient form of binary storage that Python uses to serialize objects.

To load the data from a .pickle file:

import pickle
with open('file_name_here.pickle', 'rb') as data_file:
    data = pickle.load(data_file)

GUI Options

Console

Set

Scan

Stabilization

Shamrock

Development

After checking out the repo, run pipenv install --dev to install dependencies. Using a virtual environment is recommended.

To install this package onto your local machine, run pip install -e ..

Useful documentation: PyVISA, pySerial, SciPy, matplotlib, Qt 5

Adding features to the Matisse class

The standard way of interacting with the Matisse outside of the existing API is to use the Matisse.query method. The Matisse implements several commands that run asynchronously, like motor movements, so if you want to run these synchronously, you must do it on your own (like checking the motor status until it’s idle again).

Long-running tasks should be executed in a thread that can be started and gracefully stopped from the Matisse class. Currently, fetching a measurement from the wavemeter is a relatively expensive process, so avoid doing this too much if possible.

Adding another wavemeter

Currently I’ve only implemented an interface for the WaveMaster, but any class will do, as long as it implements the get_raw_value and get_wavelength methods. The get_raw_value method should return a value representing exactly what is seen on the wavemeter display (this might not be a measurement), and the get_wavelength method should always return a floating-point number representing the latest measurement from the wavemeter. The WaveMaster implementation blocks the thread until a value is returned from the instrument. Additionally, please ensure any code you write that communicates with instruments is thread-safe.

Adding features to the GUI

Logging and UI updates should have top priority, so take care not to block the UI thread. Here’s the process I use:

Adding another PLE procedure

Currently I’ve only implemented a PLE scan for the Andor Shamrock 750. If you’d like to implement your own PLE procedure, create a separate Python package with a class that has the methods start_ple_scan, stop_ple_scan, and analyze_ple_data. It’s up to you to implement the scanning logic for your particular spectrometer and CCD setup. Modify the Matisse class __init__ method to use your chosen wavemeter and an instance of your PLE scanning class.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/0xSiO/matisse-controller.

License

The package is available as open source under the terms of the MIT License.