pythonivi (1) - Linux Manuals
pythonivi: Python IVI Documentation
NAME
pythonivi - Python IVI DocumentationPython IVI is a Python-based interpretation of the Interchangeable Virtual Instrument standard from the IVI foundation.
See also:
- •
- Python IVI home page
- •
- GitHub repository
- •
-
IVI Foundation
Contents:
INTRODUCTION TO PYTHON IVI
Overview
Python IVI is a Python-based interpretation of the Interchangeable Virtual Instrument standard from the IVI foundation. The implementation is pure Python and highly portable.
It is released under the MIT license, see LICENSE for more details.
Copyright (C) 2012-2014 Alex Forencich <alex [at] alexforencich.com>
See also:
- •
- Python IVI home page
- •
- GitHub repository
- •
- IVI Foundation
Features
- •
- Supports Python 2 and Python 3
- •
- Pure Python
- •
- Highly portable
- •
- Communicates with instruments with various add-on modules
Requirements
- •
- Python 2 or Python 3
- •
- One or more communication extensions
Installation
To install the module for all users on the system, administrator rights (root) are required.
From source
Download the archive, extract, and run:
python setup.py install
Packages
There are also packaged versions for some Linux distributions:
- Arch Linux
- Python IVI is available under the name "python-ivi-git" in the AUR.
Instrument Communication Extensions
Python IVI does not contain any IO drivers itself. In order to communicate with an instrument, you must install one or more of the following drivers:
Python VXI11
Python VXI11 provides a pure python TCP/IP driver for LAN based instruments that support the VXI11 protocol. This includes most LXI instruments and also devices like the Agilent E2050 GPIB to LAN converter.
Home page: http://www.alexforencich.com/wiki/en/python-vxi11/start
GitHub repository: https://github.com/alexforencich/python-vxi11
Python USBTMC
Python USBTMC provides a pure python USBTMC driver for instruments that support the USB Test and Measurement Class. Python USBTMC uses PyUSB to connect to the instrument in a platform-independent manner.
Home page: http://alexforencich.com/wiki/en/python-usbtmc/start
GitHub repository: https://github.com/alexforencich/python-usbtmc
Linux GPIB
Python IVI provides an interface wrapper for the Linux GPIB driver. If the Linux GPIB driver and its included Python interface available, Python IVI can use it to communicate with instruments via any GPIB interface supported by Linux GPIB.
Home page: http://linux-gpib.sourceforge.net/
pySerial
Python IVI provides an interface wrapper for the pySerial library. If pySerial is installed, Python IVI can use it to communicate with instruments via the serial port.
Home page: http://pyserial.sourceforge.net/
PYTHON IVI EXAMPLES
Connecting to an Instrument
Connect to an Agilent MSO7104A oscilloscope over LXI (VXI11) on IP address 192.168.1.104:
>>> import ivi >>> mso = ivi.agilent.agilentMSO7104A("TCPIP::192.168.1.104::INSTR") >>> mso.identity.instrument_model 'MSO7104A'
Connect to an Agilent E3649A via an HP 2050A GPIB LAN bridge:
>>> import ivi >>> psu = ivi.agilent.agilentE3649A("TCPIP::192.168.1.105::gpib,5::INSTR") >>> psu.identity.instrument_model 'E3649A'
Configuring instruments
Connect to an Agilent MSO7104A oscilloscope over LXI (VXI11) and configure a channel:
>>> import ivi >>> mso = ivi.agilent.agilentMSO7104A("TCPIP0::192.168.1.104::INSTR") >>> #mso = ivi.agilent.agilentMSO7104A("USB0::2391::5973::MY********::INSTR") >>> mso.acquisition.time_per_record = 1e-3 >>> mso.trigger.type = 'edge' >>> mso.trigger.source = 'channel1' >>> mso.trigger.coupling = 'dc' >>> mso.trigger.edge.slope = 'positive' >>> mso.trigger.level = 0 >>> mso.channels['channel1'].enabled = True >>> mso.channels['channel1'].offset = 0 >>> mso.channels['channel1'].range = 4 >>> mso.channels['channel1'].coupling = 'dc' >>> mso.measurement.initiate() >>> waveform = mso.channels[0].measurement.fetch_waveform() >>> vpp = mso.channels[0].measurement.fetch_waveform_measurement("voltage_peak_to_peak") >>> phase = mso.channels['channel1'].measurement.fetch_waveform_measurement("phase", "channel2")
Connect to a Tektronix AWG2021, generate a sinewave with numpy, and transfer it to channel 1:
>>> import ivi >>> from numpy import * >>> #awg = ivi.tektronix.tektronixAWG2021("GPIB0::25::INSTR") >>> awg = ivi.tektronix.tektronixAWG2021("TCPIP0::192.168.1.105::gpib,25::INSTR") >>> #awg = ivi.tektronix.tektronixAWG2021("ASRL::/dev/ttyUSB0,9600::INSTR") >>> n = 128 >>> f = 1 >>> a = 1 >>> wfm = a*sin(2*pi/n*f*arange(0,n)) >>> awg.outputs[0].arbitrary.create_waveform(wfm) >>> awg.outputs[0].arbitrary.gain = 2.0 >>> awg.outputs[0].arbitrary.gain = 0.0 >>> arb.arbitrary.sample_rate = 128e6 >>> awg.outputs[0].enabled = True
Connect to an Agilent E3649A and configure an output:
>>> import ivi >>> #psu = ivi.agilent.agilentE3649A("GPIB0::5::INSTR") >>> psu = ivi.agilent.agilentE3649A("TCPIP0::192.168.1.105::gpib,5::INSTR") >>> #psu = ivi.agilent.agilentE3649A("ASRL::/dev/ttyUSB0,9600::INSTR") >>> psu.outputs[0].configure_range('voltage', 12) >>> psu.outputs[0].voltage_level = 12.0 >>> psu.outputs[0].current_limit = 1.0 >>> psu.outputs[0].ovp_limit = 14.0 >>> psu.outputs[0].ovp_enabled = True >>> psu.outptus[0].enabled = True
IVI --- IVI DRIVER
This module provides the base functionality of an IVI instrument driver.
Functions and Exceptions
- exception ivi.IviException
- Exception raised on various occasions; argument is a string describing what is wrong.
DriverOperation class
- class ivi.DriverOperation(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Inherent IVI methods for driver operation
DriverIdentity class
- class ivi.DriverIdentity(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Inherent IVI methods for identification
DriverUtility class
- class ivi.DriverUtility(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Inherent IVI utility methods
Driver class
- class ivi.Driver(resource=None, id_query=False, reset=False, *args, **kwargs)
-
Bases: ivi.ivi.DriverOperation, ivi.ivi.DriverIdentity, ivi.ivi.DriverUtility
Inherent IVI methods for all instruments
- doc(obj=None, itm=None, docs=None, prefix=None)
- Python IVI documentation generator
- help(itm=None, complete=False, indent=0)
- Python IVI help system
- ivi.close
-
When the user finishes using a Python IVI driver, the user should call
either the Close method or __del__. Note that __del__ will call close
automatically.
This function also does the following:
- •
- Prevents the user from calling other functions in the driver that access the instrument until the user calls the Initialize function again.
- •
- May deallocate internal resources used by the IVI session.
- driver_operation.cache
-
If True, the specific driver caches the value of attributes, and the IVI
specific driver keeps track of the current instrument settings so that it
can avoid sending redundant commands to the instrument. If False, the
specific driver does not cache the value of attributes.
The default value is True. When the user opens an instrument session through an IVI class driver or uses a logical name to initialize a specific driver, the user can override this value by specifying a value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the user specifies in the IVI configuration store.
- driver_operation.clear_interchange_warnings
-
This function clears the list of interchangeability warnings that the IVI
specific driver maintains.
When this function is called on an IVI class driver session, the function clears the list of interchangeability warnings that the class driver and the specific driver maintain.
Refer to the Interchange Check attribute for more information on interchangeability checking.
- driver_operation.driver_setup
-
Returns the driver setup string that the user specified in the IVI
configuration store when the instrument driver session was initialized or
passes in the OptionString parameter of the Initialize function. Refer to
Section 6.14, Initialize, for the restrictions on the format of the driver
setup string.
The string that this attribute returns does not have a predefined maximum length.
- driver_operation.get_next_coercion_record
-
If the Record Value Coercions attribute is set to True, the IVI specific
driver keeps a list of all value coercions it makes on integer and
floating point attributes. This function obtains the coercion information
associated with the IVI session. It retrieves and clears the oldest
instance in which the specific driver coerced a value the user specified
to another value.
The function returns an empty string in the CoercionRecord parameter if no coercion records remain for the session.
The coercion record string shall contain the following information:
- •
- The name of the attribute that was coerced. This can be the generic name, the COM property name, or the C defined constant.
- •
- If the attribute applies to a repeated capability, the name of the virtual or physical repeated capability identifier.
- •
- The value that the user specified for the attribute.
- •
-
The value to which the attribute was coerced.
A recommended format for the coercion record string is as follows:
" Attribute " + <attribute name> + [" on <repeated capability> " + <repeated capability identifier>] + " was coerced from " + <desiredVal> + " to " + <coercedVal>
.
And example coercion record string is as follows:
Attribute TKTDS500_ATTR_VERTICAL_RANGE on channel ch1 was coerced from 9.0 to 10.0.
- driver_operation.get_next_interchange_warning
-
If the Interchange Check attribute is set to True, the IVI specific driver
keeps a list of all interchangeability warnings that it encounters. This
function returns the interchangeability warnings associated with the IVI
session. It retrieves and clears the oldest interchangeability warning
from the list. Interchangeability warnings indicate that using the
application with a different instrument might cause different behavior.
When this function is called on an IVI class driver session, it may return interchangeability warnings generated by the IVI class driver as well as interchangeability warnings generated by the IVI specific driver. The IVI class driver determines the relative order in which the IVI class driver warnings are returned in relation to the IVI specific driver warnings.
The function returns an empty string in the InterchangeWarning parameter if no interchangeability warnings remain for the session.
Refer to the Interchange Check attribute for more information on interchangeability checking.
- driver_operation.interchange_check
-
If True, the specific driver performs interchangeability checking. If the
Interchange Check attribute is enabled, the specific driver maintains a
record of each interchangeability warning that it encounters. The user
calls the Get Next Interchange Warning function to extract and delete the
oldest interchangeability warning from the list. Refer to Section 6.11,
Get Next Interchange Warning, Section 6.2, Clear Interchange Warnings,
and Section 6.18, Reset Interchange Check, for more information. If False,
the specific driver does not perform interchangeability checking.
If the user opens an instrument session through an IVI class driver and the Interchange Check attribute is enabled, the IVI class driver may perform additional interchangeability checking. The IVI class driver maintains a list of the interchangeability warnings that it encounters. The user can retrieve both class driver interchangeability warnings and specific driver interchangeability warnings by calling the Get Next Interchange Warning function on the class driver session.
If the IVI specific driver does not implement interchangeability checking, the specific driver returns the Value Not Supported error when the user attempts to set the Interchange Check attribute to True. If the specific driver does implement interchangeability checking and the user opens an instrument session through an IVI class driver, the IVI class driver accepts True as a valid value for the Interchange Check attribute even if the class driver does not implement interchangeability checking capabilities of its own.
The default value is False. If the user opens an instrument session through an IVI class driver or initializes an IVI specific driver with a logical name, the user can override this value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the userspecifies in the IVI configuration store.
- driver_operation.invalidate_all_attributes
- This function invalidates the cached values of all attributes for the session.
- driver_operation.io_resource_descriptor
-
Returns the resource descriptor that the user specified for the physical
device. The user specifies the resource descriptor by editing the IVI
configuration store or by passing a resource descriptor to the Initialize
function of the specific driver. Refer to Section 6.14, Initialize, for the
restrictions on the contents of the resource descriptor string.
The string that this attribute returns contains a maximum of 256 characters including the NULL character.
- driver_operation.logical_name
-
Returns the IVI logical name that the user passed to the Initialize
function. If the user initialized the IVI specific driver directly and did
not pass a logical name, then this attribute returns an empty string.
Refer to IVI-3.5: Configuration Server Specification for restrictions on
the format of IVI logical names.
The string that this attribute returns contains a maximum of 256 characters including the NULL character.
- driver_operation.query_instrument_status
-
If True, the IVI specific driver queries the instrument status at the end
of each user operation. If False, the IVI specific driver does not query
the instrument status at the end of each user operation. Querying the
instrument status is very useful for debugging. After validating the
program, the user can set this attribute to False to disable status
checking and maximize performance. The user specifies this value for the
entire IVI driver session.
The default value is False. When the user opens an instrument session through an IVI class driver or uses a logical name to initialize an IVI specific driver, the user can override this value by specifying a value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the user specifies in the IVI configuration store.
- driver_operation.range_check
-
If True, the IVI specific driver validates attribute values and function
parameters. If False, the IVI specific driver does not validate attribute
values and function parameters.
If range check is enabled, the specific driver validates the parameter values that users pass to driver functions. Validating attribute values and function parameters is useful for debugging. After validating the program, the user can set this attribute to False to disable range checking and maximize performance. The default value is True. When the user opens an instrument session through an IVI class driver or uses a logical name to initialize an IVI specific driver, the user can override this value by specifying a value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the user specifies in the IVI configuration store.
- driver_operation.record_coercions
-
If True, the IVI specific driver keeps a list of the value coercions it
makes for ViInt32 and ViReal64 attributes. If False, the IVI specific
driver does not keep a list of the value coercions it makes for ViInt32 and
ViReal64 attributes.
If the Record Value Coercions attribute is enabled, the specific driver maintains a record of each coercion. The user calls the Get Next Coercion Record function to extract and delete the oldest coercion record from the list. Refer to Section 6.10, Get Next Coercion Record, for more information.
If the IVI specific driver does not implement coercion recording, the specific driver returns the Value Not Supported error when the user attempts to set the Record Value Coercions attribute to True.
The default value is False. When the user opens an instrument session through an IVI class driver or uses a logical name to initialize a IVI specific driver, the user can override this value by specifying a value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the user specifies in the IVI configuration store.
- driver_operation.reset_interchange_check
-
This function resets the interchangeability checking algorithms of the IVI
specific driver so that specific driver functions that execute prior to
calling this function have no effect on whether future calls to the
specific driver generate interchangeability warnings.
When developing a complex test system that consists of multiple test modules, it is generally a good idea to design the test modules so that they can run in any order. To do so requires ensuring that each test module completely configures the state of each instrument it uses. If a particular test module does not completely configure the state of an instrument, the state of the instrument depends on the configuration from a previously executed test module. If the test modules execute in a different order, the behavior of the instrument and therefore the entire test module is likely to change. This change in behavior is generally instrument specific and represents an interchangeability problem.
Users can use this function to test for such cases. By calling this function at the beginning of a test module, users can determine whether the test module has dependencies on the operation of previously executed test modules. Any interchangeability warnings that occur after the user calls this function indicate that the section of the test program that executes after this function and prior to the generation of the warning does not completely configure the instrument and that the user is likely to experience different behavior if the user changes the execution order of the test modules or if the user changes instruments.
Note: This function does not clear interchangeability warnings from the list of interchangeability warnings. To guarantee that the Get Next Interchange Warning function returns interchangeability warnings that occur only after the program calls function, the user must clear the list of interchangeability warnings by calling the Clear Interchange Warnings function.
Refer to the Interchange Check attribute for more information on interchangeability checking.
- driver_operation.simulate
-
If True, the IVI specific driver simulates instrument driver I/O
operations. If False, the IVI specific driver communicates directly with
the instrument.
If simulation is enabled, the specific driver functions do not perform instrument I/O. For output parameters that represent instrument data, the specific driver functions return simulated values.
The default value is False. When the user opens an instrument session through an IVI class driver or uses a logical name to initialize an IVI specific driver, the user can override this value by specifying a value in the IVI configuration store. The Initialize function allows the user to override both the default value and the value that the user specifies in the IVI configuration store.
- identity.description
-
Returns a brief description of the IVI software component.
The string that this attribute returns has no maximum size.
- identity.get_group_capabilities
-
Returns a list of names of class capability groups that the IVI specific
driver implements. The items in the list are capability group names that
the IVI class specifications define. The list is returned as a list of
strings.
If the IVI specific driver does not comply with an IVI class specification, the specific driver returns an array with zero elements.
- identity.get_supported_instrument_models
-
Returns a list of names of instrument models with which the IVI specific
driver is compatible. The list is returned as a list of strings. For
example, this attribute might return the strings "TKTDS3012", "TKTDS3014",
and "TKTDS3016" .
It is not necessary for the string to include the abbreviation for the manufacturer if it is the same for all models. In the example above, it is valid for the attribute to return the strings "TDS3012", "TDS3014", and "TDS3016".
- identity.group_capabilities
-
Returns a comma-separated list that identifies the class capability groups
that the IVI specific driver implements. The items in the list are
capability group names that the IVI class specifications define. The
string has no white space except for white space that might be embedded in
a capability group name.
If the IVI specific driver does not comply with an IVI class specification, the specific driver returns an empty string as the value of this attribute.
The string that this attribute returns does not have a predefined maximum length.
- identity.identifier
- Returns the case-sensitive unique identifier of the IVI software component. The string that this attribute returns contains a maximum of 32 characters including the NULL character.
- identity.instrument_firmware_revision
-
Returns an instrument specific string that contains the firmware
revision information of the physical instrument. The IVI specific driver
returns the value it queries from the instrument as the value of this
attribute or a string indicating that it cannot query the instrument
identity.
In some cases, it is not possible for the specific driver to query the firmware revision of the instrument. This can occur when the Simulate attribute is set to True or if the instrument is not capable of returning the firmware revision. For these cases, the specific driver returns defined strings for this attribute. If the Simulate attribute is set to True, the specific driver returns "Not available while simulating" as the value of this attribute. If the instrument is not capable of returning the firmware version and the Simulate attribute is set to False, the specific driver returns "Cannot query from instrument" as the value of this attribute.
The string that this attribute returns does not have a predefined maximum length.
- identity.instrument_manufacturer
-
Returns the name of the manufacturer of the instrument. The IVI specific
driver returns the value it queries from the instrument as the value of
this attribute or a string indicating that it cannot query the instrument
identity.
In some cases, it is not possible for the specific driver to query the manufacturer of the instrument. This can occur when the Simulate attribute is set to True or if the instrument is not capable of returning the manufacturer. For these cases, the specific driver returns defined strings for this attribute. If the Simulate attribute is set to True, the specific driver returns "Not available while simulating" as the value of this attribute. If the instrument is not capable of returning the manufacturer and the Simulate attribute is set to False, the specific driver returns "Cannot query from instrument" as the value of this attribute.
The string that this attribute returns does not have a predefined maximum length.
- identity.instrument_model
-
Returns the model number or name of the physical instrument. The IVI
specific driver returns the value it queries from the instrument or a
string indicating that it cannot query the instrument identity.
In some cases, it is not possible for the specific driver to query the model of the instrument. This can occur when the Simulate attribute is set to True or if the instrument is not capable of returning the model. For these cases, the specific driver returns defined strings for this attribute. If the Simulate attribute is set to True, the specific driver returns "Not available while simulating" as the value of this attribute. If the instrument is not capable of returning the model and the Simulate attribute is set to False, the specific driver returns "Cannot query from instrument" as the value of this attribute.
The string that this attribute returns does not have a predefined maximum length.
- identity.revision
-
Returns version information about the IVI software component. Refer to
Section 3.1.2.2, Additional Compliance Rules for Revision String
Attributes, for additional rules regarding this attribute.
The string that this attribute returns has no maximum size.
- identity.specification_major_version
-
Returns the major version number of the class specification in accordance
with which the IVI software component was developed. The value is a
positive integer value.
If the software component is not compliant with a class specification, the software component returns zero as the value of this attribute.
- identity.specification_minor_version
-
Returns the minor version number of the class specification in accordance
with which the IVI software component was developed. The value is a
positive integer value.
If the software component is not compliant with a class specification, the software component returns zero as the value of this attribute.
- identity.supported_instrument_models
-
Returns a comma-separated list of names of instrument models with which
the IVI specific driver is compatible. The string has no white space
except possibly embedded in the instrument model names. An example of a
string that this attribute might return is "TKTDS3012,TKTDS3014,TKTDS3016".
It is not necessary for the string to include the abbreviation for the manufacturer if it is the same for all models. In the example above, it is valid for the attribute to return the string "TDS3012,TDS3014,TDS3016".
The string that this attribute returns does not have a predefined maximum length.
- identity.vendor
-
Returns the name of the vendor that supplies the IVI software component.
The string that this attribute returns has no maximum size.
- ivi.initialize
-
The user must call the Initialize function prior to calling other IVI
driver functions that access the instrument. The Initialize function is
called automatically by the constructor if a resource string is passed as
the first argument to the constructor.
If simulation is disabled when the user calls the Initialize function, the function performs the following actions:
- •
- Opens and configures an I/O session to the instrument.
- •
- If the user passes True for the IdQuery parameter, the function queries the instrument for its ID and verifies that the IVI specific driver supports the particular instrument model. If the instrument cannot return its ID, the specific driver returns the ID Query Not Supported warning.
- •
-
If the user passes True for the Reset parameter, the function places the
instrument in a known state. In an IEEE 488.2 instrument, the function
sends the command string "
*
RST" to the instrument. If the instrument cannot perform a reset, the IVI specific driver returns the Reset Not Supported warning. - •
- Configures instrument options on which the IVI specific driver depends. For example, a specific driver might enable or disable headers or enable binary mode for waveform transfers.
- •
- Performs the following operations in the given order:
- 1.
- Disables the class extension capability groups that the IVI specific driver does not implement.
- 2.
- If the class specification with which the IVI specific driver is compliant defines initial values for attributes, this function sets the attributes to the values that the class specification defines.
- 3.
-
If the ResourceName parameter is a logical name, the IVI specific
driver configures the initial settings for the specific driver and
instrument based on the configuration of the logical name in the IVI
configuration store.
If simulation is enabled when the user calls the Initialize function, the function performs the following actions:
- •
- If the user passes True for the IdQuery parameter and the instrument cannot return its ID, the IVI specific driver returns the ID Query Not Supported warning.
- •
- If the user passes True for the Reset parameter and the instrument cannot perform a reset, the IVI specific driver returns the Reset Not Supported warning.
- •
-
If the ResourceName parameter is a logical name, the IVI specific driver
configures the initial settings for the specific driver based on the
configuration of the logical name in the IVI configuration store.
Some instrument driver operations require or take into account information from the IVI configuration store. Examples of such information are virtual repeated capability name mappings and the value of certain inherent attributes. An IVI driver shall retrieve all the information for a session from the IVI configuration store during the Initialization function. The IVI driver shall not read any information from the IVI configuration store for a session after the Initialization function completes. Refer to Section 3.2.3, Instantiating the Right Configuration Store From Software Modules, of IVI-3.5: Configuration Server Specification for details on how to correctly instantiate the configuration store.
The ResourceName parameter must contain either a logical name that is defined in the IVI configuration store or an instrument specific string that identifies the I/O address of the instrument, such as a VISA resource descriptor string. Refer to IVI-3.5: Configuration Server Specification for restrictions on the format of IVI logical names. Refer to the VXIplug&play specifications for the grammar of VISA resource descriptor strings.
Example resource strings:
'TCPIP::10.0.0.1::INSTR' 'TCPIP0::10.0.0.1::INSTR' 'TCPIP::10.0.0.1::gpib,5::INSTR' 'TCPIP0::10.0.0.1::gpib,5::INSTR' 'TCPIP0::10.0.0.1::usb0::INSTR' 'TCPIP0::10.0.0.1::usb0[1234::5678::MYSERIAL::0]::INSTR' 'USB::1234::5678::INSTR' 'USB::1234::5678::SERIAL::INSTR' 'USB0::0x1234::0x5678::INSTR' 'USB0::0x1234::0x5678::SERIAL::INSTR' 'GPIB::10::INSTR' 'GPIB0::10::INSTR' 'ASRL1::INSTR' 'ASRL::COM1,9600,8n1::INSTR' 'ASRL::/dev/ttyUSB0,9600::INSTR' 'ASRL::/dev/ttyUSB0,9600,8n1::INSTR'
The user can use additional parameters to specify the initial values of certain IVI inherent attributes for the session. The following table lists the inherent attributes that the user can set through these named parameters. The user does not have to specify all or any of the attributes. If the user does not specify the initial value of an inherent attribute, the initial value of the attribute depends on the value of the ResourceName parameter:
- •
- If the ResourceName parameter contains an IVI logical name, the IVI specific driver configures the initial settings based on the configuration of the logical name in the IVI configuration store.
- •
-
If the ResourceName parameter contains a resource descriptor string that
identifies the I/O address of the instrument, the IVI specific driver
sets inherent attributes to their default initial values. The following
table shows the default initial value for each attribute.
The following table lists the IVI inherent attributes that the user can set, their default initial values, and the name that represents each attribute. These options are passed to the initialize function or the constructor as key-value pairs.
Attribute Default Inital Value Options String Name Range Check True range_check Query Instrument Status False query_instr_status Cache True cache Simulate False simulate Record Value Coercions False record_coercions Interchange Check False interchange_check Driver Setup '' driver_setup Prefer PyVISA False prefer_pyvisa Each IVI specific driver defines it own meaning and valid values for the Driver Setup attribute. Many specific drivers ignore the value of the Driver Setup attribute. Other specific drivers use the Driver Setup string to configure instrument specific features at initialization. For example, if a specific driver supports a family of instrument models, the driver can use the Driver Setup attribute to allow the user to specify a particular instrument model to simulate.
If the user attempts to initialize the instrument a second time without first calling the Close function, the Initialize function returns the Already Initialized error.
- ivi.initialized
-
Returns a value that indicates whether the IVI specific driver is in the
initialized state. After the specific driver is instantiated and before
the Initialize function successfully executes, this attribute returns
False. After the Initialize function successfully executes and prior to
the execution of the Close function, this attribute returns True. After
the Close function executes, this attribute returns False.
The Initialized attribute is one of the few IVI specific driver attributes that can be accessed while the specific driver is not in the initialized state. All the attributes of an IVI specific driver that can be accessed while the specific driver is not in the initialized state are listed below.
- •
- Component Class Spec Major Version
- •
- Component Class Spec Minor Version
- •
- Component Description
- •
- Component Prefix
- •
- Component Identifier
- •
- Component Revision
- •
- Component Vendor
- •
- Initialized
- •
- Supported Instrument Models
- utility.disable
-
The Disable operation places the instrument in a quiescent state as
quickly as possible. In a quiescent state, an instrument has no or minimal
effect on the external system to which it is connected. The Disable
operation might be similar to the Reset operation in that it places the
instrument in a known state. However, the Disable operation does not
perform the other operations that the Reset operation performs such as
configuring the instrument options on which the IVI specific driver
depends. For some instruments, the disable function may do nothing.
The IVI class specifications define the exact behavior of this function for each instrument class. Refer to the IVI class specifications for more information on the behavior of this function.
- utility.error_query
-
Queries the instrument and returns instrument specific error information.
Generally, the user calls this function after another function in the IVI driver returns the Instrument Status error. The IVI specific driver returns the Instrument Status error when the instrument indicates that it encountered an error and its error queue is not empty. Error Query extracts an error out of the instrument's error queue.
For instruments that have status registers but no error queue, the IVI specific driver emulates an error queue in software.
The method returns a tuple containing the error code and error message.
- utility.lock_object
-
This function obtains a multithread lock for this instance of the driver.
Before it does so, Lock Session waits until all other execution threads
have released their locks or for the length of time specified by the
maximum time parameter, whichever come first. The type of lock obtained
depends upon the parameters passed to the specific driver constructor.
The user can use Lock Session with IVI specific drivers to protect a section of code that requires exclusive access to the instrument. This occurs when the user takes multiple actions that affect the instrument and the user wants to ensure that other execution threads do not disturb the instrument state until all the actions execute. For example, if the user sets various instrument attributes and then triggers a measurement, the user must ensure no other execution thread modifies the attribute values until the user finishes taking the measurement.
It is important to note that this lock is not related to I/O locks such as the VISA resource locking mechanism.
The user can safely make nested calls to Lock Session within the same thread. To completely unlock the session, the user must balance each call to Lock Session with a call to Unlock Session. Calls to Lock Session must always obtain the same lock that is used internally by the IVI driver to guard individual method calls.
- utility.reset
- This function performs the following actions:
- •
- Places the instrument in a known state. In an IEEE 488.2 instrument, the Reset function sends the command string *RST to the instrument.
- •
-
Configures instrument options on which the IVI specific driver depends.
A specific driver might enable or disable headers or enable binary mode
for waveform transfers.
The user can either call the Reset function separately or specify that it be called from the Initialize function. The Initialize function performs additional operations after performing the reset operation to place the instrument in a state more suitable for interchangeable programming. To reset the device and perform these additional operations, call the Reset With Defaults function instead of the Reset function.
- utility.reset_with_defaults
- The Reset With Defaults function performs the same operations that the Reset function performs and then performs the following additional operations in the specified order:
- •
- Disables the class extension capability groups that the IVI specific driver implements.
- •
- If the class specification with which the IVI specific driver is compliant defines initial values for attributes, this function sets those attributes to the initial values that the class specification defines.
- •
-
Configures the initial settings for the specific driver and instrument
based on the information retrieved from the IVI configuration store when
the instrument driver session was initialized.
Notice that the Initialize function also performs these functions. To place the instrument and the IVI specific driver in the exact same state that they attain when the user calls the Initialize function, the user must first call the Close function and then the Initialize function.
- utility.self_test
-
Causes the instrument to perform a self test. Self Test waits for the
instrument to complete the test. It then queries the instrument for the
results of the self test and returns the results to the user.
If the instrument passes the self test, this function returns the tuple:
(0, 'Self test passed')
Otherwise, the function returns a tuple of the result code and message.
- utility.unlock_object
-
This function releases a lock that the Lock Session function acquires.
Refer to Lock Session for additional information on IVI session locks.
Helper Classes
PropertyCollection class
- class ivi.PropertyCollection
- A building block to create hierarchical trees of methods and properties
- _add_method(name, f=None, doc=None)
- Add a managed method
- _add_property(name, fget=None, fset=None, fdel=None, doc=None)
- Add a managed property
- _del_property(name)
- Remove managed property or method
- _lock(lock=True)
- Set lock state to prevent creation or deletion of unmanaged members
- _unlock()
- Unlock object to allow creation or deletion of unmanaged members, equivalent to _lock(False)
IndexedPropertyCollection class
- class ivi.IndexedPropertyCollection
- A building block to create hierarchical trees of methods and properties with an index that is converted to a parameter
- _add_method(name, f=None, doc=None, props=None, docs=None)
- Add a managed method
- _add_property(name, fget=None, fset=None, fdel=None, doc=None, props=None, docs=None)
- Add a managed property
- _add_sub_method(sub, name, f=None, doc=None)
- Add a sub-method (equivalent to _add_method('sub.name', ...))
- _add_sub_property(sub, name, fget=None, fset=None, fdel=None, doc=None)
- Add a sub-property (equivalent to _add_property('sub.name', ...))
- _build_obj(props, docs, i)
- Build a tree of PropertyCollection objects with the proper index associations
- _del_property(name)
- Delete property
- _set_list(l)
- Set a list of allowable indicies as an associative array
IVI.SCOPE --- OSCILLOSCOPE CLASS
This module provides the base functionality for Oscilloscopes.
Functions and Exceptions
- exception ivi.scope.IviException
- Exception raised on various occasions; argument is a string describing what is wrong.
Base class
- class ivi.scope.Base(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Base IVI methods for all oscilloscopes
- acquisition.configure_record
-
IVI class IviScope, capability group IviScopeBase, section 4.3.4
This function configures the most commonly configured attributes of the oscilloscope acquisition sub-system. These attributes are the time per record, minimum record length, and the acquisition start time.
- acquisition.number_of_points_minimum
-
IVI class IviScope, capability group IviScopeBase, section 4.2.8
Specifies the minimum number of points the end-user requires in the waveform record for each channel. The instrument driver uses the value the end-user specifies to configure the record length that the oscilloscope uses for waveform acquisition. If the instrument cannot support the requested record length, the driver shall configure the instrument to the closest bigger record length. The Horizontal Record Length attribute returns the actual record length.
- acquisition.record_length
-
IVI class IviScope, capability group IviScopeBase, section 4.2.9
Returns the actual number of points the oscilloscope acquires for each channel. The value is equal to or greater than the minimum number of points the end-user specifies with the Horizontal Minimum Number of Points attribute.
Note: Oscilloscopes may use different size records depending on the value the user specifies for the Acquisition Type attribute.
- acquisition.sample_rate
-
IVI class IviScope, capability group IviScopeBase, section 4.2.10
Returns the effective sample rate of the acquired waveform using the current configuration. The units are samples per second.
- acquisition.start_time
-
IVI class IviScope, capability group IviScopeBase, section 4.2.1
Specifies the length of time from the trigger event to the first point in the waveform record. If the value is positive, the first point in the waveform record occurs after the trigger event. If the value is negative, the first point in the waveform record occurs before the trigger event. The units are seconds.
- acquisition.time_per_record
-
IVI class IviScope, capability group IviScopeBase, section 4.2.11
Specifies the length of time that corresponds to the record length. The units are seconds.
- acquisition.type
-
IVI class IviScope, capability group IviScopeBase, section 4.2.3
Specifies how the oscilloscope acquires data and fills the waveform record.
Values: * 'normal' * 'high_resolution' * 'average' * 'peak_detect' * 'envelope'
- channels[].configure
-
IVI class IviScope, capability group IviScopeBase, section 4.3.6
This function configures the most commonly configured attributes of the oscilloscope channel sub-system. These attributes are the range, offset, coupling, probe attenuation, and whether the channel is enabled.
- channels[].configure_characteristics
-
IVI class IviScope, capability group IviScopeBase, section 4.3.8
This function configures the attributes that control the electrical characteristics of the channel. These attributes are the input impedance and the maximum frequency of the input signal.
- channels[].coupling
-
IVI class IviScope, capability group IviScopeBase, section 4.2.23
Specifies how the oscilloscope couples the input signal for the channel.
Values:
- •
- 'ac'
- •
- 'dc'
- •
- 'gnd'
- channels[].enabled
-
IVI class IviScope, capability group IviScopeBase, section 4.2.5
If set to True, the oscilloscope acquires a waveform for the channel. If set to False, the oscilloscope does not acquire a waveform for the channel.
- channels[].input_frequency_max
-
IVI class IviScope, capability group IviScopeBase, section 4.2.13
Specifies the maximum frequency for the input signal you want the instrument to accommodate without attenuating it by more than 3dB. If the bandwidth limit frequency of the instrument is greater than this maximum frequency, the driver enables the bandwidth limit. This attenuates the input signal by at least 3dB at frequencies greater than the bandwidth limit.
- channels[].input_impedance
-
IVI class IviScope, capability group IviScopeBase, section 4.2.12
Specifies the input impedance for the channel in Ohms.
Common values are 50.0, 75.0, and 1,000,000.0.
- channels[].measurement.fetch_waveform
-
IVI class IviScope, capability group IviScopeBase, section 4.3.13
This function returns the waveform the oscilloscope acquires for the specified channel. The waveform is from a previously initiated acquisition.
You use the Initiate Acquisition function to start an acquisition on the channels that the end-user configures with the Configure Channel function. The oscilloscope acquires waveforms on the concurrently enabled channels. If the channel is not enabled for the acquisition, this function returns the Channel Not Enabled error.
Use this function only when the acquisition mode is Normal, Hi Res, or Average. If the acquisition type is not one of the listed types, the function returns the Invalid Acquisition Type error.
You use the Acquisition Status function to determine when the acquisition is complete. You must call this function separately for each enabled channel to obtain the waveforms.
You can call the Read Waveform function instead of the Initiate Acquisition function. The Read Waveform function starts an acquisition on all enabled channels, waits for the acquisition to complete, and returns the waveform for the specified channel. You call this function to obtain the waveforms for each of the remaining channels.
The return value is a list of (x, y) tuples that represent the time and voltage of each data point. The y point may be NaN in the case that the oscilloscope could not sample the voltage.
The end-user configures the interpolation method the oscilloscope uses with the Acquisition.Interpolation property. If interpolation is disabled, the oscilloscope does not interpolate points in the waveform. If the oscilloscope cannot sample a value for a point in the waveform, the driver sets the corresponding element in the waveformArray to an IEEE-defined NaN (Not a Number) value. Check for this value with math.isnan() or numpy.isnan().
This function does not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
- channels[].measurement.read_waveform
-
IVI class IviScope, capability group IviScopeBase, section 4.3.16
This function initiates an acquisition on the channels that the end-user configures with the Configure Channel function. If the channel is not enabled for the acquisition, this function returns Channel Not Enabled error. It then waits for the acquisition to complete, and returns the waveform for the channel the end-user specifies. If the oscilloscope did not complete the acquisition within the time period the user specified with the max_time parameter, the function returns the Max Time Exceeded error.
Use this function only when the acquisition mode is Normal, Hi Res, or Average. If the acquisition type is not one of the listed types, the function returns the Invalid Acquisition Type error.
You call the Fetch Waveform function to obtain the waveforms for each of the remaining enabled channels without initiating another acquisition. After this function executes, each element in the WaveformArray parameter is either a voltage or a value indicating that the oscilloscope could not sample a voltage.
The end-user configures the interpolation method the oscilloscope uses with the Acquisition.Interpolation property. If interpolation is disabled, the oscilloscope does not interpolate points in the waveform. If the oscilloscope cannot sample a value for a point in the waveform, the driver sets the corresponding element in the waveformArray to an IEEE-defined NaN (Not a Number) value. Check for this value with math.isnan() or numpy.isnan(). Check an entire array with
any(any(math.isnan(b) for b in a) for a in waveform)
- channels[].name
-
IVI class IviScope, capability group IviScopeBase, section 4.2.7
This attribute returns the repeated capability identifier defined by specific driver for the channel that corresponds to the index that the user specifies. If the driver defines a qualified channel name, this property returns the qualified name.
If the value that the user passes for the Index parameter is less than zero or greater than the value of the channel count, the attribute raises a SelectorRangeException.
- channels[].offset
-
IVI class IviScope, capability group IviScopeBase, section 4.2.24
Specifies the location of the center of the range that the Vertical Range attribute specifies. The value is with respect to ground and is in volts.
For example, to acquire a sine wave that spans between on 0.0 and 10.0 volts, set this attribute to 5.0 volts.
- channels[].probe_attenuation
-
IVI class IviScope, capability group IviScopeBase, section 4.2.16
Specifies the scaling factor by which the probe the end-user attaches to the channel attenuates the input. For example, for a 10:1 probe, the end-user sets this attribute to 10.0.
Note that if the probe is changed to one with a different attenuation, and this attribute is not set, the amplitude calculations will be incorrect.
Querying this value will return the probe attenuation corresponding to the instrument's actual probe attenuation. Setting this property sets Probe Attenuation Auto to False Negative values are not valid.
- channels[].range
-
IVI class IviScope, capability group IviScopeBase, section 4.2.25
Specifies the absolute value of the full-scale input range for a channel. The units are volts.
For example, to acquire a sine wave that spans between -5.0 and 5.0 volts, set the Vertical Range attribute to 10.0 volts.
- measurement.abort
-
IVI class IviScope, capability group IviScopeBase, section 4.3.1
This function aborts an acquisition and returns the oscilloscope to the Idle state. This function does not check the instrument status.
Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
If the instrument cannot abort an initiated acquisition, the driver shall return the Function Not Supported error.
- measurement.initiate
-
IVI class IviScope, capability group IviScopeBase, section 4.3.14
This function initiates a waveform acquisition. After calling this function, the oscilloscope leaves the idle state and waits for a trigger. The oscilloscope acquires a waveform for each channel the end-user has enabled with the Configure Channel function.
This function does not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
- measurement.status
-
IVI class IviScope, capability group IviScopeBase, section 4.2.2
Acquisition status indicates whether an acquisition is in progress, complete, or if the status is unknown.
Acquisition status is not the same as instrument status, and does not necessarily check for instrument errors. To make sure that the instrument is checked for errors after getting the acquisition status, call the Error Query method. (Note that the end user may want to call Error Query at the end of a sequence of other calls which include getting the acquisition status - it does not necessarily need to be called immediately.)
If the driver cannot determine whether the acquisition is complete or not, it returns the Acquisition Status Unknown value.
Values: * 'compete' * 'in_progress' * 'unknown'
- trigger.configure
-
IVI class IviScope, capability group IviScopeBase, section 4.3.10
This function configures the common attributes of the trigger subsystem. These attributes are the trigger type and trigger holdoff.
When the end-user calls Read Waveform, Read Waveform Measurement, Read Min Max Waveform, or Initiate Acquisition, the oscilloscope waits for a trigger. The end-user specifies the type of trigger for which the oscilloscope waits with the TriggerType parameter.
If the oscilloscope requires multiple waveform acquisitions to build a complete waveform, it waits for the length of time the end-user specifies with the Holdoff parameter to elapse since the previous trigger. The oscilloscope then waits for the next trigger. Once the oscilloscope acquires a complete waveform, it returns to the idle state.
- trigger.coupling
-
IVI class IviScope, capability group IviScopeBase, section 4.2.17
Specifies how the oscilloscope couples the trigger source.
Values:
- •
- 'ac'
- •
- 'dc'
- •
- 'lf_reject'
- •
- 'hf_reject'
- •
- 'noise_reject'
- trigger.edge.configure
-
IVI class IviScope, capability group IviScopeBase, section 4.3.9
This function sets the edge triggering attributes. An edge trigger occurs when the trigger signal that the end-user specifies with the Source parameter passes through the voltage threshold that the end-user specifies with the level parameter and has the slope that the end-user specifies with the Slope parameter.
This function affects instrument behavior only if the Trigger Type is Edge Trigger. Set the Trigger Type and Trigger Coupling before calling this function.
If the trigger source is one of the analog input channels, an application program should configure the vertical range, vertical offset, vertical coupling, probe attenuation, and the maximum input frequency before calling this function.
- trigger.edge.slope
-
IVI class IviScope, capability group IviScopeBase, section 4.2.20
Specifies whether a rising or a falling edge triggers the oscilloscope.
This attribute affects instrument operation only when the Trigger Type attribute is set to Edge Trigger.
- Values:
- •
- 'positive'
- •
- 'negative'
- trigger.holdoff
-
IVI class IviScope, capability group IviScopeBase, section 4.2.18
Specifies the length of time the oscilloscope waits after it detects a trigger until the oscilloscope enables the trigger subsystem to detect another trigger. The units are seconds. The Trigger Holdoff attribute affects instrument operation only when the oscilloscope requires multiple acquisitions to build a complete waveform. The oscilloscope requires multiple waveform acquisitions when it uses equivalent-time sampling or when the Acquisition Type attribute is set to Envelope or Average.
Note: Many scopes have a small, non-zero value as the minimum value for this attribute. To configure the instrument to use the shortest trigger hold-off, the user can specify a value of zero for this attribute.
Therefore, the IVI Class-Compliant specific driver shall coerce any value between zero and the minimum value to the minimum value. No other coercion is allowed on this attribute.
- trigger.level
-
IVI class IviScope, capability group IviScopeBase, section 4.2.19
Specifies the voltage threshold for the trigger sub-system. The units are volts. This attribute affects instrument behavior only when the Trigger Type is set to one of the following values: Edge Trigger, Glitch Trigger, or Width Trigger.
This attribute, along with the Trigger Slope, Trigger Source, and Trigger Coupling attributes, defines the trigger event when the Trigger Type is set to Edge Trigger.
- trigger.source
-
IVI class IviScope, capability group IviScopeBase, section 4.2.21
Specifies the source the oscilloscope monitors for the trigger event. The value can be a channel name alias, a driver-specific channel string, or one of the values below.
This attribute affects the instrument operation only when the Trigger Type is set to one of the following values: Edge Trigger, TV Trigger, Runt Trigger, Glitch Trigger, or Width Trigger.
- trigger.type
-
IVI class IviScope, capability group IviScopeBase, section 4.2.22
Specifies the event that triggers the oscilloscope.
Values:
- •
- 'edge'
- •
- 'tv'
- •
- 'runt'
- •
- 'glitch'
- •
- 'width'
- •
- 'immediate'
- •
- 'ac_line'
Interpolation class
- class ivi.scope.Interpolation(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting interpolation
- acquisition.interpolation
-
IVI class IviScope, capability group IviScopeInterpolation, section 5.2.1
Specifies the interpolation method the oscilloscope uses when it cannot resolve a voltage for every point in the waveform record.
Values: * 'none' * 'sinex' * 'linear'
TVTrigger class
- class ivi.scope.TVTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting TV triggering
- trigger.tv.configure
-
IVI class IviScope, capability group IviScopeTVTrigger, section 6.3.2
This function configures the oscilloscope for TV triggering. It configures the TV signal format, the event and the signal polarity.
This function affects instrument behavior only if the trigger type is TV Trigger. Set the Trigger Type and Trigger Coupling before calling this function.
- trigger.tv.line_number
-
IVI class IviScope, capability group IviScopeTVTrigger, section 6.2.2
Specifies the line on which the oscilloscope triggers. The driver uses this attribute when the TV Trigger Event is set to TV Event Line Number. The line number setting is independent of the field. This means that to trigger on the first line of the second field, the user must configure the line number to the value of 263 (if we presume that field one had 262 lines).
- trigger.tv.polarity
-
IVI class IviScope, capability group IviScopeTVTrigger, section 6.2.3
Specifies the polarity of the TV signal.
Values: * 'positive' * 'negative'
- trigger.tv.signal_format
-
IVI class IviScope, capability group IviScopeTVTrigger, section 6.2.4
Specifies the format of TV signal on which the oscilloscope triggers.
Values: * 'ntsc' * 'pal' * 'secam'
- trigger.tv.trigger_event
-
IVI class IviScope, capability group IviScopeTVTrigger, section 6.2.1
Specifies the event on which the oscilloscope triggers.
Values: * 'field1' * 'field2' * 'any_field' * 'any_line' * 'line_number'
RuntTrigger class
- class ivi.scope.RuntTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting runt triggering
- trigger.runt.configure
-
IVI class IviScope, capability group IviScopeRuntTrigger, section 7.3.1
This function configures the runt trigger. A runt trigger occurs when the trigger signal crosses one of the runt thresholds twice without crossing the other runt threshold. The end-user specifies the runt thresholds with the RuntLowThreshold and RuntHighThreshold parameters. The end-user specifies the polarity of the runt with the RuntPolarity parameter.
This function affects instrument behavior only if the trigger type is Runt Trigger. Set the trigger type and trigger coupling before calling this function.
- trigger.runt.polarity
-
IVI class IviScope, capability group IviScopeRuntTrigger, section 7.2.3
Specifies the polarity of the runt that triggers the oscilloscope.
Values: * 'positive' * 'negative' * 'either'
- trigger.runt.threshold_high
-
IVI class IviScope, capability group IviScopeRuntTrigger, section 7.2.1
Specifies the high threshold the oscilloscope uses for runt triggering. The units are volts.
- trigger.runt.threshold_low
-
IVI class IviScope, capability group IviScopeRuntTrigger, section 7.2.2
Specifies the low threshold the oscilloscope uses for runt triggering. The units are volts.
GlitchTrigger class
- class ivi.scope.GlitchTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting glitch triggering
- trigger.glitch.condition
-
IVI class IviScope, capability group IviScopeGlitchTrigger, section 8.2.1
Specifies the glitch condition. This attribute determines whether the glitch trigger happens when the oscilloscope detects a pulse with a width less than or greater than the width value.
Values: * 'greater_than' * 'less_than'
- trigger.glitch.configure
-
IVI class IviScope, capability group IviScopeGlitchTrigger, section 8.3.1
This function configures the glitch trigger. A glitch trigger occurs when the trigger signal has a pulse with a width that is less than or greater than the glitch width. The end user specifies which comparison criterion to use with the GlitchCondition parameter. The end-user specifies the glitch width with the GlitchWidth parameter. The end-user specifies the polarity of the pulse with the GlitchPolarity parameter. The trigger does not actually occur until the edge of a pulse that corresponds to the GlitchWidth and GlitchPolarity crosses the threshold the end-user specifies in the TriggerLevel parameter.
This function affects instrument behavior only if the trigger type is Glitch Trigger. Set the trigger type and trigger coupling before calling this function.
- trigger.glitch.polarity
-
IVI class IviScope, capability group IviScopeGlitchTrigger, section 8.2.2
Specifies the polarity of the glitch that triggers the oscilloscope.
Values: * 'positive' * 'negative' * 'either'
- trigger.glitch.width
-
IVI class IviScope, capability group IviScopeGlitchTrigger, section 8.2.3
Specifies the glitch width. The units are seconds. The oscilloscope triggers when it detects a pulse with a width less than or greater than this value, depending on the Glitch Condition attribute.
WidthTrigger class
- class ivi.scope.WidthTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting width triggering
- trigger.width.condition
-
IVI class IviScope, capability group IviScopeWidthTrigger, section 9.2.1
Specifies whether a pulse that is within or outside the high and low thresholds triggers the oscilloscope. The end-user specifies the high and low thresholds with the Width High Threshold and Width Low Threshold attributes.
Values: * 'within' * 'outside'
- trigger.width.configure
-
IVI class IviScope, capability group IviScopeWidthTrigger, section 9.3.1
This function configures the width trigger. A width trigger occurs when the oscilloscope detects a positive or negative pulse with a width between, or optionally outside, the width thresholds. The end-user specifies the width thresholds with the WidthLowThreshold and WidthHighThreshold parameters. The end-user specifies whether the oscilloscope triggers on pulse widths that are within or outside the width thresholds with the WidthCondition parameter. The end-user specifies the polarity of the pulse with the WidthPolarity parameter. The trigger does not actually occur until the edge of a pulse that corresponds to the WidthLowThreshold, WidthHighThreshold, WidthCondition, and WidthPolarity crosses the threshold the end-user specifies with the TriggerLevel parameter.
This function affects instrument behavior only if the trigger type is Width Trigger. Set the trigger type and trigger coupling before calling this function.
- trigger.width.polarity
-
IVI class IviScope, capability group IviScopeWidthTrigger, section 9.2.4
Specifies the polarity of the pulse that triggers the oscilloscope.
Values: * 'positive' * 'negative' * 'either'
- trigger.width.threshold_high
-
IVI class IviScope, capability group IviScopeWidthTrigger, section 9.2.2
Specifies the high width threshold time. Units are seconds.
- trigger.width.threshold_low
-
IVI class IviScope, capability group IviScopeWidthTrigger, section 9.2.3
Specifies the low width threshold time. Units are seconds.
AcLineTrigger class
- class ivi.scope.AcLineTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting AC line triggering
- trigger.ac_line.slope
-
IVI class IviScope, capability group IviScopeAcLineTrigger, section 10.2.1
Specifies the slope of the zero crossing upon which the scope triggers.
Values: * 'positive' * 'negative' * 'either'
WaveformMeasurement class
- class ivi.scope.WaveformMeasurement(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting waveform measurements
- channels[].measurement.fetch_waveform_measurement
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.3.2
This function fetches a specified waveform measurement from a specific channel from a previously initiated waveform acquisition. If the channel is not enabled for the acquisition, this function returns the Channel Not Enabled error.
This function obtains a waveform measurement and returns the measurement value. The end-user specifies a particular measurement type, such as rise time, frequency, and voltage peak-to-peak. The waveform on which the oscilloscope calculates the waveform measurement is from an acquisition that was previously initiated.
Use the Initiate Acquisition function to start an acquisition on the channels that were enabled with the Configure Channel function. The oscilloscope acquires waveforms for the enabled channels concurrently. Use the Acquisition Status function to determine when the acquisition is complete. Call this function separately for each waveform measurement on a specific channel.
The end-user can call the Read Waveform Measurement function instead of the Initiate Acquisition function. The Read Waveform Measurement function starts an acquisition on all enabled channels. It then waits for the acquisition to complete, obtains a waveform measurement on the specified channel, and returns the measurement value. Call this function separately to obtain any other waveform measurements on a specific channel.
Configure the appropriate reference levels before calling this function to take a rise time, fall time, width negative, width positive, duty cycle negative, or duty cycle positive measurement.
The end-user can configure the low, mid, and high references either by calling the Configure Reference Levels function or by setting the following attributes.
- •
- Measurement High Reference
- •
- Measurement Low Reference
- •
-
Measurement Mid Reference
This function does not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
Values for measurement_function: * 'rise_time' * 'fall_time' * 'frequency' * 'period' * 'voltage_rms' * 'voltage_peak_to_peak' * 'voltage_max' * 'voltage_min' * 'voltage_high' * 'voltage_low' * 'voltage_average' * 'width_negative' * 'width_positive' * 'duty_cycle_negative' * 'duty_cycle_positive' * 'amplitude' * 'voltage_cycle_rms' * 'voltage_cycle_average' * 'overshoot' * 'preshoot'
- channels[].measurement.read_waveform_measurement
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.3.3
This function initiates a new waveform acquisition and returns a specified waveform measurement from a specific channel.
This function initiates an acquisition on the channels that the end-user enables with the Configure Channel function. If the channel is not enabled for the acquisition, this function returns Channel Not Enabled error. It then waits for the acquisition to complete, obtains a waveform measurement on the channel the end-user specifies, and returns the measurement value. The end-user specifies a particular measurement type, such as rise time, frequency, and voltage peak-to-peak.
If the oscilloscope did not complete the acquisition within the time period the user specified with the MaxTimeMilliseconds parameter, the function returns the Max Time Exceeded error.
The end-user can call the Fetch Waveform Measurement function separately to obtain any other waveform measurement on a specific channel without initiating another acquisition.
The end-user must configure the appropriate reference levels before calling this function. Configure the low, mid, and high references either by calling the Configure Reference Levels function or by setting the following attributes. following attributes.
- •
- Measurement High Reference
- •
- Measurement Low Reference
- •
- Measurement Mid Reference
- reference_level.configure
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.3.1
This function configures the reference levels for waveform measurements. Call this function before calling the Read Waveform Measurement or Fetch Waveform Measurement to take waveform measurements.
- reference_level.high
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.2.1
Specifies the high reference the oscilloscope uses for waveform measurements. The value is a percentage of the difference between the Voltage High and Voltage Low.
- reference_level.low
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.2.2
Specifies the low reference the oscilloscope uses for waveform measurements. The value is a percentage of the difference between the Voltage High and Voltage Low.
- reference_level.middle
-
IVI class IviScope, capability group IviScopeWaveformMeasurement, section 11.2.3
Specifies the middle reference the oscilloscope uses for waveform measurements. The value is a percentage of the difference between the Voltage High and Voltage Low.
MinMaxWaveform class
- class ivi.scope.MinMaxWaveform(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting minimum and maximum waveform acquisition
- acquisition.number_of_envelopes
-
IVI class IviScope, capability group IviScopeMinMaxWaveform, section 12.2.1
When the end-user sets the Acquisition Type attribute to Envelope, the oscilloscope acquires multiple waveforms. After each waveform acquisition, the oscilloscope keeps the minimum and maximum values it finds for each point in the waveform record. This attribute specifies the number of waveforms the oscilloscope acquires and analyzes to create the minimum and maximum waveforms. After the oscilloscope acquires as many waveforms as this attribute specifies, it returns to the idle state. This attribute affects instrument operation only when the Acquisition Type attribute is set to Envelope.
- channels[].measurement.fetch_waveform_min_max
-
IVI class IviScope, capability group IviScopeMinMaxWaveform, section 12.3.2
This function returns the minimum and maximum waveforms that the oscilloscope acquires for the specified channel. If the channel is not enabled for the acquisition, this function returns the Channel Not Enabled error.
The waveforms are from a previously initiated acquisition. Use this function to fetch waveforms when the acquisition type is set to Peak Detect or Envelope. If the acquisition type is not one of the listed types, the function returns the Invalid Acquisition Type error.
Use the Initiate Acquisition function to start an acquisition on the enabled channels. The oscilloscope acquires the min/max waveforms for the enabled channels concurrently. Use the Acquisition Status function to determine when the acquisition is complete. The end-user must call this function separately for each enabled channel to obtain the min/max waveforms.
The end-user can call the Read Min Max Waveform function instead of the Initiate Acquisition function. The Read Min Max Waveform function starts an acquisition on all enabled channels, waits for the acquisition to complete, and returns the min/max waveforms for the specified channel. You call this function to obtain the min/max waveforms for each of the remaining channels.
After this function executes, each element in the MinWaveform and MaxWaveform parameters is either a voltage or a value indicating that the oscilloscope could not sample a voltage.
The return value is a list of (x, y_min, y_max) tuples that represent the time and voltage of each data point. Either of the y points may be NaN in the case that the oscilloscope could not sample the voltage.
The end-user configures the interpolation method the oscilloscope uses with the Acquisition.Interpolation property. If interpolation is disabled, the oscilloscope does not interpolate points in the waveform. If the oscilloscope cannot sample a value for a point in the waveform, the driver sets the corresponding element in the waveformArray to an IEEE-defined NaN (Not a Number) value. Check for this value with math.isnan() or numpy.isnan(). Check an entire array with
any(any(math.isnan(b) for b in a) for a in waveform)
This function does not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
- channels[].measurement.read_waveform_min_max
-
IVI class IviScope, capability group IviScopeMinMaxWaveform, section 12.3.3
This function initiates new waveform acquisition and returns minimum and maximum waveforms from a specific channel. If the channel is not enabled for the acquisition, this function returns the Channel Not Enabled error.
This function is used when the Acquisition Type is Peak Detect or Envelope. If the acquisition type is not one of the listed types, the function returns the Invalid Acquisition Type error.
This function initiates an acquisition on the enabled channels. It then waits for the acquisition to complete, and returns the min/max waveforms for the specified channel. Call the Fetch Min Max Waveform function to obtain the min/max waveforms for each of the remaining enabled channels without initiating another acquisition. If the oscilloscope did not complete the acquisition within the time period the user specified with the max_time parameter, the function returns the Max Time Exceeded error.
The return value is a list of (x, y_min, y_max) tuples that represent the time and voltage of each data point. Either of the y points may be NaN in the case that the oscilloscope could not sample the voltage.
The end-user configures the interpolation method the oscilloscope uses with the Acquisition.Interpolation property. If interpolation is disabled, the oscilloscope does not interpolate points in the waveform. If the oscilloscope cannot sample a value for a point in the waveform, the driver sets the corresponding element in the waveformArray to an IEEE-defined NaN (Not a Number) value. Check for this value with math.isnan() or numpy.isnan(). Check an entire array with
any(any(math.isnan(b) for b in a) for a in waveform)
This function does not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. Call the Error Query function at the conclusion of the sequence to check the instrument status.
ProbeAutoSense class
- class ivi.scope.ProbeAutoSense(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting probe attenuation sensing
- channels[].probe_attenuation_auto
-
IVI class IviScope, capability group IviScopeProbeAutoSense, section 13.2.1
If this attribute is True, the driver configures the oscilloscope to sense the attenuation of the probe automatically.
If this attribute is False, the driver disables the automatic probe sense and configures the oscilloscope to use the value of the Probe Attenuation attribute.
The actual probe attenuation the oscilloscope is currently using can be determined from the Probe Attenuation attribute.
Setting the Probe Attenuation attribute also sets the Probe Attenuation Auto attribute to false.
ContinuousAcquisition class
- class ivi.scope.ContinuousAcquisition(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting continuous acquisition
- trigger.continuous
-
IVI class IviScope, capability group IviScopeContinuousAcquisition, section 14.2.1
Specifies whether the oscilloscope continuously initiates waveform acquisition. If the end-user sets this attribute to True, the oscilloscope immediately waits for another trigger after the previous waveform acquisition is complete. Setting this attribute to True is useful when the end-user requires continuous updates of the oscilloscope display. This specification does not define the behavior of the read waveform and fetch waveform functions when this attribute is set to True. The behavior of these functions is instrument specific.
AverageAcquisition class
- class ivi.scope.AverageAcquisition(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting average acquisition
- acquisition.number_of_averages
-
IVI class IviScope, capability group IviScopeAverageAcquisition, section 15.2.1
Specifies the number of waveform the oscilloscope acquires and averages. After the oscilloscope acquires as many waveforms as this attribute specifies, it returns to the idle state. This attribute affects instrument behavior only when the Acquisition Type attribute is set to Average.
SampleMode class
- class ivi.scope.SampleMode(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting equivalent and real time acquisition
- acquisition.sample_mode
-
IVI class IviScope, capability group IviScopeSampleMode, section 16.2.1
Returns the sample mode the oscilloscope is currently using.
Values: * 'real_time' * 'equivalent_time'
TriggerModifier class
- class ivi.scope.TriggerModifier(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting specific triggering subsystem behavior in the absence of a trigger
- trigger.modifier
-
IVI class IviScope, capability group IviScopeTriggerModifier, section 17.2.1
Specifies the trigger modifier. The trigger modifier determines the oscilloscope's behavior in the absence of the configured trigger.
Values: * 'none' * 'auto' * 'auto_level'
AutoSetup class
- class ivi.scope.AutoSetup(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for oscilloscopes supporting automatic setup
- measurement.auto_setup
-
IVI class IviScope, capability group IviScopeAutoSetup, section 18.2.1
This function performs an auto-setup on the instrument.
IVI.FGEN --- FUNCTION GENERATOR CLASS
This module provides the base functionality for Function Generators.
Functions and Exceptions
- exception ivi.fgen.IviException
- Exception raised on various occasions; argument is a string describing what is wrong.
Base class
- class ivi.fgen.Base(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Base IVI methods for all function generators
- ivi.fgen.abort_generation
-
Aborts a previously initiated signal generation. If the function generator
is in the Output Generation State, this function moves the function
generator to the Configuration State. If the function generator is already
in the Configuration State, the function does nothing and returns Success.
This specification requires that the user be able to configure the output of the function generator regardless of whether the function generator is in the Configuration State or the Generation State. This means that the user is not required to call Abort Generation prior to configuring the output of the function generator.
Many function generators constantly generate an output signal, and do not require the user to abort signal generation prior to configuring the instrument. If a function generator's output cannot be aborted (i.e., the function generator cannot stop generating a signal) this function does nothing and returns Success.
Some function generators require that the user abort signal generation prior to configuring the instrument. The specific drivers for these types of instruments must compensate for this restriction and allow the user to configure the instrument without requiring the user to call Abort Generation. For these types of instruments, there is often a significant performance increase if the user configures the output while the instrument is not generating a signal.
The user is not required to call Abort Generation or Initiate Generation. Whether the user chooses to call these functions in an application program has no impact on interchangeability. The user can choose to use these functions if they want to optimize their application for instruments that exhibit increased performance when output configuration is performed while the instrument is not generating a signal.
- ivi.fgen.initiate_generation
-
Initiates signal generation. If the function generator is in the
Configuration State, this function moves the function generator to the
Output Generation State. If the function generator is already in the
Output Generation State, this function does nothing and returns Success.
This specification requires that the instrument be in the Generation State after the user calls the Initialize or Reset functions. This specification also requires that the user be able to configure the output of the function generator regardless of whether the function generator is in the Configuration State or the Generation State. This means that the user is only required to call Initiate Generation if they abort signal generation by calling Abort Generation.
Many function generators constantly generate an output signal, and do not require the user to abort signal generation prior to configuring the instrument. If a function generator's output cannot be aborted (i.e., the function generator cannot stop generating a signal) this function does nothing and returns Success.
Some function generators require that the user abort signal generation prior to configuring the instrument. The specific drivers for these types of instruments must compensate for this restriction and allow the user to configure the instrument without requiring the user to call Abort Generation. For these types of instruments, there is often a significant performance increase if the user configures the output while the instrument is not generating a signal.
The user is not required to call Abort Generation or Initiate Generation. Whether the user chooses to call these functions in an application program has no impact on interchangeability. The user can choose to use these functions if they want to optimize their application for instruments that exhibit increased performance when output configuration is performed while the instrument is not generating a signal.
- outputs.enabled
- If set to True, the signal the function generator produces appears at the output connector. If set to False, the signal the function generator produces does not appear at the output connector.
- outputs.impedance
- Specifies the impedance of the output channel. The units are Ohms.
- outputs.name
- This property returns the physical name defined by the specific driver for the output channel that corresponds to the 0-based index that the user specifies. If the driver defines a qualified channel name, this property returns the qualified name. If the value that the user passes for the Index parameter is less than zero or greater than the value of Output Count, the property returns an empty string and returns an error.
- outputs.operation_mode
-
Specifies how the function generator produces output on a channel.
Values for operation_mode:
- •
- 'continuous'
- •
- 'burst'
- outputs.output_mode
-
Determines how the function generator produces waveforms. This attribute
determines which extension group's functions and attributes are used to
configure the waveform the function generator produces.
Values for output_mode:
- •
- 'function'
- •
- 'arbitrary'
- •
- 'sequence'
- outputs.reference_clock_source
-
Specifies the source of the reference clock. The function generator
derives frequencies and sample rates that it uses to generate waveforms
from the reference clock.
The source of the reference clock is a string. If an IVI driver supports a reference clock source and the reference clock source is listed in IVI-3.3 Cross Class Capabilities Specification, Section 3, then the IVI driver shall accept the standard string for that reference clock. This attribute is case insensitive, but case preserving. That is, the setting is case insensitive but when reading it back the programmed case is returned. IVI specific drivers may define new reference clock source strings for reference clock sources that are not defined by IVI-3.3 Cross Class Capabilities Specification if needed.
StdFunc class
- class ivi.fgen.StdFunc(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that can produce manufacturer-supplied periodic waveforms
- outputs.standard_waveform.amplitude
- Specifies the amplitude of the standard waveform the function generator produces. When the Waveform attribute is set to Waveform DC, this attribute does not affect signal output. The units are volts.
- outputs.standard_waveform.configure
-
This function configures the attributes of the function generator that
affect standard waveform generation. These attributes are the Waveform,
Amplitude, DC Offset, Frequency, and Start Phase.
When the Waveform parameter is set to Waveform DC, this function ignores the Amplitude, Frequency, and Start Phase parameters and does not set the Amplitude, Frequency, and Start Phase attributes.
- outputs.standard_waveform.dc_offset
- Specifies the DC offset of the standard waveform the function generator produces. If the Waveform attribute is set to Waveform DC, this attribute specifies the DC level the function generator produces. The units are volts.
- outputs.standard_waveform.duty_cycle_high
- Specifies the duty cycle for a square waveform. This attribute affects function generator behavior only when the Waveform attribute is set to Waveform Square. The value is expressed as a percentage.
- outputs.standard_waveform.frequency
- Specifies the frequency of the standard waveform the function generator produces. When the Waveform attribute is set to Waveform DC, this attribute does not affect signal output. The units are Hertz.
- outputs.standard_waveform.start_phase
- Specifies the start phase of the standard waveform the function generator produces. When the Waveform attribute is set to Waveform DC, this attribute does not affect signal output. The units are degrees.
- outputs.standard_waveform.waveform
-
Specifies which standard waveform the function generator produces.
Values for waveform:
- •
- 'sine'
- •
- 'square'
- •
- 'triangle'
- •
- 'ramp_up'
- •
- 'ramp_down'
- •
- 'dc'
ArbWfm class
- class ivi.fgen.ArbWfm(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that can produce arbitrary waveforms
- arbitrary.sample_rate
- Specifies the sample rate of the arbitrary waveforms the function generator produces. The units are samples per second.
- arbitrary.waveform.clear
-
Removes a previously created arbitrary waveform from the function
generator's memory and invalidates the waveform's handle.
If the waveform cannot be cleared because it is currently being generated, or it is specified as part of an existing arbitrary waveform sequence, this function returns the Waveform In Use error.
- arbitrary.waveform.configure
- Configures the attributes of the function generator that affect arbitrary waveform generation. These attributes are the arbitrary waveform handle, gain, and offset.
- arbitrary.waveform.create
- Creates an arbitrary waveform from an array of data points. The function returns a handlethat identifies the waveform. You pass a waveform handle to the Handle parameter of the Configure Arbitrary Waveform function to produce that waveform.
- arbitrary.waveform.number_waveforms_max
- Returns the maximum number of arbitrary waveforms that the function generator allows.
- arbitrary.waveform.quantum
- The size of each arbitrary waveform shall be a multiple of a quantum value. This attribute returns the quantum value the function generator allows. For example, if this attribute returns a value of 8, all waveform sizes must be a multiple of 8.
- arbitrary.waveform.size_max
- Returns the maximum number of points the function generator allows in an arbitrary waveform.
- arbitrary.waveform.size_min
- Returns the minimum number of points the function generator allows in an arbitrary waveform.
- outputs.arbitrary.configure
- Configures the attributes of the function generator that affect arbitrary waveform generation. These attributes are the arbitrary waveform handle, gain, and offset.
- outputs.arbitrary.gain
- Specifies the gain of the arbitrary waveform the function generator produces. This value is unitless.
- outputs.arbitrary.offset
- Specifies the offset of the arbitrary waveform the function generator produces. The units are volts.
- outputs.arbitrary.waveform
ArbChannelWfm class
- class ivi.fgen.ArbChannelWfm(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support user-defined arbitrary waveform generation
- arbitrary.waveform.create_channel_waveform
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. You pass a waveform handle as the waveformHandle
parameter of the Configure Arbitrary Waveform function to produce that
waveform. You also use the handles this function returns to create a
sequence of arbitrary waveforms with the Create Arbitrary Sequence
function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
- outputs.arbitrary.create_waveform
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. You pass a waveform handle as the waveformHandle
parameter of the Configure Arbitrary Waveform function to produce that
waveform. You also use the handles this function returns to create a
sequence of arbitrary waveforms with the Create Arbitrary Sequence
function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
ArbWfmBinary class
- class ivi.fgen.ArbWfmBinary(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support user-defined arbitrary binary waveform generation
- arbitrary.binary_alignment
- Identifies whether the arbitrary waveform generator treats binary data provided to the Create Channel Arbitrary Waveform Int16 or Create Channel Arbitrary Waveform Int32 functions as left-justified or right-justified. Binary Alignment is only relevant if the generator supports bit-depths less than the size of the binarydata type of the create waveform function being used. For a 16-bit or a 32-bit generator, this function can return either value.
- arbitrary.sample_bit_resolution
- Returns the number of significant bits that the generator supports in an arbitrary waveform. Together with the binary alignment, this allows the user to know the range and resolution of the integers in the waveform.
- arbitrary.waveform.create_channel_waveform_int16
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. Data is passed in as 16-bit binary data. If the
arbitrary waveform generator supports formats less than 16 bits, call the
BinaryAlignment property to determine whether to left or right justify the
data before passing it to this call. You pass a waveform handle as the
waveformHandle parameter of the Configure Arbitrary Waveform function to
produce that waveform. You also use the handles this function returns to
create a sequence of arbitrary waveforms with the Create Arbitrary
Sequence function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
- arbitrary.waveform.create_channel_waveform_int32
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. Data is passed in as 32-bit binary data. If the
arbitrary waveform generator supports formats less than 32 bits, call the
BinaryAlignment property to determine whether to left or right justify the
data before passing it to this call. You pass a waveform handle as the
waveformHandle parameter of the Configure Arbitrary Waveform function to
produce that waveform. You also use the handles this function returns to
create a sequence of arbitrary waveforms with the Create Arbitrary
Sequence function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
- outputs.arbitrary.waveform.create_channel_waveform_int16
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. Data is passed in as 16-bit binary data. If the
arbitrary waveform generator supports formats less than 16 bits, call the
BinaryAlignment property to determine whether to left or right justify the
data before passing it to this call. You pass a waveform handle as the
waveformHandle parameter of the Configure Arbitrary Waveform function to
produce that waveform. You also use the handles this function returns to
create a sequence of arbitrary waveforms with the Create Arbitrary
Sequence function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
- outputs.arbitrary.waveform.create_channel_waveform_int32
-
Creates a channel-specific arbitrary waveform and returns a handle that
identifies that waveform. Data is passed in as 32-bit binary data. If the
arbitrary waveform generator supports formats less than 32 bits, call the
BinaryAlignment property to determine whether to left or right justify the
data before passing it to this call. You pass a waveform handle as the
waveformHandle parameter of the Configure Arbitrary Waveform function to
produce that waveform. You also use the handles this function returns to
create a sequence of arbitrary waveforms with the Create Arbitrary
Sequence function.
If the instrument has multiple channels, it is possible to create multi-channel waveforms: the channel names are passed as a comma-separated list of channel names, and the waveform arrays are concatenated into a single array. In this case, all waveforms must be of the same length.
If the function generator cannot store any more arbitrary waveforms, this function returns the error No Waveforms Available.
DataMarker class
- class ivi.fgen.DataMarker(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support output of particular waveform data bits as markers
- data_markers.amplitude
- Specifies the amplitude of the data marker output. The units are volts.
- data_markers.bit_position
- Specifies the bit position of the binary representation of the waveform data that will be output as a data marker. A value of 0 indicates the least significant bit.
- data_markers.clear
- Disables all of the data markers by setting their Data Marker Destination attribute to None.
- data_markers.configure
- Configures some of the common data marker attributes.
- data_markers.delay
- Specifies the amount of delay applied to the data marker output with respect to the analog data output. A value of zero indicates the marker is aligned with the analog data output. The units are seconds.
- data_markers.destination
- Specifies the destination terminal for the data marker output.
- data_markers.name
-
This attribute returns the repeated capability identifier defined by
specific driver for the data marker that corresponds to the index that the
user specifies. If the driver defines a qualified Data Marker name, this
property returns the qualified name.
If the value that the user passes for the Index parameter is less than zero or greater than the value of the Data Marker Count, the attribute returns an empty string for the value and returns an error.
- data_markers.polarity
-
Specifies the polarity of the data marker output.
Values for polarity:
- •
- 'active_high'
- •
- 'active_low'
- data_markers.source_channel
- Specifies the channel whose data bit will be output as a marker.
SparseMarker class
- class ivi.fgen.SparseMarker(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support output of markers associated with output data samples
- sparse_markers.amplitude
- Specifies the amplitude of the sparse marker output. The units are volts.
- sparse_markers.clear
- Disables all of the sparse markers by setting their Sparse Marker Destination attribute to None.
- sparse_markers.configure
- Configures some of the common sparse marker attributes.
- sparse_markers.delay
- Specifies the amount of delay applied to the sparse marker output with respect to the analog data output. A value of zero indicates the marker is aligned with the analog data output. The units are seconds.
- sparse_markers.destination
- Specifies the destination terminal for the sparse marker output.
- sparse_markers.get_indexes
- Gets the coerced indexes associated with the sparse marker. These indexes are specified by either the Configure SparseMarker function or the Set Sparse Marker Indexes function.
- sparse_markers.name
-
This attribute returns the repeated capability identifier defined by
specific driver for the sparse marker that corresponds to the index that
the user specifies. If the driver defines a qualified Sparse Marker name,
this property returns the qualified name.
If the value that the user passes for the Index parameter is less than one or greater than the value of the Sparse Marker Count, the attribute returns an empty string for the value and returns an error.
- sparse_markers.polarity
-
Specifies the polarity of the sparse marker output.
Values for polarity:
- •
- 'active_high'
- •
- 'active_low'
- sparse_markers.set_indexes
- Sets the indexes associated with the sparse marker. These indexes may be coerced by the driver. Use the Get Sparse Marker Indexes function to find the coerced values.
- sparse_markers.waveform_handle
- Specifies the waveform whose indexes the sparse marker refers to.
ArbDataMask class
- class ivi.fgen.ArbDataMask(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support masking of waveform data bits
- arbitrary.data_mask
-
Determines which bits of the output data are masked out. This is
especially useful when combined with Data Markers so that the bits
embedded with the data to be used for markers are not actually output by
the generator.
A value of 1 for a particular bit indicates that the data bit should be output. A value of 0 indicates that the data bit should be masked out. For example, if the value of this property is 0xFFFFFFFF (all bits are 1), no masking is applied.
ArbFrequency class
- class ivi.fgen.ArbFrequency(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that can produce arbitrary waveforms with variable rate
- outputs.arbitrary.frequency
- Specifies the rate in Hertz at which an entire arbitrary waveform is generated.
ArbSeq class
- class ivi.fgen.ArbSeq(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that can produce sequences of arbitrary waveforms
- arbitrary.clear_memory
-
Removes all previously created arbitrary waveforms and sequences from the
function generator's memory and invalidates all waveform and sequence
handles.
If a waveform cannot be cleared because it is currently being generated, this function returns the error Waveform In Use.
If a sequence cannot be cleared because it is currently being generated, this function returns the error Sequence In Use.
- arbitrary.sequence.clear
-
Removes a previously created arbitrary sequence from the function
generator's memory and invalidates the sequence's handle.
If the sequence cannot be cleared because it is currently being generated, this function returns the error Sequence In Use.
- arbitrary.sequence.configure
- Configures the attributes of the function generator that affect arbitrary sequence generation. These attributes are the arbitrary sequence handle, gain, and offset.
- arbitrary.sequence.create
-
Creates an arbitrary waveform sequence from an array of waveform handles
and a corresponding array of loop counts. The function returns a handle
that identifies the sequence. You pass a sequence handle to the Handle
parameter of the Configure Arbitrary Sequence function to produce that
sequence.
If the function generator cannot store any more arbitrary sequences, this function returns the error No Sequences Available.
- arbitrary.sequence.length_max
- Returns the maximum number of arbitrary waveforms that the function generator allows in an arbitrary sequence.
- arbitrary.sequence.length_min
- Returns the minimum number of arbitrary waveforms that the function generator allows in an arbitrary sequence.
- arbitrary.sequence.loop_count_max
- Returns the maximum number of times that the function generator can repeat a waveform in a sequence.
- arbitrary.sequence.number_sequences_max
- Returns the maximum number of arbitrary sequences that the function generator allows.
- outputs.arbitrary.sequence.configure
- Configures the attributes of the function generator that affect arbitrary sequence generation. These attributes are the arbitrary sequence handle, gain, and offset.
ArbSeqDepth class
- class ivi.fgen.ArbSeqDepth(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support producing sequences of sequences of waveforms
- arbitrary.sequence.depth_max
- Returns the maximum sequence depth - that is, the number of times a sequence can include other sequences recursively. A depth of zero indicates the generator supports waveforms only. A depth of 1 indicates a generator supports sequences of waveforms, but not sequences of sequences. A depth of 2 or greater indicates that the generator supports sequences of sequences. Note that if the MaxSequenceDepth is 2 or greater, the driver must return unique handles for waveforms and sequences so that a sequence may contain both waveform and sequence handles.
Trigger class
- class ivi.fgen.Trigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support triggering
- outputs.trigger.source
- Specifies the trigger source. After the function generator receives a trigger from this source, it produces a signal.
InternalTrigger class
- class ivi.fgen.InternalTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support internal triggering
- trigger.internal_rate
- Specifies the rate at which the function generator's internal trigger source produces a trigger, in triggers per second.
SoftwareTrigger class
- class ivi.fgen.SoftwareTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support software triggering
- ivi.fgen.send_software_trigger
-
This function sends a software-generated trigger to the instrument. It is
only applicable for instruments using interfaces or protocols which
support an explicit trigger function. For example, with GPIB this function
could send a group execute trigger to the instrument. Other
implementations might send a *TRG command.
Since instruments interpret a software-generated trigger in a wide variety of ways, the precise response of the instrument to this trigger is not defined. Note that SCPI details a possible implementation.
This function should not use resources which are potentially shared by other devices (for example, the VXI trigger lines). Use of such shared resources may have undesirable effects on other devices.
This function should not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. To check the instrument status, call the appropriate error query function at the conclusion of the sequence.
The trigger source attribute must accept Software Trigger as a valid setting for this function to work. If the trigger source is not set to Software Trigger, this function does nothing and returns the error Trigger Not Software.
Burst class
- class ivi.fgen.Burst(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support triggered burst output
- outputs.burst_count
- Specifies the number of waveform cycles that the function generator produces after it receives a trigger.
ModulateAM class
- class ivi.fgen.ModulateAM(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support amplitude modulation
- am.configure_internal
- Configures the attributes that control the function generator's internal amplitude modulating waveform source. These attributes are the modulation depth, waveform, and frequency.
- am.internal_depth
-
Specifies the extent of modulation the function generator applies to the
carrier waveform when the AM Source attribute is set to AM Internal. The
unit is percentage.
This attribute affects the behavior of the instrument only when the AM ource attribute is set to AM Internal.
- am.internal_frequency
-
Specifies the frequency of the internal modulating waveform source. The
units are Hertz.
This attribute affects the behavior of the instrument only when the AM ource attribute is set to AM Internal.
- am.internal_waveform
-
Specifies the waveform of the internal modulating waveform source.
This attribute affects the behavior of the instrument only when the AM ource attribute is set to AM Internal.
Values for internal_waveform:
- •
- 'sine'
- •
- 'square'
- •
- 'triangle'
- •
- 'ramp_up'
- •
- 'ramp_down'
- •
- 'dc'
- outputs.am.enabled
- Specifies whether the function generator applies amplitude modulation to the signal that the function generator produces with the IviFgenStdFunc, IviFgenArbWfm, or IviFgenArbSeq capability groups. If set to True, the function generator applies amplitude modulation to the output signal. If set to False, the function generator does not apply amplitude modulation to the output signal.
- outputs.am.source
-
Specifies the source of the signal that the function generator uses as the
modulating waveform.
This attribute affects instrument behavior only when the AM Enabled attribute is set to True.
ModulateFM class
- class ivi.fgen.ModulateFM(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support frequency modulation
- fm.configure_internal
-
Specifies the source of the signal that the function generator uses as the
modulating waveform.
This attribute affects instrument behavior only when the FM Enabled attribute is set to True.
- fm.internal_deviation
-
Specifies the maximum frequency deviation, in Hertz, that the function
generator applies to the carrier waveform when the FM Source attribute is
set to FM Internal.
This attribute affects the behavior of the instrument only when the FM Source attribute is set to FM Internal.
- fm.internal_frequency
-
Specifies the frequency of the internal modulating waveform source. The
units are hertz.
This attribute affects the behavior of the instrument only when the FM Source attribute is set to FM Internal.
- fm.internal_waveform
-
Specifies the waveform of the internal modulating waveform source.
This attribute affects the behavior of the instrument only when the FM Source attribute is set to FM Internal.
Values for internal_waveform:
- •
- 'sine'
- •
- 'square'
- •
- 'triangle'
- •
- 'ramp_up'
- •
- 'ramp_down'
- •
- 'dc'
- outputs.fm.enabled
- Specifies whether the function generator applies amplitude modulation to the carrier waveform. If set to True, the function generator applies frequency modulation to the output signal. If set to False, the function generator does not apply frequency modulation to the output signal.
- outputs.fm.source
SampleClock class
- class ivi.fgen.SampleClock(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support external sample clocks
- sample_clock.output_enabled
- Specifies whether or not the sample clock appears at the sample clock output of the generator.
- sample_clock.source
- Specifies the clock used for the waveform generation. Note that when using an external sample clock, the Arbitrary Sample Rate attribute must be set to the corresponding frequency of the external sample clock.
TerminalConfiguration class
- class ivi.fgen.TerminalConfiguration(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support single ended or differential output selection
- outputs.terminal_configuration
-
Determines whether the generator will run in single-ended or differential
mode, and whether the output gain and offset values will be analyzed
based on single-ended or differential operation.
Values for terminal_configuration:
- •
- 'single_ended'
- •
- 'differential'
StartTrigger class
- class ivi.fgen.StartTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support start triggering
- outputs.trigger.start.configure
- This function configures the start trigger properties.
- outputs.trigger.start.delay
- Specifies an additional length of time to delay from the start trigger to the first point in the waveform generation. The units are seconds.
- outputs.trigger.start.slope
-
Specifies the slope of the trigger that starts the generator.
Values for slope:
- •
- 'positive'
- •
- 'negative'
- •
- 'either'
- outputs.trigger.start.source
- Specifies the source of the start trigger.
- outputs.trigger.start.threshold
- Specifies the voltage threshold for the start trigger. The units are volts.
- trigger.start.configure
- This function configures the start trigger properties.
- trigger.start.send_software_trigger
- This function sends a software-generated start trigger to the instrument.
StopTrigger class
- class ivi.fgen.StopTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support stop triggering
ERROR: Unable to execute python code at fgen.rst:1194:
_add_method() takes at most 4 arguments (5 given)
HoldTrigger class
- class ivi.fgen.HoldTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support hold triggering
- outputs.trigger.hold.configure
- This function configures the hold trigger properties.
- outputs.trigger.hold.delay
- Specifies an additional length of time to delay from the hold trigger to the pause of the generation. The units are seconds.
- outputs.trigger.hold.slope
-
Specifies the slope of the hold trigger.
Values for slope:
- •
- 'positive'
- •
- 'negative'
- •
- 'either'
- outputs.trigger.hold.source
- Specifies the source of the hold trigger.
- outputs.trigger.hold.threshold
- Specifies the voltage threshold for the hold trigger. The units are volts.
- trigger.hold.configure
- This function configures the hold trigger properties.
- trigger.hold.send_software_trigger
- This function sends a software-generated hold trigger to the instrument.
ResumeTrigger class
- class ivi.fgen.ResumeTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support resume triggering
- outputs.trigger.resume.configure
- This function configures the resume trigger properties.
- outputs.trigger.resume.delay
- Specifies an additional length of time to delay from the resume trigger to the resumption of the generation. The units are seconds.
- outputs.trigger.resume.slope
-
Specifies the slope of the resume trigger.
Values for slope:
- •
- 'positive'
- •
- 'negative'
- •
- 'either'
- outputs.trigger.resume.source
- Specifies the source of the resume trigger.
- outputs.trigger.resume.threshold
- Specifies the voltage threshold for the resume trigger. The units are volts.
- trigger.resume.configure
- This function configures the resume trigger properties.
- trigger.resume.send_software_trigger
- This function sends a software-generated resume trigger to the instrument.
AdvanceTrigger class
- class ivi.fgen.AdvanceTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for function generators that support advance triggering
- outputs.trigger.advance.configure
- This function configures the advance trigger properties.
- outputs.trigger.advance.delay
- Specifies an additional length of time to delay from the advance trigger to the advancing to the end of the current waveform. Units are seconds.
- outputs.trigger.advance.slope
-
Specifies the slope of the advance trigger.
Values for slope:
- •
- 'positive'
- •
- 'negative'
- •
- 'either'
- outputs.trigger.advance.source
- Specifies the source of the advance trigger.
- outputs.trigger.advance.threshold
- Specifies the voltage threshold for the advance trigger. The units are volts.
- trigger.advance.configure
- This function configures the advance trigger properties.
- trigger.advance.send_software_trigger
- This function sends a software-generated advance trigger to the instrument.
IVI.DCPWR --- DC POWER SUPPLY CLASS
This module provides the base functionality for DC power supplies.
Functions and Exceptions
- exception ivi.dcpwr.IviException
- Exception raised on various occasions; argument is a string describing what is wrong.
Base class
- class ivi.dcpwr.Base(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Base IVI methods for all DC power supplies
- outputs[].configure_current_limit
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.1
This function configures the current limit. It specifies the output current limit value and the behavior of the power supply when the output current is greater than or equal to that value.
See the definition of the Current Limit Behavior attribute for defined values for the behavior parameter.
- outputs[].configure_ovp
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.4
Configures the over-voltage protection. It specifies the over-voltage limit and the behavior of the power supply when the output voltage is greater than or equal to that value.
When the Enabled parameter is False, the Limit parameter does not affect the instrument's behavior, and the driver does not set the OVP Limit attribute.
- outputs[].configure_range
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.3
Configures the power supply's output range on an output. One parameter specifies whether to configure the voltage or current range, and the other parameter is the value to which to set the range.
Setting a voltage range can invalidate a previously configured current range. Setting a current range can invalidate a previously configured voltage range.
- outputs[].current_limit
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.1
Specifies the output current limit. The units are Amps.
The value of the Current Limit Behavior attribute determines the behavior of the power supply when the output current is equal to or greater than the value of this attribute.
- outputs[].current_limit_behavior
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.2
Specifies the behavior of the power supply when the output current is equal to or greater than the value of the Current Limit attribute.
Values
- •
- 'trip' - The power supply disables the output when the output current is equal to or greater than the value of the Current Limit attribute.
- •
- 'regulate' - The power supply restricts the output voltage such that the output current is not greater than the value of the Current Limit attribute.
- outputs[].enabled
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.3
If true, the signal the power supply produces appears at the output connector. If false, the signal the power supply produces does not appear at the output connector.
- outputs[].name
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.9
This attribute returns the repeated capability identifier defined by specific driver for the output channel that corresponds to the index that the user specifies. If the driver defines a qualified Output Channel name, this property returns the qualified name.
If the value that the user passes for the Index parameter is less than zero or greater than the value of the Output Channel Count, the attribute raises a SelectorRangeException.
- outputs[].ovp_enabled
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.4
Specifies whether the power supply provides over-voltage protection. If this attribute is set to True, the power supply disables the output when the output voltage is greater than or equal to the value of the OVP Limit attribute.
- outputs[].ovp_limit
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.5
Specifies the voltage the power supply allows. The units are Volts.
If the OVP Enabled attribute is set to True, the power supply disables the output when the output voltage is greater than or equal to the value of this attribute.
If the OVP Enabled is set to False, this attribute does not affect the behavior of the instrument.
- outputs[].query_current_limit_max
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.7
This function returns the maximum programmable current limit that the power supply accepts for a particular voltage level on an output.
- outputs[].query_output_state
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.9
This function returns whether the power supply is in a particular output state.
A constant voltage condition occurs when the output voltage is equal to the value of the Voltage Level attribute and the current is less than or equal to the value of the Current Limit attribute.
A constant current condition occurs when the output current is equal to the value of the Current Limit attribute and the Current Limit Behavior attribute is set to the Current Regulate defined value.
An unregulated condition occurs when the output voltage is less than the value of the Voltage Level attribute and the current is less than the value of the Current Limit attribute.
An over-voltage condition occurs when the output voltage is equal to or greater than the value of the OVP Limit attribute and the OVP Enabled attribute is set to True.
An over-current condition occurs when the output current is equal to or greater than the value of the Current Limit attribute and the Current Limit Behavior attribute is set to the Current Trip defined value.
When either an over-voltage condition or an over-current condition occurs, the power supply's output protection disables the output. If the power supply is in an over-voltage or over-current state, it does not produce power until the output protection is reset. The Reset Output Protection function resets the output protection. Once the output protection is reset, the power supply resumes generating a power signal.
Values for output_state:
- •
- 'constant_voltage'
- •
- 'constant_current'
- •
- 'over_voltage'
- •
- 'over_current'
- •
- 'unregulated'
- outputs[].query_voltage_level_max
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.8
This function returns the maximum programmable voltage level that the power supply accepts for a particular current limit on an output.
- outputs[].reset_output_protection
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.3.10
This function resets the power supply output protection after an over-voltage or over-current condition occurs.
An over-voltage condition occurs when the output voltage is equal to or greater than the value of the OVP Limit attribute and the OVP Enabled attribute is set to True.
An over-current condition occurs when the output current is equal to or greater than the value of the Current Limit attribute and the Current Limit Behavior attribute is set to Current Trip.
When either an over-voltage condition or an over-current condition occurs, the output protection of the power supply disables the output. Once the output protection is reset, the power supply resumes generating a power signal.
Use the Query Output State function to determine if the power supply is in an over-voltage or over-current state.
- outputs[].voltage_level
-
IVI class IviDCPwr, capability group IviDCPwrBase, section 4.2.6
Specifies the voltage level the DC power supply attempts to generate. The units are Volts.
Trigger class
- class ivi.dcpwr.Trigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for power supplies supporting trigger based output changes
- outputs[].trigger_source
-
IVI class IviDCPwr, capability group IviDCPwrTrigger, section 5.2.1
Specifies the trigger source. After an Initiate call, the power supply waits for a trigger event from the source specified with this attribute. After a trigger event occurs, the power supply changes the voltage level to the value of the Triggered Voltage Level attribute and the current limit to the value of the Triggered Current Limit attribute.
- outputs[].triggered_current_limit
-
IVI class IviDCPwr, capability group IviDCPwrTrigger, section 5.2.2
Specifies the value to which the power supply sets the current limit after a trigger event occurs. The units are Amps.
After an Initiate call, the power supply waits for a trigger event from the source specified with the Trigger Source attribute. After a trigger event occurs, the power supply sets the current limit to the value of this attribute.
After a trigger occurs, the value of the Current Limit attribute reflects the new value to which the current limit has been set.
- outputs[].triggered_voltage_level
-
IVI class IviDCPwr, capability group IviDCPwrTrigger, section 5.2.3
Specifies the value to which the power supply sets the voltage level after a trigger event occurs. The units are Volts.
After an Initiate call, the power supply waits for a trigger event from the source specified with the Trigger Source attribute. After a trigger event occurs, the power supply sets the voltage level to the value of this attribute.
After a trigger occurs, the value of the Voltage Level attribute reflects the new value to which the voltage level has been set.
- trigger.abort
-
IVI class IviDCPwr, capability group IviDCPwrTrigger, section 5.3.1
If the power supply is currently waiting for a trigger to change the output signal, this function returns the power supply to the ignore triggers state.
If the power supply is not waiting for a trigger, this function does nothing and returns Success.
- trigger.initiate
-
IVI class IviDCPwr, capability group IviDCPwrTrigger, section 5.3.5
If the power supply is not currently waiting for a trigger, this function causes the power supply to wait for a trigger.
If the power supply is already waiting for a trigger, this function does nothing and returns Success.
SoftwareTrigger class
- class ivi.dcpwr.SoftwareTrigger(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for power supplies supporting software triggering
- ivi.dcpwr.send_software_trigger
-
IVI class IviDCPwr, capability group IviDCPwrSoftwareTrigger, section 6.2.1
This function sends a software-generated trigger to the instrument. It is only applicable for instruments using interfaces or protocols which support an explicit trigger function. For example, with GPIB this function could send a group execute trigger to the instrument. Other implementations might send a *TRG command.
Since instruments interpret a software-generated trigger in a wide variety of ways, the precise response of the instrument to this trigger is not defined. Note that SCPI details a possible implementation.
This function should not use resources which are potentially shared by other devices (for example, the VXI trigger lines). Use of such shared resources may have undesirable effects on other devices.
This function should not check the instrument status. Typically, the end-user calls this function only in a sequence of calls to other low-level driver functions. The sequence performs one operation. The end-user uses the low-level functions to optimize one or more aspects of interaction with the instrument. To check the instrument status, call the appropriate error query function at the conclusion of the sequence.
The trigger source attribute must accept Software Trigger as a valid setting for this function to work. If the trigger source is not set to Software Trigger, this function does nothing and returns the error Trigger Not Software.
Measurement class
- class ivi.dcpwr.Measurement(*args, **kwargs)
-
Bases: ivi.ivi.IviContainer
Extension IVI methods for power supplies supporting measurement of the output signal
- outputs[].measure
-
IVI class IviDCPwr, capability group IviDCPwrMeasurement, section 7.2.1
Takes a measurement on the output signal and returns the measured value.
Values for measurement_type:
- •
- 'voltage'
- •
- 'current'
WRITING NEW PYTHON IVI DRIVERS
First, you're going to need to download the IVI specification for the type of instrument you have from the IVI foundation. This isn't completely necessary, but there is a lot of information in the spec about the specific functionality of various commands that isn't in the source code. I suppose this should probably be changed, but the spec is freely available so it isn't that big of an issue. You only need to download the spec for your type of device (IviFgen, IviScope, etc.). You're also going to need to download the programming guide for your instrument, if you haven't already.
Now that you know what instrument class your instrument is, you should create a file for it in the proper subdirectory with the proper name. Note that supporting several instruments in the same line is pretty easy, just look at some of the other files for reference. I would highly recommend creating wrappers for all of the instruments in the series even if you don't have any on hand for testing. You also will need to add a line (or several lines) to __init__.py in the same directory so that the instrument files are loaded automatically with python-ivi and don't need to be loaded individually.
The structure of the individual driver files is quite simple. Take a look at the existing files for reference. Start by adding the header comment and license information. Then add the correct includes. At minimum, you will need to include ivi and the particular instrument class that you need from the parent directory (from .. include ivi). After that, you can specify any constants and/or mappings that the instrument requires. IVI specifies one set of standard configuration values for a lot of functions and this does not necessarily agree with the instrument's firmware, so it's likely you will need to redefine several of these lists as mappings to make writing the code easier. This can be done incrementally while the driver functionality is being implemented.
Next, you need to add the class definition. The name should match the file name, and it will derive from ivi.Driver and the supported subclasses of your instrument. Go over the IVI spec and the programming guide and see what subclasses are supported by seeing which functions are supported by the instrument. There isn't always going to be a 1:1 mapping - there will likely be functions that the instrument does not support but IVI has a wrapper for, and there will likely be functions that IVI does not have a wrapper for but the instrument does support that may be very useful. You should add a subclass if any portion of its functionality is supported by the instrument.
After that, you need to define the functions common to all IVI drivers. You can just copy everything from init to utility_unlock_object from an existing driver and then update everything for your instrument. Generally all this code will be very similar. Take a look at some of the existing drivers for reference. Very important: any super() calls must be updated so that the class name matches (requirement for Python 2). You should also remove all of the initialization in __init__ that you don't need - the bare minimum is _instrument_id and all of the _identity values. For some instruments, you're going to need to specify channel counts as well as an _init_channels or _init_outputs method. Note that if one of these methods is needed, it cannot be empty as it must at least have a call to super so that all of the proper init methods are called. At this point, you can test the connection to the equipment to make sure it is communicating and reading out the ID properly.
Testing you code is actually pretty straightforward; you don't need to re-install the library to test it; just make sure to instantiate it while you're running in the same directory as the ivi folder (not inside). I recommend ipython for testing. Unfortulatey, the auto reload doesn't work very well for python-ivi, so you'll need to restart ipython every time you change something. However, it supports history and autocompletion, so after you import IVI once, you can just type 'imp' and hit the up arrow until 'import ivi' shows up.
Test the interface and identity query by instantiating your driver and connecting to the instrument by running something like this in ipython:
>>> import ivi >>> mso = ivi.agilent.agilentMSO7104A("TCPIP0::192.168.1.104::INSTR") >>> mso.identity.instrument_model
If everything is working, the instrument's model number will be displayed. Once you get this working, you can move on to implementing the actual functionality.
Start by copying in all of the bare function definitions from the driver file. Copy all of the get and _set function definitions from the ivi driver file for the Base class and all of the subclasses that you are implementing. You also need any methods whose only implementation is 'pass'. The ones that call other methods can generally be left out as the default implementation should be fine. You may also want to copy some of the instance variable initializations from the __init__ method as well if you need different defaults. These should be added to the init method you created earlier for your instrument.
Finally, you need to go write python code for all of the functions that the instrument supports. Take a look at some _get/_set pairs for some of the existing drivers to see the format. It's rather straightforward but quite tedious.
Driver Template
This is a sample template driver that incorporates all of the major components. It is drawn from the Agilent 7000 series driver. Template:
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import struct from .. import ivi from .. import scope AcquisitionTypeMapping = { 'normal': 'norm', 'peak_detect': 'peak', 'high_resolution': 'hres', 'average': 'aver'} # more instrument-specific sets and mappings class agilent7000(ivi.Driver, scope.Base, scope.TVTrigger, scope.GlitchTrigger, scope.WidthTrigger, scope.AcLineTrigger, scope.WaveformMeasurement, scope.MinMaxWaveform, scope.ContinuousAcquisition, scope.AverageAcquisition, scope.SampleMode, scope.AutoSetup): "Agilent InfiniiVision 7000 series IVI oscilloscope driver" def __init__(self, *args, **kwargs): self._analog_channel_name = list() self._analog_channel_count = 4 self._digital_channel_name = list() self._digital_channel_count = 16 self._channel_label = list() # other per-channel instrument-specific variables that are # referenced in _init_channels super(agilent7000, self).__init__(*args, **kwargs) self._instrument_id = 'AGILENT TECHNOLOGIES' self._analog_channel_name = list() self._analog_channel_count = 4 self._digital_channel_name = list() self._digital_channel_count = 16 self._channel_count = 20 self._bandwidth = 1e9 # initialize other instrument-specific variables self._identity_description = "Agilent InfiniiVision 7000 series IVI oscilloscope driver" self._identity_identifier = "" self._identity_revision = "" self._identity_vendor = "" self._identity_instrument_manufacturer = "Agilent Technologies" self._identity_instrument_model = "" self._identity_instrument_firmware_revision = "" self._identity_specification_major_version = 4 self._identity_specification_minor_version = 1 self._identity_supported_instrument_models =['DSO7012A','DSO7014A','DSO7032A', 'DSO7034A','DSO7052A','DSO7054A','DSO7104A','MSO7012A','MSO7014A','MSO7032A', 'MSO7034A','MSO7052A','MSO7054A','MSO7104A','DSO7012B','DSO7014B','DSO7032B', 'DSO7034B','DSO7052B','DSO7054B','DSO7104B','MSO7012B','MSO7014B','MSO7032B', 'MSO7034B','MSO7052B','MSO7054B','MSO7104B'] self.channels._add_property('label', self._get_channel_label, self._set_channel_label, None, """ Custom property documentation """) # other instrument specific properties self._init_channels() def initialize(self, resource = None, id_query = False, reset = False, **keywargs): "Opens an I/O session to the instrument." self._channel_count = self._analog_channel_count + self._digital_channel_count super(agilent7000, self).initialize(resource, id_query, reset, **keywargs) # interface clear if not self._driver_operation_simulate: self._clear() # check ID if id_query and not self._driver_operation_simulate: id = self.identity.instrument_model id_check = self._instrument_id id_short = id[:len(id_check)] if id_short != id_check: raise Exception("Instrument ID mismatch, expecting %s, got %s", id_check, id_short) # reset if reset: self.utility.reset() def _load_id_string(self): if self._driver_operation_simulate: self._identity_instrument_manufacturer = "Not available while simulating" self._identity_instrument_model = "Not available while simulating" self._identity_instrument_firmware_revision = "Not available while simulating" else: lst = self._ask("*IDN?").split(",") self._identity_instrument_manufacturer = lst[0] self._identity_instrument_model = lst[1] self._identity_instrument_firmware_revision = lst[3] self._set_cache_valid(True, 'identity_instrument_manufacturer') self._set_cache_valid(True, 'identity_instrument_model') self._set_cache_valid(True, 'identity_instrument_firmware_revision') def _get_identity_instrument_manufacturer(self): if self._get_cache_valid(): return self._identity_instrument_manufacturer self._load_id_string() return self._identity_instrument_manufacturer def _get_identity_instrument_model(self): if self._get_cache_valid(): return self._identity_instrument_model self._load_id_string() return self._identity_instrument_model def _get_identity_instrument_firmware_revision(self): if self._get_cache_valid(): return self._identity_instrument_firmware_revision self._load_id_string() return self._identity_instrument_firmware_revision def _utility_disable(self): pass def _utility_error_query(self): error_code = 0 error_message = "No error" if not self._driver_operation_simulate: error_code, error_message = self._ask(":system:error?").split(',') error_code = int(error_code) error_message = error_message.strip(' "') return (error_code, error_message) def _utility_lock_object(self): pass def _utility_reset(self): if not self._driver_operation_simulate: self._write("*RST") self.driver_operation.invalidate_all_attributes() def _utility_reset_with_defaults(self): self._utility_reset() def _utility_self_test(self): code = 0 message = "Self test passed" if not self._driver_operation_simulate: code = int(self._ask("*TST?")) if code != 0: message = "Self test failed" return (code, message) def _utility_unlock_object(self): pass def _init_channels(self): super(agilent7000, self)._init_channels() self._channel_name = list() self._channel_label = list() # init per-channel instrument-specific variables for i in range(self._channel_count): self._channel_name.append("channel%d" % (i+1)) self._channel_label.append("%d" % (i+1)) # init per-channel instrument-specific variables self.channels._set_list(self._channel_name) def _get_acquisition_start_time(self): pos = 0 if not self._driver_operation_simulate and not self._get_cache_valid(): pos = float(self._ask(":timebase:position?")) self._set_cache_valid() self._acquisition_start_time = pos - self._get_acquisition_time_per_record() * 5 / 10 return self._acquisition_start_time def _set_acquisition_start_time(self, value): value = float(value) value = value + self._get_acquisition_time_per_record() * 5 / 10 if not self._driver_operation_simulate: self._write(":timebase:position %e" % value) self._acquisition_start_time = value self._set_cache_valid() # more definitions
APPENDIX
License
Copyright (c) 2012-2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- •
- genindex
- •
- modindex
- •
- search
AUTHOR
Alex ForencichCOPYRIGHT
2012-2014, Alex Forencich