Mundo¶
A Qt graphical user interface for automating sample measurements using CONEX-CC linear X, Y, and Z stages.
Dependencies¶
Mundo only relies on Python packages and drivers. No external, third-party, drivers need to be installed. All required Python packages can be installed using pip.
pyvisa
pyvisa-py
pyvisa-sim
nidaqmx
pyserial
pyside2
matplotlib
numpy
sphinx
piccolo-theme
myst-parser
pytest
pytest-mock
flake8
mypy
Development setup¶
If you are using pip, all dependencies can be installed using
$ pip install -r requirements.txt
For Guix users, the dependencies can be installed in a new environment using
$ guix shell
The application uses the Qt Resource System for some assets, such as icons. The resources file is located at ~mundo/gui/assets/resources.qrc~. To compile the resources file, you need to have pyrcc5 installed, and either run
$ pyrcc5 mundo/gui/assets/resources.qrc -o resources.py
Or
$ make resources
Tests¶
Unit tests can be ran using
$ python -m pytest
NOTE: Because the tests are outside of the
mundo
package directory you must use thepython -m
prefix!
Code style and linting¶
Formatting¶
Code formatting is done using yapf and will be done automatically in pull requests. However, you can also run it locally using the following command (will write changes):
$ python -m yapf --recursive --in-place .
Linting and typechecking¶
For general code linting, flake8. It does not support type annotations, and for this mypy is used. They can be run using the following commands:
$ python -m flake8
and
$ python -m mypy mundo
Documentation¶
Documentation is managed by Sphinx. To generate the documenation in HTML format, run the following commands:
cd docs
make html
The documentation can then be accessed from docs/build/html/index.html
.
Resources¶
CONEX-CC¶
The CONEX-MFACC is a CONEX-CC DC motor controller/driver coupled with the all-steel MFA-CC linear stage. The unit is a miniature, low-cost option which offers precision motion in space-confined applications. See full specification here.
You can find manuals for the CONEX-CC controller in resources/
.
VISA¶
Virtual Instrument Software Architecture. VISA is a Test & Measurement industry standard communication API (Application Programming Interface) for use with test and measurement devices.
For a deep dive in the VISA protocol, refer to the NI-VISA implementation manual.
PyVISA¶
PyVISA is a frontend to the VISA library that enables you to control all kinds of measurement devices independently of the interface (e.g. GPIB, RS232, USB, Ethernet). The project is open-source and is maintained by independent developers. It is MIT-licensed and can be used for commercial purposes as long as the Copyright notice for the library is included.
PyVISA supports multiple VISA backends. It is possible to call functions from the VISA shared library (.dll, .so, .dylib, etc) which allows you to directly leverage the standard implementation for your operating system. Another option is to use the PyVISA-Py backend, which is a pure Python implementation of the VISA protocol that does not rely on any shared libraries. This means that you do not need to install any third party proprietary implementations of the VISA protocol (such as NI-VISA).
PyVISA works with 32- and 64- bit Python and can deal with both 32- and 64-bit VISA libraries without any extra configuration. What PyVISA cannot do is open a 32-bit VISA library while running in 64-bit Python (or the other way around).
NI-DAQmx¶
National Instruments’ current-generation data acquisition driver. This controller is used to send a start signal to the MS (i.e. “contact closure”). This must be done before any sampling, since this is what causes the spectrometer to begin its continuous measuring. There is currently no way of stopping the measurement process. NI-DAQmx can be controlled using Python via the nidaqmx package that is developed and maintained by National Instruments.
Running nidaqmx requires NI-DAQmx or NI-DAQmx Runtime. Visit the ni.com/downloads to download the latest version of NI-DAQmx.