Programming the 9103 With Python – Part 1: Standard Speed

Print Friendly, PDF & Email

New sample Python code for the 9103 is now available on RBD’s website. The 9103’s API is easy to program with any language and documented fully, but as always with any device programming, a few examples always help. We chose Python because it’s well supported, easy to understand even if you’re using another language and compatible with a number of popular lab control and analysis environments.

The sample code we provide is open-source and free for you to use and distribute as you see fit.

(If you haven’t taken a look at the 9103 USB auto-ranging picoammeter, everything you need to know can be found here. Measure bi-polar DC current from picoamps to milliamps, with optional built-in bias and 5 kV isolation.)

Programming the 9103 with Python

A Quick Look at the Standard Speed Sampling Code

Python’s pySerial module abstracts the calls to class-compliant USB serial COM port drivers, so setting up communications with the 9103 is a matter of a few simple calls:

port=serial.Serial(
    'com' + port_number,
    baudrate=57600,
    bytesize=serial.EIGHTBITS,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    xonxoff=False,
    timeout=1)

With the addition of a few helper functions for handling ASCII, it’s simple to write functions to send individual commands to the 9103. The following sets the auto-range and filter settings:

def message(message_string):
return bytes('&'+ message_string + '\n','utf-8')

def command_range_auto():
port.write(message('R0')) # put in autorange

def command_default_filter_32():
port.write(message('F032'))

Similarly, with the addition of a few helper functions, the 9103 samples can be read with a simple loop that reads lines from the port buffer: In this case, we’ve setup the 9103 to read in interval mode, and poll the port for incoming samples, with a simple keyboard interrupt. This code also writes the sample information to a text file.

try:
while True:
msg=port.readline().decode('utf-8').rstrip()
print(msg)
parsed = parse_message_for_sample(msg)
if parsed:
samplefile.write( parsed + '\n')

except KeyboardInterrupt:
pass

All of the code is commented and documented in the Python file.

Using Python with LabView and MATLAB

The Python code samples can be helpful to both LabView and MATLAB users.
LabVIEW now supports Python through the Python Node, which features low-latency calls from a LabVIEW Block Diagram using LabVIEW primitives.

The MATLAB Engine API for Python allows you to call MATLAB as a computational engine from Python, and you can call functions and objects in Python from MATLAB.

More to Come…

Next up we’ll be posting some sample code to write and read using the high-speed version of the 9103. Since high-speed data from the 9103 arrives in packets, there are some minor differences in parsing the message samples.

New AugerScan Feature – Automatic Marking of Multiple Element Peaks

Print Friendly, PDF & Email

A new feature has been added to AugerScan – the option to automatically mark all the peaks of a particular Auger element when marking the primary peak. With this feature you can mark an element’s primary peak and AugerScan will automatically mark the rest of the element’s peaks and select the primary for atomic concentration.

An Example Using Copper (Cu1)

AugerScan
AugerScan – Marking multiple peaks for copper (Cu1)

In the example above, we’ve selected the carbon (C1), oxygen (O1) and copper (Cu1) peaks. AugerScan automatically marked the additional copper peaks (Cu2, Cu3, and Cu4). When performing an atomic concentration calculation, only the Cu1 peak is selected.

You can of course easily change which peaks are selected for atomic concentration by clicking the “Markers” command from the “Edit” menu. You can also remove selected markers from peaks using this dialog.

AugerScan

AugerScan – Marker Selection Dialog

To turn this feature on/off, choose the “Options…” command from the “Data” menu, and select/deselect the checkbox labeled “When Marking and Element, Mark all of its Peaks”.

AugerScan

AugerScan – Marking all Peaks Option

(This feature was originally developed for CMapp, RBD’s software for the microCMA Compact Auger Analyzer)

AugerScan Version 3.3.1

The latest version of AugerScan is available for download. In addition to this new feature, this release includes some bug fixes and improved compatibility with high-dpi displays and Windows 10.

Running AugerScan and AugerMap on Windows 7 – 10

Print Friendly, PDF & Email

AugerScan and AugerMap are “legacy” software applications originally developed for Windows 95 and 98, however they have been and continue to be updated for bug fixes, additional features, and operating system compatibility. Both applications (and the systems they run) are still going strong and support Windows 7 – 10.

While many customers are still content running their RBD-upgraded PHI systems on Windows XP (or 95-98!), Microsoft no longer supports those operating systems, making upgrading the OS or replacing those PCs inevitable. There are a few areas where the transitions is not as smooth as we’d yet like, and those are driver support and the legacy help system.

Drivers

RBD provides drivers for older Windows XP systems as well as drivers that are fully compatible with Windows 7 – 10. However, none of these drivers are currently digitally signed. Depending on your operating system, providing the rights to run unsigned drivers may be necessary upon installing the drivers and/or running the software.

Some of the errors you may encounter are cryptic, such as the following sometimes seen when installing unsigned drivers on Windows 10: “The hash for the file is not present in the specified catalog file”.

Driver Error

Thanks for the clarity, Microsoft!

 

The good news is that you should only have to take care of the issue once, not every time you are running the software. The bad news is the methods are different for each operating system version, and even different for the same exact operating system depending on the date it was installed and the PC BIOS.

For most versions of Windows, disabling driver signature enforcement can be accomplished easily by one of these methods.

For Windows 10 PCs that were installed (not updated) with build 1607 (Anniversary Edition), the Secure Boot feature of the BIOS must be turned off.

Help

The original Help system (largely unchanged since Windows 3.1) was phased out in Windows Vista. The context-sensitive help – also known as “what’s this?” or “right-click” help cannot be replaced (this was the information you would typically see for each field in a dialog box, for example). However, for Windows Vista through 8.1, Microsoft does provide separate downloads for the legacy help system; it’s just no longer installed in the operating system.

You can find most of those files on this Microsoft support page (scroll down to “Resolution”) For security reasons, Microsoft no longer supports this help format at all in Windows 10, and there are no third-party solutions available.

However, we’ve translated most of RBD’s help to HTML for both AugerScan and AugerMap. In each case, simply  unzip the file to a convenient folder and run “index.html” in your browser.