Python Interface Code

Post general discussions on using our drivers to write your own software here
Post Reply
coflynn
Newbie
Posts: 0
Joined: Sun Dec 15, 2013 10:23 pm

Python Interface Code

Post by coflynn »

Hi All,

I've started to write a Python interface code & wanted to put it up here, even though it's far from complete! In case anyone else is doing the same...

It's on github at https://github.com/colinoflynn/pico-python

I know there have been other Python interfaces posted, but they always seemed to be too instrument-specific. I'm trying to use a generic base-class which is extended for each instrument class (e.g. PS6000, etc).

It also gives you "nice" error messages, e.g. if something goes wrong it raises an exception, which if you don't have a handler looks like this:

Code: Select all

IOError: Error calling setChannel: PICO_INVALID_ANALOGUE_OFFSET (An impossible analogue offset value was specified in ps6000SetChannel.)
Still needs more work obviously! But Python is pretty damn easy to do almost anything in, so once it's running will be very handy I think.

Regards,

-Colin
Last edited by coflynn on Fri May 02, 2014 10:37 pm, edited 1 time in total.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Python Interface Code

Post by Martyn »

Thank you for that, I am sure other posters will be able to make use of this.
Martyn
Technical Support Manager

coflynn
Newbie
Posts: 0
Joined: Sun Dec 15, 2013 10:23 pm

Re: Python Interface Code

Post by coflynn »

To add some examples... I was looking towards a waterfall figure but was too complex for now, just used the spectragraph built into matplot lib, here's a measurement of a frequency sweep:
Spectragraph
Spectragraph
python-spectragraph.png (175.57 KiB) Viewed 7590 times
Video version:


Matplotlib tends to crash a lot on my computer, so also added an example to the library using PyQtGraph, here is a dual-view time-domain + frequency domain:
Dual View SA
Dual View SA
python-sa.png (23.8 KiB) Viewed 7590 times

Post Reply