DCSIMG

Python Example: Get and Plot Waveform DPO4000

Moderators: Buck, Hiker, notnomis, Super Mod

Re: Python Example: Get and Plot Waveform DPO4000

Postby cball on Wed Oct 31, 2012 6:56 pm

Are you saying that if you do this:
Code: Select all
import visa
print visa.get_instruments_list()

You are not getting anything to respond? If so, try power cycling your instrument, then run it again. Did you happen to install both TekVISA and NI VISA? If so, this can cause problems. Additionally the get_instrument_list() function does not work with TekVISA (NI VISA is fine).

I just sent you an FTP link with the program/code mentioned as well. If you have any further questions regarding this, please respond directly to the email.
Tektronix Application Engineer
Anything I post here is user to user advice. For official technical support:
http://www.tek.com/webform/technical-support-request
cball
 
Posts: 645
Joined: Fri Dec 17, 2010 11:17 pm
Location: Beaverton, OR

Re: Python Example: Get and Plot Waveform DPO4000

Postby cball on Thu Nov 29, 2012 9:32 pm

I have had problems with the get_instrument_list() function (specifically when using TekVISA), due to the way it handles querying for aliases. I use the following function instead:

Code: Select all
import visa
from visa import vpp43
def getinstrument():
    resource_names = []
    try:
        find_list, return_counter, instrument_description = \
                vpp43.find_resources(visa.resource_manager.session, '?*')
        resource_names.append(instrument_description)
    except visa.VisaIOError:
        resource_names.append('ERROR: No Instruments Detected')
        return_counter = 0
    except:
        resource_names.append('ERROR: Unable to communicate ' \
                                + 'with VISA Driver')
        return_counter = 0

    for i in xrange(return_counter - 1):
        resource_names.append(vpp43.find_next(find_list))

    return resource_names
Tektronix Application Engineer
Anything I post here is user to user advice. For official technical support:
http://www.tek.com/webform/technical-support-request
cball
 
Posts: 645
Joined: Fri Dec 17, 2010 11:17 pm
Location: Beaverton, OR

Re: Python Example: Get and Plot Waveform DPO4000

Postby fslee on Tue Feb 05, 2013 5:11 am

Hi Chris,

Thanks for the code and example. Have you tried to get a raw socket working with a TDS3000B series scope? I am reading a few places (links below) that with TekVisa, there's a way to get raw socket support on TDS3000B series scopes. Is this true?

Thanks,

Fred

matlab w/tekvisa and TDS3000B: http://www.mathworks.com/support/soluti ... product=IC
national instruments w/tekvisa and TDS300B http://forums.ni.com/t5/Instrument-Cont ... d-p/867160
in the release notes for tekvisa 4.0 there is a comment that says it enables raw socket connection... is this true? http://www.tek.com/oscilloscope/tds7054 ... tware-v400

I've seen all the examples listed here by Buck, but they are not really useful:
viewtopic.php?f=8&t=1789

this is pretty useful, and I wonder how I can convert this to python: https://sites.google.com/site/giluth/kn ... e-over-lan

Any help is really appreciated... Thanks!

Fred
fslee
 
Posts: 1
Joined: Tue Feb 05, 2013 4:50 am

Re: Python Example: Get and Plot Waveform DPO4000

Postby agentschreck on Wed Feb 06, 2013 12:35 pm

Hello everyone,

I want to create a program, that (when executed) reads all available Channels from the Oscilloscope and stores them as CSV-file on my computer - maybe in the script directory.

Could someone help me with that issue?
Thanks
agentschreck
 
Posts: 2
Joined: Wed Feb 06, 2013 12:09 pm

Re: Python Example: Get and Plot Waveform DPO4000

Postby cball on Thu Feb 07, 2013 2:27 am

fslee,

The TDS3000 series scopes do not support raw socket connections. They run an VXI-11 server internally. The easiest way to communicate with that via a Windows PC is through VISA. On Non windows PCs, it may be easier to find a VXI-11 library. The scope also has an e*Scope interface, designed to work as an interactive tool. One of the threads that are linked on the example list uses a hack to communicate with the scope via the e*Scope interface pragmatically. http://www1.tek.com/forum/viewtopic.php?f=5&t=1943 If you dig further into the thread, they use Matlab doing URL read and writes to send SCPI commands. You could mimic this in any programing language.

agentschreck,

If you just want a program that will do this for you, you can use OpenChice Desktop (search www.tek.com for it), of I can send you an FTP link for a full program written in python that will log all your active channels to a .csv file (along with several other tools)
Tektronix Application Engineer
Anything I post here is user to user advice. For official technical support:
http://www.tek.com/webform/technical-support-request
cball
 
Posts: 645
Joined: Fri Dec 17, 2010 11:17 pm
Location: Beaverton, OR

Re: Python Example: Get and Plot Waveform DPO4000

Postby agentschreck on Thu Feb 07, 2013 12:59 pm

cball,

first thanks for your fast response!
I've tried OpenChoice already, but I need a command line tool to automate the acquiring of measurements.

It would be perfect, if you could send me an FTP-link.
agentschreck
 
Posts: 2
Joined: Wed Feb 06, 2013 12:09 pm

Re: Python Example: Get and Plot Waveform DPO4000

Postby renllawa on Tue Mar 12, 2013 4:56 pm

Hello. May I also get the program written in python that will log all active channels to a .csv file?
renllawa
 
Posts: 1
Joined: Tue Mar 12, 2013 4:48 pm

Re: Python Example: Get and Plot Waveform DPO4000

Postby Jochen Baltes on Thu Jun 06, 2013 9:26 am

you can try:
https://github.com/mwalle/pyvxi11
as command line tool

use:
https://github.com/mwalle/osccap
to get scope screenshots - tested with TDS5104 TDS7704B
Jochen Baltes
 
Posts: 1
Joined: Thu Jun 06, 2013 9:19 am

Re: Python Example: Get and Plot Waveform DPO4000

Postby divyanshub on Tue Jun 25, 2013 10:36 am

Hey , I'm using a tektronix oscilloscope DPO 4104B. I have two waveforms on different channels. My aim is to capture a waveform on one channel when the waveform on another channel meets a specified condition. Say it is a square wave and I need to capture the data present on the other channel using the two edges of the square wave as reference points. Please provide me with any pointers or any sample code in this direction. Thanks in advance.
divyanshub
 
Posts: 1
Joined: Tue Jun 25, 2013 10:19 am

Re: Python Example: Get and Plot Waveform DPO4000

Postby cball on Mon Jul 01, 2013 5:33 pm

You would want to have some way of knowing the condition is met then on the other channel. This could be by means of a measurement being above or bellow a certain value (such as RMS value, or positive edge count), or depending on your criteria, you could set the scope to only trigger when the waveform meets your needs.
Tektronix Application Engineer
Anything I post here is user to user advice. For official technical support:
http://www.tek.com/webform/technical-support-request
cball
 
Posts: 645
Joined: Fri Dec 17, 2010 11:17 pm
Location: Beaverton, OR

PreviousNext

Return to Oscilloscope Technical Support