def __init__(self, params): ''' Constructor ''' # Importar librerias para manejo de protocolos VISA from pyvisa.vpp43 import visa_library visa_library.load_library( "visa32.dll" ) import visa self.multimeter = visa.instrument( 'USB0::2391::1543::my47030898::0' ) self.name="AG34410A"
# from pyvisa.vpp43 import visa_library from pyvisa.visa_exceptions import VisaIOError visa_library.load_library("/Library/Frameworks/Visa.framework/VISA") import visa import sys import time class ScopeException(Exception): """Just an exception class """ def __init__(self, error): Exception.__init__(self, error) def chstr(channel): """Function to convert channel to the appropriate string. Only needed where a function can be used for either math/channel types. """ if type(channel) is int: return "C%01d" % channel elif type(channel) is str: return "T%s" % channel else: raise ScopeException("Unknown channel type") class LeCroy684(object):
#!/usr/bin/env python # # scope_connections.py # # This code opens the connection to send and recieve from a scope # # Author P G Jones - 28/05/2013 <*****@*****.**> : First revision #################################################################################################### try: from pyvisa.vpp43 import visa_library, visa_exceptions visa_library.load_library("/Library/Frameworks/Visa.framework/VISA") # Mac specific?? import visa except ImportError: print "No VISA/pyVISA software installed, cannot use VisaUSB" import socket class VisaUSB(object): """ Connect via visa/usb.""" def __init__(self): """ Try the default connection.""" try: for instrument in visa.get_instruments_list(): if instrument[0:3] == "USB": self._connection = visa.instrument(instrument) print "Connecting to", instrument print "Which has identity:", self.ask("*idn?") # Ask the scope for its identity except visa_exceptions.VisaIOError: print "Cannot connect to any instrument." raise def send(self, command):
# Find the machine and define it. from pyvisa.vpp43 import visa_library visa_library.load_library(r"C:\Windows\System32\visa32.dll") import visa instr = visa.instrument("GPIB3::17::INSTR") import os import time from IPython.core.display import Javascript def UI(): """This is a Javascript UI dynamically created by JQuery for the HP4192A impedance analyzer. You must have an html <div> with the ID = 'UI' to make this work. (i.e. <div id='UI'></div>) This will load all the buttons and switches necessary to run the machine. Notice that all the functions for a switch and select box are defined, so anyone can add more of these elements to the div as they please. The values are sent via the IPython messaging through the IPython kernel and are assigned to Python variables. The 'settings' dictionary maps the UI variable to the messaging protocol for the impedance analyzer. """ return Javascript(""" /* This Code uses JQuery in an IPython notebook to create a UI for the HP 4192A LF
#!/usr/bin/env python # # scope_connections.py # # This code opens the connection to send and recieve from a scope # # Author P G Jones - 28/05/2013 <*****@*****.**> : First revision #################################################################################################### import logging logger = logging.getLogger(__name__) try: from pyvisa.vpp43 import visa_library, visa_exceptions visa_library.load_library( "/Library/Frameworks/Visa.framework/VISA") # Mac specific?? import visa except ImportError: print "No VISA/pyVISA software installed, cannot use VisaUSB" import socket class TekConnection(object): """ Base class for Tektronix scope connections.""" def __init__(self): print "\n-----------------------------------------------------------------------------------" def __del__(self): print "-----------------------------------------------------------------------------------\n" def sync(self):
''' Created on 12/09/2013 @author: Javier Cruce%A4o ''' # Importar librerias necesarias # interfaz grafica from PyQt4 import QtCore, QtGui, uic # Comunicacion con sistema y manejo de puerto serie import os, sys, serial, time # Importar librerias para manejo de protocolos VISA from pyvisa.vpp43 import visa_library visa_library.load_library( "visa32.dll" ) import pyvisa.visa as visa #Funcion para pasar datos como si fueran un archivo de texto from StringIO import StringIO # Manejo numerico de datos import numpy as np # Librerias para graficar en el ploter from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas # from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigatioToolbar from matplotlib.figure import Figure class canvas( FigureCanvas ): def __init__( self, parent ): # Se instancia el objeto figure self.fig = Figure() # Se define la grafica en coordenadas polares
More details. """ import sys import time import serial as ser import win32com.client sys.path.append('./utility/') sys.path.append('../include/') import debug_msg #requires VISA library try: from pyvisa.vpp43 import visa_library visa_library.load_library(r"C:\WINDOWS\system32\agvisa32.dll") except WindowsError: print "Agilent VISA not found" try: import visa except: print "VISA module not working" if sys.version_info >= (3, 0): def data(string): return bytes(string, 'latin1') bytes0to255 = bytes(range(256)) else: