Tutorial: Next Steps#
There are several ways to go forward after finishing the tutorial.
The most practical way may be try to build your own system. If you have enough time or interest, try to understand mahos further.
Building your own system#
Writing Instrument#
If you want to build your own system, first step might be preparing the Instrument
class for your instrument.
You are very lucky if you can find corresponding class in mahos.inst package.
Even this is not the case, writing your own Instrument
is not a very hard way; you can use existing classes in mahos.inst as the examples.
Following subsections explain several methods to write Instrument
.
It depends on the real instrument’s interface / driver provided by the manufacturer, but most of the instruments will fit into (at least) one of these.
VISA#
VISA (Virtual Instrument Software Architecture) is a standardized communication library for measurement instruments.
VISA is an abstraction layer above GPIB, RS232 (Serial), Ethernet or USB.
We can use PyVISA library to communicate with the instruments following this standard.
VisaInstrument
serves as a base class which implements a few convenient methods.
Wrapping Python library#
Some (rather modern) instruments provide the libraries for Python. You are lucky! This is usually the easiest case.
Wrapping C library#
We can use Python standard ctypes library to wrap the library for C.
Wrapping C# (.NET) library#
We can use pythonnet library to wrap the library for C# (.NET).
The example can be found in implementation of LightField
or Thorlabs_KCube_DCServo
.
NI-DAQ#
We can use PyDAQmx library to implement Instrument
based on National Instruments DAQ.
There are several classes in mahos.inst.daq
module.
Writing meas Node#
If your measurement is not very complex,
the easiest way to write meas node is sub-classing BasicMeasNode
.
We have already seen an example in Tutorial 2: Basic Measurement.
Writing gui Node#
If GUI is necessary, you can try to write a GUINode
.
Since the existing implementations are based on PyQt,
you will need some experiences or practices to use it.
If you are familiar with other UI (either native / web-based) technologies,
it will be also possible to implement the gui node with that.
In that case, your node will not be based on GUINode
(because this is for PyQt).
Understanding mahos further#
Architecture explains the architecture of mahos system.
Configuration file provides a bit detailed specification of configuration files.
Command Line Interface is a list of cli commands; but
mahos [subcommand] -h
may provide more information. You can also try to read the code inmahos.cli
package, that is not quite big.
Reading the codes#
API Reference is not perfect for the time being: listed are not all the stuffs / there are some undocumented classes. But we are working toward better documentation. It could be used at least to discover which module or class is important.
You will eventually be required to read the codes to fully understand the mahos internals. We are very happy if you could report / fix bugs, add missing code / documentation, or give us any feedbacks.