Skip to content
SAFedorov edited this page Jan 27, 2020 · 26 revisions

Overview

The main goal of this project is to create a unified object oriented way of controlling instruments from MATLAB, then pairing this with a MyDaq program that allows for fitting and cursory processing of the data before saving.

The main entities of the project are

  1. Instrument classes (most of which are derived from MyInstrument) that communicate with physical devices, acquire data and send it to MyCollector using NewData event.
  2. MyCollector, an object that always runs in the background and keeps track of all the running instrument objects. When an instrument object records a new data trace, MyCollector provides metadata for the trace, containing the information about the state of the running instruments.
  3. MyDaq that collects, displays and saves data traces together with the information about conditions (instrument parameters) at which they are acquired.

Furthermore, there is a number of tools that extend the basic functionality, including

  1. MyFit implements interactive fitting procedures, which are employed in MyDaq or can be used independently.
  2. MyLogger can record, save and display measurements taken periodically, e.g. pressure or temperature readings.

Getting started

  1. Add the base project folder with all subfolders on MATLAB path.
  2. Run Setup.mlapp which will create a local base directory for the software that contains a file with local settings and script-like "run files" for custom programs.
  3. Run MyDaqMenu and list local instruments (their addresses, ways of communication etc.) using MyInstrumentManager.
  4. Run MyDaq, select acquisition instrument and read a trace using the instrument GUI. Once the trace is acquired by the instrument, it should show up in MyDaq.

Supported instruments

The list below provides correspondence between instrument classes and physical devices which they were tested with. This list might be not exhaustive, see the content of Instrument classes folder. The classes below may also be compatible with different devices from the same vendors and of similar model.

  • MyTekDpo - scopes Tektronix DPO4034, DPO3034
  • MyAgilentDso - scope Agilent DSO7034A
  • MyTekTbs - scope Tektronix TBS2074
  • MyTekTds - scope 2-channel Tektronix TDS
  • MyTekRsa - real-time spectrum analyzers Tektronix RSA5106, RSA5103
  • MyAgilentNa - network analyzer Agilent E5061B
  • MyPreifferTpg - pressure gauge controllers Pfeiffer TPG262, TPG362
  • MyNewpTlb6300 - tunable diode laser controller NewFocus TLB6300
  • MyNewpTlb6700 - tunable diode laser controller NewFocus TLB6700
  • MyHfWs - wavelengthmeter HighFinesse WS6-200
  • MyThorlabsPm - powermeter Thorlabs PM100D
  • MyLakeshore336 - temperature controller Lakeshore Model 336
  • MyZiLockIn - lock-in amplifiers from Zurich Instruments, UHFLI and MFLI
  • MyColdEdgeCryo - Stinger cryostat from ColdEdge, controlled by an automated valve manifold with custom driver.

Tutorials

Project structure

The main classes of the project are located in the root directory, each class in a separate folder starting from "@" (MATLAB standard). Particular instrument and analysis routine classes are grouped in dedicated folders. By convention, we also store instrument GUIs separately, in the "GUIs" folder, as they are sometimes used by more than one instrument class. All functions are stored under "Utility functions". "Test tools" contains dummy instrument objects and functions which are useful for debugging in the absence of physical instruments. "Required packages" contains external code directly used in the project and license agreements for the code that was reused with modifications. Everything that is not code (e.g. graphics) is stored in "Resources".

The code mostly follows naming conventions

List of content

Main classes

GUI utilities

  1. MyDaqMenu - root GUI that provides interface to start instrument control panels, MyDaq and any other routines specified by "run" files in the local base directory.
  2. MyInstrumentManager - app-based interface to local settings that store the information about connected instruments and their parameters.

Data structures

  1. MyTrace – data structure that represents a list of y(x) values with additional information about units, acquisition conditions etc.
  2. MyAvgTrace – derivative of MyTrace with averaging capabilities
  3. MyLog – data structure which represents a record of vector values [t, y1(t), y2(t), y3(t), ...].
  4. MyMetadata – object which is capable of storing and saving a wide range of MATLAB data in a readable format, including numerical and character arrays, cell arrays and structures with arbitrary nesting. Used as a part of MyTrace and MyLog, also instruments return measurement headers in the form of this object.

Instrument superclasses

  1. MyDataSource – class, defining the necessary minimum for being able to transfer data to MyDaq
  2. MyCommCont – class, providing high-level capabilities for robust textual command-based communication
  3. MyInstrument – class that implements commands structure
  4. MyScpiInstrument – extended capabilities to work with SCPI communication
  5. MyZiLockIn – initialization of a Zurich Instruments lock-in data server

Measurement routines

  1. MyZiRingdown – program for ringdown measurements of mechanical quality factors
  2. MyZiScopeFt – fft spectrum analyzer using a Zurich Instruments lock-in

Fits

  1. MyFit – superclass for the creation of fitting routines with interactive capabilities
  2. MyFitParamScalingMyFit with added rescaling of data in order to improve the convergence and make the fits insensitive to the absolute magnitude of data. Abstract class, requires the definition of scaling/unscaling functions in the subclasses.

Other classes

  1. MyGuiSync – contains a mechanism for the synchronization of values of class properties and GUI elements (numeric edit fields, list boxes etc). Apps that provide user interface to existing classes and are well decoupled from their implementation can be created in this way. See creating an app based GUI.
  2. MySingleton – superclass of singleton classes that are allowed to have only one instance at a time. MyCollector is a singleton class.
  3. MyClassParser – extends the capabilities of MATLAB inputParser to handle the assignment of class properties, these objects are used in constructors of other classes.
  4. MyNewDataEvent – derivative of MATLAB event.EventData that is is sent to MyDaq with NewData event by instrument objects. Among other, contains the trace to be transferred.
  5. MyNewpUsbComm – used to implement blocking communication with Newport usb driver, for example, in MyNewpTlb6700.

Utility functions

  1. Tools for manipulations with local settings
  2. runInstrument
  3. var2str
  4. printSubs, str2substruct and substruct2str
  5. dirfind - a straightforward but useful tool to track code dependencies