Test and Measurement Forum

Python Interface Code

Post general discussions on using our drivers to write your own software here

Python Interface Code

Postby coflynn » Sun Dec 15, 2013 10:28 pm

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.
coflynn
Newbie
 
Posts: 0
Joined: Sun Dec 15, 2013 10:23 pm

Re: Python Interface Code

Postby Martyn » Mon Dec 16, 2013 7:21 am

Thank you for that, I am sure other posters will be able to make use of this.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2349
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Python Interface Code

Postby coflynn » Mon Dec 16, 2013 2:48 pm

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:
python-spectragraph.png
Spectragraph
python-spectragraph.png (175.57 KiB) Viewed 2108 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:
python-sa.png
Dual View SA
python-sa.png (23.8 KiB) Viewed 2108 times
coflynn
Newbie
 
Posts: 0
Joined: Sun Dec 15, 2013 10:23 pm


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 2 guests