wxMCA Software Package Reference

wxMCA Package

Introduction

Capabilities MCA-1000

Capabilities MCA-2000

Capabilities MCA-3000

Capabilities eMorpho

Neutron-3000

User's Manual MCA-1000 (pdf)

User's Manual MCA-2000 (pdf)

User's Manual MCA-3000 (pdf)

User's Manual eMorpho (pdf)

Components

Installation

MCA Data Server

Serial Interface

Simulator

Configuration

Code Examples

wxMCA Software Installation

The software package consists of a number of independent server and client modules serving different tasks. While there are some requirements for pre-installed software, the package itself requires no installer and the files can be copied to wherever the user wishes. It will be advantageous, although not strictly necessary, to maintain the internal folder hierarchy.

Requirements

The package is mostly written in Python and requires Python 3.7.

Within the package, client-server communication is established via ZMQ (www.zeromq.org). ZMQ is available for over 40 programming languages, and the protocol allows the client programmer to access our server software from many different programming languages. Hence our server software acts as a bridge between the USB-based hardware and the local network, as well as acting as a bridge between programming languages.

The graphics user interface is built using wxPython. The graphics displays are performed using matplotlib.

Installation under Windows

Device driver and private Python

For Windows there is an installer. It offers to place a complete Python 3.7 (64-bit) install into C:\BPISoft_V3\Python37 which will contain all the required python packages shown below. Secondly, the installer provides a signed driver copy of libusb0.1 (libusb_win32) in the correct Windows SYS folder. The installer also contains a stand-alone program (wxMCA/zadig-2.4.exe) to manually link an MCA to the libusb0.1 driver.

The installer will also create a BPISoft_V3/wxMCA folder with a version of the data acquisition software. Note that the user can copy the folder wxMCA to anywhere on the hard drive. Further, the examples can all be operated outside the wxMCA folder.

The wxMCA folder itself can be downloaded as a zip file from here. This zip file will often be more up to date than the wxMCA folder in the installer.

If an MCA device is present during the installation, no further action is required. Alternatively, for Windows 10, you can use the zadig.exe utility. After plugging in the MCA and waiting for it to enumerate, launch zadig.exe and list all attached devices. Select the device with a vendor ID of 0x1FA4 and install the libusb-win32 driver. Note that after clicking on the install button, nothing happens for a while (up to 20s). Be patient. The software bundle ships with wxMCA/zadig-2.4.exe .

Using pip install

The BPI installation comes with Python 3.7 and the required modules, matplotlib, wxPython and zmq are pre-installed. If you want to use your own existing python installation, we recommend using pip install, as shown below.

Especially under Python 3.7, using pip to install new software is quite simple. Open a cmd window in administrator mode and change the directory to your python installation; eg cd C:\\BPISoft_V3\\Python37 .

ZMQ: python -m pip install zmq.

matplotlib: python -m pip install matplotlib.

wxPython: python -m pip install -U wxPython.

Installation under Linux

USB driver

We use a user-space USB driver called libusb0.1. Most Linux-based OS ship with a working version of libusb0.1, and the user is encouraged to find the local version of the *.so file. On most systems one of the provided binaries in the wxMCA/mds/lib folder will work, including the Raspberry Pi 3 and 4.

Since June 2022 the MCA Data Server also supports the use of libusb1. In that case, the user space driver is embedded in the CPython code and does not need to be linked via ctypes.

The mds/libusb0.py module automatically attempts to select the correct libusb_*_.so file. In case it fails, the user can force a selection by setting the libusb_selected variable (near line 33).

Using pip install for Python components

libusb 1: sudo python3.7 -m pip install usb1. (When planning to use libusb 1)

ZMQ: sudo python3.7 -m pip install zmq.

matplotlib: sudo python3.7 -m pip install matplotlib.

wxPython: wxPython wheels can be found at https://extras.wxpython.org/wxPython4 . E.g for Ubuntu 20.04:
sudo python3.7 -m pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04/
If the wxpython install fails because of missing GTK+, perform gtk install first
sudo apt install libgtk-3-dev